Your favorite shift management application!
feat: add DialogDescription component and enhance dialog accessibility with descriptions
panteLxf97d68511e96
diff --git a/app/page.tsx b/app/page.tsxindex 72d96cb..0f37d40 100644--- a/app/page.tsx+++ b/app/page.tsx@@ -19,6 +19,7 @@ import {DialogContent,DialogHeader,DialogTitle,+ DialogDescription,} from "@/components/ui/dialog";import {Plus,@@ -521,6 +522,11 @@ function HomeContent() {<div className="w-1 h-5 bg-primary rounded-full"></div>{t("calendar.select", { default: "Your BetterShift Calendar" })}</DialogTitle>+ <DialogDescription>+ {t("calendar.selectDescription", {+ default: "Choose a calendar to manage your shifts",+ })}+ </DialogDescription></DialogHeader><div className="space-y-4 py-4"><CalendarSelectordiff --git a/components/calendar-dialog.tsx b/components/calendar-dialog.tsxindex 01f6abf..997180c 100644--- a/components/calendar-dialog.tsx+++ b/components/calendar-dialog.tsx@@ -7,6 +7,7 @@ import {DialogContent,DialogHeader,DialogTitle,+ DialogDescription,} from "@/components/ui/dialog";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";@@ -62,6 +63,11 @@ export function CalendarDialog({<DialogContent className="sm:max-w-[425px]"><DialogHeader><DialogTitle>{t("calendar.create")}</DialogTitle>+ <DialogDescription>+ {t("calendar.createDescription", {+ default: "Create a new calendar to organize your shifts",+ })}+ </DialogDescription></DialogHeader><form onSubmit={handleSubmit} className="space-y-4"><div className="space-y-2">diff --git a/components/preset-selector.tsx b/components/preset-selector.tsxindex 0525583..b404ff9 100644--- a/components/preset-selector.tsx+++ b/components/preset-selector.tsx@@ -10,6 +10,7 @@ import {DialogContent,DialogHeader,DialogTitle,+ DialogDescription,} from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";@@ -397,6 +398,11 @@ export function PresetSelector({<DialogContent className="sm:max-w-[500px] max-h-[85vh] flex flex-col"><DialogHeader><DialogTitle>{t("preset.manage")}</DialogTitle>+ <DialogDescription>+ {t("preset.manageDescription", {+ default: "Edit or delete your shift presets",+ })}+ </DialogDescription></DialogHeader><div className="space-y-3 overflow-y-auto flex-1 pr-2"><Button@@ -463,6 +469,15 @@ export function PresetSelector({<DialogTitle className="text-base sm:text-lg">{isCreatingNew ? t("preset.createNew") : t("preset.edit")}</DialogTitle>+ <DialogDescription className="text-sm">+ {isCreatingNew+ ? t("preset.createDescription", {+ default: "Create a new preset for quick shift creation",+ })+ : t("preset.editDescription", {+ default: "Update preset details",+ })}+ </DialogDescription></DialogHeader><div className="space-y-4 pb-2"><div className="space-y-1.5">diff --git a/components/shift-dialog.tsx b/components/shift-dialog.tsxindex 289fa85..15bac6f 100644--- a/components/shift-dialog.tsx+++ b/components/shift-dialog.tsx@@ -7,6 +7,7 @@ import {DialogContent,DialogHeader,DialogTitle,+ DialogDescription,} from "@/components/ui/dialog";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";@@ -205,6 +206,15 @@ export function ShiftDialog({<DialogTitle>{shift ? t("shift.edit") : t("shift.create")}</DialogTitle>+ <DialogDescription>+ {shift+ ? t("shift.editDescription", {+ default: "Update the shift details",+ })+ : t("shift.createDescription", {+ default: "Add a new shift to your calendar",+ })}+ </DialogDescription></DialogHeader><form onSubmit={handleSubmit} className="space-y-4">{/* Preset Selection */}diff --git a/components/ui/color-picker.tsx b/components/ui/color-picker.tsxindex 0f1f0ab..38c6356 100644--- a/components/ui/color-picker.tsx+++ b/components/ui/color-picker.tsx@@ -9,6 +9,7 @@ import {DialogContent,DialogHeader,DialogTitle,+ DialogDescription,DialogTrigger,} from "@/components/ui/dialog";@@ -69,6 +70,9 @@ export function ColorPicker({<DialogContent className="sm:max-w-md"><DialogHeader><DialogTitle>Custom Color</DialogTitle>+ <DialogDescription>+ Choose a custom color using the color picker+ </DialogDescription></DialogHeader><div className="space-y-4"><HexColorPicker color={color} onChange={onChange} />diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsxindex d9ccec9..c5f4308 100644--- a/components/ui/dialog.tsx+++ b/components/ui/dialog.tsx@@ -1,33 +1,33 @@-"use client"+"use client";-import * as React from "react"-import * as DialogPrimitive from "@radix-ui/react-dialog"-import { XIcon } from "lucide-react"+import * as React from "react";+import * as DialogPrimitive from "@radix-ui/react-dialog";+import { XIcon } from "lucide-react";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";function Dialog({...props}: React.ComponentProps<typeof DialogPrimitive.Root>) {- return <DialogPrimitive.Root data-slot="dialog" {...props} />+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;}function DialogTrigger({...props}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;}function DialogPortal({...props}: React.ComponentProps<typeof DialogPrimitive.Portal>) {- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;}function DialogClose({...props}: React.ComponentProps<typeof DialogPrimitive.Close>) {- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;}function DialogOverlay({@@ -43,7 +43,7 @@ function DialogOverlay({)}{...props}/>- )+ );}function DialogContent({@@ -52,7 +52,7 @@ function DialogContent({showCloseButton = true,...props}: React.ComponentProps<typeof DialogPrimitive.Content> & {- showCloseButton?: boolean+ showCloseButton?: boolean;}) {return (<DialogPortal data-slot="dialog-portal">@@ -71,13 +71,13 @@ function DialogContent({data-slot="dialog-close"className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">- <XIcon />+ <XIcon aria-hidden="true" /><span className="sr-only">Close</span></DialogPrimitive.Close>)}</DialogPrimitive.Content></DialogPortal>- )+ );}function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {@@ -87,7 +87,7 @@ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {className={cn("flex flex-col gap-2 text-center sm:text-left", className)}{...props}/>- )+ );}function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {@@ -100,7 +100,7 @@ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {)}{...props}/>- )+ );}function DialogTitle({@@ -113,7 +113,7 @@ function DialogTitle({className={cn("text-lg leading-none font-semibold", className)}{...props}/>- )+ );}function DialogDescription({@@ -126,7 +126,7 @@ function DialogDescription({className={cn("text-muted-foreground text-sm", className)}{...props}/>- )+ );}export {@@ -140,4 +140,4 @@ export {DialogPortal,DialogTitle,DialogTrigger,-}+};diff --git a/messages/de.json b/messages/de.jsonindex 0f05e8b..a3ce7dc 100644--- a/messages/de.json+++ b/messages/de.json@@ -18,6 +18,8 @@"calendar": {"title": "Kalender","create": "Neuen Kalender erstellen",+ "createDescription": "Erstelle einen neuen Kalender, um deine Schichten zu organisieren",+ "selectDescription": "Wähle einen Kalender aus, um deine Schichten zu verwalten","name": "Kalendername","namePlaceholder": "z.B. Meine Schichten","color": "Farbe",@@ -53,7 +55,9 @@"shift": {"title": "Schichten","create": "Neue Schicht",+ "createDescription": "Füge eine neue Schicht zu deinem Kalender hinzu","edit": "Schicht bearbeiten",+ "editDescription": "Aktualisiere die Schichtdetails","delete": "Schicht löschen","date": "Datum","startTime": "Startzeit",@@ -87,6 +91,9 @@"edit": "Vorlage bearbeiten","delete": "Vorlage löschen","manage": "Vorlagen verwalten",+ "manageDescription": "Bearbeite oder lösche deine Schichtvorlagen",+ "createDescription": "Erstelle eine neue Vorlage für eine schnelle Schichterstellung",+ "editDescription": "Aktualisiere Vorlagendetails","name": "Vorlagenname","namePlaceholder": "z.B. Frühschicht","saveAsPreset": "Als Vorlage speichern",diff --git a/messages/en.json b/messages/en.jsonindex cfca711..d362f97 100644--- a/messages/en.json+++ b/messages/en.json@@ -18,6 +18,8 @@"calendar": {"title": "Calendar","create": "Create New Calendar",+ "createDescription": "Create a new calendar to organize your shifts",+ "selectDescription": "Choose a calendar to manage your shifts","name": "Calendar Name","namePlaceholder": "e.g., My Shifts","color": "Color",@@ -53,7 +55,9 @@"shift": {"title": "Shifts","create": "New Shift",+ "createDescription": "Add a new shift to your calendar","edit": "Edit Shift",+ "editDescription": "Update the shift details","delete": "Delete Shift","date": "Date","startTime": "Start Time",@@ -87,6 +91,9 @@"edit": "Edit Preset","delete": "Delete Preset","manage": "Manage Presets",+ "manageDescription": "Edit or delete your shift presets",+ "createDescription": "Create a new preset for quick shift creation",+ "editDescription": "Update preset details","name": "Preset Name","namePlaceholder": "e.g., Morning Shift","saveAsPreset": "Save as preset",diff --git a/middleware.ts b/middleware.tsdeleted file mode 100644index 762f5ee..0000000--- a/middleware.ts+++ /dev/null@@ -1,12 +0,0 @@-import { NextRequest, NextResponse } from "next/server";--export function middleware(request: NextRequest) {- // This middleware doesn't need to do anything- // Locale detection is handled in i18n.ts- return NextResponse.next();-}--export const config = {- // Skip middleware for api, static files, etc.- matcher: ["/((?!api|_next|_vercel|.*\\..*).*)"],-};