import { APPEARANCE_FIELD_ROW, APPEARANCE_GRID, AppearanceChoices, AppearanceControls, AppearancePresets, AppearanceSection, } from "@/components/ui/appearance-design"; import { AppearancePreview } from "@/components/ui/appearance-preview"; import { NumberStepper } from "@/components/ui/number-stepper"; /** * Shipment Tracking Appearance Tab * * Full appearance customization with live preview. * Follows the Product Addons Customization Tab pattern. * - Customize Design on the left with collapsible accordion sections * - Live Preview on the right (sticky) * - Free: Colors + Form Content * - Pro: Typography, Spacing & Dimensions, Layout */ import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { GlobalColorPicker } from "@/components/ui/global-color-picker"; import { GlobalTypographyPicker, resolveGlobalTypography, } from "@/components/ui/global-typography-picker"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import { usePro } from "@/contexts/pro-context"; import { useId, useState } from "react"; import { getGoogleFontUrl } from "@/lib/google-fonts"; import { TrackingFormCustomization, TrackingSettings, defaultCustomization, quickStartPresets, } from "../../types"; interface AppearanceTabProps { settings: TrackingSettings; updateSetting: ( key: K, value: TrackingSettings[K], ) => void; } /* ------------------------------------------------------------------ */ /* Reusable inline helpers */ /* ------------------------------------------------------------------ */ function SegmentedControl({ value, onChange, options, }: { value: T; onChange: (v: T) => void; options: { value: T; label: string }[]; }) { return ( onChange(value as T)} options={options} /> ); } /* ------------------------------------------------------------------ */ /* Main component */ /* ------------------------------------------------------------------ */ export function AppearanceTab({ settings, updateSetting }: AppearanceTabProps) { const { isPro } = usePro(); const c = settings.customization || defaultCustomization; const updateC = ( key: K, value: TrackingFormCustomization[K], ) => { updateSetting("customization", { ...c, [key]: value }); }; const resetDesign = () => { updateSetting("customization", { ...defaultCustomization }); }; const designPresets = quickStartPresets.map((preset) => ({ id: preset.id, name: preset.label, description: `${preset.label} tracking form`, values: preset.customization, })); /* ------------------------------------------------------------------ */ /* Live Preview */ /* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */ /* Render */ /* ------------------------------------------------------------------ */ return (
{/* Left Column */}
updateSetting("customization", { ...c, ...values }) } isPro={isPro} /> {/* Customize Design */}
updateSetting("form_title", e.target.value)} placeholder="Track Your Order" />