Skip to content

Commit

Permalink
add options in dropdown for switching app theme
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPesce committed Sep 24, 2024
1 parent cb15840 commit c115d3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions electron/ui/src/components/Boilerplate/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import LoggingPanel from '../../LoggingPanel/LoggingPanel';
import {useNavigate} from "react-router-dom";
import {Menu, MenuItem, IconButton} from '@mui/material';
import ListIcon from '@mui/icons-material/List';
import {themes} from '../../../theme';

export default function Header({theme, hasTheme}) {
console.debug("header hasTheme=", hasTheme, ", theme=", theme);
export default function Header({theme, hasTheme, changeTheme}) {
let navigate = useNavigate();
const [showLogs, setShowLogs] = React.useState(false)
const [actionsList, setActionsList] = React.useState(false)
Expand Down Expand Up @@ -63,8 +63,12 @@ export default function Header({theme, hasTheme}) {
onClose={() => setActionsList(false)}
>
<MenuItem className="view-logs" onClick={handleShowLogs}>View Logs</MenuItem>
<MenuItem className="return-home" onClick={handleNavigateHome}>Return to list
page</MenuItem>
{Object.keys(themes).map((key, idx) => {
if (key != localStorage.getItem("theme")) return (
<MenuItem key={key} className="change_theme" onClick={() => changeTheme(key)}>Switch to {key}</MenuItem>
)
})}
<MenuItem className="return-home" onClick={handleNavigateHome}>Return to list page</MenuItem>
</Menu>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion electron/ui/src/components/MainContent/MainContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function MainContent(props) {
const spState = props.subProcState;
return (
<Container id='AppRootContainer'>
<Header theme={theme} hasTheme={hasTheme}/>
<Header theme={theme} hasTheme={hasTheme} changeTheme={props.changeTheme}/>
<Routes>
<Route path="flowsheet/:id/config" element={<FlowsheetConfig
numberOfSubprocesses={spState.value}
Expand Down

0 comments on commit c115d3a

Please sign in to comment.