import { Form } from '@inertiajs/react'; import { ExternalLink, Globe, GlobeLock } from 'lucide-react'; import StorePublishController from '@/actions/App/Http/Controllers/StorePublishController'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { formatDateTime } from '@/lib/money'; import type { Store } from '@/types'; /** * Shows whether the store is live, where shoppers open it, and the buttons to publish or take it offline. */ export default function PublishPanel({ store, busy, }: { store: Store; busy: boolean; }) { const address = store.live_url.replace(/^https?:\/\//, ''); if (!store.is_published) { return (

Your store is not live

Only you can see it. When you publish, shoppers can open it at{' '} {address} .

{({ processing }) => ( )}
); } return (

Your store is live

{address}

Last published {formatDateTime(store.published_at)}

Take your store offline? Shoppers will no longer be able to open{' '} {address}. Your design, products and orders are kept, and you can publish again any time.
{({ processing }) => ( )}
{store.has_unpublished_changes && (

You changed the design since you last published. Shoppers still see the older version.

{({ processing }) => ( )}
)}
); }