Skip to content

Commit

Permalink
Merge branch 'dev' into profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
akrimelzer authored Nov 8, 2019
2 parents 043dc1e + 9ae0f4d commit 75bc397
Show file tree
Hide file tree
Showing 19 changed files with 2,310 additions and 1,198 deletions.
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

42 changes: 12 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

Use Gitmoji to add emoji to a commit :sparkles:

## Available Scripts
## AAS frontend

In the project directory, you can run:
prerequisite:
- Node



### `npm install`

Installs all the dependencies for the project.

### `npm start`

Expand All @@ -14,33 +20,9 @@ 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!
### `AAS backend`
Can be found here: https://github.com/ddabble/aas

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
To learn React, check out the [React documentation](https://reactjs.org/).

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/).
2,181 changes: 1,129 additions & 1,052 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"@types/react": "16.9.3",
"@types/react-dom": "16.9.1",
"@types/react-router-dom": "^5.1.0",

"@types/react-select": "^3.0.6",

"@types/react-table": "^6.8.5",
"axios": "^0.19.0",
"react": "^16.9.0",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="stylesheet" href="node_modules/react-table/react-table.css" />
<link href="https://fonts.googleapis.com/css?family=Titillium+Web&display=swap" rel="stylesheet">
<title>React App</title>
</head>
<body>
Expand Down
32 changes: 20 additions & 12 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React from 'react';
import AlertView from './views/alertView/AlertView';
import LoginView from './views/loginView/LoginView';
import { Route, Switch } from 'react-router-dom';
import { ProtectedRoute } from './protected.route';
import './variables.css';
import './colorscheme.css';
import NotificationProfileView from './views/notificationProfileView/NotificationProfileView';
import ActiveProfile from './components/active-profiles/ActiveProfile';

import ProfileList from './components/profileList/ProfileList';

import React from "react";
import AlertView from "./views/alertView/AlertView";
import LoginView from "./views/loginView/LoginView";
import { Route, Switch } from "react-router-dom";
import { ProtectedRoute } from "./protected.route";
import "./variables.css";
import "./colorscheme.css";
import NotificationProfileView from "./views/notificationProfileView/NotificationProfileView";
import ActiveProfile from "./components/active-profiles/ActiveProfile";
import FilterBuildingView from "./views/filterBuildingView/filterBuildingView";


const App: React.SFC = () => {
return (
<div>
Expand All @@ -18,10 +22,14 @@ const App: React.SFC = () => {
path='/notification-profile'
component={NotificationProfileView}
/>

<Route path='/real-profile' component={ProfileList} />
<Route path='/login' component={LoginView} />
<Route path='/profile' component={ActiveProfile} />
<Route path='*' component={() => <h1>404 not found</h1>} />

<Route path="/login" component={LoginView} />
<Route path="/profile" component={ActiveProfile} />
<ProtectedRoute path="/customfilter" component={FilterBuildingView} />
<Route path="*" component={() => <h1>404 not found</h1>} />

</Switch>
</div>
);
Expand Down
44 changes: 23 additions & 21 deletions src/components/active-profiles/ActiveProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useState, useEffect } from 'react';
import './ActiveProfile.css';
import { makeStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import axios from 'axios';
import React, { useState, useEffect } from "react";
import "./ActiveProfile.css";
import { makeStyles } from "@material-ui/core/styles";
import Button from "@material-ui/core/Button";
import axios from "axios";

const useStyles = makeStyles(theme => ({
button: {
margin: theme.spacing(1)
},
input: {
display: 'none'
display: "none"
}
}));

Expand Down Expand Up @@ -39,42 +39,44 @@ const ActiveProfile: React.FC<NotificationProps> = props => {

const deleteProfile = async (item: any) => {
await axios({
url: 'http://localhost:8000/notificationprofiles/' + item.id,
method: 'DELETE',
url: "http://localhost:8000/notificationprofiles/" + item.id,
method: "DELETE",
headers: {
Authorization: 'Token ' + localStorage.getItem('token')
Authorization: "Token " + localStorage.getItem("token")
}
}).then((response: any) => {
handleRemoveProfile(item);
});
};

const weekList = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
];

return (
<div className='profile-container'>
<div className="profile-container">
{profiles.map((item: any) => {
return (
<div className='item-container' key={item.id}>
<div className="item-container" key={item.id}>
<h3>{item.title}</h3>

<h4>{`${
weekList[item.startDate.getDay()]
} ${item.startDate.getHours()}${
weekList[item.endDate.getDay()]
} ${item.endDate.getHours()}`}</h4>
<Button
variant='contained'
color='secondary'
variant="contained"
color="secondary"
className={classes.button}
onClick={() => deleteProfile(item)}>
onClick={() => deleteProfile(item)}
>
Delete
</Button>
</div>
Expand Down
86 changes: 86 additions & 0 deletions src/components/filterBuilder/FilterBuilder.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.WrappingDiv {
display: grid;
grid-template-areas: "filter"
"preview";
}

.filterBuilding-div {
color: var(--primary-darker);
width: 60vw;
height: auto;
margin: auto;
grid-area: filter;
border: 1px solid lightgrey;
border-radius: 5px;
box-shadow: 0px 1px 5px 1px #c5c5df;
margin-top: 5vh;
}

.filterHeader {
color:var(--primary);
}

.ButtonDiv {
display: grid;
grid-template-areas: ". preview create";
grid-template-columns: 30% auto auto;
margin-bottom: 20px;
}

.create {
align-items: flex-end;
grid-area: create;
margin-left: auto;
}
.ButtonDiv .MuiButton-containedPrimary {
color: #fff;
background-color: var(--primary);
}

.ButtonDiv .MuiButton-containedPrimary:hover {
background-color: var(--primary-dark);
}

.preview {
grid-area: preview;
}

.InputWrapperDiv {
display: flex;
flex-direction: column;
justify-content: center;
width: 90%;
margin: auto;
}

.FilterTableDiv {
width: 40% !important;
}

.NameFieldDiv {
display: flex;
flex-direction: column;
padding: 0px;
}

.ReactTable {
grid-area: preview;
margin-bottom: 30px;
}

.filterSelect {
display: grid;
grid-template-areas: "intruction selector";
grid-template-columns: 30% auto;
}
.filterSelect p {
grid-area: intruction;
}

.filterSelect div div {
grid-area: selector;
}

.selector {
margin-top: 10px;
}
Loading

0 comments on commit 75bc397

Please sign in to comment.