Add menu enable toggle, user status, and mobile/UI polish
- Admin menu page: mobile item cards now put Actions in the top-right
corner next to Status, matching the desktop row layout instead of
stacking at the bottom; same treatment applied to announcements and
users for consistency across all three admin lists
- Center button label text everywhere via .btn { justify-content: center }
instead of one-off overrides
- Add a Disable/Enable Menu toggle to the admin menu toolbar; the public
menu page shows its existing "menu being updated" message while disabled
- Add an Enabled/Disabled status to user accounts, with its own toggle
badge, guardrails against disabling your own account or the last
enabled account, and an immediate session kick for anyone disabled
mid-session
- Fix the announcement banner / hero tagline "·" separators to hide only
when their neighboring text actually wraps onto a different line,
instead of a fixed breakpoint or always-on dot
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eab20899de
commit
cd4c6c1969
13 files changed
+405
-50
No files matched your search
@@ -135,6 +135,12 @@ function handle_delete_category(array $post): array
|
||||
return ['success' => true];
|
||||
}
|
||||
|
||||
function handle_toggle_menu_enabled(): array
|
||||
{
|
||||
set_menu_enabled(!is_menu_enabled());
|
||||
return ['success' => true, 'menu_enabled' => is_menu_enabled()];
|
||||
}
|
||||
|
||||
function handle_menu_action(string $action, array $post): array
|
||||
{
|
||||
return match ($action) {
|
||||
@@ -145,6 +151,7 @@ function handle_menu_action(string $action, array $post): array
|
||||
'save_category' => handle_save_category($post),
|
||||
'move_category' => handle_move_category($post),
|
||||
'delete_category' => handle_delete_category($post),
|
||||
'toggle_menu_enabled' => handle_toggle_menu_enabled(),
|
||||
default => ['success' => false, 'error' => 'Unknown action'],
|
||||
};
|
||||
}
|
||||
@@ -167,6 +174,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$categories = get_all_categories();
|
||||
$menuGrouped = get_full_menu(false);
|
||||
$menuEnabled = is_menu_enabled();
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
@@ -213,6 +221,13 @@ $menuGrouped = get_full_menu(false);
|
||||
<div class="admin-toolbar">
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btn-new-item">+ Add Menu Item</button>
|
||||
<button type="button" class="btn btn-outline btn-sm" id="btn-new-cat">+ Add Category</button>
|
||||
<button type="button" class="btn btn-sm <?= $menuEnabled ? 'btn-danger' : 'btn-outline' ?>" id="btn-toggle-menu" data-enabled="<?= $menuEnabled ? '1' : '0' ?>">
|
||||
<?= $menuEnabled ? 'Disable Menu' : 'Enable Menu' ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="alert-error" id="menu-disabled-alert" role="status" <?= $menuEnabled ? 'hidden' : '' ?>>
|
||||
Menu is disabled — the public menu page shows a "menu being updated" message instead of your items.
|
||||
</div>
|
||||
|
||||
<div id="categories-container">
|
||||
|
||||
Reference in new issue
Block a user