Skip to content
Browse documentation

A recurring Mon to Sun operating and availability hours editor with split shifts, aligned 24-hour coverage bars, overlap guards and Copy to Mon-Fri.

Used forBooking and calendar availabilitySupport SLA and on-call policiesLocal business and storefront hoursTeam shift and dispatch schedules

Install with the shadcn CLI

$ npx shadcn@latest add https://hairlineui.com/r/weekly-hours.json

Registered the namespace? Then it’s shadcn add @hairline/weekly-hours. Set it up

Templates

Need the whole page?

63 Next.js landing pages, each designed from scratch. Try any of them live; one is $39, all of them $159, and 8 are free.

All 63 templates

Where it’s used

  • Booking and calendar availability

    Pair with Timezone picker so hosts configure Mon to Sun availability and lunch breaks without leaving settings.

  • Support SLA and on-call policies

    Define live support operating hours with instant 24/7 or Mon-Fri 9-5 presets and total weekly coverage calculation.

  • Local business and storefront hours

    Support split daytime/evening shifts, 12-hour or 24-hour formatting and Sunday-first or Monday-first week ordering.

  • Team shift and dispatch schedules

    Catch overlapping intervals and inverted start/end times client-side via exported validateDaySlots().

What it handles for you

A recurring hours form should make editing seven days effortless while making gaps, split breaks and accidental overlaps impossible to miss.

Instead of wiring up7-row custom hours forminterval overlap validatorcopy-to-weekdays buttonweekly coverage visualiser
  1. Aligned 24-hour coverage hairlines

    Every row draws proportional segments on a shared 00:00 to 24:00 bar with 06/12/18 ticks so lunch breaks and weekend gaps read at a glance.

  2. Split shifts with smart next-slot defaults

    Clicking + inserts a fresh interval starting 1 hour after the previous shift ends, with one-click Trash removal per split.

  3. One-click Copy to Mon-Fri

    Propagate any day intervals across all weekdays in one click with an inline emerald confirmation.

  4. Live overlap and order validation

    Detects inverted ranges (end <= start) and overlapping intervals on every day, tinting both the select border and the 24-hour bar crimson.

  5. Quick presets and live weekly total

    Switch between Mon-Fri 9-5 and 24/7 in one tap while the header continuously tallies valid weekly hours and open days.

  6. Exported schedule helpers

    Exports validateDaySlots(), calculateWeeklyMinutes(), formatWeeklyDuration() and DEFAULT_WEEKLY_SCHEDULE.

Overview

Scheduling apps, support desks and storefronts all need recurring weekly hours, yet single start/end fields break the moment someone adds a lunch break or accidentally creates overlapping shifts. WeeklyHours structures Monday through Sunday into one hairline editor: toggle any day on or off, split a day into multiple intervals with +, copy any day schedule across Monday through Friday in one click, and scan an aligned 00:00 to 24:00 proportional coverage bar beside every row. Invalid ranges and overlapping intervals flag immediately in crimson both inline and on the coverage bar, while total weekly open hours stay live in the header.

States

standard week
Monday through Friday open 09:00 to 17:00 with Saturday and Sunday toggled Unavailable.
split shifts
Days with multiple intervals stack cleanly and visually part their 24-hour hairline bar around breaks.
conflict detected
Overlapping or inverted intervals highlight crimson inline with an alert label and red coverage bar.
copied to weekdays
Pressing Copy on any row applies its intervals across Mon to Fri and briefly flashes an emerald Check badge.

Usage

usage.tsx
import { WeeklyHours, DEFAULT_WEEKLY_SCHEDULE } from "@/components/weekly-hours";<WeeklyHours  value={schedule}  onChange={setSchedule}  timezone="Europe/London"/>

Depends on lucide-react, installed for you by the CLI along with the keyframes it needs.

Works with

Availability settings paired with validation guard

Run validateDaySlots() across the schedule to disable Save whenever a day has overlapping or invalid ranges.

example.tsx
"use client";import { useState } from "react";import { WeeklyHours, DEFAULT_WEEKLY_SCHEDULE, validateDaySlots, type WeeklySchedule, type WeekdayKey } from "@/components/weekly-hours";export function AvailabilityForm({ onSave }: { onSave: (s: WeeklySchedule) => Promise<void> }) {  const [schedule, setSchedule] = useState<WeeklySchedule>(DEFAULT_WEEKLY_SCHEDULE);  const hasErrors = (Object.keys(schedule) as WeekdayKey[]).some((k) => {    const v = validateDaySlots(schedule[k]);    return v.hasInvalid || v.hasOverlap;  });  return (    <div className="space-y-3">      <WeeklyHours value={schedule} onChange={setSchedule} timezone="Europe/London" />      <button        type="button"        disabled={hasErrors}        onClick={() => void onSave(schedule)}        className="h-9 rounded-xl bg-primary px-4 text-xs font-medium text-primary-foreground disabled:opacity-40"      >        Save availability      </button>    </div>  );}

Props

value / defaultValue / onChange
WeeklySchedule / WeeklySchedule / (s) => void
Controlled or uncontrolled Record<WeekdayKey, TimeSlot[]>.
stepMinutes / hour12 / weekStartsOnSunday= 30 / false / false
15 | 30 | 60 / boolean / boolean
Time dropdown step increment, 12-hour AM/PM display and week start day.
timezone / showTimeline / showPresets= — / true / true
string / boolean / boolean
Optional header timezone pill, aligned 24-hour coverage bars and quick preset buttons.
title / sound= "Working hours" / false
string / boolean
Accessible region label and opt-in Web Audio feedback cues.

Accessibility and motion

  • Stores canonical 24-hour "HH:MM" strings ("00:00" through "24:00") regardless of whether hour12 display is enabled.
  • Time selectors use PillSelect (a theme-aware portaled listbox with keyboard search and arrows) instead of native browser <select> menus.
  • Under prefers-reduced-motion: reduce, day toggle thumbs switch immediately without sliding animation.

Requirements

React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

The CLI also installs Text morph, Number roll.

Source

"use client";import * as React from "react";import {  AlertCircle,  Check,  Clock,  Copy,  Globe,  Plus,  Trash2,} from "lucide-react";import {  EASE_OUT,  EASE_THROW,  INTERACTION_FOCUS,  INTERACTION_PRESS,  interactionIcon,  useInteractionReducedMotion,} from "./ui-interaction-motion";import { NumberRoll } from "./number-roll";import { PillSelect, type PillOption } from "./pill-select";import { TextMorph } from "./text-morph";import { playSound } from "./ui-sounds";/* ───────────────────────────────────────────────────────── * WEEKLY HOURS: recurring availability & operating schedule * *   presets   gliding segmented pill (Mon–Fri 9–5 / 24/7) throws *             its active highlight across while weekly hours roll *             with NumberRoll and every day's 24-hour track eases * *   bars      every day renders a proportional 00:00–24:00 *             hairline coverage ribbon aligned across Mon–Sun; *             intervals ease smoothly, split shifts part the bar, *             and overlapping ranges highlight their collision in *             crimson with a height-folded alert * *   ergonomic portaled PillSelect time pickers (zero native *             selects), smooth day toggle transitions, "+" smart *             next-slot split shifts and one-click Copy to Mon–Fri * ───────────────────────────────────────────────────────── */export type WeekdayKey = "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun";export interface TimeSlot {  /** 24-hour start time in "HH:MM" format (e.g. "09:00"). */  start: string;  /** 24-hour end time in "HH:MM" format (e.g. "17:00", or "24:00" for midnight end). */  end: string;}export type WeeklySchedule = Record<WeekdayKey, TimeSlot[]>;export interface WeeklyHoursProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {  /** Controlled Mon–Sun weekly schedule. */  value?: WeeklySchedule;  /** Initial uncontrolled weekly schedule (defaults to Mon–Fri 09:00–17:00). */  defaultValue?: WeeklySchedule;  /** Called whenever any day or interval changes. */  onChange?: (next: WeeklySchedule) => void;  /** Minute increment for time selectors (default 30). */  stepMinutes?: 15 | 30 | 60;  /** Format displayed times in 12-hour AM/PM clock (default false -> crisp 24-hour). */  hour12?: boolean;  /** Optional IANA timezone label shown in the card header (e.g. "Europe/London"). */  timezone?: string;  /** Show the aligned 24-hour proportional coverage hairline column (default true). */  showTimeline?: boolean;  /** Show header quick presets (Mon–Fri 9–5, 24/7) (default true). */  showPresets?: boolean;  /** Start week on Sunday instead of Monday (default false). */  weekStartsOnSunday?: boolean;  /** Card header title (default "Working hours"). */  title?: string;  /** Opt-in Web Audio ticks (from ui-sounds.ts). */  sound?: boolean;}interface DayMeta {  key: WeekdayKey;  short: string;  full: string;  weekday: boolean;}const DAYS_MON_FIRST: DayMeta[] = [  { key: "mon", short: "Mon", full: "Monday", weekday: true },  { key: "tue", short: "Tue", full: "Tuesday", weekday: true },  { key: "wed", short: "Wed", full: "Wednesday", weekday: true },  { key: "thu", short: "Thu", full: "Thursday", weekday: true },  { key: "fri", short: "Fri", full: "Friday", weekday: true },  { key: "sat", short: "Sat", full: "Saturday", weekday: false },  { key: "sun", short: "Sun", full: "Sunday", weekday: false },];export const DEFAULT_WEEKLY_SCHEDULE: WeeklySchedule = {  mon: [{ start: "09:00", end: "17:00" }],  tue: [{ start: "09:00", end: "17:00" }],  wed: [{ start: "09:00", end: "17:00" }],  thu: [{ start: "09:00", end: "17:00" }],  fri: [{ start: "09:00", end: "17:00" }],  sat: [],  sun: [],};export function timeToMinutes(hhmm: string): number {  const [hStr, mStr] = hhmm.split(":");  const h = Number.parseInt(hStr ?? "0", 10);  const m = Number.parseInt(mStr ?? "0", 10);  if (!Number.isFinite(h) || !Number.isFinite(m)) return 0;  return Math.max(0, Math.min(1440, h * 60 + m));}export function minutesToTime(total: number): string {  const clamped = Math.max(0, Math.min(1440, Math.round(total)));  const h = Math.floor(clamped / 60);  const m = clamped % 60;  return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;}export function formatTimeDisplay(hhmm: string, hour12: boolean): string {  if (!hour12) return hhmm;  const mins = timeToMinutes(hhmm);  if (mins === 1440) return "12:00 AM";  const h24 = Math.floor(mins / 60);  const m = mins % 60;  const suffix = h24 >= 12 ? "PM" : "AM";  const h12 = h24 % 12 === 0 ? 12 : h24 % 12;  return `${h12}:${String(m).padStart(2, "0")} ${suffix}`;}export interface SlotValidation {  errors: Array<string | null>;  hasOverlap: boolean;  hasInvalid: boolean;  validMinutes: number;}/** Validate all intervals for a single day (invalid order and overlaps). */export function validateDaySlots(slots: TimeSlot[]): SlotValidation {  const errors: Array<string | null> = slots.map(() => null);  let hasInvalid = false;  let hasOverlap = false;  let validMinutes = 0;  const ranges = slots.map((s, idx) => ({    idx,    start: timeToMinutes(s.start),    end: timeToMinutes(s.end),  }));  for (const r of ranges) {    if (r.end <= r.start) {      errors[r.idx] = "End must be after start";      hasInvalid = true;    } else {      validMinutes += r.end - r.start;    }  }  for (let i = 0; i < ranges.length; i++) {    const a = ranges[i];    if (a.end <= a.start) continue;    for (let j = i + 1; j < ranges.length; j++) {      const b = ranges[j];      if (b.end <= b.start) continue;      if (a.start < b.end && b.start < a.end) {        errors[a.idx] = errors[a.idx] ?? "Overlaps another interval";        errors[b.idx] = errors[b.idx] ?? "Overlaps another interval";        hasOverlap = true;      }    }  }  return { errors, hasOverlap, hasInvalid, validMinutes };}/** Calculate total valid open minutes across the entire Mon–Sun schedule. */export function calculateWeeklyMinutes(schedule: WeeklySchedule): number {  let total = 0;  for (const day of DAYS_MON_FIRST) {    total += validateDaySlots(schedule[day.key] ?? []).validMinutes;  }  return total;}export function formatWeeklyDuration(minutes: number): string {  const h = Math.floor(minutes / 60);  const m = minutes % 60;  if (m === 0) return `${h}h / wk`;  return `${h}h ${m}m / wk`;}function buildTimeOptions(stepMinutes: number, includeEndMidnight: boolean): string[] {  const out: string[] = [];  const limit = includeEndMidnight ? 1440 : 1440 - stepMinutes;  for (let m = 0; m <= limit; m += stepMinutes) {    out.push(minutesToTime(m));  }  return out;}function detectActivePreset(schedule: WeeklySchedule): "weekdays" | "24x7" | null {  const is9to5 = (slots: TimeSlot[]) => slots.length === 1 && slots[0].start === "09:00" && slots[0].end === "17:00";  const isFull = (slots: TimeSlot[]) => slots.length === 1 && slots[0].start === "00:00" && slots[0].end === "24:00";  if (    DAYS_MON_FIRST.every((d) => (d.weekday ? is9to5(schedule[d.key] ?? []) : (schedule[d.key] ?? []).length === 0))  ) {    return "weekdays";  }  if (DAYS_MON_FIRST.every((d) => isFull(schedule[d.key] ?? []))) {    return "24x7";  }  return null;}/** Hairline sliding segmented preset switcher. */function PresetPill({  active,  reduced,  onSelect,}: {  active: "weekdays" | "24x7" | null;  reduced: boolean;  onSelect: (kind: "weekdays" | "24x7") => void;}) {  const wrapRef = React.useRef<HTMLDivElement | null>(null);  const btnRefs = React.useRef<Record<string, HTMLButtonElement | null>>({});  const [pill, setPill] = React.useState<{ left: number; width: number; ready: boolean }>({    left: 0,    width: 0,    ready: false,  });  React.useLayoutEffect(() => {    const el = active ? btnRefs.current[active] : null;    if (!el) {      setPill((p) => (p.width === 0 ? p : { ...p, width: 0 }));      return;    }    const left = el.offsetLeft;    const width = el.offsetWidth;    setPill((p) => (p.left === left && p.width === width && p.ready ? p : { left, width, ready: true }));  }, [active]);  return (    <div      ref={wrapRef}      role="group"      aria-label="Schedule presets"      className="relative inline-flex items-center rounded-[9px] border border-border bg-muted/50 p-0.5"    >      <span        aria-hidden="true"        className="pointer-events-none absolute inset-y-0.5 left-0 rounded-[7px] bg-background shadow-[inset_0_0.5px_0_rgb(255_255_255/0.8)] dark:shadow-[inset_0_0.5px_0_rgb(255_255_255/0.07)]"        style={{          width: pill.width,          transform: `translate3d(${pill.left}px, 0, 0)`,          opacity: active && pill.width > 0 ? 1 : 0,          transition:            reduced || !pill.ready              ? "none"              : `transform 360ms ${EASE_THROW}, width 320ms ${EASE_OUT}, opacity 180ms ${EASE_OUT}`,        }}      />      {(        [          { id: "weekdays", label: "Mon–Fri 9–5" },          { id: "24x7", label: "24/7" },        ] as const      ).map((item) => {        const on = active === item.id;        return (          <button            key={item.id}            ref={(el) => {              btnRefs.current[item.id] = el;            }}            type="button"            aria-pressed={on}            onClick={() => onSelect(item.id)}            className={`relative z-10 h-6 cursor-pointer rounded-[7px] px-2 text-[11px] font-medium transition-colors duration-150 ${              on ? "text-foreground" : "text-muted-foreground hover:text-foreground"            } ${INTERACTION_FOCUS}`}          >            {item.label}          </button>        );      })}    </div>  );}/** Aligned 24-hour coverage bar with smooth interval transitions and crimson overlap highlight. */function DayCoverageBar({  slots,  hasError,  validMinutes,  reduced,}: {  slots: TimeSlot[];  hasError: boolean;  validMinutes: number;  reduced: boolean;}) {  const hours = Math.floor(validMinutes / 60);  const mins = validMinutes % 60;  const durLabel = validMinutes === 0 ? "Off" : mins === 0 ? `${hours}h` : `${hours}h ${mins}m`;  return (    <div className="hidden items-center gap-2 @[520px]:flex">      <span className="w-10 text-right font-mono text-[10.5px] tabular-nums text-muted-foreground/80">        <TextMorph>{durLabel}</TextMorph>      </span>      <div        aria-hidden="true"        className="relative h-2 w-24 shrink-0 overflow-hidden rounded-full border border-border/70 bg-muted/40"      >        <span className="absolute inset-y-0 left-1/4 w-px bg-border/60" />        <span className="absolute inset-y-0 left-1/2 w-px bg-border/80" />        <span className="absolute inset-y-0 left-3/4 w-px bg-border/60" />        {slots.map((slot, idx) => {          const s = timeToMinutes(slot.start);          const e = timeToMinutes(slot.end);          if (e <= s) return null;          const left = (s / 1440) * 100;          const width = ((e - s) / 1440) * 100;          return (            <span              key={idx}              className={`absolute inset-y-0 rounded-full ${                hasError ? "bg-red-500/85" : "bg-primary/85"              }`}              style={{                left: `${left.toFixed(2)}%`,                width: `${Math.max(1.8, width).toFixed(2)}%`,                transition: reduced ? "none" : `left 320ms ${EASE_OUT}, width 320ms ${EASE_OUT}, background-color 200ms ${EASE_OUT}`,              }}            />          );        })}      </div>    </div>  );}export function WeeklyHours({  value: controlledValue,  defaultValue = DEFAULT_WEEKLY_SCHEDULE,  onChange,  stepMinutes = 30,  hour12 = false,  timezone,  showTimeline = true,  showPresets = true,  weekStartsOnSunday = false,  title = "Working hours",  sound = false,  className = "",  ...props}: WeeklyHoursProps) {  const reduced = useInteractionReducedMotion();  const [ownSchedule, setOwnSchedule] = React.useState<WeeklySchedule>(defaultValue);  const schedule = controlledValue !== undefined ? controlledValue : ownSchedule;  const [copiedFromDay, setCopiedFromDay] = React.useState<WeekdayKey | null>(null);  const [liveStatus, setLiveStatus] = React.useState("");  const copyTimerRef = React.useRef(0);  React.useEffect(    () => () => {      window.clearTimeout(copyTimerRef.current);    },    [],  );  const days = React.useMemo(() => {    if (!weekStartsOnSunday) return DAYS_MON_FIRST;    return [DAYS_MON_FIRST[6], ...DAYS_MON_FIRST.slice(0, 6)];  }, [weekStartsOnSunday]);  const startOptions = React.useMemo<PillOption[]>(    () => buildTimeOptions(stepMinutes, false).map((opt) => ({ value: opt, label: formatTimeDisplay(opt, hour12) })),    [stepMinutes, hour12],  );  const endOptions = React.useMemo<PillOption[]>(    () => buildTimeOptions(stepMinutes, true).map((opt) => ({ value: opt, label: formatTimeDisplay(opt, hour12) })),    [stepMinutes, hour12],  );  const commit = React.useCallback(    (next: WeeklySchedule) => {      if (controlledValue === undefined) setOwnSchedule(next);      onChange?.(next);    },    [controlledValue, onChange],  );  const toggleDay = (key: WeekdayKey) => {    const cur = schedule[key] ?? [];    const nextSlots = cur.length > 0 ? [] : [{ start: "09:00", end: "17:00" }];    commit({ ...schedule, [key]: nextSlots });    if (sound) playSound(nextSlots.length > 0 ? "unfold" : "fold", 0.25);  };  const updateSlot = (key: WeekdayKey, index: number, patch: Partial<TimeSlot>) => {    const cur = schedule[key] ?? [];    const next = cur.map((s, i) => (i === index ? { ...s, ...patch } : s));    commit({ ...schedule, [key]: next });  };  const addSlot = (key: WeekdayKey) => {    const cur = schedule[key] ?? [];    const last = cur[cur.length - 1];    let nextStart = 540;    let nextEnd = 1020;    if (last) {      const lastEnd = timeToMinutes(last.end);      nextStart = Math.min(1380, lastEnd + 60);      nextEnd = Math.min(1440, nextStart + 180);      if (nextEnd <= nextStart) {        nextStart = Math.min(1380, lastEnd);        nextEnd = Math.min(1440, nextStart + 60);      }    }    commit({      ...schedule,      [key]: [...cur, { start: minutesToTime(nextStart), end: minutesToTime(nextEnd) }],    });    if (sound) playSound("tick", 0.28);  };  const removeSlot = (key: WeekdayKey, index: number) => {    const cur = schedule[key] ?? [];    commit({ ...schedule, [key]: cur.filter((_, i) => i !== index) });    if (sound) playSound("fold", 0.24);  };  const copyToWeekdays = (sourceKey: WeekdayKey) => {    const sourceSlots = (schedule[sourceKey] ?? []).map((s) => ({ ...s }));    const next: WeeklySchedule = { ...schedule };    for (const d of DAYS_MON_FIRST) {      if (d.weekday) next[d.key] = sourceSlots.map((s) => ({ ...s }));    }    commit(next);    setCopiedFromDay(sourceKey);    setLiveStatus("Copied hours to Monday through Friday");    if (sound) playSound("success", 0.32);    window.clearTimeout(copyTimerRef.current);    copyTimerRef.current = window.setTimeout(() => setCopiedFromDay(null), 1800);  };  const applyPreset = (kind: "weekdays" | "24x7") => {    if (kind === "weekdays") {      commit({        mon: [{ start: "09:00", end: "17:00" }],        tue: [{ start: "09:00", end: "17:00" }],        wed: [{ start: "09:00", end: "17:00" }],        thu: [{ start: "09:00", end: "17:00" }],        fri: [{ start: "09:00", end: "17:00" }],        sat: [],        sun: [],      });      setLiveStatus("Applied Weekdays 9 to 5 preset");    } else {      commit({        mon: [{ start: "00:00", end: "24:00" }],        tue: [{ start: "00:00", end: "24:00" }],        wed: [{ start: "00:00", end: "24:00" }],        thu: [{ start: "00:00", end: "24:00" }],        fri: [{ start: "00:00", end: "24:00" }],        sat: [{ start: "00:00", end: "24:00" }],        sun: [{ start: "00:00", end: "24:00" }],      });      setLiveStatus("Applied 24/7 open preset");    }    if (sound) playSound("tick", 0.28);  };  const totalMinutes = React.useMemo(() => calculateWeeklyMinutes(schedule), [schedule]);  const totalHours = Math.floor(totalMinutes / 60);  const remMinutes = totalMinutes % 60;  const openDaysCount = React.useMemo(    () => days.filter((d) => (schedule[d.key] ?? []).length > 0).length,    [days, schedule],  );  const anyConflict = React.useMemo(    () =>      days.some((d) => {        const v = validateDaySlots(schedule[d.key] ?? []);        return v.hasInvalid || v.hasOverlap;      }),    [days, schedule],  );  const activePreset = React.useMemo(() => detectActivePreset(schedule), [schedule]);  return (    <div      role="region"      aria-label={title}      data-weekly-minutes={totalMinutes}      data-has-conflict={anyConflict ? "true" : "false"}      className={`@container flex w-full max-w-[620px] flex-col overflow-hidden rounded-[16px] border border-border bg-card text-card-foreground shadow-[inset_0_0.5px_0_rgb(255_255_255/0.75)] dark:shadow-[inset_0_0.5px_0_rgb(255_255_255/0.06)] ${className}`}      {...props}    >      {/* Header */}      <div className="flex flex-wrap items-center justify-between gap-2 border-b border-border/80 bg-muted/20 px-4 py-3">        <div className="flex flex-wrap items-center gap-2">          <Clock className="size-4 text-muted-foreground" strokeWidth={1.9} />          <span className="text-[13px] font-medium tracking-[-0.01em] text-foreground">{title}</span>          <span className="inline-flex items-center gap-1 font-mono text-[11px] tabular-nums text-muted-foreground">            <NumberRoll value={totalHours} suffix="h" duration={500} />            {remMinutes > 0 && <NumberRoll value={remMinutes} suffix="m" duration={450} />}            <span>/ wk ·</span>            <NumberRoll value={openDaysCount} suffix="d" duration={450} />          </span>          {timezone && (            <span className="inline-flex items-center gap-1 rounded-[6px] border border-border/80 bg-background px-1.5 py-0.5 font-mono text-[10.5px] text-muted-foreground">              <Globe className="size-2.5" strokeWidth={2} />              {timezone}            </span>          )}          <span            aria-hidden={!copiedFromDay || undefined}            className="grid"            style={{              gridTemplateColumns: copiedFromDay ? "1fr" : "0fr",              opacity: copiedFromDay ? 1 : 0,              transition: reduced ? "none" : `grid-template-columns 340ms ${EASE_OUT}, opacity 200ms ${EASE_OUT}`,            }}          >            <span className="min-w-0 overflow-hidden">              <span className="inline-flex w-max items-center gap-1 whitespace-nowrap rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[10.5px] font-medium text-emerald-700 dark:text-emerald-300">                <Check className="size-2.5" strokeWidth={2.5} />                Copied to Mon–Fri              </span>            </span>          </span>        </div>        {showPresets && <PresetPill active={activePreset} reduced={reduced} onSelect={applyPreset} />}      </div>      {/* Mon–Sun structured hairline rows */}      <div className="divide-y divide-border/70">        {days.map((day) => {          const slots = schedule[day.key] ?? [];          const enabled = slots.length > 0;          const validation = validateDaySlots(slots);          const hasDayError = validation.hasInvalid || validation.hasOverlap;          const justCopied = copiedFromDay === day.key;          return (            <div              key={day.key}              data-day-row={day.key}              data-enabled={enabled ? "true" : "false"}              className={`grid grid-cols-[1fr_auto] items-center gap-x-2 gap-y-2 px-4 py-2.5 transition-colors duration-200 @[460px]:flex @[460px]:items-start @[460px]:justify-between ${                enabled ? "bg-card" : "bg-muted/[0.14]"              }`}            >              {/* Left: switch + day label */}              <div className="order-1 flex h-8 w-24 shrink-0 items-center gap-2.5">                <button                  type="button"                  role="switch"                  aria-checked={enabled}                  aria-label={`Enable ${day.full}`}                  onClick={() => toggleDay(day.key)}                  className={`relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border transition-colors duration-200 ${                    enabled                      ? "border-primary bg-primary"                      : "border-border bg-muted/70"                  } ${INTERACTION_FOCUS}`}                >                  <span                    className={`block size-3 rounded-full shadow-xs ${                      enabled                        ? "bg-primary-foreground"                        : "bg-muted-foreground/75"                    }`}                    style={{                      transform: enabled ? "translateX(15px)" : "translateX(2px)",                      transition: reduced ? "none" : `transform 280ms ${EASE_THROW}, background-color 180ms ${EASE_OUT}`,                    }}                  />                </button>                <span                  className={`text-[12.5px] font-medium transition-colors duration-150 ${                    enabled ? "text-foreground" : "text-muted-foreground/70"                  }`}                >                  {day.short}                </span>              </div>              {/* Centre: intervals OR Unavailable (on mobile <460px, enabled intervals wrap cleanly under Row 1; Unavailable stays inline on Row 1 right!) */}              <div                className={`flex min-w-0 flex-1 flex-col gap-1.5 ${                  enabled                    ? "order-3 col-span-2 @[460px]:order-2 @[460px]:col-span-1"                    : "order-2 col-span-1 items-end @[460px]:order-2 @[460px]:items-start"                }`}              >                {!enabled ? (                  <div className="flex h-8 items-center text-[12px] text-muted-foreground/65">Unavailable</div>                ) : (                  slots.map((slot, idx) => {                    const slotErr = validation.errors[idx];                    const sList = startOptions.some((o) => o.value === slot.start)                      ? startOptions                      : [{ value: slot.start, label: formatTimeDisplay(slot.start, hour12) }, ...startOptions];                    const eList = endOptions.some((o) => o.value === slot.end)                      ? endOptions                      : [{ value: slot.end, label: formatTimeDisplay(slot.end, hour12) }, ...endOptions];                    const pillW = hour12 ? 114 : 90;                    return (                      <div key={idx} className="flex flex-col">                        <div className="flex flex-wrap items-center gap-1.5">                          <PillSelect                            options={sList}                            value={slot.start}                            onValueChange={(next) => updateSlot(day.key, idx, { start: next })}                            label={`${day.full} interval ${idx + 1} start`}                            mono                            size="sm"                            width={pillW}                            className={slotErr ? "ring-1 ring-red-500/60" : ""}                          />                          <span className="text-[11px] text-muted-foreground">–</span>                          <PillSelect                            options={eList}                            value={slot.end}                            onValueChange={(next) => updateSlot(day.key, idx, { end: next })}                            label={`${day.full} interval ${idx + 1} end`}                            mono                            size="sm"                            width={pillW}                            className={slotErr ? "ring-1 ring-red-500/60" : ""}                          />                          {slots.length > 1 && (                            <button                              type="button"                              aria-label={`Remove ${day.full} interval ${idx + 1}`}                              onClick={() => removeSlot(day.key, idx)}                              className={`inline-flex size-7 cursor-pointer items-center justify-center rounded-[7px] text-muted-foreground hover:bg-accent hover:text-red-600 dark:hover:text-red-400 ${INTERACTION_PRESS} ${INTERACTION_FOCUS}`}                            >                              <Trash2 className="size-3.5" strokeWidth={1.9} />                            </button>                          )}                        </div>                        <div                          aria-hidden={!slotErr || undefined}                          className={`grid ${!slotErr ? "pointer-events-none" : ""}`}                          style={{                            gridTemplateRows: slotErr ? "1fr" : "0fr",                            opacity: slotErr ? 1 : 0,                            transition: reduced ? "none" : `grid-template-rows 260ms ${EASE_OUT}, opacity 180ms ${EASE_OUT}`,                          }}                        >                          <div className="min-h-0 overflow-hidden">                            <span role="alert" className="inline-flex items-center gap-1 pt-1 text-[11px] text-red-600 dark:text-red-400">                              <AlertCircle className="size-3 shrink-0" strokeWidth={2} />                              {slotErr ?? ""}                            </span>                          </div>                        </div>                      </div>                    );                  })                )}              </div>              {/* Right: aligned 24h hairline bar + fixed-width action slot so all 7 bars align */}              <div                className={`order-2 h-8 shrink-0 items-center justify-end gap-2 @[460px]:order-3 ${                  enabled ? "flex" : "hidden @[460px]:flex"                }`}              >                {showTimeline && (                  <DayCoverageBar                    slots={slots}                    hasError={hasDayError}                    validMinutes={validation.validMinutes}                    reduced={reduced}                  />                )}                <div className="flex w-[60px] shrink-0 items-center justify-end gap-1">                  {enabled && (                    <>                      <button                        type="button"                        aria-label={`Add interval for ${day.full}`}                        title="Add split shift interval"                        onClick={() => addSlot(day.key)}                        className={`inline-flex size-7 cursor-pointer items-center justify-center rounded-[7px] text-muted-foreground hover:bg-accent hover:text-foreground ${INTERACTION_PRESS} ${INTERACTION_FOCUS}`}                      >                        <Plus className="size-3.5" strokeWidth={2.1} />                      </button>                      <button                        type="button"                        aria-label={`Copy ${day.full} hours to weekdays`}                        title="Copy to Mon–Fri"                        onClick={() => copyToWeekdays(day.key)}                        className={`relative inline-flex size-7 cursor-pointer items-center justify-center rounded-[7px] hover:bg-accent ${                          justCopied                            ? "text-emerald-600 dark:text-emerald-400"                            : "text-muted-foreground hover:text-foreground"                        } ${INTERACTION_PRESS} ${INTERACTION_FOCUS}`}                      >                        <span aria-hidden="true" className="absolute inset-0 flex items-center justify-center" style={interactionIcon(!justCopied, reduced)}>                          <Copy className="size-3.5" strokeWidth={1.9} />                        </span>                        <span aria-hidden="true" className="absolute inset-0 flex items-center justify-center" style={interactionIcon(justCopied, reduced)}>                          <Check className="size-3.5" strokeWidth={2.3} />                        </span>                      </button>                    </>                  )}                </div>              </div>            </div>          );        })}      </div>      {/* Footer scale legend */}      {showTimeline && (        <div className="flex items-center justify-between border-t border-border/80 bg-muted/15 px-4 py-2 text-[11px] text-muted-foreground">          <TextMorph animateWidth={false}>            {anyConflict ? "Resolve highlighted interval conflicts before saving." : "Click + to split a day around breaks."}          </TextMorph>          <div className="mr-[68px] hidden w-24 items-center justify-between font-mono text-[9.5px] tabular-nums opacity-75 @[520px]:flex">            <span>00</span>            <span>12</span>            <span>24</span>          </div>        </div>      )}      <span className="sr-only" role="status" aria-live="polite">        {liveStatus}      </span>    </div>  );}export default WeeklyHours;

Registry item: /r/weekly-hours.json