pull/3542/head
Edson Alcala 4 years ago committed by Joseph Izang
parent 7e4c99e030
commit a40e422ed6
  1. 17
      src/App.tsx
  2. 2
      src/AppContext.tsx
  3. 5
      src/views/HomeView.tsx

@ -38,7 +38,7 @@ const App = () => {
clientInstanceRef.current = clientInstance;
const contractsRef = useRef(contracts);
contractsRef.current = contracts;
const [themeType, setThemeType] = useState<string>("dark")
const [themeType, setThemeType] = useState<string>("dark");
useEffect(() => {
console.log("Remix EthDoc loading...");
@ -78,16 +78,15 @@ const App = () => {
}
);
const currentTheme = await client.call("theme", "currentTheme")
console.log("Current theme", currentTheme)
const currentTheme = await client.call("theme", "currentTheme");
console.log("Current theme", currentTheme);
setThemeType(currentTheme.brightness || currentTheme.quality)
setThemeType(currentTheme.brightness || currentTheme.quality);
client.on("theme", "themeChanged", (theme: any) => {
console.log("themeChanged")
setThemeType(theme.quality)
})
console.log("themeChanged");
setThemeType(theme.quality);
});
};
loadClient();
@ -101,7 +100,7 @@ const App = () => {
setContracts,
sites,
setSites,
themeType
themeType,
}}
>
<Routes />

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

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

Loading…
Cancel
Save