Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed front-end/src/App.css
Empty file.
7 changes: 3 additions & 4 deletions front-end/src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from 'react';
import './App.css';
import Login from './pages/Login';
import Home from './pages/Home';
import Profile from './pages/Profile';
Expand Down Expand Up @@ -202,13 +201,13 @@ export default function App() {
<Navbar employees={uidEmployees} uid={data.uid} isAdmin={isAdmin} logout={logout.bind(this)} getKudos={getKudos.bind(this)}/>
<div className={classes.content}>
<Route exact path="/home" render={(props) => (
<Home {...props} data={data} uri={uri} employees={uidEmployees} kudos={kudos} getKudos={getKudos.bind(this)} reactions={reactions}/>
<Home {...props} data={data} uri={uri} employees={uidEmployees} kudos={kudos} isAdmin={isAdmin} getKudos={getKudos.bind(this)} reactions={reactions}/>
)}/>
<Route exact path="/profile" render={(props) => (
<Profile {...props} data={data} uri={uri} employees={uidEmployees} uid={data.uid} reactions={reactions} reloadEmp={reloadEmployees.bind(this)}/>
<Profile {...props} data={data} uri={uri} employees={uidEmployees} uid={data.uid} reactions={reactions} isAdmin={isAdmin} reloadEmp={reloadEmployees.bind(this)}/>
)}/>
{isAdmin ? <Route exact path="/admin" render={(props) => (
<Admin data={data} uri={uri} employees={uidEmployees} kudos={kudos} getKudos={getKudos.bind(this)}/>
<Admin data={data} uri={uri} employees={uidEmployees} kudos={kudos} isAdmin={isAdmin} reactions={reactions} getKudos={getKudos.bind(this)}/>
)}/> : null}
</div>
</div>
Expand Down
180 changes: 110 additions & 70 deletions front-end/src/components/AddKudo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { Button, Card, CardContent, Chip, TextField, Grid } from '@material-ui/core';
import { Button, Card, CardContent, Chip, TextField, Grid, Modal, Fade } from '@material-ui/core';
import Autocomplete from '@material-ui/lab/Autocomplete';
import React, { useState, useEffect } from 'react';
import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles({
modalCenter: {
position: 'absolute',
top: '30%',
left: '50%',
transform: 'translate(-50%, -50%)',
outline: '0',
},
});

// props: getKudos, optional: toggleShowAddKudos
export default function AddKudo(props) {
Expand All @@ -11,7 +22,15 @@ export default function AddKudo(props) {
const [uid, setUid] = useState('');
const [nameMapUid, setNameMapUid] = useState('');
const [coreValues, setCoreValues] = useState(['loading']);
const [showAddSuccess, toggleShowAddSuccess] = useState(false);
const [tags, updateTags] = useState('');
const classes = useStyles();

useEffect(() => {
if(showAddSuccess) {
setTimeout(() => toggleShowAddSuccess(false), 1500)
}
}, [showAddSuccess])

useEffect(() => {
const uri = localStorage.getItem('uri');
Expand Down Expand Up @@ -78,82 +97,103 @@ export default function AddKudo(props) {
if (props.toggleShowAddKudo) {
props.toggleShowAddKudo(false);
}
if (props.toggleShowAddSuccess) {
props.toggleShowAddSuccess(true);
} else {
toggleShowAddSuccess(true)
}
});
setName('');
updateKudo('');
updateTags([]);
}

return (
<Card style={{width: '600px', margin: '10px'}} elevation={0}>
<CardContent>
<form onSubmit={(e) => {e.preventDefault(); handleSumbit();}}>
<Grid
container
direction="column"
justify="space-evenly"
alignItems="stretch"
spacing={1}
>
<Grid item>
<Autocomplete
id='toField'
value={name !== '' ? name : null}
options={Object.keys(nameMapUid)}
getOptionLabel={(option) => option}
onChange={(event, newValue) => {
setName(newValue);
}}
renderInput={(params) => <TextField {...params} required label="Send To..." variant="outlined"/>}
/>
</Grid>
<Grid item>
<TextField
required
label='Message'
variant='outlined'
multiline
rows={4}
value={kudo}
fullWidth
onChange={(e) => updateKudo(e.target.value)}
/>
</Grid>
<Grid item>
<Autocomplete
multiple
id="tags-outlined"
options={coreValues}
getOptionLabel={(option) => option.value}
renderTags={() => (
tags.map((option, index) => (
<Chip
style={{backgroundColor: option.color}}
label={option.value}
key={index}
/>
))
)}
onChange={(event, newValue) => {
updateTags(newValue)
}}
renderInput={(params) => (
<TextField
{...params}
required={tags.length === 0}
variant="outlined"
label="Core Values"
placeholder="Core Values"
/>
)}
/>
</Grid>
<Grid item container justify='flex-end'>
<Button type="submit" variant="contained" color="primary">Submit Kudo</Button>
<div>
<Modal
open={showAddSuccess}
onClose={() => toggleShowAddSuccess(false)}
aria-labelledby="report-confirmed"
aria-describedby="report-kudo"
>
<Fade in={showAddSuccess}>
<div className={classes.modalCenter}>
<Card style={{width: '600px', margin: '10px', backgroundColor: '#00FF00', textAlign: 'center'}} elevation={0}>
<h1>Kudo Submitted Succesfully</h1>
</Card>
</div>
</Fade>
</Modal>
<Card style={{width: '600px', margin: '10px'}} elevation={0}>
<CardContent>
<form onSubmit={(e) => {e.preventDefault(); handleSumbit();}}>
<Grid
container
direction="column"
justify="space-evenly"
alignItems="stretch"
spacing={1}
>
<Grid item>
<Autocomplete
id='toField'
value={name !== '' ? name : null}
options={Object.keys(nameMapUid)}
getOptionLabel={(option) => option}
onChange={(event, newValue) => {
setName(newValue);
}}
renderInput={(params) => <TextField {...params} required label="Send To..." variant="outlined"/>}
/>
</Grid>
<Grid item>
<TextField
required
label='Message'
variant='outlined'
multiline
rows={4}
value={kudo}
fullWidth
onChange={(e) => updateKudo(e.target.value)}
/>
</Grid>
<Grid item>
<Autocomplete
multiple
id="tags-outlined"
options={coreValues}
getOptionLabel={(option) => option.value}
renderTags={() => (
tags.map((option, index) => (
<Chip
style={{backgroundColor: option.color}}
label={option.value}
key={index}
/>
))
)}
onChange={(event, newValue) => {
updateTags(newValue)
}}
renderInput={(params) => (
<TextField
{...params}
required={tags.length === 0}
variant="outlined"
label="Core Values"
placeholder="Core Values"
/>
)}
/>
</Grid>
<Grid item container justify='flex-end'>
<Button type="submit" variant="contained" color="primary">Submit Kudo</Button>
</Grid>
</Grid>
</Grid>
</form>
</CardContent>
</Card>
</form>
</CardContent>
</Card>
</div>
);
}
Loading