Skip to content
Snippets Groups Projects
Commit d5cfe41f authored by James D'Alton's avatar James D'Alton
Browse files

major refactor of frontend

parent 4fd8aced
No related branches found
No related tags found
No related merge requests found
Showing
with 15797 additions and 0 deletions
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
This diff is collapsed.
{
"name": "compforge",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.9.7",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>CompForge</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
{
"short_name": "React App",
"name": "Create React App Sample",
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
import React from 'react';
import './App.css';
import SignedIn from './pages/SignedIn'
// import SignedOut from './pages/SignedOut'
function App() {
// Get isSignedIn
// Hardcoded for now
// const [isSignedIn] = useState(true);
return (
<div className="App">
<header className="App-header">
{/* {isSignedIn ? <SignedIn /> : <SignedOut />} */}
<SignedIn />
</header>
</div>
);
}
export default App;
\ No newline at end of file
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
import React from 'react'
import { Grid, AppBar, Toolbar, Typography, Button } from '@material-ui/core';
function Header() {
return (
<Grid item xs={12}>
<AppBar position="static">
<Toolbar>
<Typography variant="h6" flexGrow={1}>
Compforge
</Typography>
<Button color="inherit">Login</Button>
</Toolbar>
</AppBar>
</Grid>
)
}
export default Header
\ No newline at end of file
import React from 'react';
import { Grid, Button } from '@material-ui/core';
function Navigation({ menuItems }) {
return (
<Grid
container
direction="column"
justify="space-evenly"
alignItems="stretch"
spacing={3}
>
<Grid item xs={3}>
<Button variant="contained" color="primary">Dashboard</Button>
</Grid>
<Grid item xs={3}>
<Button variant="contained" color="primary">New Form</Button>
</Grid>
<Grid item xs={3}>
<Button variant="contained" color="primary">Add Partner</Button>
</Grid>
<Grid item xs={3}>
<Button variant="contained" color="primary">My Account</Button>
</Grid>
<Grid item xs={3}>
<Button variant="contained" color="secondary">Sign Out</Button>
</Grid>
</Grid >
)
}
export default Navigation
\ No newline at end of file
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 './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
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 './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
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
import React from 'react';
import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper, makeStyles } from '@material-ui/core';
const useStyles = makeStyles({
table: {
minWidth: 650,
},
});
const UserFormsTable = ({ formItems }) => {
const classes = useStyles();
return (
<div>
<TableContainer component={Paper}>
<Table className={classes.table} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell>Form name</TableCell>
<TableCell align="right">Owner</TableCell>
<TableCell align="right">Date modified</TableCell>
</TableRow>
</TableHead>
<TableBody>
{formItems.map(formItem => (
<TableRow key={formItem.name}>
<TableCell component="th" scope="row">
{formItem.name}
</TableCell>
<TableCell align="right">{formItem.owner}</TableCell>
<TableCell align="right">{formItem.dateModified}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</div>
)
}
export default UserFormsTable
\ No newline at end of file
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';
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="/SignOut">
<ListItem button>
<ListItemIcon>
<PowerSettingsNewIcon />
</ListItemIcon>
<ListItemText primary="Sign Out" />
</ListItem>
</Link>
</div>
);
\ No newline at end of file
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment