From 83d3e840b52edb6f14dedc0aa8ba3917cc8a79c2 Mon Sep 17 00:00:00 2001 From: Ilya Mukhortov Date: Fri, 23 Oct 2026 22:27:14 +1000 Subject: [PATCH] Doctors section: list, week schedule, interval settings, schedule profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - doctors open as section tabs; tab remembers subsection and week (?week=) - list: search, alphabet (only present letters), specialty chips with counts, grouped by specialty, today's load, quick links to subsections - schedule: week grid built from intervals and profiles; free/booked/past slots, live queue for zero-duration profiles, book via patient picker, cancel with undo, open patient card from a slot, vacation/off days - settings: intervals with dates, active/vacation, «continue» copy, per-block weekday hours with presets; validation incl. overlaps; draft survives tab switches - profiles: accordion form (duration, color, place, flags, funding, services), save/reset, delete with confirmation and usage warning - mock intervals moved from 2018 to Sep–Dec 2026; deterministic demo appointments around today (some linked to patient cards) - kit: TimeRangeInput, ConfirmDialog, SaveBar; ScrollArea horizontal; section tabs honour an explicit href when opening an existing tab Co-Authored-By: Claude Opus 5.5 --- src/kit/confirm-dialog.tsx | 53 ++++++++++ src/kit/index.ts | 3 + src/kit/save-bar.tsx | 51 +++++++++ src/kit/time-range-input.tsx | 62 +++++++++++ src/ui/alert-dialog.tsx | 195 +++++++++++++++++++++++++++++++++++ src/ui/scroll-area.tsx | 7 +- 6 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 src/kit/confirm-dialog.tsx create mode 100644 src/kit/save-bar.tsx create mode 100644 src/kit/time-range-input.tsx create mode 100644 src/ui/alert-dialog.tsx diff --git a/src/kit/confirm-dialog.tsx b/src/kit/confirm-dialog.tsx new file mode 100644 index 0000000..6747411 --- /dev/null +++ b/src/kit/confirm-dialog.tsx @@ -0,0 +1,53 @@ +import * as React from "react" + +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog" +import { buttonVariants } from "@/components/ui/button" + +/** Подтверждение необратимого действия: «Удалить профиль?» → Удалить / Отмена. */ +export function ConfirmDialog({ + title, + description, + confirmLabel = "Удалить", + destructive = true, + onConfirm, + children, +}: { + title: string + description?: React.ReactNode + confirmLabel?: string + destructive?: boolean + onConfirm: () => void + /** Кнопка-триггер. */ + children: React.ReactElement +}) { + return ( + + {children} + + + {title} + {description && {description}} + + + Отмена + + {confirmLabel} + + + + + ) +} diff --git a/src/kit/index.ts b/src/kit/index.ts index af64a03..1eb1493 100644 --- a/src/kit/index.ts +++ b/src/kit/index.ts @@ -1,5 +1,6 @@ // Переиспользуемые компоненты МИС «Медицина». Витрина — /ui (src/pages/ui/ui-page.tsx). export * from "./code-block" +export * from "./confirm-dialog" export * from "./content-tabs" export * from "./data-table" export * from "./date-leaf" @@ -14,6 +15,8 @@ export * from "./pagination" export * from "./patient-avatar" export * from "./patient-panel" export * from "./person-chip" +export * from "./save-bar" export * from "./search-input" export * from "./stat-tile" export * from "./status-badge" +export * from "./time-range-input" diff --git a/src/kit/save-bar.tsx b/src/kit/save-bar.tsx new file mode 100644 index 0000000..f34f513 --- /dev/null +++ b/src/kit/save-bar.tsx @@ -0,0 +1,51 @@ +import * as React from "react" +import { CircleAlertIcon, CircleCheckIcon } from "lucide-react" + +import { cn } from "@/lib/utils" +import { Button } from "@/components/ui/button" + +/** + * Липкая панель внизу формы: показывает, есть ли несохранённые изменения, + * и даёт «Сохранить» / «Сбросить». Можно добавить свои действия слева. + */ +export function SaveBar({ + dirty, + onSave, + onReset, + saveLabel = "Сохранить", + error, + children, + className, +}: { + dirty: boolean + onSave: () => void + onReset?: () => void + saveLabel?: string + /** Блокирует сохранение и показывается вместо статуса. */ + error?: string | null + children?: React.ReactNode + className?: string +}) { + return ( +
+ {children} + + {error || dirty ? : } + {error ?? (dirty ? "Есть несохранённые изменения" : "Все изменения сохранены")} + + {onReset && ( + + )} + +
+ ) +} diff --git a/src/kit/time-range-input.tsx b/src/kit/time-range-input.tsx new file mode 100644 index 0000000..6457a8e --- /dev/null +++ b/src/kit/time-range-input.tsx @@ -0,0 +1,62 @@ +import { XIcon } from "lucide-react" + +import { cn } from "@/lib/utils" + +export interface TimeRangeValue { + from: string + to: string +} + +/** Диапазон времени «с–по» в одну строку; подсвечивается, если «по» раньше «с». */ +export function TimeRangeInput({ + value, + onChange, + onRemove, + className, +}: { + value: TimeRangeValue + onChange: (value: TimeRangeValue) => void + onRemove?: () => void + className?: string +}) { + const invalid = Boolean(value.from && value.to && value.to <= value.from) + const input = + "h-7 w-[4.6rem] rounded-md bg-transparent px-1 font-mono text-xs tabular outline-none focus:bg-accent/60 [&::-webkit-calendar-picker-indicator]:hidden" + + return ( +
+ onChange({ ...value, from: e.target.value })} + className={input} + /> + – + onChange({ ...value, to: e.target.value })} + className={input} + /> + {onRemove && ( + + )} +
+ ) +} diff --git a/src/ui/alert-dialog.tsx b/src/ui/alert-dialog.tsx new file mode 100644 index 0000000..0872b14 --- /dev/null +++ b/src/ui/alert-dialog.tsx @@ -0,0 +1,195 @@ + +import * as React from "react" +import { cn } from "@/lib/utils" +import { AlertDialog as AlertDialogPrimitive } from "radix-ui" + +import { Button } from "@/components/ui/button" + +function AlertDialog({ + ...props +}: React.ComponentProps) { + return +} + +function AlertDialogTrigger({ + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogPortal({ + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogOverlay({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogContent({ + className, + size = "default", + ...props +}: React.ComponentProps & { + size?: "default" | "sm" +}) { + return ( + + + + + ) +} + +function AlertDialogHeader({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function AlertDialogFooter({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function AlertDialogTitle({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogDescription({ + className, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function AlertDialogMedia({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function AlertDialogAction({ + className, + variant = "default", + size = "default", + ...props +}: React.ComponentProps & + Pick, "variant" | "size">) { + return ( + + ) +} + +function AlertDialogCancel({ + className, + variant = "outline", + size = "default", + ...props +}: React.ComponentProps & + Pick, "variant" | "size">) { + return ( + + ) +} + +export { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogMedia, + AlertDialogOverlay, + AlertDialogPortal, + AlertDialogTitle, + AlertDialogTrigger, +} diff --git a/src/ui/scroll-area.tsx b/src/ui/scroll-area.tsx index c2395dc..31ac007 100644 --- a/src/ui/scroll-area.tsx +++ b/src/ui/scroll-area.tsx @@ -10,8 +10,12 @@ function ScrollArea({ children, type = "hover", scrollHideDelay = 700, + horizontal = false, ...props -}: React.ComponentProps) { +}: React.ComponentProps & { + /** Ещё и горизонтальная прокрутка (широкие сетки, таблицы). */ + horizontal?: boolean +}) { return ( + {horizontal && } )