fix issue and theme

pull/3542/head
Edson Alcala 4 years ago committed by Joseph Izang
parent 9a1ea5831c
commit 8aff3ad0a1
  1. 1
      src/App.css
  2. 13
      src/App.tsx
  3. 1
      src/AppContext.tsx
  4. 14
      src/utils/template.ts
  5. 4
      src/views/HomeView.tsx

@ -3,7 +3,6 @@ body {
}
#ethdoc .active {
color: #212529;
background-color: #e9ecef;
border-color: #e9ecef;
}

@ -38,6 +38,7 @@ const App = () => {
clientInstanceRef.current = clientInstance;
const contractsRef = useRef(contracts);
contractsRef.current = contracts;
const [themeType, setThemeType] = useState<string>("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
}}
>
<Routes />

@ -16,4 +16,5 @@ export const AppContext = React.createContext({
setSites: (sites: PublishedSite[]) => {
console.log("Calling Set Sites");
},
themeType: "dark"
});

@ -53,8 +53,7 @@ export const template = (
<div id="ethdoc-viewer">
${
functions.length === 0
${functions.length === 0
? "No contract to display"
: renderHeader(name, contractDoc)
}
@ -63,7 +62,7 @@ export const template = (
.map(
(item) => `
<hr>
<h6>${item.name} - ${item.type} </h6>
<h6>${item.name}</h6>
${getMethodDetails(item.devdoc)}
@ -92,22 +91,21 @@ export const renderHeader = (
name: string,
contractDoc: ContractDocumentation
) => `
<h3>${name} ${
contractDoc.title ? `<small>: ${contractDoc.title}</small>` : ""
}</h3>
<h3>${name} ${contractDoc.title ? `<small>: ${contractDoc.title}</small>` : ""
}</h3>
${contractDoc.notice ? `<p class="lead">${contractDoc.notice}</p>` : ""}
${contractDoc.author ? `<p>Author: ${contractDoc.author}</p>` : ""}
<br />
<p><strong>Functions</strong></p>
`;
export const renderParameterDocumentation = (
parameters: ParameterDocumentation[]
) =>
`${
parameters.length > 0
`${parameters.length > 0
? `<table class="table table-sm table-bordered table-striped">
<thead>
<tr>

@ -63,8 +63,8 @@ export const HomeView: React.FC = () => {
return (
<AppContext.Consumer>
{({ clientInstance, contracts, setContracts }) => (
<div id="ethdoc">
{({ clientInstance, contracts, setContracts, themeType }) => (
<div id="ethdoc" style={{ color: themeType === "dark" ? "white" : "black" }}>
{[...contracts.keys()].length === 0 && (
<p>Compile a contract with Solidity Compiler</p>
)}

Loading…
Cancel
Save