diff --git a/src/components/day-schedule.tsx b/src/components/day-schedule.tsx index 4e8df9f..a22d154 100644 --- a/src/components/day-schedule.tsx +++ b/src/components/day-schedule.tsx @@ -158,6 +158,12 @@ const DaySchedule: React.FC = ({ } const deltaMinutes = currentTotalMinutes - prevTotalMinutes; + // Resurn string "-" if delta is negative + // Thes shouldn't happen if sorting works correctly, but it can happen when time picker is open and + // inakes are temporarily not in correct order wihle picker is still open (sorting happens on blur) + if (deltaMinutes <= 0) { + return '-'; + } const deltaHours = Math.floor(deltaMinutes / 60); const remainingMinutes = deltaMinutes % 60; @@ -360,7 +366,7 @@ const DaySchedule: React.FC = ({ )} {/* Dose table header */} -
+
#
{/* Index header */}
{t('time')}
{/* Time header */}
{t('ldx')} (mg)
{/* LDX header */} @@ -400,7 +406,7 @@ const DaySchedule: React.FC = ({ return (
-
+
{/* Intake index badge */}
= ({ inputWidth="w-[72px]" /> - {/* Action buttons - right aligned */} -
- handleActionWithoutSort(() => onUpdateDoseField(day.id, dose.id, 'isFed', !dose.isFed))} icon={} tooltip={dose.isFed ? t('doseWithFood') : t('doseFasted')} @@ -451,6 +456,9 @@ const DaySchedule: React.FC = ({ variant={dose.isFed ? "default" : "outline"} className={`h-9 w-9 p-0 ${dose.isFed ? 'bg-orange-500 hover:bg-orange-600' : ''}`} /> + + {/* Row action buttons - right aligned */} +
handleActionWithoutSort(() => onRemoveDose(day.id, dose.id))} icon={} diff --git a/src/components/ui/form-time-input.tsx b/src/components/ui/form-time-input.tsx index c09bf6e..12d902d 100644 --- a/src/components/ui/form-time-input.tsx +++ b/src/components/ui/form-time-input.tsx @@ -13,7 +13,6 @@ import { Clock } from "lucide-react" import { Button } from "./button" import { Input } from "./input" import { Popover, PopoverContent, PopoverTrigger } from "./popover" -import { Badge } from './badge'; import { cn } from "../../lib/utils" import { useTranslation } from "react-i18next" @@ -229,12 +228,12 @@ const FormTimeInput = React.forwardRef( - -
+ +
-
-
{t('timePickerHour')}
-
+
+
{t('timePickerHour')}
+
{Array.from({ length: 24 }, (_, i) => { const isCurrentValue = pickerHours === i && stagedHour === null const isStaged = stagedHour === i @@ -244,7 +243,8 @@ const FormTimeInput = React.forwardRef( type="button" variant={isStaged ? "default" : isCurrentValue ? "secondary" : "outline"} size="sm" - className="h-8 w-10" + //className={cn("h-8 text-sm", i === 0 ? "col-span-3": "w-10")} + className="h-8 w-10 text-sm" onClick={() => handleHourClick(i)} > {String(i).padStart(2, '0')} @@ -253,9 +253,9 @@ const FormTimeInput = React.forwardRef( })}
-
-
{t('timePickerMinute')}
-
+
+
{t('timePickerMinute')}
+
{Array.from({ length: 12 }, (_, i) => i * 5).map(minute => { const isCurrentValue = pickerMinutes === minute && stagedMinute === null const isStaged = stagedMinute === minute @@ -265,7 +265,7 @@ const FormTimeInput = React.forwardRef( type="button" variant={isStaged ? "default" : isCurrentValue ? "secondary" : "outline"} size="sm" - className="h-8 w-10" + className="h-8 w-10 text-sm" onClick={() => handleMinuteClick(minute)} > {String(minute).padStart(2, '0')}