From 2d6b4d94d44aa98778d12cccbcc487f3aa5fb055 Mon Sep 17 00:00:00 2001 From: Solid Studio Date: Sat, 4 Jul 2020 09:58:14 +0100 Subject: [PATCH] fix build issues --- src/AppContext.tsx | 3 +-- src/index.tsx | 2 +- src/utils/template.ts | 41 ++++++++++++++++++++--------------------- src/utils/utils.ts | 9 ++------- src/views/ErrorView.tsx | 2 +- src/views/HomeView.tsx | 2 +- 6 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/AppContext.tsx b/src/AppContext.tsx index c243fa5103..6e179ff2b5 100644 --- a/src/AppContext.tsx +++ b/src/AppContext.tsx @@ -3,8 +3,7 @@ import { PluginApi, IRemixApi, Api, - PluginClient, - CompilationResult, + PluginClient } from "@remixproject/plugin"; import { ContractName, Documentation, PublishedSite } from "./types"; diff --git a/src/index.tsx b/src/index.tsx index e0434dd0ac..3779b3d173 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; -import { Routes } from "./routes"; +// import { Routes } from "./routes"; ReactDOM.render( diff --git a/src/utils/template.ts b/src/utils/template.ts index aaeedfe57c..c0682844b8 100644 --- a/src/utils/template.ts +++ b/src/utils/template.ts @@ -2,7 +2,6 @@ import { FunctionDocumentation, TemplateDoc, MethodDoc, - ContractDoc, ContractDocumentation, ParameterDocumentation, } from "./types"; @@ -53,14 +52,14 @@ export const template = (
${ - functions.length === 0 - ? "No contract to display" - : renderHeader(name, contractDoc) - } + functions.length === 0 + ? "No contract to display" + : renderHeader(name, contractDoc) + } ${functions - .map( - (item) => ` + .map( + (item) => `
${item.name} - ${item.type}

${renderParameterDocumentation(item.inputs)} @@ -72,8 +71,8 @@ export const template = ( ${renderParameterDocumentation(item.outputs)} ` - ) - .join("\n")} + ) + .join("\n")}
`; @@ -104,7 +103,7 @@ export const renderHeader = ( ) => `

${name} ${ contractDoc.title ? `: ${contractDoc.title}` : "" -}

+ } ${contractDoc.notice ? `

${contractDoc.notice}

` : ""} @@ -117,8 +116,8 @@ export const renderParameterDocumentation = ( parameters: ParameterDocumentation[] ) => ` ${ - parameters.length > 0 - ? ` + parameters.length > 0 + ? ` @@ -129,25 +128,25 @@ export const renderParameterDocumentation = ( ${parameters.map( - (output) => ` + (output) => `` - )} + )}
${output.name} ${output.type} ${output.description}
` - : "

No parameters

" - } + : "

No parameters

" + } `; export const getMethodDetails = (devMethod?: Partial) => { return !devMethod ? "

**Add Documentation for the method here**

" : Object.keys(devMethod) - .filter((key) => key !== "params") - .map((key) => { - (devMethodDocTemplate as any)[key]((devMethod as any)[key]); - }) - .join("\n"); + .filter((key) => key !== "params") + .map((key) => { + return (devMethodDocTemplate as any)[key]((devMethod as any)[key]); + }) + .join("\n"); }; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 4a38439934..948e1e557e 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -2,16 +2,11 @@ import { CompilationResult, CompiledContract, FunctionDescription, - ABIDescription, - DevMethodDoc, - UserMethodDoc, ABIParameter, - DeveloperDocumentation, - UserDocumentation, + ABIDescription } from "@remixproject/plugin"; import { - EthDocumentation, FileName, Documentation, ContractName, @@ -73,7 +68,7 @@ export const getContractDoc = (name: string, contract: CompiledContract) => { export const getContractDocumentation = (contract: CompiledContract) => { const methods: MethodsDocumentation = {}; - Object.keys(contract.userdoc.methods).map((item) => { + Object.keys(contract.userdoc.methods).forEach((item) => { if (contract.devdoc.methods[item]) { const finalResult = { ...contract.userdoc.methods[item], diff --git a/src/views/ErrorView.tsx b/src/views/ErrorView.tsx index ad40b0f4e7..d85f965142 100644 --- a/src/views/ErrorView.tsx +++ b/src/views/ErrorView.tsx @@ -19,7 +19,7 @@ export const ErrorView: React.FC = () => {
Sorry, something unexpected happened.
Please raise an issue:{" "} - + Here
diff --git a/src/views/HomeView.tsx b/src/views/HomeView.tsx index 17c636a590..18f052065d 100644 --- a/src/views/HomeView.tsx +++ b/src/views/HomeView.tsx @@ -27,7 +27,7 @@ export const HomeView: React.FC = () => { if (isPublishing) { publishDocumentation(); } - }, [isPublishing]); + }, [isPublishing, htmlDocumentation]); const displayDocumentation = ( client: any,