oportunidades 6
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 21:17:46 +02:00
parent 01405cbf8a
commit 20971d523f
126 changed files with 44362 additions and 3496 deletions
@@ -1,5 +1,7 @@
import type { ProfileAccess } from '@/types/profile-access';
import { Link, usePage } from '@inertiajs/react';
import { Link, router, usePage } from '@inertiajs/react';
import { LogOut } from 'lucide-react';
import { logout } from '@/routes';
import { useEffect, useId, useRef, useState } from 'react';
import type { OpportunityManagementAccess } from '@/types/opportunity-management';
import {
@@ -11,10 +13,14 @@ import {
export function PortalGroupedMenu() {
const { props, url } = usePage<{
auth: { user: unknown; canManagePortal: boolean };
auth: {
user: { name?: string; email?: string } | null;
canManagePortal: boolean;
};
existingBusinessEnabled?: boolean;
educationEnabled?: boolean;
aiEnabled?: boolean;
legacyContentEnabled?: boolean;
portalOperator?: string | null;
profileAccess?: ProfileAccess | null;
opportunityManagement?: OpportunityManagementAccess | null;
@@ -25,6 +31,7 @@ export function PortalGroupedMenu() {
businesses: props.existingBusinessEnabled,
education: props.educationEnabled,
ai: props.aiEnabled,
legacyContent: props.legacyContentEnabled,
opportunityManagement: props.opportunityManagement,
profileAccess: props.profileAccess,
});
@@ -33,6 +40,7 @@ export function PortalGroupedMenu() {
const [open, setOpen] = useState<string | null>(null);
const [branch, setBranch] = useState<string | null>(null);
const [offset, setOffset] = useState(0);
const [loggingOut, setLoggingOut] = useState(false);
const root = useRef<HTMLElement>(null);
const id = useId();
useEffect(() => {
@@ -150,6 +158,33 @@ export function PortalGroupedMenu() {
)}
</p>
</div>
{props.auth?.user && (
<nav
aria-label="Sessão da conta"
className="mb-3 flex flex-wrap items-center justify-between gap-3 rounded-lg bg-slate-50 px-3 py-2"
>
<p className="min-w-0 break-words text-sm text-slate-700 [overflow-wrap:anywhere]">
Sessão: {props.auth.user.name || props.auth.user.email}
</p>
<Link
href={logout()}
as="button"
type="button"
disabled={loggingOut}
onClick={() => {
close();
router.flushAll();
}}
onStart={() => setLoggingOut(true)}
onFinish={() => setLoggingOut(false)}
data-test="portal-logout-button"
className="inline-flex min-h-11 shrink-0 items-center gap-2 rounded-lg border border-slate-400 bg-white px-3 py-2 text-sm font-semibold text-slate-900 hover:bg-slate-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-700 disabled:cursor-wait disabled:opacity-60"
>
<LogOut aria-hidden="true" className="size-4" />
{loggingOut ? 'A terminar sessão…' : 'Terminar sessão'}
</Link>
</nav>
)}
<nav aria-label="Áreas do portal">
<ul className="flex flex-wrap gap-2">
{groups.map((group) => (