From ae12a6cd7cabe2a67920edbd63ec905fe368abf3 Mon Sep 17 00:00:00 2001 From: itzaname Date: Sat, 28 Jun 2025 00:40:39 -0400 Subject: [PATCH] Add ui support for displaying disabled accounts --- web/src/App.tsx | 1 + web/src/components/Header.tsx | 161 +++++++++++------- .../applications/ApplicationsPage.tsx | 12 +- web/src/types/index.ts | 1 + 4 files changed, 105 insertions(+), 70 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index ef06d64..83fbfbc 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -36,6 +36,7 @@ const AppUI = ({ user }: { user: UserInfo }) => {
diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index d4e998f..aa29d72 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -9,12 +9,15 @@ import { MenuItem, ListItemIcon, ListItemText, - IconButton + IconButton, + Alert, + Box } from '@mui/material'; import { Add as AddIcon, AccountCircle as AccountCircleIcon, - Logout as LogoutIcon + Logout as LogoutIcon, + Warning as WarningIcon } from '@mui/icons-material'; import {UserInfo} from "../types"; import {useConfig} from "../context/ConfigContext.tsx"; @@ -55,73 +58,99 @@ const Header: React.FC = ({ user, onCreateAppClick }) => { }; return ( - - - - StrafesNET Developer Portal - - - {/* Rate Limit Display */} - - - - - {/* Profile Avatar Button */} - - + + + + StrafesNET Developer Portal + + + {/* Rate Limit Display */} + + + - {/* Dropdown Menu */} - - - - - - Account Management - - - - - - Logout - - - - + {/* Profile Avatar Button */} + + + + + {/* Dropdown Menu */} + + + + + + Account Management + + + + + + Logout + + + + + + {/* Account Disabled Warning */} + {!user.active && ( + + } + sx={{ + borderRadius: 0, + '& .MuiAlert-message': { + width: '100%', + textAlign: 'center' + } + }} + > + + Your account has been disabled. + + + + )} + ); }; diff --git a/web/src/components/applications/ApplicationsPage.tsx b/web/src/components/applications/ApplicationsPage.tsx index 06d8a89..7759d55 100644 --- a/web/src/components/applications/ApplicationsPage.tsx +++ b/web/src/components/applications/ApplicationsPage.tsx @@ -11,14 +11,15 @@ import { Add as AddIcon } from '@mui/icons-material'; import ApplicationCard from './ApplicationCard.tsx'; -import { Permission } from '../../types'; +import { Permission, UserInfo } from '../../types'; import { useApplications } from '../../context/ApplicationContext'; interface ApplicationsPageProps { + user: UserInfo; permissions: Permission[]; } -const ApplicationsPage: React.FC = ({ permissions }) => { +const ApplicationsPage: React.FC = ({ user, permissions }) => { const { applications, openCreateDialog @@ -53,7 +54,8 @@ const ApplicationsPage: React.FC = ({ permissions }) => { py: 8, bgcolor: 'background.paper', borderRadius: 2, - border: '1px solid rgba(255, 255, 255, 0.12)' + border: '1px solid rgba(255, 255, 255, 0.12)', + opacity: user.active ? 1 : 0.6 }} > @@ -64,6 +66,7 @@ const ApplicationsPage: React.FC = ({ permissions }) => { variant="contained" startIcon={} onClick={openCreateDialog} + disabled={!user.active} sx={{ mt: 2 }} > Create Your First App @@ -78,7 +81,8 @@ const ApplicationsPage: React.FC = ({ permissions }) => { md: 'repeat(3, 1fr)', lg: 'repeat(4, 1fr)' }, - gap: 3 + gap: 3, + opacity: user.active ? 1 : 0.8 }}> {applications.map((app) => (