Your favorite shift management application!
refactor(ui): flatten permissions tab structure (#207)
panteL36b4be972955
diff --git a/components/calendar-permissions-panel.tsx b/components/calendar-permissions-panel.tsxindex 2287917..36d0252 100644--- a/components/calendar-permissions-panel.tsx+++ b/components/calendar-permissions-panel.tsx@@ -17,7 +17,7 @@ import { usePermissionLinkForm } from "@/hooks/usePermissionLinkForm";import { useAuthFeatures } from "@/hooks/useAuthFeatures";import { useReportDirty } from "@/hooks/useDirtyState";-type PermissionsTab = "groups" | "assignments" | "signups";+type PermissionsTab = "groups" | "assignments";interface PermissionsPanelProps {calendarId: string;@@ -25,7 +25,7 @@ interface PermissionsPanelProps {onDirtyChange?: (dirty: boolean) => void;}-/** Central "Berechtigungen" surface (Stufe 2, 7.3): groups, assignments and signups. */+/** Central "Berechtigungen" surface: groups (incl. signups toggle) and assignments. */export function PermissionsPanel({ calendarId, onClose, onDirtyChange }: PermissionsPanelProps) {const t = useTranslations();const { calendars, updateCalendar } = useCalendars();@@ -83,7 +83,6 @@ export function PermissionsPanel({ calendarId, onClose, onDirtyChange }: Permissconst tabs: { value: PermissionsTab; label: string }[] = [{ value: "groups", label: t("permissionBundles.tabGroups") },{ value: "assignments", label: t("permissionBundles.tabAssignments") },- { value: "signups", label: t("permissionBundles.tabMore") },];return (@@ -97,7 +96,26 @@ export function PermissionsPanel({ calendarId, onClose, onDirtyChange }: Permissoptions={tabs}/>- {tab === "groups" && <PermissionBundleEditor calendarId={calendarId} />}+ {tab === "groups" && (+ <>+ <PermissionBundleEditor calendarId={calendarId} />+ <section className="flex flex-col gap-3 border-t border-line pt-5">+ <SectionLabel className="mb-0">{t("permissionBundles.groups.signups")}</SectionLabel>+ <ToggleRow+ id="signups-enabled"+ title={t("sharingSheet.signupsEnabledLabel")}+ description={t("sharingSheet.signupsEnabledDesc")}+ checked={signupsEnabled}+ onCheckedChange={handleSignupsEnabledChange}+ disabled={saving || !canManageSettings}+ />+ {!canManageSettings && (+ <InfoNote icon={Lock}>{t("permissionBundles.signupsLocked")}</InfoNote>+ )}+ <InfoNote icon={Info}>{t("permissionBundles.signupsCapabilityHint")}</InfoNote>+ </section>+ </>+ )}{tab === "assignments" && (<PermissionAssignments@@ -108,24 +126,6 @@ export function PermissionsPanel({ calendarId, onClose, onDirtyChange }: PermissupdateCalendar={updateCalendar}/>)}-- {tab === "signups" && (- <>- <SectionLabel className="mb-0">{t("permissionBundles.groups.signups")}</SectionLabel>- <ToggleRow- id="signups-enabled"- title={t("sharingSheet.signupsEnabledLabel")}- description={t("sharingSheet.signupsEnabledDesc")}- checked={signupsEnabled}- onCheckedChange={handleSignupsEnabledChange}- disabled={saving || !canManageSettings}- />- {!canManageSettings && (- <InfoNote icon={Lock}>{t("permissionBundles.signupsLocked")}</InfoNote>- )}- <InfoNote icon={Info}>{t("permissionBundles.signupsCapabilityHint")}</InfoNote>- </>- )}</PanelBody><PanelFooter><Button variant="outline" className="h-10 flex-1 font-semibold" onClick={onClose}>diff --git a/components/permission-bundle-assignments.tsx b/components/permission-bundle-assignments.tsxindex a031718..d8a8b31 100644--- a/components/permission-bundle-assignments.tsx+++ b/components/permission-bundle-assignments.tsx@@ -5,7 +5,7 @@ import { useTranslations } from "next-intl";import { Trash2, TriangleAlert } from "lucide-react";import { Button } from "@/components/ui/button";import { ConfirmationDialog } from "@/components/ui/confirmation-dialog";-import { SegmentedControl } from "@/components/segmented-control";+import { SectionLabel } from "@/components/form-kit";import { StatusBanner } from "@/components/status-banner";import { PersonRow } from "@/components/person-row";import { CalendarShareUserSearch } from "@/components/calendar-share-user-search";@@ -55,16 +55,6 @@ export function PermissionAssignments({string | null | undefined>(undefined);- type AssignmentSubTab = "people" | "public" | "links";- const [subTab, setSubTab] = useState<AssignmentSubTab>("people");- const subTabs: { value: AssignmentSubTab; label: string }[] = [- { value: "people", label: t("permissionBundles.people") },- { value: "public", label: t("share.publicAccess") },- ...(allowGuest- ? [{ value: "links" as const, label: t("share.links") }]- : []),- ];-const effectiveInviteBundleId =inviteBundleId || bundles.find((b) => b.seedKey === "read")?.id || bundles[0]?.id || "";@@ -103,14 +93,8 @@ export function PermissionAssignments({return (<div className="flex flex-col gap-3.5">- <SegmentedControl- label={t("permissionBundles.tabAssignments")}- value={subTab}- onChange={setSubTab}- options={subTabs}- />-- {subTab === "people" && (+ <section className="flex flex-col gap-3">+ <SectionLabel className="mb-0">{t("permissionBundles.people")}</SectionLabel><section className={cardClass}>{canManageShares && bundlesError && (<StatusBanner tone="danger" icon={TriangleAlert}>@@ -175,9 +159,10 @@ export function PermissionAssignments({)}</div></section>- )}+ </section>- {subTab === "public" && (+ <section className="flex flex-col gap-3 border-t border-line pt-3.5">+ <SectionLabel className="mb-0">{t("share.publicAccess")}</SectionLabel><section className={cardClass}>{canManageGuestAccess && bundlesError ? (<StatusBanner tone="danger" icon={TriangleAlert}>@@ -203,28 +188,31 @@ export function PermissionAssignments({</div>)}</section>- )}-- {subTab === "links" && allowGuest && (- <section className={cardClass}>- <CalendarTokenList calendarId={calendarId} />- {canManageGuestAccess && linkForm.bundlesError && (- <StatusBanner tone="danger" icon={TriangleAlert}>- {t("permissionBundles.bundlesUnavailable")}- </StatusBanner>- )}- {canManageGuestAccess && !linkForm.bundlesError && (- <>- <AccessLinkCreateForm form={linkForm} />- <Button- onClick={linkForm.create}- disabled={linkForm.creating || !linkForm.bundleId}- className="h-10 self-start font-semibold"- >- {linkForm.creating ? t("sharingSheet.creating") : t("sharingSheet.createLink")}- </Button>- </>- )}+ </section>++ {allowGuest && (+ <section className="flex flex-col gap-3 border-t border-line pt-3.5">+ <SectionLabel className="mb-0">{t("share.links")}</SectionLabel>+ <section className={cardClass}>+ <CalendarTokenList calendarId={calendarId} />+ {canManageGuestAccess && linkForm.bundlesError && (+ <StatusBanner tone="danger" icon={TriangleAlert}>+ {t("permissionBundles.bundlesUnavailable")}+ </StatusBanner>+ )}+ {canManageGuestAccess && !linkForm.bundlesError && (+ <>+ <AccessLinkCreateForm form={linkForm} />+ <Button+ onClick={linkForm.create}+ disabled={linkForm.creating || !linkForm.bundleId}+ className="h-10 self-start font-semibold"+ >+ {linkForm.creating ? t("sharingSheet.creating") : t("sharingSheet.createLink")}+ </Button>+ </>+ )}+ </section></section>)}diff --git a/messages/cs.json b/messages/cs.jsonindex dc259ec..b6b5e6a 100644--- a/messages/cs.json+++ b/messages/cs.json@@ -1093,7 +1093,6 @@"title": "Oprávnění","tabGroups": "Skupiny","tabAssignments": "Přiřazení",- "tabMore": "Další","people": "Lidé","inviteAs": "Pozvat jako","cloneSuffix": "(Kopie)",diff --git a/messages/de.json b/messages/de.jsonindex d4c98be..0f71be1 100644--- a/messages/de.json+++ b/messages/de.json@@ -1093,7 +1093,6 @@"title": "Berechtigungen","tabGroups": "Gruppen","tabAssignments": "Zuweisungen",- "tabMore": "Weiteres","people": "Personen","inviteAs": "Einladen als","cloneSuffix": "(Kopie)",diff --git a/messages/en.json b/messages/en.jsonindex 780ca67..97bc33f 100644--- a/messages/en.json+++ b/messages/en.json@@ -1093,7 +1093,6 @@"title": "Permissions","tabGroups": "Groups","tabAssignments": "Assignments",- "tabMore": "More","people": "People","inviteAs": "Invite as","cloneSuffix": "(Copy)",diff --git a/messages/es.json b/messages/es.jsonindex ede5baf..2f074bc 100644--- a/messages/es.json+++ b/messages/es.json@@ -1093,7 +1093,6 @@"title": "Permisos","tabGroups": "Grupos","tabAssignments": "Asignaciones",- "tabMore": "Más","people": "Personas","inviteAs": "Invitar como","cloneSuffix": "(Copia)",diff --git a/messages/fr.json b/messages/fr.jsonindex ed8ea0c..a2df82e 100755--- a/messages/fr.json+++ b/messages/fr.json@@ -1093,7 +1093,6 @@"title": "Autorisations","tabGroups": "Groupes","tabAssignments": "Attributions",- "tabMore": "Plus","people": "Personnes","inviteAs": "Inviter en tant que","cloneSuffix": "(Copie)",diff --git a/messages/it.json b/messages/it.jsonindex 5e74edd..83c6c61 100644--- a/messages/it.json+++ b/messages/it.json@@ -1093,7 +1093,6 @@"title": "Permessi","tabGroups": "Gruppi","tabAssignments": "Assegnazioni",- "tabMore": "Altro","people": "Persone","inviteAs": "Invita come","cloneSuffix": "(Copia)",