'use client'; import dynamic from 'next/dynamic'; import type { UseFormRegister, UseFormSetValue, UseFormWatch, FieldErrors } from 'react-hook-form'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Select } from '@/components/ui/select'; import { Textarea } from '@/components/ui/textarea'; import { TRANSACTION_TYPES, PROPERTY_TYPES, DIRECTIONS, FURNISHING_OPTIONS, PROPERTY_CONDITION_OPTIONS, type CreateListingFormData, } from '@/lib/validations/listings'; // Mapbox picker is client-only + imports `mapbox-gl` which pulls WebGL // utilities — dynamic-import with ssr:false to keep it out of the server // bundle. const LocationPicker = dynamic( () => import('@/components/map/location-picker').then((m) => m.LocationPicker), { ssr: false, loading: () => (
Đang tải bản đồ...
), }, ); interface StepProps { register: UseFormRegister; errors: FieldErrors; } interface StepLocationProps extends StepProps { /** Optional — when provided, StepLocation renders the Mapbox picker and * writes latitude/longitude (+ auto-fills address/ward/district/city on * geocoder pick) into the form state. */ setValue?: UseFormSetValue; watch?: UseFormWatch; } function FieldError({ message }: { message?: string }) { if (!message) return null; return

{message}

; } // ─── Step 1: Basic Info ────────────────────────────────── export function StepBasicInfo({ register, errors }: StepProps) { return (

Thông tin cơ bản