diff --git a/client/package.json b/client/package.json index 638f0bf..170ebb2 100644 --- a/client/package.json +++ b/client/package.json @@ -12,6 +12,7 @@ "@testing-library/react": "^12.1.3", "@testing-library/user-event": "^13.5.0", "axios": "^0.26.1", + "buffer": "^6.0.3", "js-cookie": "^3.0.1", "mic-recorder-to-mp3": "^2.2.2", "react": "^17.0.2", diff --git a/client/src/App.jsx b/client/src/App.jsx index a6678ff..cd75970 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -1,20 +1,20 @@ import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'; -import { Layout } from './containers'; +import { + Layout, + Login, + Register, + MainPage, + EditUser, + Recover, + Reset, + OwnedOrgs, + MemberOrgs, + OrgDashboard, +} from './containers'; import { ContextProvider } from './contexts'; -import MainPage from './controllers/MainPage'; -import Form from './components/Form'; -import Login from './controllers/Login'; -import Register from './controllers/Register'; -import EditUser from './controllers/EditUser'; -import Recover from './controllers/Recover'; -import Reset from './controllers/Reset'; - -import OwnedOrgs from './controllers/OwnedOrgs'; -import MemberOrgs from './controllers/MemberOrgs'; -import OrgDashboard from './controllers/OrgDashboard'; -import UpdateOrganization from './controllers/UpdateOrganization'; +import UpdateOrganization from './controllers/UpdateOrganizationFormController'; function App() { return ( @@ -22,24 +22,24 @@ function App() { }> - {/* } /> */} + } /> } /> } /> - {/* } /> */} - {/* }> + } /> + } /> } /> - */} + - {/* + } /> } /> } /> } /> - */} + } /> diff --git a/client/src/components/Dashboard.jsx b/client/src/components/Dashboard.jsx index a7821f0..21ecab6 100644 --- a/client/src/components/Dashboard.jsx +++ b/client/src/components/Dashboard.jsx @@ -1,4 +1,3 @@ -import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import { Accordion, @@ -18,11 +17,13 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import PlayArrowIcon from '@mui/icons-material/PlayArrow'; import { DataGrid } from '@mui/x-data-grid'; -import MemberUnit from './MemberUnit'; +import { MemberUnit } from '.'; import { DynamicPaper, DynamicStack } from './StyledElements'; function Dashboard({ rows, + open, + handleOpen, setSelection, onClick, org, @@ -37,8 +38,6 @@ function Dashboard({ const sm = useMediaQuery((theme) => theme.breakpoints.only('sm')); const md = useMediaQuery((theme) => theme.breakpoints.only('md')); - const [open, setOpen] = useState(false); - const linkStyle = { textDecoration: 'none', color: 'inherit' }; const columns = [ { field: 'id', headerName: 'ID', flex: 1 }, @@ -67,10 +66,6 @@ function Dashboard({ { field: 'email', headerName: 'Email', flex: 10, sortable: false }, ]; - function handleOpen() { - setOpen((initial) => (initial ? false : true)); - } - const buttonGroupOrientation = () => { if (xs) return 'vertical'; }; @@ -86,25 +81,19 @@ function Dashboard({ } return ( - + <> }> - - Organizations/{org.name} - + Organizations / {org.name} - + - Organization ID: {org.orgID} + Organization ID: {org.id} Members: {org.memberCount} @@ -117,8 +106,7 @@ function Dashboard({ - Owner:{' '} - {`${org.owner.firstName} ${org.owner.lastName}`} + Owner: {`${org.owner.firstName} ${org.owner.lastName}`} Email: {org.owner.email} @@ -128,23 +116,17 @@ function Dashboard({ {status ? ( - + <> - @@ -152,31 +134,19 @@ function Dashboard({ variant='outlined' orientation={buttonGroupOrientation()} > - - - - + ) : ( - )} @@ -187,16 +157,11 @@ function Dashboard({ - + {(xs || sm) && rows.map((member) => { - return ( - - ); + return ; })} {md && ( @@ -214,7 +179,7 @@ function Dashboard({ )} - + ); } diff --git a/client/src/components/EditUserForm.jsx b/client/src/components/EditUserForm.jsx index 5cf0c3a..9881b4a 100644 --- a/client/src/components/EditUserForm.jsx +++ b/client/src/components/EditUserForm.jsx @@ -2,8 +2,8 @@ import React from 'react'; import { Link } from 'react-router-dom'; import { Box, Typography } from '@mui/material'; -import Form from './Form'; -import RecordMp3 from './RecordMp3'; +import { Form } from '.'; +import { RecordMp3 } from '../controllers'; import { FormSubmit, FormTextField } from './StyledElements'; function EditUserForm({ form, error, handleSubmit, handleChange }) { diff --git a/client/src/components/Form.jsx b/client/src/components/Form.jsx index 50d4e1d..621cc44 100644 --- a/client/src/components/Form.jsx +++ b/client/src/components/Form.jsx @@ -1,22 +1,17 @@ import React from 'react'; import { Outlet } from 'react-router-dom'; -import { Box, Grid, Paper, Typography } from '@mui/material'; +import { Box, Grid, Card, Typography, CardContent, Alert } from '@mui/material'; import { useTheme } from '@mui/material/styles'; -function Form({ children, text }) { +function Form({ children, text, error }) { const theme = useTheme(); return ( - + - - {text && ( - - {text} - - )} - {children} - - + + {text && ( + + {text} + + )} + {children} + + {error && {error}} + + diff --git a/client/src/components/LoginForm.jsx b/client/src/components/LoginForm.jsx index c75119a..2172d55 100644 --- a/client/src/components/LoginForm.jsx +++ b/client/src/components/LoginForm.jsx @@ -1,17 +1,14 @@ import React from 'react'; import { Link } from 'react-router-dom'; -import { Box, Checkbox, FormControlLabel, Typography } from '@mui/material'; +import { Checkbox, FormControlLabel, Typography } from '@mui/material'; -import Form from './Form'; +import { Form } from '.'; import { FormSubmit, FormTextField } from './StyledElements'; -function Login({ form, error, handleSubmit, handleChange, handleCheckboxChange }) { +function Login({ form, handleSubmit, handleChange, handleCheckboxChange, error }) { return ( -
+ - - Login - - {error && ( - - - {error} - - - )} Login diff --git a/client/src/components/MainPageBase.jsx b/client/src/components/MainPageBase.jsx index 9f7c97c..aea0096 100644 --- a/client/src/components/MainPageBase.jsx +++ b/client/src/components/MainPageBase.jsx @@ -6,24 +6,12 @@ import OrgUnit from './OrgUnit'; import StackItem from './StackItem'; import { Form, FormButton, FormField } from './StyledElements'; -function MainPageBase({ - form, - orgs, - ownedOrgs, - joinOrg, - createOrg, - handleChange, -}) { +function MainPageBase({ form, orgs, ownedOrgs, joinOrg, createOrg, handleChange }) { const linkStyle = { textDecoration: 'none', color: 'inherit' }; return ( - + @@ -36,10 +24,7 @@ function MainPageBase({ value={form.id} onChange={handleChange} /> - + Join Organization @@ -54,10 +39,7 @@ function MainPageBase({ value={form.name} onChange={handleChange} /> - + Create Organization @@ -76,7 +58,7 @@ function MainPageBase({ )} {ownedOrgs.map((org) => ( - + ))} @@ -92,7 +74,7 @@ function MainPageBase({ )} {orgs.map((org) => ( - + ))} diff --git a/client/src/components/Navbar.jsx b/client/src/components/Navbar.jsx index 93b98f1..c201808 100644 --- a/client/src/components/Navbar.jsx +++ b/client/src/components/Navbar.jsx @@ -1,22 +1,26 @@ import DarkModeIcon from '@mui/icons-material/DarkMode'; import LightModeIcon from '@mui/icons-material/LightMode'; -import MailIcon from '@mui/icons-material/Mail'; import MenuIcon from '@mui/icons-material/Menu'; import { AppBar, Box, Button, IconButton, Toolbar, Typography } from '@mui/material'; import { Link } from 'react-router-dom'; export default function Navbar({ logout, userData, mode, toggleMode }) { function NavbarControls() { - return userData.username ? ( - + return userData.email ? ( + <> + + + ) : ( <>