From f93267ebc73a0f0ca15beb67487f1a989877140b Mon Sep 17 00:00:00 2001 From: gtr1701 Date: Mon, 11 May 2026 12:23:14 +0200 Subject: [PATCH 1/8] feat(arc): hide calendar event button Co-authored-by: Copilot --- .../components/abstract-resource-calendar.tsx | 10 +- .../components/arc-event-card.tsx | 10 ++ .../arc-hide-button-with-dialog.tsx | 147 ++++++++++++++++++ src/features/backend/api/fetch-resources.ts | 12 +- src/features/backend/utils/get-key.ts | 2 + .../resources/data/resource-metadata.ts | 1 + .../schemas/calendar-event-schema.ts | 1 + 7 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 src/features/abstract-resource-calendar/components/arc-hide-button-with-dialog.tsx diff --git a/src/features/abstract-resource-calendar/components/abstract-resource-calendar.tsx b/src/features/abstract-resource-calendar/components/abstract-resource-calendar.tsx index 38fd68c6..ecf2a616 100644 --- a/src/features/abstract-resource-calendar/components/abstract-resource-calendar.tsx +++ b/src/features/abstract-resource-calendar/components/abstract-resource-calendar.tsx @@ -1,5 +1,6 @@ import type { ReactNode } from "react"; +import { getAuthStateServer } from "@/features/authentication/server"; import { fetchResources } from "@/features/backend"; import type { Resource } from "@/features/resources"; import type { ResourcePageProps } from "@/types/components"; @@ -23,7 +24,14 @@ export async function AbstractResourceCalendar({ dataMapper: CalendarDataMapper; clickable: boolean; }) { - const resourceData = await fetchResources(resource, true); + const authState = await getAuthStateServer(); + const isSolvroAdmin = + authState?.user.roles.some((role) => role.slug === "solvro_admin") ?? false; + const resourceData = await fetchResources( + resource, + true, + isSolvroAdmin ? "?showHidden=true" : "", + ); const mappedData = dataMapper(resourceData, clickable); return ( diff --git a/src/features/abstract-resource-calendar/components/arc-event-card.tsx b/src/features/abstract-resource-calendar/components/arc-event-card.tsx index 8877c8cf..463657c6 100644 --- a/src/features/abstract-resource-calendar/components/arc-event-card.tsx +++ b/src/features/abstract-resource-calendar/components/arc-event-card.tsx @@ -10,6 +10,8 @@ import type { ResourceDataType, } from "@/features/resources/types"; +import { ArcHideButtonWithDialog } from "./arc-hide-button-with-dialog"; + export function EventCard({ event, resource, @@ -41,6 +43,14 @@ export function EventCard({ {clickable ? (