|
|
@ -3,7 +3,7 @@ import { AppContext } from "../AppContext"; |
|
|
|
import { ContractName, Documentation } from "../types"; |
|
|
|
import { ContractName, Documentation } from "../types"; |
|
|
|
import { publish } from "../utils"; |
|
|
|
import { publish } from "../utils"; |
|
|
|
import { htmlTemplate } from "../utils/template"; |
|
|
|
import { htmlTemplate } from "../utils/template"; |
|
|
|
import { CopyToClipboard } from "react-copy-to-clipboard"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const HomeView: React.FC = () => { |
|
|
|
export const HomeView: React.FC = () => { |
|
|
|
const [activeItem, setActiveItem] = useState(""); |
|
|
|
const [activeItem, setActiveItem] = useState(""); |
|
|
@ -11,7 +11,6 @@ export const HomeView: React.FC = () => { |
|
|
|
const [htmlDocumentation, setHtmlDocumentation] = useState(""); |
|
|
|
const [htmlDocumentation, setHtmlDocumentation] = useState(""); |
|
|
|
const [hasErrorOnPublishing, setHasErrorOnPublishing] = useState(false); |
|
|
|
const [hasErrorOnPublishing, setHasErrorOnPublishing] = useState(false); |
|
|
|
const [publishedURL, setPublishedURL] = useState(""); |
|
|
|
const [publishedURL, setPublishedURL] = useState(""); |
|
|
|
const [isCopied, setIsCopied] = useState(false); |
|
|
|
|
|
|
|
const clearMessageFuncRef = useRef(undefined as any); |
|
|
|
const clearMessageFuncRef = useRef(undefined as any); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
@ -87,7 +86,6 @@ export const HomeView: React.FC = () => { |
|
|
|
aria-pressed="false" |
|
|
|
aria-pressed="false" |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
setPublishedURL(""); |
|
|
|
setPublishedURL(""); |
|
|
|
setIsCopied(false); |
|
|
|
|
|
|
|
setActiveItem(item); |
|
|
|
setActiveItem(item); |
|
|
|
displayDocumentation( |
|
|
|
displayDocumentation( |
|
|
|
clientInstance, |
|
|
|
clientInstance, |
|
|
@ -111,7 +109,6 @@ export const HomeView: React.FC = () => { |
|
|
|
setContracts(new Map()); |
|
|
|
setContracts(new Map()); |
|
|
|
displayDocumentation(clientInstance, "", ""); |
|
|
|
displayDocumentation(clientInstance, "", ""); |
|
|
|
setPublishedURL(""); |
|
|
|
setPublishedURL(""); |
|
|
|
setIsCopied(false); |
|
|
|
|
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
Clear |
|
|
|
Clear |
|
|
@ -125,16 +122,17 @@ export const HomeView: React.FC = () => { |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
console.log("Is publishing"); |
|
|
|
console.log("Is publishing"); |
|
|
|
setIsPublishing(true); |
|
|
|
setIsPublishing(true); |
|
|
|
setIsCopied(false); |
|
|
|
|
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
)} |
|
|
|
)} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{!isPublishing && publishedURL !== "" && ( |
|
|
|
{!isPublishing && publishedURL !== "" && ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
|
|
|
|
<div className="small mt-1"> |
|
|
|
<div className="small mt-1"><a rel="noreferrer" href={publishedURL} target="_blank">{publishedURL}</a></div> |
|
|
|
<a rel="noreferrer" href={publishedURL} target="_blank"> |
|
|
|
|
|
|
|
{publishedURL} |
|
|
|
|
|
|
|
</a> |
|
|
|
|
|
|
|
</div> |
|
|
|
</> |
|
|
|
</> |
|
|
|
)} |
|
|
|
)} |
|
|
|
|
|
|
|
|
|
|
|