fix(layout): migrate date pickers to useViewportTier mobile-only
All checks were successful
Build & Push Docker Images / lint (push) Successful in 2m33s
Build & Push Docker Images / build-and-push (push) Successful in 6m59s

Final Bucket 1 visual-audit follow-up. Audit of all 4 useIsMobile
callers:
- pipeline-chart.tsx + pipeline-funnel-chart.tsx → keep useIsMobile
  (short x-axis stage labels apply on tablet too — bar charts can't
  fit full "Reservation" / "Deposit Paid" text at narrow widths).
- date-picker.tsx + date-time-picker.tsx → migrate to useViewportTier.
  Tablet (768-1023) has plenty of room for the desktop Popover
  Calendar; only the smallest phone widths now fall back to the
  native datepicker input.

1454/1454 vitest, tsc clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-22 14:06:50 +02:00
parent c24f9e5508
commit 9ae7940a04
3 changed files with 12 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ import { Button, type ButtonProps } from '@/components/ui/button';
import { Calendar } from '@/components/ui/calendar';
import { Input } from '@/components/ui/input';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { useIsMobile } from '@/hooks/use-is-mobile';
import { useViewportTier } from '@/hooks/use-is-mobile';
import { cn } from '@/lib/utils';
export interface DatePickerProps {
@@ -76,8 +76,11 @@ export function DatePicker({
name,
forceVariant,
}: DatePickerProps) {
const isMobile = useIsMobile();
const variant = forceVariant ?? (isMobile ? 'mobile' : 'desktop');
// Strict mobile only — tablet (768-1023) has room for the desktop
// Popover Calendar; only the smallest phone widths fall back to the
// native datepicker input.
const tier = useViewportTier();
const variant = forceVariant ?? (tier === 'mobile' ? 'mobile' : 'desktop');
const [open, setOpen] = React.useState(false);
const selected = parseIso(value);

View File

@@ -8,7 +8,7 @@ import { Button, type ButtonProps } from '@/components/ui/button';
import { Calendar } from '@/components/ui/calendar';
import { Input } from '@/components/ui/input';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { useIsMobile } from '@/hooks/use-is-mobile';
import { useViewportTier } from '@/hooks/use-is-mobile';
import { cn } from '@/lib/utils';
export interface DateTimePickerProps {
@@ -63,8 +63,10 @@ export function DateTimePicker({
name,
forceVariant,
}: DateTimePickerProps) {
const isMobile = useIsMobile();
const variant = forceVariant ?? (isMobile ? 'mobile' : 'desktop');
// Strict mobile only — tablet has room for the desktop Popover; only
// the smallest phone widths fall back to the native datetime-local input.
const tier = useViewportTier();
const variant = forceVariant ?? (tier === 'mobile' ? 'mobile' : 'desktop');
const [open, setOpen] = React.useState(false);
const { date, time } = parseDateTime(value);
const displayTime = time || '09:00';