fix: TenantSwitcher shows dropdown for single tenant, wider name display

This commit is contained in:
m
2026-03-25 18:40:15 +01:00
parent f42b7ddec7
commit cd31e76d07
2 changed files with 8 additions and 5 deletions

0
frontend/.m/spawn.lock Normal file
View File

View File

@@ -54,30 +54,33 @@ export function TenantSwitcher() {
onClick={() => setOpen(!open)}
className="flex items-center gap-1.5 rounded-md border border-neutral-200 bg-white px-2.5 py-1.5 text-sm text-neutral-700 transition-colors hover:bg-neutral-50"
>
<span className="max-w-[120px] truncate sm:max-w-[160px]">
<span className="max-w-[200px] truncate sm:max-w-[280px]">
{current.name}
</span>
<ChevronsUpDown className="h-3.5 w-3.5 text-neutral-400" />
</button>
{open && tenants.length > 1 && (
<div className="animate-fade-in absolute right-0 top-full z-50 mt-1 w-56 rounded-md border border-neutral-200 bg-white py-1 shadow-lg">
{open && (
<div className="animate-fade-in absolute right-0 top-full z-50 mt-1 w-64 rounded-md border border-neutral-200 bg-white py-1 shadow-lg">
{tenants.map((tenant) => (
<button
key={tenant.id}
onClick={() => switchTenant(tenant)}
className={`flex w-full items-center px-3 py-1.5 text-left text-sm transition-colors ${
className={`flex w-full items-center px-3 py-2 text-left text-sm transition-colors ${
tenant.id === current.id
? "bg-neutral-50 font-medium text-neutral-900"
: "text-neutral-600 hover:bg-neutral-50"
}`}
>
<span className="truncate">{tenant.name}</span>
<span className="ml-auto text-xs text-neutral-400">
<span className="ml-auto shrink-0 text-xs text-neutral-400">
{tenant.role}
</span>
</button>
))}
{tenants.length <= 1 && (
<p className="px-3 py-2 text-xs text-neutral-400">Einzige Kanzlei</p>
)}
</div>
)}
</div>