diff --git a/src/App.css b/src/App.css index e20be2d57e..60ed460f1f 100644 --- a/src/App.css +++ b/src/App.css @@ -3,7 +3,6 @@ body { } #ethdoc .active { - color: #212529; background-color: #e9ecef; border-color: #e9ecef; } \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index 25f6a4ec93..8749512066 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -38,6 +38,7 @@ const App = () => { clientInstanceRef.current = clientInstance; const contractsRef = useRef(contracts); contractsRef.current = contracts; + const [themeType, setThemeType] = useState("dark") useEffect(() => { console.log("Remix EthDoc loading..."); @@ -76,6 +77,17 @@ const App = () => { setContracts(newMap); } ); + + const currentTheme = await client.call("theme", "currentTheme") + console.log("Current theme", currentTheme) + + setThemeType(currentTheme.brightness || currentTheme.quality) + + client.on("theme", "themeChanged", (theme: any) => { + console.log("themeChanged") + setThemeType(theme.quality) + }) + }; loadClient(); @@ -89,6 +101,7 @@ const App = () => { setContracts, sites, setSites, + themeType }} > diff --git a/src/AppContext.tsx b/src/AppContext.tsx index 9a53ccd10c..2d9685d694 100644 --- a/src/AppContext.tsx +++ b/src/AppContext.tsx @@ -16,4 +16,5 @@ export const AppContext = React.createContext({ setSites: (sites: PublishedSite[]) => { console.log("Calling Set Sites"); }, + themeType: "dark" }); diff --git a/src/utils/template.ts b/src/utils/template.ts index 59e156049b..2aa7dcdeba 100644 --- a/src/utils/template.ts +++ b/src/utils/template.ts @@ -53,17 +53,16 @@ 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}
+
${item.name}
${getMethodDetails(item.devdoc)} @@ -73,8 +72,8 @@ export const template = ( ${renderParameterDocumentation(item.outputs)} ` - ) - .join("\n")} + ) + .join("\n")}
`; @@ -92,23 +91,22 @@ export const renderHeader = ( name: string, contractDoc: ContractDocumentation ) => ` -

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

+

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

${contractDoc.notice ? `

${contractDoc.notice}

` : ""} ${contractDoc.author ? `

Author: ${contractDoc.author}

` : ""} +

Functions

`; export const renderParameterDocumentation = ( parameters: ParameterDocumentation[] ) => - `${ - parameters.length > 0 - ? ` + `${parameters.length > 0 + ? `
@@ -128,25 +126,25 @@ export const renderParameterDocumentation = ( .join("")}
Name
` - : "

No parameters

" + : "

No parameters

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

**Add Documentation for the method here**

" : Object.keys(devMethod) - .filter((key) => key !== "params") - .map((key) => { - const funcToGetTemplate = (devMethodDocTemplate as any)[key]; + .filter((key) => key !== "params") + .map((key) => { + const funcToGetTemplate = (devMethodDocTemplate as any)[key]; - if (!funcToGetTemplate) { - return ""; - } - const funcParameter = (devMethod as any)[key]; - const result = funcToGetTemplate(funcParameter); - return result; - }) - .join("\n"); + if (!funcToGetTemplate) { + return ""; + } + const funcParameter = (devMethod as any)[key]; + const result = funcToGetTemplate(funcParameter); + return result; + }) + .join("\n"); console.log("finalResult", finalResult); return finalResult; diff --git a/src/views/HomeView.tsx b/src/views/HomeView.tsx index 98fdaf597f..9d57f0237f 100644 --- a/src/views/HomeView.tsx +++ b/src/views/HomeView.tsx @@ -63,8 +63,8 @@ export const HomeView: React.FC = () => { return ( - {({ clientInstance, contracts, setContracts }) => ( -
+ {({ clientInstance, contracts, setContracts, themeType }) => ( +
{[...contracts.keys()].length === 0 && (

Compile a contract with Solidity Compiler

)}