diff --git a/CLAUDE.md b/CLAUDE.md index ca79486..752cbf7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -137,3 +137,18 @@ or adapted for production, and these accounts must never exist in a production d - DEV ONLY, do platform-tools (`functions_dev.php`, README "Dev tooling"; produção segue `main`, que não tem o ficheiro: tudo degrada para "não é dev"). - Ficheiros: `config/dev_guard.php` (shim), `includes/dev_toolbar.php` (incluído no fim de `includes/footer.php`), `dev_login.php` (na RAIZ: o site não tem `public/`; `.htaccess` tem a regra `^dev_login/?$` com `-f`), `scripts/dev_accounts.php` (`platform_dev_accounts_run`). - Contas `admin@mail.pt` / `sysadmin@mail.pt` (pw `123`). O login usa `auth_login()` + `fit_stamp_login_ua()` como o login real; CSRF do site = campo `_csrf` / `$_SESSION['csrf_token']` (verificação sem `exit`). + +## Ambiente de dev: moldura e login de um clique (2026-10-13) +- `includes/env_ribbon.php` (moldura às riscas + etiqueta DEV, só fora de `APP_ENV=prod`) incluído no `` de `includes/header.php`, `includes/auth_header.php` e `site/includes/include.php`. +- A barra de login de dev (`includes/dev_toolbar.php`) vai também em `includes/auth_footer.php` e `site/includes/footer.php`. Botões Cliente / Staff / Admin / Sysadmin (`client@mail.pt` e `staff@mail.pt` criados por `scripts/dev_accounts.php`; o painel do staff é `views/staff/dashboard.php`, criado em 2026-10-13). +- Auditoria da sidebar: `docs/audits/2026-10-13-fitme3070-sidebar.md` (em Y:/GitTea; aplicada, ver «Barra lateral» abaixo). + +## Barra lateral (2026-10-13) +- Padrão da frota (`.claude/skills/sysadmin-navbar-audit`). CSS todo em `assets/css/backoffice.css` (tokens `--bo-*`, casca, mini, view transitions; carregado com `?v=filemtime` por `_asset_versioned`); já não há ` + + - + + + 'sub']) ?> + 'sub']) ?> + 'sub']) ?> + + 'sub', + 'active' => (($_GET['tool'] ?? 'index') === 'index' && str_contains($_SERVER['REQUEST_URI'] ?? '', 'platform.php'))]) ?> + + + +
- -
+
- - - - - -
0). + */ +function bo_nav_link(string $href, string $icon, string $label, array $o = []): string +{ + $active = array_key_exists('active', $o) ? (bool) $o['active'] : bo_nav_active($o['match'] ?? strtok($href, '?')); + $mod = isset($o['mod']) ? ' bo-nav-item--' . $o['mod'] : ''; + $l = htmlspecialchars($label, ENT_QUOTES, 'UTF-8'); + $badge = (int) ($o['badge'] ?? 0); + return '' + . '' + . '' . $l . '' + . ($badge > 0 ? '' . $badge . '' : '') + . '' . "\n"; +} + +/** + * Abre um grupo recolhível. O conteúdo fica em buffer até bo_nav_group_end(), + * que precisa de saber se algum item é o ativo (o grupo da página atual abre + * sempre). $sub = subcategoria dentro de outro grupo (recuada). + */ +function bo_nav_group_start(string $key, string $label, string $icon, bool $sub = false): void +{ + $GLOBALS['bo_nav_group_stack'][] = [$key, $label, $icon, $sub]; + ob_start(); +} + +/** Fecha o grupo aberto por bo_nav_group_start() e escreve o markup final. */ +function bo_nav_group_end(): void +{ + $items = (string) ob_get_clean(); + [$key, $label, $icon, $sub] = array_pop($GLOBALS['bo_nav_group_stack']); + $hasActive = str_contains($items, 'aria-current="page"'); + $id = 'bo-grp-' . $key; + $k = htmlspecialchars($key, ENT_QUOTES, 'UTF-8'); + $l = htmlspecialchars($label, ENT_QUOTES, 'UTF-8'); + $i = htmlspecialchars($icon, ENT_QUOTES, 'UTF-8'); + $short = htmlspecialchars(mb_strtoupper(mb_substr($label, 0, 4)), ENT_QUOTES, 'UTF-8'); + echo '
' + . '' + . '
' . $items . '
' + . '
' . "\n"; +} + +/** Iniciais para o avatar (até duas letras: primeiro e último nome). */ +function bo_initials(string $name): string +{ + // Só palavras que começam por letra: «Staff (dev)» dá «SD»... não «S(». + preg_match_all('/\p{L}[\p{L}\p{M}-]*/u', $name, $m); + $parts = $m[0]; + if (!$parts) return '?'; + $first = mb_substr($parts[0], 0, 1); + $last = count($parts) > 1 ? mb_substr($parts[count($parts) - 1], 0, 1) : ''; + return mb_strtoupper($first . $last); +} diff --git a/includes/navbar.php b/includes/navbar.php deleted file mode 100644 index 582cb2f..0000000 --- a/includes/navbar.php +++ /dev/null @@ -1,18 +0,0 @@ - - - - diff --git a/views/staff/dashboard.php b/views/staff/dashboard.php new file mode 100644 index 0000000..c0f7dcc --- /dev/null +++ b/views/staff/dashboard.php @@ -0,0 +1,20 @@ + +
+

Olá,

+ +
+

Bem-vindo à área da equipa FitMe 3070.

+ O meu perfil +

As ferramentas da equipa serão disponibilizadas num passo seguinte.

+
+
+ diff --git a/views/sysadmin/system_settings.php b/views/sysadmin/system_settings.php index 7bfb019..f45717f 100644 --- a/views/sysadmin/system_settings.php +++ b/views/sysadmin/system_settings.php @@ -128,7 +128,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } include __DIR__ . '/../../includes/header.php'; -include __DIR__ . '/../../includes/navbar.php'; ?>