Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications Page #428

Merged
merged 4 commits into from
Nov 27, 2023
Merged
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
244 changes: 131 additions & 113 deletions resq/frontend/src/App.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import disasterImage from '../disaster.png';
import disasterImage from '../../disaster.png';
import Avatar from '@mui/material/Avatar';
import CssBaseline from '@mui/material/CssBaseline';
import Container from '@mui/material/Container';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import disasterImage from '../disaster.png';
import disasterImage from '../../disaster.png';
import Avatar from '@mui/material/Avatar';
import CssBaseline from '@mui/material/CssBaseline';
import Container from '@mui/material/Container';
Expand Down
77 changes: 77 additions & 0 deletions resq/frontend/src/pages/Notifications.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import * as React from 'react';
import CssBaseline from '@mui/material/CssBaseline';
import Link from '@mui/material/Link';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import {createTheme, ThemeProvider} from '@mui/material/styles';
import Container from '@mui/material/Container';
import {Card, CardContent, CardHeader} from "@mui/material";


function Copyright(props) {
return (
<div style={{position: 'fixed', bottom: 0, width: '100%'}}>
<Typography variant="body2" color="text.secondary" align="center" {...props}>
{'Copyright © '}
<Link color="inherit" href="https://github.com/bounswe/bounswe2023group1">
<span style={{fontWeight: 'bold'}}>ResQ</span>
</Link>{' '}
{new Date().getFullYear()}
{'.'}
</Typography>
</div>
);
}

const customTheme = createTheme({
palette: {
primary: {
main: '#FF0000',
},
},
});

const NotificationCard = ({notif, onClick}) => <Card
sx={{marginBottom: "24px", backgroundColor: notif.read ? "lightgrey" : "white"}}
onClick={onClick}
>
<CardHeader title={notif.title}/>
<CardContent>
<Typography variant="body2" color="text.primary" sx={{fontSize: '16px'}}>
{notif.desc}
</Typography>
</CardContent>
</Card>

// noinspection JSUnusedLocalSymbols
export default function Notifications({token, notifications, setNotifications}) {

const handleNotifRead = (i) => {
const new_notifs = JSON.parse(JSON.stringify(notifications))
new_notifs[i].read = true
setNotifications(new_notifs)
}

return (
<ThemeProvider theme={customTheme}>
<Container component="main" maxWidth="xs">
<CssBaseline/>
<Box
sx={{
marginTop: 1,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
>
{
notifications.map((notif, i) => <NotificationCard notif={notif} onClick={() => notif.read || handleNotifRead(i)}/>)
}

</Box>
</Container>
<Copyright sx={{mt: 5}}/>
</ThemeProvider>
);
}

10 changes: 5 additions & 5 deletions resq/frontend/src/pages/RequestCreation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import StepLabel from '@mui/material/StepLabel';
import Button from '@mui/material/Button';
import Link from '@mui/material/Link';
import Typography from '@mui/material/Typography';
import RequestAddress from '../components/RequestAddress';
import RequestDetails1 from '../components/RequestDetails1';
import RequestDetails2 from '../components/RequestDetails2';
import RequestDetails3 from '../components/RequestDetails3';
import RequestReview from '../components/RequestReview';
import RequestAddress from '../components/Request/RequestAddress';
import RequestDetails1 from '../components/Request/RequestDetails1';
import RequestDetails2 from '../components/Request/RequestDetails2';
import RequestDetails3 from '../components/Request/RequestDetails3';
import RequestReview from '../components/Request/RequestReview';
import { createTheme, ThemeProvider } from '@mui/material/styles';

function Copyright(props) {
Expand Down
8 changes: 4 additions & 4 deletions resq/frontend/src/pages/ResourceCreation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import StepLabel from '@mui/material/StepLabel';
import Button from '@mui/material/Button';
import Link from '@mui/material/Link';
import Typography from '@mui/material/Typography';
import ResourceAddress from '../components/ResourceAddress';
import ResourceDetail1 from '../components/ResourceDetail1';
import ResourceDetail2 from '../components/ResourceDetail2';
import ResourceAddress from '../components/Resource/ResourceAddress';
import ResourceDetail1 from '../components/Resource/ResourceDetail1';
import ResourceDetail2 from '../components/Resource/ResourceDetail2';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { ResourceProvider } from '../components/ResourceContext';
import { ResourceProvider } from '../components/Resource/ResourceContext';
import { useResource } from './ResourceContext';
import axios from 'axios';

Expand Down