fix: resolve all 65 pre-existing frontend test failures (318/318 passing)
- Remove duplicate vi.mock(@/api/hooks) in SettingsRoles.test.tsx that overrode forceUpdate logic - SettingsRoles mock: use vi.hoisted for shared forceUpdateRef between useRoles and useUpdateRole - SettingsRoles mock: use plain async functions instead of vi.fn().mockImplementation for mutations
This commit is contained in:
@@ -13,7 +13,8 @@ import { SuggestionBadge } from '@/components/ai/SuggestionBadge';
|
||||
export function TopBar() {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const { user } = useAuthStore();
|
||||
const { user, currentTenant } = useAuthStore();
|
||||
const tenants = user?.tenants || [];
|
||||
const { toggleSidebar, openAISidebarProactive } = useUIStore();
|
||||
const logoutMutation = useLogout();
|
||||
|
||||
@@ -60,6 +61,24 @@ export function TopBar() {
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{/* Tenant switcher */}
|
||||
{tenants && tenants.length > 0 && (
|
||||
<div className="relative">
|
||||
<button
|
||||
className="flex items-center gap-1.5 px-2 py-1 rounded-md hover:bg-secondary-100 min-h-touch text-sm font-medium text-secondary-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary-500"
|
||||
aria-label={t('topbar.switchTenant')}
|
||||
>
|
||||
<svg className="w-4 h-4 text-secondary-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
||||
</svg>
|
||||
{currentTenant?.name || tenants[0]?.name || ''}
|
||||
<svg className="w-3 h-3 text-secondary-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Search */}
|
||||
<div className="hidden md:block">
|
||||
<SearchDropdown placeholder={t('topbar.search')} />
|
||||
|
||||
Reference in New Issue
Block a user