diff --git a/compforge/src/common/Title.js b/compforge/src/common/Title.js new file mode 100644 index 0000000000000000000000000000000000000000..d0555b4d7c8c782591f1253cc0ab1ad7ec82bbb5 --- /dev/null +++ b/compforge/src/common/Title.js @@ -0,0 +1,15 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import Typography from '@material-ui/core/Typography'; + +export default function Title(props) { + return ( + <Typography component="h2" variant="h6" color="primary" gutterBottom> + {props.children} + </Typography> + ); +} + +Title.propTypes = { + children: PropTypes.node, +}; \ No newline at end of file diff --git a/compforge/src/pages/AddPartner/AddPartner.js b/compforge/src/pages/AddPartner/AddPartner.js new file mode 100644 index 0000000000000000000000000000000000000000..06bbfc0709d5aed5ff81728f324c2ad4e66ca48f --- /dev/null +++ b/compforge/src/pages/AddPartner/AddPartner.js @@ -0,0 +1,208 @@ +import React from 'react'; +import clsx from 'clsx'; +import { makeStyles } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import Drawer from '@material-ui/core/Drawer'; +import Box from '@material-ui/core/Box'; +import AppBar from '@material-ui/core/AppBar'; +import Toolbar from '@material-ui/core/Toolbar'; +import List from '@material-ui/core/List'; +import Typography from '@material-ui/core/Typography'; +import Divider from '@material-ui/core/Divider'; +import IconButton from '@material-ui/core/IconButton'; +import Badge from '@material-ui/core/Badge'; +import Container from '@material-ui/core/Container'; +import Grid from '@material-ui/core/Grid'; +import Paper from '@material-ui/core/Paper'; +import Link from '@material-ui/core/Link'; +import MenuIcon from '@material-ui/icons/Menu'; +import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; +import NotificationsIcon from '@material-ui/icons/Notifications'; +import { mainListItems, secondaryListItems } from '../Dashboard/listItems'; +import Partners from '../Dashboard/Partners'; +import Forms from '../Dashboard/Forms'; +import firebase from '../../firebase'; + +function Copyright() { + return ( + <Typography variant="body2" color="textSecondary" align="center"> + {'Copyright © '} + <Link color="inherit" href="https://material-ui.com/"> + CompForge + </Link>{' '} + {new Date().getFullYear()} + {'.'} + </Typography> + ); +} + +const drawerWidth = 240; + +const useStyles = makeStyles((theme) => ({ + root: { + display: 'flex', + }, + toolbar: { + paddingRight: 24, // keep right padding when drawer closed + }, + toolbarIcon: { + display: 'flex', + alignItems: 'center', + justifyContent: 'flex-end', + padding: '0 8px', + ...theme.mixins.toolbar, + }, + appBar: { + zIndex: theme.zIndex.drawer + 1, + transition: theme.transitions.create(['width', 'margin'], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen, + }), + }, + appBarShift: { + // Space for menu 'drawer' from side. Removed for now because button has gone AWOL. + // marginLeft: drawerWidth, + // width: `calc(100% - ${drawerWidth}px)`, + transition: theme.transitions.create(['width', 'margin'], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.enteringScreen, + }), + }, + menuButton: { + marginRight: 36, + }, + menuButtonHidden: { + display: 'none', + }, + title: { + flexGrow: 1, + }, + drawerPaper: { + align: 'left', + position: 'relative', + whiteSpace: 'nowrap', + width: drawerWidth, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.enteringScreen, + }), + }, + drawerPaperClose: { + overflowX: 'hidden', + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen, + }), + width: theme.spacing(7), + [theme.breakpoints.up('sm')]: { + width: theme.spacing(9), + }, + }, + appBarSpacer: theme.mixins.toolbar, + content: { + flexGrow: 1, + height: '100vh', + overflow: 'auto', + }, + container: { + paddingTop: theme.spacing(4), + paddingBottom: theme.spacing(4), + }, + paper: { + padding: theme.spacing(2), + display: 'flex', + overflow: 'auto', + flexDirection: 'column', + }, + fixedHeight: { + height: 240, + }, +})); + +export default function AddPartner() { + var user = firebase.auth().currentUser; + // var name, email, uid, emailVerified; + + if (user != null) { + // name = user.displayName; + // email = user.email; + // emailVerified = user.emailVerified; + // uid = user.uid; + } + + const classes = useStyles(); + const [open, setOpen] = React.useState(true); + const handleDrawerOpen = () => { + setOpen(true); + }; + const handleDrawerClose = () => { + setOpen(false); + }; + const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight); + + return ( + <div className={classes.root}> + <CssBaseline /> + <AppBar position="absolute" className={clsx(classes.appBar, open && classes.appBarShift)}> + <Toolbar className={classes.toolbar}> + <IconButton + edge="start" + color="inherit" + aria-label="open drawer" + onClick={handleDrawerOpen} + className={clsx(classes.menuButton, open && classes.menuButtonHidden)} + > + <MenuIcon /> + </IconButton> + <Typography component="h1" variant="h6" color="inherit" noWrap className={classes.title}> + CompForge + </Typography> + <IconButton color="inherit"> + <Badge badgeContent={4} color="secondary"> + <NotificationsIcon /> + </Badge> + </IconButton> + </Toolbar> + </AppBar> + <Drawer + variant="permanent" + classes={{ + paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose), + }} + open={open} + > + <div className={classes.toolbarIcon}> + <IconButton onClick={handleDrawerClose}> + <ChevronLeftIcon /> + </IconButton> + </div> + <Divider /> + <List>{mainListItems}</List> + <Divider /> + <List>{secondaryListItems}</List> + </Drawer> + <main className={classes.content}> + <div className={classes.appBarSpacer} /> + <Container maxWidth="lg" className={classes.container}> + <Grid container spacing={3}> + {/* Forms */} + <Grid item xs={12}> + <Paper className={classes.paper}> + <Forms /> + </Paper> + </Grid> + {/* Partners */} + <Grid item xs={12} md={4} lg={6}> + <Paper className={fixedHeightPaper}> + <Partners /> + </Paper> + </Grid> + </Grid> + <Box pt={4}> + <Copyright /> + </Box> + </Container> + </main> + </div> + ); +} \ No newline at end of file diff --git a/compforge/src/pages/CreateForm/CreateForm.js b/compforge/src/pages/CreateForm/CreateForm.js new file mode 100644 index 0000000000000000000000000000000000000000..875d216b84b732c7750c454f4b2b6b872ab22507 --- /dev/null +++ b/compforge/src/pages/CreateForm/CreateForm.js @@ -0,0 +1,202 @@ +import React from 'react'; +import clsx from 'clsx'; +import { makeStyles } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import Drawer from '@material-ui/core/Drawer'; +import Box from '@material-ui/core/Box'; +import AppBar from '@material-ui/core/AppBar'; +import Toolbar from '@material-ui/core/Toolbar'; +import List from '@material-ui/core/List'; +import Typography from '@material-ui/core/Typography'; +import Divider from '@material-ui/core/Divider'; +import IconButton from '@material-ui/core/IconButton'; +import Badge from '@material-ui/core/Badge'; +import Container from '@material-ui/core/Container'; +import Grid from '@material-ui/core/Grid'; +import Paper from '@material-ui/core/Paper'; +import Link from '@material-ui/core/Link'; +import MenuIcon from '@material-ui/icons/Menu'; +import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; +import NotificationsIcon from '@material-ui/icons/Notifications'; +import { mainListItems, secondaryListItems } from '../Dashboard/listItems'; +import Partners from '../Dashboard/Partners'; +import Forms from './Form'; +import firebase from '../../firebase'; + +function Copyright() { + return ( + <Typography variant="body2" color="textSecondary" align="center"> + {'Copyright © '} + <Link color="inherit" href="https://material-ui.com/"> + CompForge + </Link>{' '} + {new Date().getFullYear()} + {'.'} + </Typography> + ); +} + +const drawerWidth = 240; + +const useStyles = makeStyles((theme) => ({ + root: { + display: 'flex', + }, + toolbar: { + paddingRight: 24, // keep right padding when drawer closed + }, + toolbarIcon: { + display: 'flex', + alignItems: 'center', + justifyContent: 'flex-end', + padding: '0 8px', + ...theme.mixins.toolbar, + }, + appBar: { + zIndex: theme.zIndex.drawer + 1, + transition: theme.transitions.create(['width', 'margin'], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen, + }), + }, + appBarShift: { + // Space for menu 'drawer' from side. Removed for now because button has gone AWOL. + // marginLeft: drawerWidth, + // width: `calc(100% - ${drawerWidth}px)`, + transition: theme.transitions.create(['width', 'margin'], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.enteringScreen, + }), + }, + menuButton: { + marginRight: 36, + }, + menuButtonHidden: { + display: 'none', + }, + title: { + flexGrow: 1, + }, + drawerPaper: { + align: 'left', + position: 'relative', + whiteSpace: 'nowrap', + width: drawerWidth, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.enteringScreen, + }), + }, + drawerPaperClose: { + overflowX: 'hidden', + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen, + }), + width: theme.spacing(7), + [theme.breakpoints.up('sm')]: { + width: theme.spacing(9), + }, + }, + appBarSpacer: theme.mixins.toolbar, + content: { + flexGrow: 1, + height: '100vh', + overflow: 'auto', + }, + container: { + paddingTop: theme.spacing(4), + paddingBottom: theme.spacing(4), + }, + paper: { + padding: theme.spacing(2), + display: 'flex', + overflow: 'auto', + flexDirection: 'column', + }, + fixedHeight: { + height: 240, + }, +})); + +export default function CreateForm() { + var user = firebase.auth().currentUser; + // var name, email, uid, emailVerified; + + if (user != null) { + // name = user.displayName; + // email = user.email; + // emailVerified = user.emailVerified; + // uid = user.uid; + } + + const classes = useStyles(); + const [open, setOpen] = React.useState(true); + const handleDrawerOpen = () => { + setOpen(true); + }; + const handleDrawerClose = () => { + setOpen(false); + }; + const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight); + + return ( + <div className={classes.root}> + <CssBaseline /> + <AppBar position="absolute" className={clsx(classes.appBar, open && classes.appBarShift)}> + <Toolbar className={classes.toolbar}> + <IconButton + edge="start" + color="inherit" + aria-label="open drawer" + onClick={handleDrawerOpen} + className={clsx(classes.menuButton, open && classes.menuButtonHidden)} + > + <MenuIcon /> + </IconButton> + <Typography component="h1" variant="h6" color="inherit" noWrap className={classes.title}> + CompForge + </Typography> + <IconButton color="inherit"> + <Badge badgeContent={4} color="secondary"> + <NotificationsIcon /> + </Badge> + </IconButton> + </Toolbar> + </AppBar> + <Drawer + variant="permanent" + classes={{ + paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose), + }} + open={open} + > + <div className={classes.toolbarIcon}> + <IconButton onClick={handleDrawerClose}> + <ChevronLeftIcon /> + </IconButton> + </div> + <Divider /> + <List>{mainListItems}</List> + <Divider /> + <List>{secondaryListItems}</List> + </Drawer> + <main className={classes.content}> + <div className={classes.appBarSpacer} /> + <Container maxWidth="lg" className={classes.container}> + <Grid container spacing={3}> + {/* Forms */} + <Grid item xs={12}> + <Paper className={classes.paper}> + <Forms /> + </Paper> + </Grid> + </Grid> + <Box pt={4}> + <Copyright /> + </Box> + </Container> + </main> + </div> + ); +} \ No newline at end of file diff --git a/compforge/src/pages/CreateForm/Form.js b/compforge/src/pages/CreateForm/Form.js new file mode 100644 index 0000000000000000000000000000000000000000..14ac78ccc69421a90d4cc8ae5a464696147ae012 --- /dev/null +++ b/compforge/src/pages/CreateForm/Form.js @@ -0,0 +1,47 @@ +import React from 'react'; +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; +import Title from '../../common/Title'; + +// Generate Order Data +function createData(id, formName, authorName, sharedWith, created, modified) { + return { id, formName, authorName, sharedWith, created, modified }; +} + +const rows = [ + createData(0, 'My First Form', 'Me', 'N/A', '30/03/2020, 12:04', '30/03/2020, 12:54'), + createData(1, 'ISO 27001', 'Me', 'SomeCompany', '30/03/2020, 13:46', '30/03/2020, 13:46'), +]; + +export default function Form() { + return ( + <React.Fragment> + <Title>My Forms</Title> + <Table size="small"> + <TableHead> + <TableRow> + <TableCell>Form Name</TableCell> + <TableCell>Author</TableCell> + <TableCell>Shared With</TableCell> + <TableCell>Created</TableCell> + <TableCell align="right">Modified</TableCell> + </TableRow> + </TableHead> + <TableBody> + {rows.map((row) => ( + <TableRow key={row.id}> + <TableCell>{row.formName}</TableCell> + <TableCell>{row.authorName}</TableCell> + <TableCell>{row.sharedWith}</TableCell> + <TableCell>{row.created}</TableCell> + <TableCell align="right">{row.modified}</TableCell> + </TableRow> + ))} + </TableBody> + </Table> + </React.Fragment> + ); +} \ No newline at end of file diff --git a/compforge/src/pages/Dashboard/Dashboard.js b/compforge/src/pages/Dashboard/Dashboard.js new file mode 100644 index 0000000000000000000000000000000000000000..91121581951e21b3abc4c70c2c24fec84d73e086 --- /dev/null +++ b/compforge/src/pages/Dashboard/Dashboard.js @@ -0,0 +1,208 @@ +import React from 'react'; +import clsx from 'clsx'; +import { makeStyles } from '@material-ui/core/styles'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import Drawer from '@material-ui/core/Drawer'; +import Box from '@material-ui/core/Box'; +import AppBar from '@material-ui/core/AppBar'; +import Toolbar from '@material-ui/core/Toolbar'; +import List from '@material-ui/core/List'; +import Typography from '@material-ui/core/Typography'; +import Divider from '@material-ui/core/Divider'; +import IconButton from '@material-ui/core/IconButton'; +import Badge from '@material-ui/core/Badge'; +import Container from '@material-ui/core/Container'; +import Grid from '@material-ui/core/Grid'; +import Paper from '@material-ui/core/Paper'; +import Link from '@material-ui/core/Link'; +import MenuIcon from '@material-ui/icons/Menu'; +import ChevronLeftIcon from '@material-ui/icons/ChevronLeft'; +import NotificationsIcon from '@material-ui/icons/Notifications'; +import { mainListItems, secondaryListItems } from './listItems'; +import Partners from './Partners'; +import Forms from './Forms'; +import firebase from '../../firebase'; + +function Copyright() { + return ( + <Typography variant="body2" color="textSecondary" align="center"> + {'Copyright © '} + <Link color="inherit" href="https://material-ui.com/"> + CompForge + </Link>{' '} + {new Date().getFullYear()} + {'.'} + </Typography> + ); +} + +const drawerWidth = 240; + +const useStyles = makeStyles((theme) => ({ + root: { + display: 'flex', + }, + toolbar: { + paddingRight: 24, // keep right padding when drawer closed + }, + toolbarIcon: { + display: 'flex', + alignItems: 'center', + justifyContent: 'flex-end', + padding: '0 8px', + ...theme.mixins.toolbar, + }, + appBar: { + zIndex: theme.zIndex.drawer + 1, + transition: theme.transitions.create(['width', 'margin'], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen, + }), + }, + appBarShift: { + // Space for menu 'drawer' from side. Removed for now because button has gone AWOL. + // marginLeft: drawerWidth, + // width: `calc(100% - ${drawerWidth}px)`, + transition: theme.transitions.create(['width', 'margin'], { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.enteringScreen, + }), + }, + menuButton: { + marginRight: 36, + }, + menuButtonHidden: { + display: 'none', + }, + title: { + flexGrow: 1, + }, + drawerPaper: { + align: 'left', + position: 'relative', + whiteSpace: 'nowrap', + width: drawerWidth, + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.enteringScreen, + }), + }, + drawerPaperClose: { + overflowX: 'hidden', + transition: theme.transitions.create('width', { + easing: theme.transitions.easing.sharp, + duration: theme.transitions.duration.leavingScreen, + }), + width: theme.spacing(7), + [theme.breakpoints.up('sm')]: { + width: theme.spacing(9), + }, + }, + appBarSpacer: theme.mixins.toolbar, + content: { + flexGrow: 1, + height: '100vh', + overflow: 'auto', + }, + container: { + paddingTop: theme.spacing(4), + paddingBottom: theme.spacing(4), + }, + paper: { + padding: theme.spacing(2), + display: 'flex', + overflow: 'auto', + flexDirection: 'column', + }, + fixedHeight: { + height: 240, + }, +})); + +export default function Dashboard() { + var user = firebase.auth().currentUser; + // var name, email, uid, emailVerified; + + if (user != null) { + // name = user.displayName; + // email = user.email; + // emailVerified = user.emailVerified; + // uid = user.uid; + } + + const classes = useStyles(); + const [open, setOpen] = React.useState(true); + const handleDrawerOpen = () => { + setOpen(true); + }; + const handleDrawerClose = () => { + setOpen(false); + }; + const fixedHeightPaper = clsx(classes.paper, classes.fixedHeight); + + return ( + <div className={classes.root}> + <CssBaseline /> + <AppBar position="absolute" className={clsx(classes.appBar, open && classes.appBarShift)}> + <Toolbar className={classes.toolbar}> + <IconButton + edge="start" + color="inherit" + aria-label="open drawer" + onClick={handleDrawerOpen} + className={clsx(classes.menuButton, open && classes.menuButtonHidden)} + > + <MenuIcon /> + </IconButton> + <Typography component="h1" variant="h6" color="inherit" noWrap className={classes.title}> + CompForge + </Typography> + <IconButton color="inherit"> + <Badge badgeContent={4} color="secondary"> + <NotificationsIcon /> + </Badge> + </IconButton> + </Toolbar> + </AppBar> + <Drawer + variant="permanent" + classes={{ + paper: clsx(classes.drawerPaper, !open && classes.drawerPaperClose), + }} + open={open} + > + <div className={classes.toolbarIcon}> + <IconButton onClick={handleDrawerClose}> + <ChevronLeftIcon /> + </IconButton> + </div> + <Divider /> + <List>{mainListItems}</List> + <Divider /> + <List>{secondaryListItems}</List> + </Drawer> + <main className={classes.content}> + <div className={classes.appBarSpacer} /> + <Container maxWidth="lg" className={classes.container}> + <Grid container spacing={3}> + {/* Forms */} + <Grid item xs={12}> + <Paper className={classes.paper}> + <Forms /> + </Paper> + </Grid> + {/* Partners */} + <Grid item xs={12} md={4} lg={6}> + <Paper className={fixedHeightPaper}> + <Partners /> + </Paper> + </Grid> + </Grid> + <Box pt={4}> + <Copyright /> + </Box> + </Container> + </main> + </div> + ); +} \ No newline at end of file diff --git a/compforge/src/pages/Dashboard/Forms.js b/compforge/src/pages/Dashboard/Forms.js new file mode 100644 index 0000000000000000000000000000000000000000..91b3b1775dc0f6711a749e231e91df37f474d80c --- /dev/null +++ b/compforge/src/pages/Dashboard/Forms.js @@ -0,0 +1,47 @@ +import React from 'react'; +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; +import Title from '../../common/Title'; + +// Generate Order Data +function createData(id, formName, authorName, sharedWith, created, modified) { + return { id, formName, authorName, sharedWith, created, modified }; +} + +const rows = [ + createData(0, 'My First Form', 'Me', 'N/A', '30/03/2020, 12:04', '30/03/2020, 12:54'), + createData(1, 'ISO 27001', 'Me', 'SomeCompany', '30/03/2020, 13:46', '30/03/2020, 13:46'), +]; + +export default function Forms() { + return ( + <React.Fragment> + <Title>My Forms</Title> + <Table size="small"> + <TableHead> + <TableRow> + <TableCell>Form Name</TableCell> + <TableCell>Author</TableCell> + <TableCell>Shared With</TableCell> + <TableCell>Created</TableCell> + <TableCell align="right">Modified</TableCell> + </TableRow> + </TableHead> + <TableBody> + {rows.map((row) => ( + <TableRow key={row.id}> + <TableCell>{row.formName}</TableCell> + <TableCell>{row.authorName}</TableCell> + <TableCell>{row.sharedWith}</TableCell> + <TableCell>{row.created}</TableCell> + <TableCell align="right">{row.modified}</TableCell> + </TableRow> + ))} + </TableBody> + </Table> + </React.Fragment> + ); +} \ No newline at end of file diff --git a/compforge/src/pages/Dashboard/Partners.js b/compforge/src/pages/Dashboard/Partners.js new file mode 100644 index 0000000000000000000000000000000000000000..394e16ea5c7d7dc3cda75c706fbe887ccd8426a9 --- /dev/null +++ b/compforge/src/pages/Dashboard/Partners.js @@ -0,0 +1,51 @@ +import React from 'react'; +import Link from '@material-ui/core/Link'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import Table from '@material-ui/core/Table'; +import TableBody from '@material-ui/core/TableBody'; +import TableCell from '@material-ui/core/TableCell'; +import TableHead from '@material-ui/core/TableHead'; +import TableRow from '@material-ui/core/TableRow'; +import Title from '../../common/Title'; + +// Generate Order Data +function createData(id, partner, dateAdded) { + return { id, partner, dateAdded }; +} + +const rows = [ + createData(0, 'SomeCompany', '30/03/2020'), + createData(1, 'SomeOtherCompany', '30/03/2020'), +]; + +export default function Partners() { + return ( + <React.Fragment> + <Title>My Partners</Title> + <Table size="small"> + <TableHead> + <TableRow> + <TableCell>Partner</TableCell> + <TableCell align="right">Date Added</TableCell> + </TableRow> + </TableHead> + <TableBody> + {rows.map((row) => ( + <TableRow key={row.id}> + <TableCell>{row.partner}</TableCell> + <TableCell align="right">{row.dateAdded}</TableCell> + </TableRow> + ))} + </TableBody> + </Table> + <div> + <Link href="/AddPartner"> + <ListItem button> + <ListItemText align="center" primary="Add a partner" /> + </ListItem> + </Link> + </div> + </React.Fragment> + ); +} \ No newline at end of file diff --git a/compforge/src/pages/Dashboard/listItems.js b/compforge/src/pages/Dashboard/listItems.js new file mode 100644 index 0000000000000000000000000000000000000000..f99c597f08bc0fc291b1b1557a59ad1f4a486713 --- /dev/null +++ b/compforge/src/pages/Dashboard/listItems.js @@ -0,0 +1,72 @@ +import React from 'react'; +import Link from '@material-ui/core/Link'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemIcon from '@material-ui/core/ListItemIcon'; +import ListItemText from '@material-ui/core/ListItemText'; +import ListSubheader from '@material-ui/core/ListSubheader'; +import DashboardIcon from '@material-ui/icons/Dashboard'; +import AccountCircleIcon from '@material-ui/icons/AccountCircle'; +import PowerSettingsNewIcon from '@material-ui/icons/PowerSettingsNew'; +import PeopleIcon from '@material-ui/icons/People'; +import AssignmentIcon from '@material-ui/icons/Assignment'; +import firebase from '../../firebase'; + +export const mainListItems = ( + <div> + <ListSubheader>Home</ListSubheader> + <Link href="/"> + <ListItem button> + <ListItemIcon> + <DashboardIcon /> + </ListItemIcon> + <ListItemText primary="Dashboard" /> + </ListItem> + </Link> + <Link href="/CreateForm"> + <ListItem button> + <ListItemIcon> + <AssignmentIcon /> + </ListItemIcon> + <ListItemText primary="Create New Form" /> + </ListItem> + </Link> + <Link href="/AddPartner"> + <ListItem button> + <ListItemIcon> + <PeopleIcon /> + </ListItemIcon> + <ListItemText primary="Add a partner" /> + </ListItem> + </Link> + </div> +); + +export const secondaryListItems = ( + <div> + <ListSubheader>Account</ListSubheader> + <Link href="/Account"> + <ListItem button> + <ListItemIcon> + <AccountCircleIcon /> + </ListItemIcon> + <ListItemText primary="My Account" /> + </ListItem> + </Link> + <Link href='/signin' onClick={signOut}> + <ListItem button> + <ListItemIcon> + <PowerSettingsNewIcon /> + </ListItemIcon> + <ListItemText primary="Sign Out" /> + </ListItem> + </Link> + </div> +); + +function signOut() { + firebase.auth().signOut().then(function() { + console.log("Sign out successful"); + }).catch(function(error) { + console.log(error); + }); +} \ No newline at end of file