From 35d0f3ee01768470b77448ff5da945e62e707736 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sun, 6 Sep 2026 21:08:52 +0200 Subject: [PATCH] fix(catalog): make access controls visible and compact --- .../catalog-manager/catalog-access.module.css | 73 +++++++++++++++++++ .../admin/catalog-manager/inline-editor.tsx | 45 +++++++++--- src/messages/en.json | 12 ++- src/messages/it.json | 12 ++- src/messages/nl.json | 12 ++- 5 files changed, 139 insertions(+), 15 deletions(-) create mode 100644 src/components/admin/catalog-manager/catalog-access.module.css diff --git a/src/components/admin/catalog-manager/catalog-access.module.css b/src/components/admin/catalog-manager/catalog-access.module.css new file mode 100644 index 0000000000..11b4bcb7a4 --- /dev/null +++ b/src/components/admin/catalog-manager/catalog-access.module.css @@ -0,0 +1,73 @@ +.options { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); + gap: 12px; +} +.option { + min-width: 0; + padding: 14px; + border: 1px solid var(--admin-border); + border-radius: 10px; + background: var(--admin-surface); + color: var(--admin-text); +} +.optionHeader, +.control { + display: flex; + align-items: center; + gap: 10px; +} +.optionHeader { + justify-content: space-between; +} +.label { + font-size: 13px; + font-weight: 600; + cursor: pointer; +} +.control { + flex-shrink: 0; + min-height: 32px; +} +.state { + font-size: 12px; + color: var(--admin-text-muted); +} +.description { + margin-top: 4px; + font-size: 12px; + line-height: 1.5; + color: var(--admin-text-muted); +} +.toggle[data-slot="switch"] { + width: 44px; + height: 24px; + border: 1px solid var(--admin-text-muted); + background: var(--admin-border); + cursor: pointer; +} +.toggle[data-checked] { + background: var(--admin-accent); + border-color: var(--admin-accent); +} +.toggle [data-slot="switch-thumb"] { + width: 18px; + height: 18px; + left: 2px; + background: var(--admin-text); + color: var(--admin-canvas); +} +.toggle[data-checked] [data-slot="switch-thumb"] { + left: 22px; +} +.toggle:focus-visible { + outline: 2px solid var(--admin-accent); + outline-offset: 3px; +} +.option[data-disabled] .toggle, +.option[data-disabled] .label { + cursor: not-allowed; +} +.option[data-disabled] .control { + opacity: 0.6; +} diff --git a/src/components/admin/catalog-manager/inline-editor.tsx b/src/components/admin/catalog-manager/inline-editor.tsx index a35b103926..564a77ddaf 100644 --- a/src/components/admin/catalog-manager/inline-editor.tsx +++ b/src/components/admin/catalog-manager/inline-editor.tsx @@ -49,6 +49,7 @@ import { LAYOUT_DESCRIPTIONS, } from "@/lib/catalog-layouts"; import { cn } from "@/lib/utils"; +import styles from "./catalog-access.module.css"; import { ImagePreview } from "./image-preview"; import { catalogTreeQs, useCatalogManager } from "./use-catalog-store"; @@ -572,26 +573,29 @@ function InlineEditorSession({ {/* Toggles */} -
+
update("enabled", v ? "1" : "0")} /> update("visible", v ? "1" : "0")} /> {catalogType === "normal" && ( update("clubOnly", v ? "1" : "0")} /> @@ -832,24 +836,41 @@ function ToggleRow({ id, label, description, + disabled, checked, onChange, }: { id: string; label: string; description: string; + disabled: boolean; checked: boolean; onChange: (v: boolean) => void; }) { + const t = useTranslations("pages.admin.catalog.workspace.access"); return ( -
-
-