Convert AdminPanel to modal overlay with close button and add admin dashboard menu option
Refactored AdminPanel from inline component to modal overlay triggered from user menu. Added `open` and `onClose` props to control visibility, wrapped panel in modal overlay with backdrop click-to-close behavior, and added close button to header. Implemented admin-only menu item in TopBar user dropdown with shield icon and role label. Added state management for dashboard visibility in App.jsx with proper cleanup
This commit is contained in:
@@ -61,6 +61,7 @@ export default function App() {
|
||||
const [chipOpen, setChipOpen] = useState(false);
|
||||
const [chipEntry, setChipEntry] = useState(null);
|
||||
const [userMenuOpen, setUserMenuOpen] = useState(false);
|
||||
const [adminOpen, setAdminOpen] = useState(false);
|
||||
|
||||
const [pwOpen, setPwOpen] = useState(false);
|
||||
const [pw1, setPw1] = useState("");
|
||||
@@ -689,11 +690,15 @@ export default function App() {
|
||||
openPwModal={openPwModal}
|
||||
openDesignModal={openDesignModal}
|
||||
openStatsModal={openStatsModal}
|
||||
openAdminPanel={() => {
|
||||
setAdminOpen(true);
|
||||
setUserMenuOpen(false);
|
||||
}}
|
||||
doLogout={doLogout}
|
||||
onOpenNewGame={() => setNewGameOpen(true)}
|
||||
/>
|
||||
|
||||
{me.role === "admin" && <AdminPanel />}
|
||||
<AdminPanel open={me.role === "admin" && adminOpen} onClose={() => setAdminOpen(false)} />
|
||||
|
||||
<GamePickerCard
|
||||
games={games}
|
||||
|
||||
Reference in New Issue
Block a user