diff --git a/src/components/medications/scheduling/TimesOfDayChips.tsx b/src/components/medications/scheduling/TimesOfDayChips.tsx index 3b01e87b3..b166b6293 100644 --- a/src/components/medications/scheduling/TimesOfDayChips.tsx +++ b/src/components/medications/scheduling/TimesOfDayChips.tsx @@ -46,6 +46,13 @@ export interface TimesOfDayChipsProps { disabled?: boolean; /** Translation namespace prefix. */ i18nPrefix?: string; + /** + * Render the built-in Morning / Noon / Evening / Night preset row. + * Default `true`. The wizard's Step 7 supplies its own icon-based + * preset row, so it passes `false` to avoid showing each suggested + * time twice (the icon chip from Step 7 and the labelled chip here). + */ + showPresets?: boolean; } /** Preset table — wall-clock HH:mm and i18n suffix key. */ @@ -106,6 +113,7 @@ export function TimesOfDayChips({ maxChips = 8, disabled = false, i18nPrefix = "medications.scheduling.timesOfDay", + showPresets = true, }: TimesOfDayChipsProps) { const { t } = useTranslations(); const inputId = useId(); @@ -165,38 +173,40 @@ export function TimesOfDayChips({ aria-label={t(`${i18nPrefix}.label`)} > {/* Preset row */} -
- {PRESETS.map(({ key, value: preset }) => { - const isOn = sortedValue.includes(preset); - const label = `${t(`${i18nPrefix}.presets.${key}`)} ${preset}`; - return ( - - ); - })} -
+ {showPresets && ( +
+ {PRESETS.map(({ key, value: preset }) => { + const isOn = sortedValue.includes(preset); + const label = `${t(`${i18nPrefix}.presets.${key}`)} ${preset}`; + return ( + + ); + })} +
+ )} {/* Chip list */} {sortedValue.length === 0 ? ( @@ -225,7 +235,7 @@ export function TimesOfDayChips({ disabled={disabled} aria-label={`${t(`${i18nPrefix}.remove`)} ${time}`} onClick={() => onRemove(time)} - className="focus-visible:ring-ring inline-flex h-7 w-7 items-center justify-center rounded-sm hover:bg-background focus-visible:outline-none focus-visible:ring-2 disabled:opacity-50" + className="focus-visible:ring-ring hover:bg-background inline-flex h-7 w-7 items-center justify-center rounded-sm focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50" data-slot="times-of-day-chip-remove" >