feature/minore-features-v1 #85
@@ -725,6 +725,7 @@
|
||||
"noAppointment": "No appointment",
|
||||
"walkIn": "Walk-in",
|
||||
"newTreatment": "New treatment",
|
||||
"mobileOpenRail": "Patient / history",
|
||||
"newTreatmentPatientPrompt": "Who is this visit for?",
|
||||
"newTreatmentUseCurrent": "Use {name}",
|
||||
"newTreatmentUseCurrentHint": "Start a new visit for the patient already open on this page.",
|
||||
|
||||
@@ -726,6 +726,7 @@
|
||||
"noAppointment": "بدون نوبت",
|
||||
"walkIn": "بدون نوبت (مراجع)",
|
||||
"newTreatment": "درمان جدید",
|
||||
"mobileOpenRail": "بیمار / سابقه",
|
||||
"newTreatmentPatientPrompt": "این ویزیت برای چه کسی است؟",
|
||||
"newTreatmentUseCurrent": "استفاده از {name}",
|
||||
"newTreatmentUseCurrentHint": "ویزیت جدیدی برای بیماری که همین حالا در این صفحه باز است شروع کنید.",
|
||||
|
||||
@@ -725,6 +725,7 @@
|
||||
"noAppointment": "Geen afspraak",
|
||||
"walkIn": "Inloop",
|
||||
"newTreatment": "Nieuwe behandeling",
|
||||
"mobileOpenRail": "Patiënt / geschiedenis",
|
||||
"newTreatmentPatientPrompt": "Voor wie is dit bezoek?",
|
||||
"newTreatmentUseCurrent": "{name} gebruiken",
|
||||
"newTreatmentUseCurrentHint": "Start een nieuw bezoek voor de patiënt die al op deze pagina openstaat.",
|
||||
|
||||
@@ -320,7 +320,7 @@ export function CaseCreatePanel({
|
||||
const disabled = !canEdit || starting || deleting;
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-4 min-w-0">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold text-text-primary">{t('addCaseTitle')}</h2>
|
||||
@@ -478,6 +478,7 @@ export function CaseCreatePanel({
|
||||
detailClientId={activeLine.clientId}
|
||||
catalog={prosthesisOptions}
|
||||
disabled={disabled}
|
||||
className="w-full min-w-0"
|
||||
onToggleLink={(a, b) => {
|
||||
if (disabled) return;
|
||||
const currentGroups =
|
||||
|
||||
@@ -158,8 +158,8 @@ export function CaseDetailPanel({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<header className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between border-b border-border pb-3">
|
||||
<div className="space-y-4 min-w-0">
|
||||
<header className="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between border-b border-border pb-3">
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<h2 className="text-lg font-semibold text-text-primary">
|
||||
@@ -194,9 +194,9 @@ export function CaseDetailPanel({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex w-full sm:w-auto shrink-0 flex-col items-end gap-2">
|
||||
<div className="flex w-full lg:w-auto shrink-0 flex-col items-stretch lg:items-end gap-2">
|
||||
{canEditImportant ? (
|
||||
<div className="flex w-full max-w-sm items-center gap-3">
|
||||
<div className="flex w-full max-w-sm flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
|
||||
<Checkbox
|
||||
checked={labCase.isImportant ?? false}
|
||||
disabled={updatingImportant}
|
||||
@@ -225,7 +225,7 @@ export function CaseDetailPanel({
|
||||
) : labCase.externalCode?.trim() ? (
|
||||
<p className="text-sm text-text-muted">{labCase.externalCode.trim()}</p>
|
||||
) : null}
|
||||
<div className="flex w-full sm:w-auto flex-wrap items-center justify-end gap-2">
|
||||
<div className="flex w-full flex-wrap items-center justify-start lg:justify-end gap-2">
|
||||
{showCommentsButton && onCommentsClick ? (
|
||||
<Button type="button" variant="outline" size="sm" onClick={onCommentsClick}>
|
||||
<MessageSquare className="h-4 w-4 me-1.5" />
|
||||
@@ -246,7 +246,7 @@ export function CaseDetailPanel({
|
||||
</Button>
|
||||
</div>
|
||||
{labCase.shareUrl || (previewAttachment && labCase.attachments.length > 0) ? (
|
||||
<div className="flex flex-row items-center gap-2 shrink-0">
|
||||
<div className="flex flex-wrap items-center gap-2 shrink-0">
|
||||
{previewAttachment && labCase.attachments.length > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
@@ -327,40 +327,42 @@ export function CaseDetailPanel({
|
||||
<ul className="space-y-2">
|
||||
{group.tasks.map((task) => (
|
||||
<li key={task.id} className="rounded bg-background px-2 py-1.5 text-sm">
|
||||
<div className="flex flex-wrap items-center gap-x-2 gap-y-1">
|
||||
<div className="flex flex-col gap-1.5 sm:flex-row sm:flex-wrap sm:items-center sm:gap-x-2 sm:gap-y-1">
|
||||
<span className="min-w-0 flex-1 font-medium text-text-primary">
|
||||
{task.stepOrder}. {task.stepLabel}
|
||||
</span>
|
||||
<span className="text-[11px] text-text-muted shrink-0">
|
||||
{task.lastStatusChangedBy
|
||||
? t('lastUpdatedBy', { name: task.lastStatusChangedBy.name })
|
||||
: t('lastUpdatedUnknown')}
|
||||
{task.lastStatusChangedAt
|
||||
? ` · ${formatCaseDateTime(task.lastStatusChangedAt, locale)}`
|
||||
: ''}
|
||||
</span>
|
||||
{canAssignTasks && onAssignTask ? (
|
||||
<select
|
||||
value={task.assignee?.id ?? ''}
|
||||
disabled={assigningTaskId === task.id}
|
||||
onChange={(e) =>
|
||||
onAssignTask(task.id, e.target.value ? e.target.value : null)
|
||||
}
|
||||
aria-label={t('assigneeLabel')}
|
||||
className={`${FORM_SELECT_CLASS} max-w-[9.5rem] rounded-md py-0.5 text-xs`}
|
||||
>
|
||||
<option value="">{t('assigneeUnassigned')}</option>
|
||||
{assignableStaff.map((staff) => (
|
||||
<option key={staff.id} value={staff.id}>
|
||||
{staff.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
) : null}
|
||||
<Badge variant={labTaskStatusVariant(task.status)} fixedWidth={false}>
|
||||
{statusOptions.find((opt) => opt.value === task.status)?.label ??
|
||||
task.status}
|
||||
</Badge>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<span className="text-[11px] text-text-muted shrink-0">
|
||||
{task.lastStatusChangedBy
|
||||
? t('lastUpdatedBy', { name: task.lastStatusChangedBy.name })
|
||||
: t('lastUpdatedUnknown')}
|
||||
{task.lastStatusChangedAt
|
||||
? ` · ${formatCaseDateTime(task.lastStatusChangedAt, locale)}`
|
||||
: ''}
|
||||
</span>
|
||||
{canAssignTasks && onAssignTask ? (
|
||||
<select
|
||||
value={task.assignee?.id ?? ''}
|
||||
disabled={assigningTaskId === task.id}
|
||||
onChange={(e) =>
|
||||
onAssignTask(task.id, e.target.value ? e.target.value : null)
|
||||
}
|
||||
aria-label={t('assigneeLabel')}
|
||||
className={`${FORM_SELECT_CLASS} max-w-[9.5rem] rounded-md py-0.5 text-xs`}
|
||||
>
|
||||
<option value="">{t('assigneeUnassigned')}</option>
|
||||
{assignableStaff.map((staff) => (
|
||||
<option key={staff.id} value={staff.id}>
|
||||
{staff.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
) : null}
|
||||
<Badge variant={labTaskStatusVariant(task.status)} fixedWidth={false}>
|
||||
{statusOptions.find((opt) => opt.value === task.status)?.label ??
|
||||
task.status}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
|
||||
@@ -80,15 +80,17 @@ export function CaseToothChartPanel({
|
||||
if (selected.size === 0) return null;
|
||||
|
||||
return (
|
||||
<FdiToothChart
|
||||
selected={selected}
|
||||
readOnly
|
||||
scale={scale}
|
||||
crownColors={regionColors.crown}
|
||||
rootColors={regionColors.root}
|
||||
connectedTeeth={resolvedConnected.size > 0 ? resolvedConnected : undefined}
|
||||
compact={compact}
|
||||
className={className}
|
||||
/>
|
||||
<div className={`min-w-0 w-full overflow-x-hidden ${className}`.trim()}>
|
||||
<FdiToothChart
|
||||
selected={selected}
|
||||
readOnly
|
||||
scale={scale}
|
||||
crownColors={regionColors.crown}
|
||||
rootColors={regionColors.root}
|
||||
connectedTeeth={resolvedConnected.size > 0 ? resolvedConnected : undefined}
|
||||
compact={compact}
|
||||
className="w-full min-w-0"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -387,15 +387,15 @@ export function CasesPage() {
|
||||
const filterSelectClass = `${FORM_SELECT_CLASS} w-full min-w-0 rounded-md py-1.5 text-xs sm:py-2 sm:text-sm`;
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-4 min-w-0 overflow-x-hidden">
|
||||
<div>
|
||||
<h1 className="text-xl sm:text-2xl font-semibold text-text-primary">{t('title')}</h1>
|
||||
<p className="text-sm text-text-muted mt-1">{t('subtitle')}</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 lg:grid-cols-[minmax(300px,380px)_1fr] lg:items-stretch">
|
||||
<div className="grid gap-4 min-w-0 lg:grid-cols-[minmax(240px,340px)_minmax(0,1fr)] lg:items-stretch">
|
||||
<section
|
||||
className={`rounded-lg border border-border bg-surface p-3 sm:p-4 space-y-3 flex flex-col min-h-0 h-full lg:min-h-[420px] ${
|
||||
className={`rounded-lg border border-border bg-surface p-3 sm:p-4 space-y-3 flex flex-col min-h-0 min-w-0 h-full overflow-x-hidden lg:min-h-[420px] ${
|
||||
mobileDetailOpen && selectedCaseId ? 'hidden lg:flex' : 'flex'
|
||||
}`}
|
||||
>
|
||||
@@ -420,8 +420,8 @@ export function CasesPage() {
|
||||
placeholder={t('searchPlaceholder')}
|
||||
/>
|
||||
|
||||
<div className="grid gap-2 sm:grid-cols-2">
|
||||
<label className="space-y-1">
|
||||
<div className="grid gap-2 sm:grid-cols-2 min-w-0">
|
||||
<label className="space-y-1 min-w-0">
|
||||
<span className="text-xs font-medium text-text-muted">{t('filterClinic')}</span>
|
||||
<select
|
||||
value={clinicId}
|
||||
@@ -440,7 +440,7 @@ export function CasesPage() {
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label className="space-y-1">
|
||||
<label className="space-y-1 min-w-0">
|
||||
<span className="text-xs font-medium text-text-muted">{t('filterProsthesisType')}</span>
|
||||
<select
|
||||
value={prosthesisTypeCode}
|
||||
@@ -459,7 +459,7 @@ export function CasesPage() {
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label className="space-y-1">
|
||||
<label className="space-y-1 min-w-0">
|
||||
<span className="text-xs font-medium text-text-muted">{t('filterSentFrom')}</span>
|
||||
<AppDateInput
|
||||
value={sentFrom}
|
||||
@@ -471,7 +471,7 @@ export function CasesPage() {
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label className="space-y-1">
|
||||
<label className="space-y-1 min-w-0">
|
||||
<span className="text-xs font-medium text-text-muted">{t('filterSentTo')}</span>
|
||||
<AppDateInput
|
||||
value={sentTo}
|
||||
@@ -508,7 +508,7 @@ export function CasesPage() {
|
||||
setSelectedCaseId(item.id);
|
||||
setMobileDetailOpen(true);
|
||||
}}
|
||||
className={`w-full rounded-md border px-3 py-2.5 text-left transition-colors ${
|
||||
className={`w-full rounded-md border px-3 py-2.5 text-start transition-colors ${
|
||||
isActive
|
||||
? 'border-primary bg-primary/5'
|
||||
: 'border-border hover:border-primary/40'
|
||||
@@ -570,7 +570,7 @@ export function CasesPage() {
|
||||
</div>
|
||||
|
||||
{pagination.totalPages > 1 ? (
|
||||
<div className="flex shrink-0 items-center justify-between gap-2 pt-2 border-t border-border">
|
||||
<div className="flex shrink-0 flex-wrap items-center justify-between gap-2 pt-2 border-t border-border">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@@ -579,7 +579,7 @@ export function CasesPage() {
|
||||
>
|
||||
{t('prevPage')}
|
||||
</Button>
|
||||
<span className="text-xs text-text-muted text-center">
|
||||
<span className="min-w-0 flex-1 text-xs text-text-muted text-center">
|
||||
{t('pageSummary', {
|
||||
page: pagination.page,
|
||||
totalPages: pagination.totalPages,
|
||||
@@ -599,7 +599,7 @@ export function CasesPage() {
|
||||
</section>
|
||||
|
||||
<section
|
||||
className={`rounded-lg border border-border bg-surface p-3 sm:p-4 min-h-[320px] lg:min-h-[420px] ${
|
||||
className={`rounded-lg border border-border bg-surface p-3 sm:p-4 min-h-[320px] min-w-0 overflow-x-hidden lg:min-h-[420px] ${
|
||||
selectedCaseId && !mobileDetailOpen ? 'hidden lg:block' : ''
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -35,7 +35,7 @@ export function LabCaseProsthesisGroupsList({
|
||||
{groups.map((group) => (
|
||||
<li
|
||||
key={`${group.selectionGroupId ?? ''}-${group.prosthesisTypeCode}-${group.teeth.join(',')}`}
|
||||
className="text-[11px] leading-snug"
|
||||
className="text-[11px] leading-snug min-w-0 break-words"
|
||||
>
|
||||
<ProsthesisStackedTypeLabel
|
||||
className="font-medium"
|
||||
|
||||
@@ -3,14 +3,28 @@
|
||||
import { ChevronLeft } from 'lucide-react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
export function MobileDetailBackButton({ onClick }: { onClick: () => void }) {
|
||||
/** Hide from this breakpoint up (Cases = lg, Treatment = xl). */
|
||||
type HideFrom = 'lg' | 'xl';
|
||||
|
||||
const HIDE_FROM_CLASS: Record<HideFrom, string> = {
|
||||
lg: 'lg:hidden',
|
||||
xl: 'xl:hidden',
|
||||
};
|
||||
|
||||
export function MobileDetailBackButton({
|
||||
onClick,
|
||||
hideFrom = 'lg',
|
||||
}: {
|
||||
onClick: () => void;
|
||||
hideFrom?: HideFrom;
|
||||
}) {
|
||||
const t = useTranslations('common');
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
className="lg:hidden inline-flex items-center gap-1 text-sm text-primary hover:opacity-90 mb-3"
|
||||
className={`${HIDE_FROM_CLASS[hideFrom]} inline-flex items-center gap-1 text-sm text-primary hover:opacity-90 mb-3`}
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4 icon-flat" />
|
||||
{t('back')}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useId, useRef, useState, type CSSProperties, type ReactNode } from 'react';
|
||||
import {
|
||||
useEffect,
|
||||
useId,
|
||||
useRef,
|
||||
useState,
|
||||
type CSSProperties,
|
||||
type PointerEvent as ReactPointerEvent,
|
||||
type ReactNode,
|
||||
} from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { Info, Plus } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/shared/Button';
|
||||
@@ -24,6 +32,8 @@ const TOOTH_NUMBER_GAP = 'mt-1';
|
||||
const REALISTIC_NUMBER_GAP = '2mm';
|
||||
/** Tight interproximal gap between tooth columns. */
|
||||
const TOOTH_GAP = 'gap-x-px';
|
||||
/** Max finger movement (px) still counted as a tap; beyond this, treat as scroll. */
|
||||
const TOUCH_TAP_SLOP_PX = 10;
|
||||
/**
|
||||
* Centers a mark on the inline-end edge of a tooth column (between this tooth
|
||||
* and the next in flex order). Logical `end` + 0-width flex stays correct in LTR and RTL.
|
||||
@@ -31,6 +41,13 @@ const TOOTH_GAP = 'gap-x-px';
|
||||
const EDGE_MARK_ANCHOR =
|
||||
'absolute inset-y-0 end-0 z-10 w-0 flex items-center justify-center';
|
||||
|
||||
type TouchPendingTap = {
|
||||
pointerId: number;
|
||||
startX: number;
|
||||
startY: number;
|
||||
activate: () => void;
|
||||
};
|
||||
|
||||
function quadrantMirrored(fdi: FdiToothId): boolean {
|
||||
const q = fdi[0];
|
||||
return q === '2' || q === '3';
|
||||
@@ -67,6 +84,7 @@ function ToothNumber({
|
||||
interactive,
|
||||
disabled,
|
||||
onActivate,
|
||||
onBeginPointer,
|
||||
}: {
|
||||
fdi: FdiToothId;
|
||||
selected: boolean;
|
||||
@@ -76,6 +94,7 @@ function ToothNumber({
|
||||
interactive: boolean;
|
||||
disabled: boolean;
|
||||
onActivate: (keys: { shiftKey: boolean; ctrlKey: boolean }) => void;
|
||||
onBeginPointer: (e: ReactPointerEvent<HTMLButtonElement>) => void;
|
||||
}) {
|
||||
const className = `text-[10px] tabular-nums text-center leading-none ${colorClass}`;
|
||||
const boxStyle: CSSProperties = { width: `${widthRem}rem`, ...style };
|
||||
@@ -98,8 +117,7 @@ function ToothNumber({
|
||||
}}
|
||||
onPointerDown={(e) => {
|
||||
if (e.button !== 0) return;
|
||||
e.preventDefault();
|
||||
onActivate({ shiftKey: e.shiftKey, ctrlKey: e.ctrlKey || e.metaKey });
|
||||
onBeginPointer(e);
|
||||
}}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key !== 'Enter' && e.key !== ' ') return;
|
||||
@@ -308,23 +326,69 @@ export function FdiToothChart({
|
||||
const uid = useId().replace(/:/g, '');
|
||||
const [hintOpen, setHintOpen] = useState(false);
|
||||
const paintingRef = useRef(false);
|
||||
const touchPendingRef = useRef<TouchPendingTap | null>(null);
|
||||
const archPeak = 8;
|
||||
const interactive = !readOnly && (Boolean(onToggle) || Boolean(onAssignPointer));
|
||||
const linkInteractive = interactive && Boolean(onToggleLink);
|
||||
const isDisabled = disabled || readOnly;
|
||||
|
||||
useEffect(() => {
|
||||
const endPaint = () => {
|
||||
paintingRef.current = false;
|
||||
const slopSq = TOUCH_TAP_SLOP_PX * TOUCH_TAP_SLOP_PX;
|
||||
const onMove = (e: PointerEvent) => {
|
||||
const pending = touchPendingRef.current;
|
||||
if (!pending || e.pointerId !== pending.pointerId) return;
|
||||
const dx = e.clientX - pending.startX;
|
||||
const dy = e.clientY - pending.startY;
|
||||
if (dx * dx + dy * dy > slopSq) {
|
||||
touchPendingRef.current = null;
|
||||
}
|
||||
};
|
||||
window.addEventListener('pointerup', endPaint);
|
||||
window.addEventListener('pointercancel', endPaint);
|
||||
const onUp = (e: PointerEvent) => {
|
||||
paintingRef.current = false;
|
||||
const pending = touchPendingRef.current;
|
||||
if (!pending || e.pointerId !== pending.pointerId) return;
|
||||
touchPendingRef.current = null;
|
||||
pending.activate();
|
||||
};
|
||||
const onCancel = (e: PointerEvent) => {
|
||||
paintingRef.current = false;
|
||||
const pending = touchPendingRef.current;
|
||||
if (pending && e.pointerId === pending.pointerId) {
|
||||
touchPendingRef.current = null;
|
||||
}
|
||||
};
|
||||
window.addEventListener('pointermove', onMove);
|
||||
window.addEventListener('pointerup', onUp);
|
||||
window.addEventListener('pointercancel', onCancel);
|
||||
return () => {
|
||||
window.removeEventListener('pointerup', endPaint);
|
||||
window.removeEventListener('pointercancel', endPaint);
|
||||
window.removeEventListener('pointermove', onMove);
|
||||
window.removeEventListener('pointerup', onUp);
|
||||
window.removeEventListener('pointercancel', onCancel);
|
||||
};
|
||||
}, []);
|
||||
|
||||
/** Mouse/pen: activate immediately. Touch: defer until pointerup if movement stays within slop. */
|
||||
const beginToothPointer = (
|
||||
e: ReactPointerEvent<HTMLButtonElement>,
|
||||
opts: { startPaint: boolean; activate: () => void },
|
||||
) => {
|
||||
if (e.pointerType === 'touch') {
|
||||
touchPendingRef.current = {
|
||||
pointerId: e.pointerId,
|
||||
startX: e.clientX,
|
||||
startY: e.clientY,
|
||||
activate: opts.activate,
|
||||
};
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (opts.startPaint && !e.shiftKey) {
|
||||
paintingRef.current = true;
|
||||
}
|
||||
opts.activate();
|
||||
};
|
||||
|
||||
const toothSizeClass = (fdi: FdiToothId) => toothSize(fdi);
|
||||
|
||||
const archOffset = (index: number, count: number, upper?: boolean) => {
|
||||
@@ -531,14 +595,11 @@ export function FdiToothChart({
|
||||
}}
|
||||
onPointerDown={(e) => {
|
||||
if (e.button !== 0) return;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (onAssignPointer && !e.shiftKey) {
|
||||
paintingRef.current = true;
|
||||
}
|
||||
activateTooth({
|
||||
shiftKey: e.shiftKey,
|
||||
ctrlKey: e.ctrlKey || e.metaKey,
|
||||
const shiftKey = e.shiftKey;
|
||||
const ctrlKey = e.ctrlKey || e.metaKey;
|
||||
beginToothPointer(e, {
|
||||
startPaint: Boolean(onAssignPointer),
|
||||
activate: () => activateTooth({ shiftKey, ctrlKey }),
|
||||
});
|
||||
}}
|
||||
onPointerEnter={() => {
|
||||
@@ -665,6 +726,24 @@ export function FdiToothChart({
|
||||
}
|
||||
onToggle?.(fdi, { shiftKey: keys.shiftKey });
|
||||
}}
|
||||
onBeginPointer={(e) => {
|
||||
const shiftKey = e.shiftKey;
|
||||
const ctrlKey = e.ctrlKey || e.metaKey;
|
||||
beginToothPointer(e, {
|
||||
startPaint: false,
|
||||
activate: () => {
|
||||
if (onAssignPointer) {
|
||||
onAssignPointer(fdi, {
|
||||
shiftKey,
|
||||
ctrlKey,
|
||||
paint: ctrlKey,
|
||||
});
|
||||
return;
|
||||
}
|
||||
onToggle?.(fdi, { shiftKey });
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -683,19 +762,37 @@ export function FdiToothChart({
|
||||
style={numberStyle(fdi, selected.has(fdi))}
|
||||
interactive={interactive}
|
||||
disabled={isDisabled}
|
||||
onActivate={(keys) => {
|
||||
if (onAssignPointer) {
|
||||
onAssignPointer(fdi, {
|
||||
shiftKey: keys.shiftKey,
|
||||
ctrlKey: keys.ctrlKey,
|
||||
paint: keys.ctrlKey,
|
||||
onActivate={(keys) => {
|
||||
if (onAssignPointer) {
|
||||
onAssignPointer(fdi, {
|
||||
shiftKey: keys.shiftKey,
|
||||
ctrlKey: keys.ctrlKey,
|
||||
paint: keys.ctrlKey,
|
||||
});
|
||||
return;
|
||||
}
|
||||
onToggle?.(fdi, { shiftKey: keys.shiftKey });
|
||||
}}
|
||||
onBeginPointer={(e) => {
|
||||
const shiftKey = e.shiftKey;
|
||||
const ctrlKey = e.ctrlKey || e.metaKey;
|
||||
beginToothPointer(e, {
|
||||
startPaint: false,
|
||||
activate: () => {
|
||||
if (onAssignPointer) {
|
||||
onAssignPointer(fdi, {
|
||||
shiftKey,
|
||||
ctrlKey,
|
||||
paint: ctrlKey,
|
||||
});
|
||||
return;
|
||||
}
|
||||
onToggle?.(fdi, { shiftKey });
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
onToggle?.(fdi, { shiftKey: keys.shiftKey });
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className={TOOTH_NUMBER_GAP}>
|
||||
<div
|
||||
@@ -733,8 +830,8 @@ export function FdiToothChart({
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={`${cardClass} ${className}`}>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div className={`${cardClass} min-w-0 ${className}`.trim()}>
|
||||
<div className="flex min-w-0 items-start justify-between gap-2">
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<h3 className="text-sm font-semibold text-text-primary">
|
||||
{compact || embedded ? t('toothChartTitleCompact') : t('toothChartTitle')}
|
||||
@@ -769,7 +866,7 @@ export function FdiToothChart({
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
<p className="min-w-0 text-[11px] text-text-secondary tabular-nums text-end">
|
||||
<p className="min-w-0 max-w-full text-[11px] text-text-secondary tabular-nums text-end break-words">
|
||||
{t('selectedLabel')}{' '}
|
||||
{selectedSummary ??
|
||||
(selected.size === 0 ? t('selectedEmpty') : [...selected].sort().join(', '))}
|
||||
|
||||
@@ -508,12 +508,12 @@ export function ProsthesisJobPopover({
|
||||
);
|
||||
|
||||
const body = (
|
||||
<div className="grid h-full min-h-0 flex-1 grid-cols-[4fr_1fr]">
|
||||
<section className="flex min-h-0 min-w-0 flex-col gap-2.5 border-e border-border pe-3">
|
||||
<div className="grid h-full min-h-0 flex-1 grid-cols-1 sm:grid-cols-[4fr_1fr]">
|
||||
<section className="flex min-h-0 min-w-0 flex-col gap-2.5 border-b border-border pb-3 sm:border-b-0 sm:border-e sm:pb-0 sm:pe-3">
|
||||
<p className="shrink-0 text-xs font-semibold leading-none text-text-primary">{title}</p>
|
||||
{scope === 'arch' && onLockedArchChange ? (
|
||||
<div
|
||||
className="flex h-8 w-1/2 shrink-0 rounded-[var(--radius-md)] border border-border p-0.5"
|
||||
className="flex h-8 w-full sm:w-1/2 shrink-0 rounded-[var(--radius-md)] border border-border p-0.5"
|
||||
role="group"
|
||||
aria-label={title}
|
||||
>
|
||||
@@ -541,13 +541,13 @@ export function ProsthesisJobPopover({
|
||||
{tileRow}
|
||||
</div>
|
||||
</section>
|
||||
<section className="flex min-h-0 min-w-0 flex-col gap-1 ps-3">
|
||||
<div className="flex shrink-0 flex-col gap-1">
|
||||
<section className="flex min-h-0 min-w-0 flex-col gap-1 pt-3 sm:pt-0 sm:ps-3">
|
||||
<div className="flex shrink-0 flex-row gap-1 sm:flex-col">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className={HEADER_BTN_CLASS}
|
||||
className={`${HEADER_BTN_CLASS} flex-1 sm:flex-none`}
|
||||
disabled={!hasLeaf}
|
||||
onClick={onClear}
|
||||
>
|
||||
@@ -557,7 +557,7 @@ export function ProsthesisJobPopover({
|
||||
type="button"
|
||||
variant="primary"
|
||||
size="sm"
|
||||
className={HEADER_BTN_CLASS}
|
||||
className={`${HEADER_BTN_CLASS} flex-1 sm:flex-none`}
|
||||
onClick={onClose}
|
||||
>
|
||||
{t('done')}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useLocale, useTranslations } from 'next-intl';
|
||||
import { useRouter } from '@/i18n/navigation';
|
||||
import { Button } from '@/components/ui/shared/Button';
|
||||
import { MobileDetailBackButton } from '@/components/ui/shared/MobileDetailBackButton';
|
||||
import { PatientSearchCombobox } from '@/components/ui/patient/PatientSearchCombobox';
|
||||
import {
|
||||
TreatmentLabCasesPanel,
|
||||
@@ -480,6 +481,8 @@ export function TreatmentWorkspace({
|
||||
const [patientSearchBusy, setPatientSearchBusy] = useState(false);
|
||||
const [newTreatmentPickerOpen, setNewTreatmentPickerOpen] = useState(false);
|
||||
const [creatingStandalone, setCreatingStandalone] = useState(false);
|
||||
/** Below xl: show left rail instead of editor (Cases-style pane swap). */
|
||||
const [mobileRailOpen, setMobileRailOpen] = useState(false);
|
||||
|
||||
const {
|
||||
search: patientSearch,
|
||||
@@ -684,6 +687,12 @@ export function TreatmentWorkspace({
|
||||
!historyLoading &&
|
||||
history.length === 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (showNoTreatmentFound) {
|
||||
setMobileRailOpen(true);
|
||||
}
|
||||
}, [showNoTreatmentFound]);
|
||||
|
||||
const unreadUpdatesCount = unreadLabCases.length;
|
||||
const otherPatientsUnreadCount = useMemo(
|
||||
() => unreadLabCases.filter((item) => item.patientId !== activePatientId).length,
|
||||
@@ -1690,6 +1699,7 @@ export function TreatmentWorkspace({
|
||||
draftHydratingRef.current = true;
|
||||
hydrateFromTreatment(created.data, { seedBlankIfEmpty: true });
|
||||
draftHydratingRef.current = false;
|
||||
setMobileRailOpen(false);
|
||||
if (created.data.patientId && !created.data.patient?.isWalkIn) {
|
||||
await refreshHistory(created.data.patientId);
|
||||
}
|
||||
@@ -1795,6 +1805,8 @@ export function TreatmentWorkspace({
|
||||
const ok = workspaceModeRef.current === 'live' ? await flushDraftSave() : true;
|
||||
if (!ok) return false;
|
||||
|
||||
setMobileRailOpen(false);
|
||||
|
||||
let treatmentToLoad = treatment;
|
||||
try {
|
||||
const draftResponse = treatment.appointmentId
|
||||
@@ -1947,6 +1959,7 @@ export function TreatmentWorkspace({
|
||||
(item: LabDispatchAttentionItem) => {
|
||||
if (item.isCurrentDraft) {
|
||||
exitBrowse();
|
||||
setMobileRailOpen(false);
|
||||
setLabWorkspaceView('dispatch');
|
||||
if (item.detailClientId !== activeDetailId) {
|
||||
pendingScrollToLabRef.current = true;
|
||||
@@ -1968,6 +1981,7 @@ export function TreatmentWorkspace({
|
||||
history.find((entry) => entry.id === item.treatmentId) ??
|
||||
historyPanelItems.find((entry) => entry.id === item.treatmentId);
|
||||
if (!treatment) return;
|
||||
setMobileRailOpen(false);
|
||||
void loadTreatmentIntoWorkspace(treatment, item.detailClientId);
|
||||
},
|
||||
[exitBrowse, activeDetailId, history, historyPanelItems, labCaseDrafts, loadTreatmentIntoWorkspace],
|
||||
@@ -2018,6 +2032,7 @@ export function TreatmentWorkspace({
|
||||
workspaceMode === 'live' &&
|
||||
!isBrowsing
|
||||
) {
|
||||
setMobileRailOpen(false);
|
||||
setLabWorkspaceView('dispatch');
|
||||
if (item.detailClientId !== activeDetailId) {
|
||||
pendingScrollToLabRef.current = true;
|
||||
@@ -2623,7 +2638,12 @@ export function TreatmentWorkspace({
|
||||
)}
|
||||
|
||||
<div className="treatment-layout-grid grid grid-cols-1 xl:grid-cols-[minmax(300px,380px)_minmax(0,1fr)] gap-4 items-start">
|
||||
<div className="space-y-3 min-w-0 xl:max-w-[380px]">
|
||||
<div
|
||||
className={`space-y-3 min-w-0 xl:max-w-[380px] ${
|
||||
mobileRailOpen ? 'block' : 'hidden'
|
||||
} xl:block`}
|
||||
>
|
||||
<MobileDetailBackButton hideFrom="xl" onClick={() => setMobileRailOpen(false)} />
|
||||
<div className="surface-card p-3 space-y-3">
|
||||
{canEdit && !isViewingPastDay ? (
|
||||
<div className="space-y-2">
|
||||
@@ -2781,7 +2801,21 @@ export function TreatmentWorkspace({
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="space-y-3 min-w-0 w-full">
|
||||
<div
|
||||
className={`space-y-3 min-w-0 w-full ${
|
||||
mobileRailOpen ? 'hidden' : 'block'
|
||||
} xl:block`}
|
||||
>
|
||||
<div className="xl:hidden">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setMobileRailOpen(true)}
|
||||
>
|
||||
{t('mobileOpenRail')}
|
||||
</Button>
|
||||
</div>
|
||||
{showSearchedPatientLoading ? (
|
||||
<div className="surface-card p-6">
|
||||
<p className="text-sm text-text-muted">{t('loading')}</p>
|
||||
|
||||
Reference in New Issue
Block a user