import { Form, Head, Link } from '@inertiajs/react'; import StoreController from '@/actions/App/Http/Controllers/StoreController'; import Heading from '@/components/heading'; import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { dashboard } from '@/routes'; import { create } from '@/routes/stores'; import type { SelectOption } from '@/types'; const fieldClass = 'w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm'; /** * The store name typed on our home page, if any: from the address (?name=...) or, after signing up, * kept in this browser. Empty otherwise. */ function pendingName(): string { if (typeof window === 'undefined') { return ''; } const fromAddress = new URLSearchParams(window.location.search).get('name'); if (fromAddress) { return fromAddress.slice(0, 60); } try { return (window.localStorage.getItem('pending-store-name') ?? '').slice( 0, 60, ); } catch { return ''; } } function forgetPendingName(): void { try { window.localStorage.removeItem('pending-store-name'); } catch { // Nothing to forget when storage is blocked. } } export default function CreateStore({ categories, languages, }: { categories: SelectOption[]; languages: SelectOption[]; }) { return ( <>
{({ processing, errors }) => ( <>