PageSourceSearch

https://www.localspace.com.au/assets/AdminDirectoryPage-CC9fOPra.js

js localspace.com.au collected 2026-10-03 18:17:22 UTC 6,527 bytes, 6 lines download raw bytes

1import{c as k,a4 as M,a5 as C,i as E,r as d,j as e,F as S,L as R,h as m,M as D,P,B as t,T as B,Q as _}from"./index-ecIq6INl.js";import{C as u}from"./Card-Bwqgvsh8.js";import{E as T,a as A}from"./ErrorMessage-B8eV_cH6.js";import{f as F}from"./utils-fJxONHoi.js";import{C as L}from"./clock-CvqAKoa0.js";import{M as z}from"./mail-31GgzXan.js";import{G}from"./globe-BPajB2t-.js";import"./file-text-C--Bbtsp.js";/**
2 * @license lucide-react v0.344.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 H=k("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);function U(){const{entries:i,loading:f,error:x,refetch:h}=M(),{moderateEntry:p,loading:l}=C(),{showToast:a}=E(),[g,n]=d.useState(null),[r,c]=d.useState(""),[N,o]=d.useState(!1),v=async s=>{await p(s,"approved","Approved by moderator")?(a("Directory listing approved and verified","success"),h()):a("Failed to approve listing","error")},w=s=>{n(s),o(!0)},b=async()=>{if(!g||!r.trim()){a("Please provide a reason for rejection","error");return}await p(g,"rejected",r)?(a("Directory listing rejected with feedback sent to owner","success"),o(!1),n(null),c(""),h()):a("Failed to reject listing","error")},y=s=>{const j={"Food & Dining":"warning","Retail & Shopping":"primary","Health & Wellness":"success","Professional Services":"secondary",Education:"primary",Entertainment:"warning","Sports & Recreation":"success"};return e.jsx(m,{variant:j[s]||"default",children:s})};return f?e.jsx("div",{className:"bg-neutral-50 min-h-screen",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16",children:e.jsx(S,{})})}):x?e.jsx("div",{className:"bg-neutral-50 min-h-screen",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16",children:e.jsx(T,{message:x})})}):e.jsx("div",{className:"bg-neutral-50 min-h-screen",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex items-center gap-4 mb-4",children:e.jsx(R,{to:"/admin",className:"text-primary-600 hover:text-primary-800",children:"← Back to Dashboard"})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-neutral-900",children:"Directory Moderation"}),e.jsx("p",{className:"mt-2 text-lg text-neutral-600",children:"Review and moderate business directory submissions"})]}),e.jsxs(m,{variant:"warning",className:"text-lg px-4 py-2",children:[e.jsx(L,{className:"w-5 h-5 inline mr-2"}),i.length," Pending"]})]})]}),i.length===0?e.jsx(A,{title:"No pending listings",message:"There are no directory listings awaiting moderation."}):e.jsx("div",{className:"space-y-6",children:i.map(s=>e.jsx(u,{className:"p-6",children:e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6",children:[e.jsx("div",{className:"flex-1",children:e.jsxs("div",{className:"flex items-start gap-4",children:[s.image_url&&e.jsx("img",{src:s.image_url,alt:s.name,className:"w-20 h-20 object-cover rounded-lg"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2 flex-wrap",children:[e.jsx("h3",{className:"text-xl font-semibold text-neutral-900",children:s.name}),y(s.category),s.subcategory&&e.jsx(m,{variant:"default",children:s.subcategory})]}),e.jsx("p",{className:"text-neutral-600 mb-3 line-clamp-2",children:s.description}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 text-sm text-neutral-500",children:[s.address&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(D,{className:"w-4 h-4"}),e.jsx("span",{className:"truncate",children:s.address})]}),s.phone&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{className:"w-4 h-4"}),e.jsx("span",{children:s.phone})]}),s.email&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),e.jsx("span",{className:"truncate",children:s.email})]}),s.website&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{className:"w-4 h-4"}),e.jsx("a",{href:s.website,target:"_blank",rel:"noopener noreferrer",className:"text-primary-600 hover:text-primary-800 truncate",children:s.website})]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-neutral-500 flex-wrap",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(H,{className:"w-4 h-4"}),s.location_name]}),e.jsxs("span",{children:["Owner: ",s.owner_name]}),e.jsxs("span",{children:["Submitted: ",F(s.created_at)]})]}),s.hours&&e.jsxs("div",{className:"mt-3 text-sm text-neutral-600",children:[e.jsx("strong",{children:"Hours:"})," ",s.hours]})]})]})}),e.jsxs("div",{className:"flex lg:flex-col gap-3 lg:min-w-[160px]",children:[e.jsxs(t,{variant:"primary",onClick:()=>v(s.id),disabled:l,className:"flex-1 lg:flex-none min-h-[44px]",children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),"Approve"]}),e.jsxs(t,{variant:"secondary",onClick:()=>w(s.id),disabled:l,className:"flex-1 lg:flex-none min-h-[44px]",children:[e.jsx(_,{className:"w-4 h-4 mr-2"}),"Reject"]})]})]})},s.id))}),N&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:e.jsxs(u,{className:"w-full max-w-md p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Rejection Reason"}),e.jsx("p",{className:"text-sm text-neutral-600 mb-4",children:"Please provide a reason for rejecting this listing. This will be sent to the owner."}),e.jsx("textarea",{value:r,onChange:s=>c(s.target.value),placeholder:"Enter rejection reason...",className:"w-full border border-neutral-300 rounded-lg p-3 mb-4 min-h-[100px] focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx(t,{variant:"secondary",onClick:()=>{o(!1),n(null),c("")},children:"Cancel"}),e.jsx(t,{variant:"primary",onClick:b,disabled:l||!r.trim(),children:"Submit Rejection"})]})]})})]})})}export{U as AdminDirectoryPage};

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.