fix(symbol-groups): API + Frontend auf category-Objekt-Format umgestellt – zeigt jetzt alle Kategorien korrekt
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -25,8 +25,7 @@ interface DisplayCategory {
|
||||
}
|
||||
|
||||
interface TenantSymbolGroup {
|
||||
categoryId: string | null
|
||||
categoryName: string
|
||||
category: { id: string; name: string } | null
|
||||
symbols: DisplaySymbol[]
|
||||
}
|
||||
|
||||
@@ -143,8 +142,7 @@ export function RightSidebar({ onSymbolDrop, canEdit, isOpen, onToggle, activeTa
|
||||
|
||||
// ─── New tenant symbol groups (Phase 1) ───
|
||||
const groups: TenantSymbolGroup[] = (data.tenantSymbolGroups || []).map((g: any) => ({
|
||||
categoryId: g.categoryId,
|
||||
categoryName: g.categoryName,
|
||||
category: g.category,
|
||||
symbols: g.symbols.map((s: any) => ({
|
||||
id: s.id,
|
||||
name: s.name,
|
||||
@@ -155,8 +153,7 @@ export function RightSidebar({ onSymbolDrop, canEdit, isOpen, onToggle, activeTa
|
||||
// Merge legacy "Eigene" into tenant groups if present
|
||||
if (eigene && eigene.symbols.length > 0) {
|
||||
const legacyGroup: TenantSymbolGroup = {
|
||||
categoryId: '__legacy__',
|
||||
categoryName: 'Eigene',
|
||||
category: { id: '__legacy__', name: 'Eigene' },
|
||||
symbols: eigene.symbols,
|
||||
}
|
||||
groups.unshift(legacyGroup)
|
||||
@@ -166,7 +163,7 @@ export function RightSidebar({ onSymbolDrop, canEdit, isOpen, onToggle, activeTa
|
||||
|
||||
// Auto-expand all tenant groups, auto-collapse library if tenant has symbols
|
||||
if (groups.length > 0 && groups.some(g => g.symbols.length > 0)) {
|
||||
setExpandedTenantCats(new Set(groups.map(g => g.categoryId || '__none__')))
|
||||
setExpandedTenantCats(new Set(groups.map(g => g.category?.id || '__none__')))
|
||||
setShowLibrarySection(false)
|
||||
}
|
||||
}
|
||||
@@ -357,17 +354,17 @@ export function RightSidebar({ onSymbolDrop, canEdit, isOpen, onToggle, activeTa
|
||||
</div>
|
||||
) : (
|
||||
filteredTenantGroups.map(g => {
|
||||
const key = g.categoryId || '__none__'
|
||||
const key = g.category?.id || '__none__'
|
||||
const expanded = expandedTenantCats.has(key)
|
||||
return (
|
||||
<div key={key} className="border rounded-md">
|
||||
<button
|
||||
onClick={() => toggleTenantCat(g.categoryId)}
|
||||
onClick={() => toggleTenantCat(g.category?.id || null)}
|
||||
className="w-full flex items-center justify-between px-2 py-1 text-[11px] font-medium hover:bg-muted/40 transition-colors"
|
||||
>
|
||||
<span className="flex items-center gap-1.5">
|
||||
<FolderOpen className="w-3 h-3 text-muted-foreground" />
|
||||
{g.categoryName}
|
||||
{g.category?.name || 'Ohne Kategorie'}
|
||||
<span className="text-[10px] text-muted-foreground">({g.symbols.length})</span>
|
||||
</span>
|
||||
<ChevronRight className={`w-3 h-3 transition-transform ${expanded ? 'rotate-90' : ''}`} />
|
||||
|
||||
Reference in New Issue
Block a user