PageSourceSearch

https://naveliaindonesia.com/assets/AdminYachts-DpYUQxWR.js

js naveliaindonesia.com collected 2026-09-30 18:45:42 UTC 4,871 bytes, 6 lines download raw bytes

1import{r as d,j as e,t as m}from"./index-s0HIRwyY.js";import{c as C,d as L,L as u}from"./act-platform-aerial-CSLVFaor.js";import{s as c}from"./client-BWh-Wkd0.js";import{B as i}from"./index-MSCZTdil.js";import{I as z}from"./input-D4RvwY-1.js";import{C as _,a as k,b as y,c as F,B as p}from"./badge-CpjkAqZq.js";import{F as P}from"./file-text-DF-Q4pPq.js";import{P as B}from"./plus-BoGar_8A.js";import{L as S}from"./log-out-CMaeCS8y.js";import{L as E}from"./loader-circle-DwdrvzMd.js";import"./index-BBMGpB2m.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const U=C("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);function G(){const f=L(),[h,n]=d.useState([]),[g,x]=d.useState(!0),[r,j]=d.useState("");async function b(){x(!0);const{data:s,error:a}=await c.from("yachts").select("id, slug, name, sort, published, featured, price_from, price_label, hero_image_thumbnail, guests, cabins").order("sort",{ascending:!0});a?m({title:"Failed to load yachts",description:a.message,variant:"destructive"}):n(s||[]),x(!1)}d.useEffect(()=>{b()},[]);const l=d.useMemo(()=>h.filter(s=>!r||s.name.toLowerCase().includes(r.toLowerCase())||s.slug.toLowerCase().includes(r.toLowerCase())),[h,r]);async function v(s){const{error:a}=await c.from("yachts").update({published:!s.published}).eq("id",s.id);a?m({title:"Update failed",description:a.message,variant:"destructive"}):n(o=>o.map(t=>t.id===s.id?{...t,published:!s.published}:t))}async function N(s){const{error:a}=await c.from("yachts").update({featured:!s.featured}).eq("id",s.id);a?m({title:"Update failed",description:a.message,variant:"destructive"}):n(o=>o.map(t=>t.id===s.id?{...t,featured:!s.featured}:t))}async function w(){await c.auth.signOut(),f("/admin/login",{replace:!0})}return e.jsxs("main",{className:"min-h-screen bg-background pb-16",children:[e.jsx("div",{className:"border-b border-border bg-card",children:e.jsxs("div",{className:"container mx-auto flex flex-wrap items-center justify-between gap-3 px-6 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-display",children:"Yacht Admin"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage fleet directly from Lovable."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(i,{asChild:!0,variant:"outline",size:"sm",children:e.jsxs(u,{to:"/admin/brochures",children:[e.jsx(P,{size:14,className:"mr-2"})," Brochures"]})}),e.jsx(i,{asChild:!0,size:"sm",children:e.jsxs(u,{to:"/admin/yachts/new",children:[e.jsx(B,{size:14,className:"mr-2"})," New yacht"]})}),e.jsxs(i,{onClick:w,variant:"ghost",size:"sm",children:[e.jsx(S,{size:14,className:"mr-2"})," Logout"]})]})]})}),e.jsx("div",{className:"container mx-auto px-6 pt-6",children:e.jsxs(_,{children:[e.jsxs(k,{className:"flex flex-row items-center justify-between gap-4",children:[e.jsxs(y,{className:"text-base",children:[l.length," yachts"]}),e.jsx(z,{placeholder:"Search by name or slug…",value:r,onChange:s=>j(s.target.value),className:"max-w-xs"})]}),e.jsx(F,{className:"px-0",children:g?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(E,{className:"animate-spin text-muted-foreground"})}):l.length===0?e.jsxs("div",{className:"px-6 py-12 text-center text-sm text-muted-foreground",children:["No yachts yet. Click ",e.jsx("strong",{children:"New yacht"})," to create one from scratch."]}):e.jsx("div",{className:"divide-y divide-border",children:l.map(s=>e.jsxs("div",{className:"flex flex-wrap items-center gap-4 px-6 py-3 hover:bg-muted/30",children:[s.hero_image_thumbnail?e.jsx("img",{src:s.hero_image_thumbnail,alt:s.name,loading:"lazy",className:"h-14 w-20 rounded object-cover"}):e.jsx("div",{className:"h-14 w-20 rounded bg-muted"}),e.jsxs("div",{className:"flex-1 min-w-[180px]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:s.name}),e.jsxs("code",{className:"text-xs text-muted-foreground",children:["/",s.slug]}),!s.published&&e.jsx(p,{variant:"outline",children:"Hidden"}),s.featured&&e.jsx(p,{children:"Featured"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[s.price_label||`$${s.price_from}`," · ",s.guests," guests · ",s.cabins," cabins"]})]}),e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>v(s),children:s.published?"Unpublish":"Publish"}),e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>N(s),children:s.featured?"Unfeature":"Feature"}),e.jsx(i,{asChild:!0,size:"sm",children:e.jsxs(u,{to:`/admin/yachts/${s.id}`,children:[e.jsx(U,{size:14,className:"mr-2"})," Edit"]})})]},s.id))})})]})})]})}export{G as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.