Projekte: Reiter-Liste der sechs Ansichten als getestete Funktion
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d2d4ad9cfb
commit
5647412e34
2 files changed
+35
-1
No files matched your search
@@ -29,6 +29,22 @@ export function projectsInView(projects, filter, { isAdmin = false } = {}) {
|
||||
|
||||
export const VIEW_LABELS = { all: 'Aktive Projekte', templates: 'Vorlagen', archived: 'Archiviert', everything: 'Alle inkl. Archiv' }
|
||||
|
||||
/**
|
||||
* Reiter der Projektliste (Reihenfolge wie die bisherige Filter-Auswahl), je mit Zaehler aus
|
||||
* `projectCounts`. Die IDs sind die Filterwerte der Seite; die Vorlagen-Ansicht gibt es nur fuer Admins.
|
||||
*/
|
||||
export function projectTabs(counts, { isAdmin = false } = {}) {
|
||||
const tab = (id, label) => ({ id, label, count: counts?.[id] ?? 0 })
|
||||
return [
|
||||
tab('all', VIEW_LABELS.all),
|
||||
tab('unassigned', 'Unzugeordnet'),
|
||||
tab('assigned', 'Zugeordnet'),
|
||||
...(isAdmin ? [tab('templates', VIEW_LABELS.templates)] : []),
|
||||
tab('archived', VIEW_LABELS.archived),
|
||||
tab('everything', VIEW_LABELS.everything),
|
||||
]
|
||||
}
|
||||
|
||||
// Ansichten, die ein Projekt zeigen koennen - die Vorlagen-Ansicht gibt es nur fuer Admins
|
||||
const viewsFor = (isAdmin) => ['all', ...(isAdmin ? ['templates'] : []), 'archived', 'everything']
|
||||
|
||||
|
||||
Reference in new issue
Block a user