From 08c2c1063e4f02d53662ba621b007c0cdcb246f6 Mon Sep 17 00:00:00 2001 From: A Repko Date: Fri, 21 Jun 2024 15:00:33 +0200 Subject: [PATCH 1/7] Fixes to theme and pages --- CoVAR-app/src/evaluate/evaluate.tsx | 6 +- CoVAR-app/src/sidebar/sidebar.tsx | 78 +++++++++++++++++--- CoVAR-app/src/styles/customThemeProvider.tsx | 2 +- CoVAR-app/src/styles/dashboardStyle.tsx | 4 +- CoVAR-app/src/styles/evaluateStyle.tsx | 15 +--- CoVAR-app/src/styles/sidebarStyle.tsx | 6 +- CoVAR-app/src/styles/themes.tsx | 20 ++--- 7 files changed, 89 insertions(+), 42 deletions(-) diff --git a/CoVAR-app/src/evaluate/evaluate.tsx b/CoVAR-app/src/evaluate/evaluate.tsx index 63f192c..e0ca8ab 100644 --- a/CoVAR-app/src/evaluate/evaluate.tsx +++ b/CoVAR-app/src/evaluate/evaluate.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import { Box, Button, Typography, Paper } from '@mui/material'; import { mainContentStyles } from '../styles/sidebarStyle'; -// import { dashboardContainerStyles } from '../styles/dashboardStyle'; import { uploadBoxStyles, uploadButtonStyles } from '../styles/evaluateStyle'; const Evaluate: React.FC = () => { @@ -15,7 +14,6 @@ const Evaluate: React.FC = () => { }; const handleSubmitFile = () => { - // Handle file submit console.log('File submitted:', selectedFile); }; @@ -23,7 +21,7 @@ const Evaluate: React.FC = () => { return ( - + Upload a Vulnerability Assessment { {selectedFile && ( <> - + Selected File: {selectedFile.name} - + Change Organisation Name setOrganisationName(e.target.value)} - sx={{ - '& .MuiOutlinedInput-root': { - '& fieldset': { - borderColor: '#CAD2C5', - }, - '&:hover fieldset': { - borderColor: '#CAD2C5', - }, - '&.Mui-focused fieldset': { - borderColor: '#52796F', - }, - }, - }} + sx={textFieldStyles} /> -
-
-
diff --git a/CoVAR-app/src/styles/organisationStyle.tsx b/CoVAR-app/src/styles/organisationStyle.tsx index a26a305..209fd90 100644 --- a/CoVAR-app/src/styles/organisationStyle.tsx +++ b/CoVAR-app/src/styles/organisationStyle.tsx @@ -1,55 +1,54 @@ -import { SxProps } from '@mui/material/styles'; +import { SxProps, Theme } from '@mui/system'; -export const mainContentStyles: SxProps = { +export const mainContentStyles: SxProps = { flexGrow: 1, - backgroundColor: '#1F282E', - padding: 3, - color: '#CAD2C5', + backgroundColor: (theme) => theme.palette.background.default, + padding: (theme) => theme.spacing(3), + color: (theme) => theme.palette.text.primary, display: 'flex', flexDirection: 'column', alignItems: 'center', - overflow : 'hidden', + overflow: 'hidden', }; -export const cardStyles: SxProps = { +export const cardStyles: SxProps = { width: 450, height: 220, - backgroundColor: '#2F3E46', - color: '#CAD2C5', - padding: 2, + backgroundColor: (theme) => theme.palette.background.paper, + color: (theme) => theme.palette.text.secondary, + padding: (theme) => theme.spacing(2), }; -export const headingBoxStyles: SxProps = { - backgroundColor: '#2D3E44', +export const headingBoxStyles: SxProps = { width: '98%', display: 'flex', justifyContent: 'center', alignItems: 'center', - padding: 2, - marginBottom: 2, + padding: (theme) => theme.spacing(2), + marginBottom: (theme) => theme.spacing(2), }; -export const textFieldStyles: SxProps = { - color: '#CAD2C5', - '& .MuiOutlinedInput-root': { - '& fieldset': { - borderColor: '#CAD2C5', - }, - '&:hover fieldset': { - borderColor: '#CAD2C5', - }, - '&.Mui-focused fieldset': { - borderColor: '#52796F', - }, - }, +export const textFieldStyles: SxProps = { + // '& .MuiOutlinedInput-root': { + // '& fieldset': { + // borderColor: (theme) => theme.palette.text.secondary, + // }, + // '&:hover fieldset': { + // borderColor: (theme) => theme.palette.text.primary, + // }, + // '&.Mui-focused fieldset': { + // borderColor: (theme) => theme.palette.primary.main, + // }, + // }, }; -export const buttonStyles: SxProps = { - mt: 3, - mb: 2, - backgroundColor: 'primary.main', - color: 'white', - '&:hover': { - backgroundColor: 'primary.dark', - }, +export const buttonStyles: SxProps = { + mt: 3, + mb: 2, + backgroundColor: (theme) => theme.palette.primary.main, + color: (theme) => theme.palette.primary.contrastText, + '&:hover': { + backgroundColor: (theme) => theme.palette.primary.dark, + }, + width: '100%', }; From 505bed60afbb00af4d7ae0c6d6d0620da6ddb554 Mon Sep 17 00:00:00 2001 From: daniel-geerdink Date: Fri, 21 Jun 2024 15:54:43 +0200 Subject: [PATCH 4/7] Updated the theme's colours and fonts --- CoVAR-app/src/login/loginForm.tsx | 2 +- CoVAR-app/src/login/signupForm.tsx | 4 ++-- CoVAR-app/src/sidebar/sidebar.tsx | 12 ++++++------ CoVAR-app/src/styles/themes.tsx | 12 +++++++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CoVAR-app/src/login/loginForm.tsx b/CoVAR-app/src/login/loginForm.tsx index 9479279..02ba6c5 100644 --- a/CoVAR-app/src/login/loginForm.tsx +++ b/CoVAR-app/src/login/loginForm.tsx @@ -95,7 +95,7 @@ const Login: React.FC = ({ toggleForm }) => { - + CoVAR diff --git a/CoVAR-app/src/login/signupForm.tsx b/CoVAR-app/src/login/signupForm.tsx index b7e6154..a97f754 100644 --- a/CoVAR-app/src/login/signupForm.tsx +++ b/CoVAR-app/src/login/signupForm.tsx @@ -88,11 +88,11 @@ const Signup: React.FC = ({ toggleForm }) => { CoVAR - + - + Sign Up diff --git a/CoVAR-app/src/sidebar/sidebar.tsx b/CoVAR-app/src/sidebar/sidebar.tsx index 282d855..0ea60f2 100644 --- a/CoVAR-app/src/sidebar/sidebar.tsx +++ b/CoVAR-app/src/sidebar/sidebar.tsx @@ -61,7 +61,7 @@ const Sidebar: React.FC = () => { to="/" sx={{ ...sidebarItemStyles, - backgroundColor: isActive('/') ? theme.palette.primary.main : 'inherit' + backgroundColor: isActive('/') ? theme.palette.primary.main : 'inherit', borderRadius: '10px' }} > @@ -76,7 +76,7 @@ const Sidebar: React.FC = () => { to="/evaluate" sx={{ ...sidebarItemStyles, - backgroundColor: isActive('/evaluate') ? theme.palette.primary.main : 'inherit' + backgroundColor: isActive('/evaluate') ? theme.palette.primary.main : 'inherit', borderRadius: '10px' }} > @@ -91,7 +91,7 @@ const Sidebar: React.FC = () => { to="/account" sx={{ ...sidebarItemStyles, - backgroundColor: isActive('/account') ? theme.palette.primary.main : 'inherit' + backgroundColor: isActive('/account') ? theme.palette.primary.main : 'inherit', borderRadius: '10px' }} > @@ -105,7 +105,7 @@ const Sidebar: React.FC = () => { to="/organisation" sx={{ ...sidebarItemStyles, - backgroundColor: isActive('/organisation') ? theme.palette.primary.main : 'inherit' + backgroundColor: isActive('/organisation') ? theme.palette.primary.main : 'inherit', borderRadius: '10px' }} > @@ -119,7 +119,7 @@ const Sidebar: React.FC = () => { to="/settings" sx={{ ...sidebarItemStyles, - backgroundColor: isActive('/settings') ? theme.palette.primary.main : 'inherit' + backgroundColor: isActive('/settings') ? theme.palette.primary.main : 'inherit', borderRadius: '10px' }} > @@ -134,7 +134,7 @@ const Sidebar: React.FC = () => { to="/admin-tools" sx={{ ...sidebarItemStyles, - backgroundColor: isActive('/admin-tools') ? theme.palette.primary.main : 'inherit' + backgroundColor: isActive('/admin-tools') ? theme.palette.primary.main : 'inherit', borderRadius: '10px' }} > diff --git a/CoVAR-app/src/styles/themes.tsx b/CoVAR-app/src/styles/themes.tsx index a920e09..84abe34 100644 --- a/CoVAR-app/src/styles/themes.tsx +++ b/CoVAR-app/src/styles/themes.tsx @@ -5,8 +5,11 @@ const lightTheme = createTheme({ palette: { mode: 'light', primary: { - main: '#ADB5BD', - dark: '#6C757D', + main: '#52796F', + dark: '#DEDEDE', + }, + secondary: { + main: '#52796F', }, background: { default: '#CED4DA', @@ -17,7 +20,7 @@ const lightTheme = createTheme({ secondary: '#343A40', }, action: { - hover: '#ADB5BD', + hover: '#DEDEDE', }, }, typography: { @@ -70,6 +73,9 @@ const darkTheme = createTheme({ main: '#52796F', dark: '#405d51', }, + secondary: { + main: '#52796F', + }, background: { default: '#1F282E', paper: '#2D3E44', From 7e708bf56a47c3617997aadaf8ee7de421c44e27 Mon Sep 17 00:00:00 2001 From: daniel-geerdink Date: Fri, 21 Jun 2024 19:45:41 +0200 Subject: [PATCH 5/7] Updated the themes on the organisation and admin tools pages to match the new design --- .../src/adminTools/components/userList.tsx | 51 +++++---- CoVAR-app/src/organisation/organisation.tsx | 103 +++++++++++++++--- CoVAR-app/src/sidebar/sidebar.tsx | 78 +++++++++---- CoVAR-app/src/styles/sidebarStyle.tsx | 4 +- CoVAR-app/src/styles/themes.tsx | 4 +- 5 files changed, 176 insertions(+), 64 deletions(-) diff --git a/CoVAR-app/src/adminTools/components/userList.tsx b/CoVAR-app/src/adminTools/components/userList.tsx index 3093f08..4a1cdbf 100644 --- a/CoVAR-app/src/adminTools/components/userList.tsx +++ b/CoVAR-app/src/adminTools/components/userList.tsx @@ -297,46 +297,53 @@ const UserList = () => { sx={{ height: 600, flex: '1 auto', - '& .MuiDataGrid-root': { - bgcolor: '#52796F', - color: '#CAD2C5', - borderColor: '#52796F', - }, - '& .MuiDataGrid-columnHeader': { - backgroundColor: '#2F3E46', - color: '#CAD2C5', - }, + fontWeight: 500, + borderColor: 'text.primary', '& .MuiDataGrid-columnHeaderTitle': { - color: '#CAD2C5', + color: 'text.primary', }, '& .MuiDataGrid-columnSeparator': { - color: '#52796F', + color: 'text.primary', }, '& .MuiDataGrid-cell': { - color: '#CAD2C5', - borderColor: '#52796F', + color: 'text.primary', + borderColor: 'text.primary', }, '& .MuiDataGrid-footerContainer': { - backgroundColor: '#2F3E46', - color: '#CAD2C5', + backgroundColor: 'background.paper', + color: 'text.primary', }, '& .MuiTablePagination-root': { - color: '#CAD2C5', + color: 'text.primary', }, '& .MuiSvgIcon-root': { - color: '#CAD2C5', + color: 'text.primary', }, '& .MuiDataGrid-toolbarContainer button': { - color: '#CAD2C5', + color: 'text.primary', }, '& .MuiDataGrid-topContainer, & .MuiDataGrid-container--top': { - backgroundColor: '#52796F', + backgroundColor: 'primary.main', }, '& .MuiDataGrid-overlay': { - backgroundColor: '#1F282E', - color: '#CAD2C5', + backgroundColor: 'background.default', + color: 'text.primary', + }, + '& .MuiDataGrid-filler': { + backgroundColor: 'background.paper', + color: 'text.primary', + }, + '& .MuiDataGrid-scrollbarFiller': { + backgroundColor: 'background.paper', + }, + '& .MuiDataGrid-scrollbarFiller--header': { + backgroundColor: 'background.paper', + }, + '& .MuiDataGrid-columnHeader': { + backgroundColor: 'background.paper', + color: 'text.primary', }, - }} + }} /> { const [loading, setLoading] = useState(true); const [newMemberEmail, setNewMemberEmail] = useState(''); const [organisationName, setOrganisationName] = useState(''); + const [confirmOrganisationName, setConfirmOrganisationName] = useState(''); + const [deleteConfirmed, setDeleteConfirmed] = useState(false); useEffect(() => { const fetchUsers = async () => { @@ -78,9 +80,29 @@ const Organisation = () => { }; const handleChangeOrganisationName = async () => { - // Implement the logic to change the organisation name - console.log('Change organisation name to:', organisationName); - setOrganisationName(''); + // Verify if confirmOrganisationName matches organisationName + if (confirmOrganisationName !== organisationName) { + console.error('Organisation names do not match. Aborting.'); + return; + } + + try { + // Implement the logic to delete the organisation + console.log('Disbanding organisation:', organisationName); + + // Example deletion using Firestore + const organisationRef = doc(db, 'organizations', 'your-organisation-id'); + await deleteDoc(organisationRef); + + // After deletion, you may want to clear state or redirect + + // Reset fields after successful deletion + setOrganisationName(''); + setConfirmOrganisationName(''); + setDeleteConfirmed(false); + } catch (error) { + console.error('Error deleting organisation:', error); + } }; const columns: GridColDef[] = [ @@ -137,25 +159,25 @@ const Organisation = () => { columns={columns} sx={{ width: '100%', - // bgcolor: 'primary.main', color: 'text.primary', - borderColor: 'primary.main', + fontWeight: 500, + borderColor: 'text.primary', '& .MuiDataGrid-columnHeader': { - backgroundColor: 'primary.main', + backgroundColor: 'background.paper', color: 'text.primary', }, '& .MuiDataGrid-columnHeaderTitle': { color: 'text.primary', }, '& .MuiDataGrid-columnSeparator': { - color: 'primary.main', + color: 'text.primary', }, '& .MuiDataGrid-cell': { color: 'text.primary', - borderColor: 'primary.main', + borderColor: 'text.primary', }, '& .MuiDataGrid-footerContainer': { - backgroundColor: 'primary.main', + backgroundColor: 'background.paper', color: 'text.primary', }, '& .MuiTablePagination-root': { @@ -174,14 +196,25 @@ const Organisation = () => { backgroundColor: 'background.default', color: 'text.primary', }, + '& .MuiDataGrid-filler': { + backgroundColor: 'background.paper', + color: 'text.primary', + }, + '& .MuiDataGrid-scrollbarFiller': { + backgroundColor: 'background.paper', + }, + '& .MuiDataGrid-scrollbarFiller--header': { + backgroundColor: 'background.paper', + }, }} /> - + - Add a Member + Add a Member { name="email" autoComplete="email" autoFocus - InputLabelProps={{ style: { color: 'text.primary' } }} + InputLabelProps={{ sx: { color: 'text.primary' } }} + InputProps={{ sx: { color: 'text.primary' } }} value={newMemberEmail} onChange={(e) => setNewMemberEmail(e.target.value)} sx={textFieldStyles} @@ -201,8 +235,9 @@ const Organisation = () => { - Change Organisation Name + Change Organisation Name { name="organisation-name" autoComplete="organisation-name" autoFocus - InputLabelProps={{ style: { color: 'text.primary' } }} + InputLabelProps={{ sx: { color: 'text.primary' } }} + InputProps={{ sx: { color: 'text.primary' } }} value={organisationName} onChange={(e) => setOrganisationName(e.target.value)} sx={textFieldStyles} @@ -220,6 +256,43 @@ const Organisation = () => { + + + Disband Organisation + setConfirmOrganisationName(e.target.value)} + sx={textFieldStyles} + /> +

+

+ +
+
); diff --git a/CoVAR-app/src/sidebar/sidebar.tsx b/CoVAR-app/src/sidebar/sidebar.tsx index 0ea60f2..5ec2e56 100644 --- a/CoVAR-app/src/sidebar/sidebar.tsx +++ b/CoVAR-app/src/sidebar/sidebar.tsx @@ -56,89 +56,119 @@ const Sidebar: React.FC = () => { - - + + {(isAdmin || isVA) && ( - - + + )} - - + + - - + + - - + + {isAdmin && ( - - + + diff --git a/CoVAR-app/src/styles/sidebarStyle.tsx b/CoVAR-app/src/styles/sidebarStyle.tsx index 8f47821..1e333d1 100644 --- a/CoVAR-app/src/styles/sidebarStyle.tsx +++ b/CoVAR-app/src/styles/sidebarStyle.tsx @@ -26,6 +26,7 @@ export const sidebarItemStyles: SxProps = (theme) => ({ borderRadius: theme.shape.borderRadius, '&:hover': { backgroundColor: theme.palette.action.hover, + }, }); @@ -43,9 +44,10 @@ export const logoutButtonStyles: SxProps = (theme) => ({ marginBottom: theme.spacing(2), width: '90%', backgroundColor: theme.palette.primary.main, - color: theme.palette.primary.contrastText, // Use contrast text color + color: theme.palette.primary.contrastText, '&:hover': { backgroundColor: theme.palette.primary.dark, + color: theme.palette.text.primary, }, }); diff --git a/CoVAR-app/src/styles/themes.tsx b/CoVAR-app/src/styles/themes.tsx index 84abe34..3f80cd0 100644 --- a/CoVAR-app/src/styles/themes.tsx +++ b/CoVAR-app/src/styles/themes.tsx @@ -116,14 +116,14 @@ const darkTheme = createTheme({ MuiButton: { styleOverrides: { root: { - borderRadius: 4, // ensuring button border radius matches the theme + borderRadius: 4, }, }, }, MuiPaper: { styleOverrides: { root: { - padding: 8, // ensure all papers have consistent padding + padding: 8, }, }, }, From 1621481926e54be6f7c9bee6e00ad540776ef920 Mon Sep 17 00:00:00 2001 From: daniel-geerdink Date: Sat, 22 Jun 2024 12:08:06 +0200 Subject: [PATCH 6/7] Changed the hover colour in light mode --- CoVAR-app/src/styles/sidebarStyle.tsx | 1 - CoVAR-app/src/styles/themes.tsx | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CoVAR-app/src/styles/sidebarStyle.tsx b/CoVAR-app/src/styles/sidebarStyle.tsx index 1e333d1..d254ae2 100644 --- a/CoVAR-app/src/styles/sidebarStyle.tsx +++ b/CoVAR-app/src/styles/sidebarStyle.tsx @@ -47,7 +47,6 @@ export const logoutButtonStyles: SxProps = (theme) => ({ color: theme.palette.primary.contrastText, '&:hover': { backgroundColor: theme.palette.primary.dark, - color: theme.palette.text.primary, }, }); diff --git a/CoVAR-app/src/styles/themes.tsx b/CoVAR-app/src/styles/themes.tsx index 3f80cd0..32a3625 100644 --- a/CoVAR-app/src/styles/themes.tsx +++ b/CoVAR-app/src/styles/themes.tsx @@ -6,7 +6,7 @@ const lightTheme = createTheme({ mode: 'light', primary: { main: '#52796F', - dark: '#DEDEDE', + dark: '#3d5b53', }, secondary: { main: '#52796F', From 1731cd370b956cdeb49edbd4b361eb9cda37329c Mon Sep 17 00:00:00 2001 From: daniel-geerdink Date: Sat, 22 Jun 2024 12:16:20 +0200 Subject: [PATCH 7/7] Changed the organisation delete function --- CoVAR-app/src/organisation/organisation.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CoVAR-app/src/organisation/organisation.tsx b/CoVAR-app/src/organisation/organisation.tsx index dfc3472..7b1f364 100644 --- a/CoVAR-app/src/organisation/organisation.tsx +++ b/CoVAR-app/src/organisation/organisation.tsx @@ -79,7 +79,7 @@ const Organisation = () => { } }; - const handleChangeOrganisationName = async () => { + const handleDeleteOrganisation = async () => { // Verify if confirmOrganisationName matches organisationName if (confirmOrganisationName !== organisationName) { console.error('Organisation names do not match. Aborting.'); @@ -105,6 +105,10 @@ const Organisation = () => { } }; + const handleChangeOrganisationName = async () => { + //logic to change organisation name + } + const columns: GridColDef[] = [ { field: 'name', headerName: 'Name', flex: 1, headerAlign: 'left', resizable: false }, { field: 'email', headerName: 'Email', flex: 1, headerAlign: 'left', resizable: false }, @@ -267,7 +271,6 @@ const Organisation = () => { label="Confirm Organisation Name" name="confirm-organisation-name" autoComplete="organisation-name" - autoFocus InputLabelProps={{ sx: { color: 'text.primary' } }} InputProps={{ sx: { color: 'text.primary' } }} value={confirmOrganisationName} @@ -286,7 +289,7 @@ const Organisation = () => { backgroundColor: '#B2163B', }, }} - onClick={handleChangeOrganisationName} + onClick={handleDeleteOrganisation} disabled={confirmOrganisationName !== organisationName || deleteConfirmed} > Delete Organisation