fix build issues

pull/3475/head
Solid Studio 4 years ago committed by Aniket
parent dd4f8cd3b7
commit 2d6b4d94d4
  1. 3
      src/AppContext.tsx
  2. 2
      src/index.tsx
  3. 41
      src/utils/template.ts
  4. 9
      src/utils/utils.ts
  5. 2
      src/views/ErrorView.tsx
  6. 2
      src/views/HomeView.tsx

@ -3,8 +3,7 @@ import {
PluginApi,
IRemixApi,
Api,
PluginClient,
CompilationResult,
PluginClient
} from "@remixproject/plugin";
import { ContractName, Documentation, PublishedSite } from "./types";

@ -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(
<React.StrictMode>

@ -2,7 +2,6 @@ import {
FunctionDocumentation,
TemplateDoc,
MethodDoc,
ContractDoc,
ContractDocumentation,
ParameterDocumentation,
} from "./types";
@ -53,14 +52,14 @@ export const template = (
<div id="ethdoc-viewer">
${
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) => `
<h6>${item.name} - ${item.type}</h6>
<hr>
${renderParameterDocumentation(item.inputs)}
@ -72,8 +71,8 @@ export const template = (
${renderParameterDocumentation(item.outputs)}
`
)
.join("\n")}
)
.join("\n")}
</div>
`;
@ -104,7 +103,7 @@ export const renderHeader = (
) => `
<h3>${name} ${
contractDoc.title ? `<small>: ${contractDoc.title}</small>` : ""
}</h3>
}</h3>
${contractDoc.notice ? `<p class="lead">${contractDoc.notice}</p>` : ""}
@ -117,8 +116,8 @@ export const renderParameterDocumentation = (
parameters: ParameterDocumentation[]
) => `
${
parameters.length > 0
? `
parameters.length > 0
? `
<table class="table table-sm table-bordered table-striped">
<thead>
<tr>
@ -129,25 +128,25 @@ export const renderParameterDocumentation = (
</thead>
<tbody>
${parameters.map(
(output) => `<tr>
(output) => `<tr>
<td>${output.name}</td>
<td>${output.type}</td>
<td>${output.description}</td>
</tr>`
)}
)}
</tbody>
</table>`
: "<p>No parameters</p>"
}
: "<p>No parameters</p>"
}
`;
export const getMethodDetails = (devMethod?: Partial<MethodDoc>) => {
return !devMethod
? "<p><strong>**Add Documentation for the method here**</strong></p>"
: 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");
};

@ -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],

@ -19,7 +19,7 @@ export const ErrorView: React.FC = () => {
<h5>Sorry, something unexpected happened. </h5>
<h5>
Please raise an issue:{" "}
<a style={{ color: "red" }} href="">
<a style={{ color: "red" }} href="https://github.com/Machinalabs/remix-ethdoc-plugin/issues">
Here
</a>
</h5>

@ -27,7 +27,7 @@ export const HomeView: React.FC = () => {
if (isPublishing) {
publishDocumentation();
}
}, [isPublishing]);
}, [isPublishing, htmlDocumentation]);
const displayDocumentation = (
client: any,

Loading…
Cancel
Save