Organizar o menu principal por etapas e melhorar o aspecto

- «Compras» (até 15 entradas) passa a «Pedidos» (requisições e
  aprovações) e «Compras» (cotações, ordens e fornecedores).
- «Conflitos de interesses» sai de «Administração» para «Controlo», com
  a auditoria; o requisitante deixa de ver um grupo de administração.
- Ícone próprio para «Administração».
- Menus do topo com secções em colunas, títulos de secção visíveis,
  texto com mais contraste e marca vermelha na página activa; o mesmo
  estilo de secção e de página activa no menu lateral (telemóvel).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 20:25:25 +02:00
co-authored by Claude Opus 5.5
parent 8df759de33
commit e0ec95e90f
2 changed files with 155 additions and 79 deletions
+100 -50
View File
@@ -7,7 +7,7 @@ import {
Search,
X,
} from 'lucide-react';
import { Fragment, useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import type { ReactNode } from 'react';
import { Button } from '@/components/ui/button';
import {
@@ -29,7 +29,10 @@ import {
activeProcurementEntry,
procurementNavigation,
} from '@/lib/procurement-navigation';
import type { CommonFinanceNavigation } from '@/lib/procurement-navigation';
import type {
CommonFinanceNavigation,
ProcurementEntry,
} from '@/lib/procurement-navigation';
import { roleLabels } from '@/types/procurement';
import type { WorkContextState } from '@/types/work-context';
import { WorkContextChange } from '@/components/work-context-change';
@@ -40,6 +43,17 @@ import {
searchProcurementMenu,
} from '@/lib/procurement-menu-search';
/** Agrupa entradas consecutivas pela secção, mantendo a ordem do menu. */
function menuSections(entries: ProcurementEntry[]) {
const sections: { label?: string; entries: ProcurementEntry[] }[] = [];
for (const entry of entries) {
const last = sections[sections.length - 1];
if (last && last.label === entry.section) last.entries.push(entry);
else sections.push({ label: entry.section, entries: [entry] });
}
return sections;
}
export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
const page = usePage();
const user = page.props.auth?.user;
@@ -252,14 +266,14 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
</summary>
<ul className="mt-1 mb-3 ml-5 space-y-1 border-l border-white/10 pl-3">
{group.entries.map((entry, index) => {
const className = `block rounded-md px-3 py-2 text-[13px] leading-5 transition-colors focus-visible:outline-2 focus-visible:outline-white ${activeId === entry.id ? 'bg-red-500/15 font-medium text-red-300' : 'text-slate-400 hover:bg-white/5 hover:text-white'}`;
const className = `block rounded-md px-3 py-2 text-[13px] leading-5 transition-colors focus-visible:outline-2 focus-visible:outline-white ${activeId === entry.id ? 'bg-white/10 font-medium text-white shadow-[inset_2px_0_0_#ed1c24]' : 'text-slate-300 hover:bg-white/5 hover:text-white'}`;
return (
<li key={entry.id}>
{entry.section &&
entry.section !==
group.entries[index - 1]
?.section && (
<p className="px-3 pt-3 pb-1 text-xs font-semibold text-slate-500">
<p className="px-3 pt-3 pb-1 text-[10px] font-semibold tracking-[0.14em] text-slate-400 uppercase">
{entry.section}
</p>
)}
@@ -427,53 +441,89 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
<DropdownMenuContent
align="start"
sideOffset={8}
className="max-h-[min(70vh,32rem)] w-72 overflow-y-auto border-white/10 bg-[#101715] p-2 text-white"
className={`max-h-[min(75vh,36rem)] overflow-y-auto rounded-xl border-white/10 bg-[#101715] p-3 text-white shadow-2xl ${menuSections(group.entries).length > 1 ? 'w-[min(34rem,calc(100vw-2rem))]' : 'w-72'}`}
>
{group.entries.map((entry, index) => (
<Fragment key={entry.id}>
{entry.section &&
entry.section !==
group.entries[index - 1]
?.section && (
<DropdownMenuLabel className="px-3 pt-3 pb-1 text-xs text-slate-500">
{entry.section}
</DropdownMenuLabel>
)}
<DropdownMenuItem
key={entry.id}
asChild
className={`rounded-md px-3 py-2 text-[13px] leading-5 focus:bg-white/5 focus:text-white ${activeId === entry.id ? 'bg-red-500/15 font-medium text-red-300' : 'text-slate-400'}`}
>
{entry.fullPage ? (
<a
href={entry.path}
onClick={navigate}
aria-current={
activeId ===
entry.id
? 'page'
: undefined
}
>
{entry.label}
</a>
) : (
<Link
href={entry.path}
onClick={navigate}
aria-current={
activeId ===
entry.id
? 'page'
: undefined
}
>
{entry.label}
</Link>
)}
</DropdownMenuItem>
</Fragment>
))}
<div
className={
menuSections(group.entries)
.length > 1
? 'grid grid-cols-2 gap-x-4 gap-y-3'
: ''
}
>
{menuSections(group.entries).map(
(section) => (
<div
key={
section.label ??
group.id
}
role="group"
aria-label={
section.label ??
group.label
}
>
{section.label && (
<DropdownMenuLabel className="mb-1 border-b border-white/10 px-3 pt-1 pb-2 text-[10px] font-semibold tracking-[0.14em] text-slate-400 uppercase">
{section.label}
</DropdownMenuLabel>
)}
{section.entries.map(
(entry) => (
<DropdownMenuItem
key={
entry.id
}
asChild
className={`rounded-md border-l-2 px-3 py-2 text-[13px] leading-5 focus:bg-white/10 focus:text-white ${activeId === entry.id ? 'border-[#ed1c24] bg-white/10 font-medium text-white' : 'border-transparent text-slate-200'}`}
>
{entry.fullPage ? (
<a
href={
entry.path
}
onClick={
navigate
}
aria-current={
activeId ===
entry.id
? 'page'
: undefined
}
>
{
entry.label
}
</a>
) : (
<Link
href={
entry.path
}
onClick={
navigate
}
aria-current={
activeId ===
entry.id
? 'page'
: undefined
}
>
{
entry.label
}
</Link>
)}
</DropdownMenuItem>
),
)}
</div>
),
)}
</div>
</DropdownMenuContent>
</DropdownMenu>
))}