Support the read-only calendar role, show "Vorstand", fix link buttons
- Read-only role: /admin/me's permissions decide via canEditCalendar (lib/permissions.ts, mirrors the API's canWrite: only `access` writes). Read-only accounts see everything but get no "Neuer Termin", no "+", no "Veröffentlichen"; an event opens as "Termin ansehen" with locked fields. A "Nur lesen" badge in the header explains why. The API refuses their writes regardless. - The management calendar is labelled "Vorstand"; the slug stays `management` for the API, URLs and iCal links. - The subscription dialog's Apple/Google links are plain anchors styled with buttonVariants instead of Base UI Buttons rendering an <a>, which warned in dev and would have given them role="button". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
16 files changed
+155
-32
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { CalendarPlusIcon, CheckIcon, CircleAlertIcon, CopyIcon, RefreshCwIcon } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Button, buttonVariants } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -114,16 +114,19 @@ export function SubscriptionsDialog() {
|
||||
{subscription.icalUrl}
|
||||
</code>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Button variant="outline" size="xs" render={<a href={toWebcal(subscription.icalUrl)} />}>
|
||||
{/* Plain links that only look like buttons. Rendering them through Base UI's
|
||||
Button made them role="button" (and warned without nativeButton={false}). */}
|
||||
<a href={toWebcal(subscription.icalUrl)} className={buttonVariants({ variant: "outline", size: "xs" })}>
|
||||
Apple Kalender
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="xs"
|
||||
render={<a href={toGoogleCalendar(subscription.icalUrl)} target="_blank" rel="noopener noreferrer" />}
|
||||
</a>
|
||||
<a
|
||||
href={toGoogleCalendar(subscription.icalUrl)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={buttonVariants({ variant: "outline", size: "xs" })}
|
||||
>
|
||||
Google Kalender
|
||||
</Button>
|
||||
</a>
|
||||
<Button variant="outline" size="xs" onClick={() => void copy(subscription)}>
|
||||
{copied === calendar.slug ? <CheckIcon /> : <CopyIcon />}
|
||||
{copied === calendar.slug ? "Kopiert" : "Link kopieren"}
|
||||
|
||||
Reference in new issue
Block a user