Skip to content

Commit

Permalink
Show app version on sidebar
Browse files Browse the repository at this point in the history
Signed-off-by: Diogo Correia <[email protected]>
  • Loading branch information
diogotcorreia committed Sep 23, 2020
1 parent fc950a7 commit 7d7a45e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/components/TopAppBar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import clsx from 'clsx';
import React from 'react';
import { DRAWER_WIDTH } from '../../constants/drawer.json';
import { mainListItems, secondaryListItems } from './listItems';
import VersionIndicator from './versionIndicator';

const useStyles = makeStyles((theme) => ({
toolbarIcon: {
Expand All @@ -27,6 +28,7 @@ const useStyles = makeStyles((theme) => ({
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
overflow: 'hidden',
},
drawerPaperClose: {
overflowX: 'hidden',
Expand All @@ -39,6 +41,9 @@ const useStyles = makeStyles((theme) => ({
width: theme.spacing(9),
},
},
grow: {
flexGrow: 1,
},
}));

type Props = {
Expand Down Expand Up @@ -66,6 +71,13 @@ export default function Sidebar({ open, handleDrawerClose }: Props) {
<List>{mainListItems}</List>
<Divider />
<List>{secondaryListItems}</List>
<div className={classes.grow} />
{open && (
<>
<Divider />
<VersionIndicator />
</>
)}
</Drawer>
);
}
24 changes: 24 additions & 0 deletions app/components/TopAppBar/VersionIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { makeStyles, Typography } from '@material-ui/core';
import React from 'react';

const { app } = require('electron').remote;

const useStyles = makeStyles((theme) => ({
root: {
margin: theme.spacing(1),
},
}));

export default function VersionIndicator() {
const classes = useStyles();
return (
<div className={classes.root}>
<Typography variant="body2" color="textSecondary">
{`Versão ${app.getVersion()}`}
</Typography>
<Typography variant="caption" color="textSecondary">
Designed by Diogo Correia
</Typography>
</div>
);
}

0 comments on commit 7d7a45e

Please sign in to comment.