PageSourceSearch

https://delsolprimehomes.com/assets/home-carousel-20260928/assets/Articles-ZwRGWW-P.js

js delsolprimehomes.com collected 2026-10-09 00:14:41 UTC 14,873 bytes, 1 lines download raw bytes

1import{u as Fe,x as Ae,r as l,y as De,j as e,B as n,S as qe,X as Pe}from"./index-BDDJAZXa.js";import{u as D}from"./useQuery-8XWlAjvY.js";import{u as X}from"./useMutation-DwgxO8VC.js";import{s as y}from"./client-CofTV22O.js";import{A as J}from"./AdminLayout-DNAYUojp.js";import{I as _e}from"./input-BPZg0m8N.js";import{B as q}from"./badge-B5CtICq9.js";import{C as P,d as _,a as Te,b as Le}from"./card-khlbgs4C.js";import{S as C,a as S,b as w,c as k,d as r}from"./select-DgYRTvbn.js";import{C as W}from"./checkbox-DVCq7JUq.js";import{A as Y,a as Z,b as ee,c as se,d as te,e as re,f as ae,g as le}from"./alert-dialog-BM_sAGJ8.js";import{u as T}from"./index-Bu_MzYVD.js";import{C as Me}from"./circle-alert--LT_k_bH.js";import{L as ie}from"./loader-circle-BP8LykBt.js";import{P as Ue}from"./plus-BHjDxvg3.js";import{T as ne}from"./trash-2-C_lkNrjf.js";import{S as Ee}from"./square-pen-Ds55vOKN.js";import{E as $e}from"./eye-v6sdQGzz.js";import"./sheet-OSLDRbDb.js";import"./index-CrmJ2o_D.js";import"./index-DW48STyt.js";import"./index-hGqNpnwe.js";import"./index-thJdkZrX.js";import"./index-CflSeYQF.js";import"./index-BVUs2AGw.js";import"./index-C_rDSQsw.js";import"./index-CNRWf0Ix.js";import"./index-Cl-kz0ID.js";import"./Combination-B7SE-RVP.js";import"./index-CxSTJoXu.js";import"./collapsible-CWr5qvFb.js";import"./index-BHcMXrYP.js";import"./ThemeToggle-C7ClqKvr.js";import"./dropdown-menu-BgZYjveX.js";import"./index-BLWrFdQk.js";import"./index-gkgIjZ9F.js";import"./index-C7i9B3uw.js";import"./index-C7lZzTMF.js";import"./index-WvHfnCe_.js";import"./chevron-right-DzEo6SEt.js";import"./circle-CLkfCSa2.js";import"./sun-Bie9TmbA.js";import"./moon-Dv8Oq5mh.js";import"./logo-T4Pm7CvP.js";import"./layout-dashboard-8u9MxwTg.js";import"./message-circle-C6L_xbNu.js";import"./file-text-BqpncVXj.js";import"./building-2-brcEVvm-.js";import"./activity-0HPmS0uR.js";import"./image-BCdkmSRI.js";import"./database-CiWy7Uvq.js";import"./copy-Bhm1ttsq.js";import"./link-2-Cnp-2k3p.js";import"./triangle-alert-bpXhAJxP.js";import"./ban-CLsPqF6P.js";import"./shield-DDcTHSe6.js";import"./book-open-Drn86Zhb.js";import"./download-04n1Bpfu.js";import"./settings--RrWsxVm.js";import"./index-BdQq_4o_.js";import"./index-BWBOxNCX.js";import"./index-6tp_2c2X.js";import"./chevron-up-CU6b5bZU.js";const Is=()=>
1{const L=Fe(),[ce,M]=Ae(),F=ce.get("cluster"),[U,oe]=l.useState(""),[b,de]=l.useState(""),[x,me]=l.useState("all"),[g,ue]=l.useState("all"),[p,he]=l.useState("all"),[j,xe]=l.useState("all"),[u,E]=l.useState(F||"all"),[c,v]=l.useState(1),$=20,[i,f]=l.useState([]),[z,O]=l.useState(null),[ge,B]=l.useState(!1);l.useEffect(()=>{const s=setTimeout(()=>{de(U),v(1)},300);return()=>clearTimeout(s)},[U]),l.useEffect(()=>{v(1)},[x,g,p,j,u]),l.useEffect(()=>{F&&E(F)},[F]);const G=s=>{let t=s;return p!=="all"&&(t=t.eq("language",p)),x!=="all"&&(t=t.eq("status",x)),g!=="all"&&(t=t.eq("category",g)),j!=="all"&&(t=t.eq("funnel_stage",j)),u!=="all"&&(t=t.eq("cluster_id",u)),b&&(t=t.or(`headline.ilike.%${b}%,slug.ilike.%${b}%`)),t},{data:h,isLoading:pe}=D({queryKey:["articles-count",x,g,p,j,u,b],queryFn:async()=>{let s=y.from("blog_articles").select("*",{count:"exact",head:!0});s=G(s);const{count:t,error:a}=await s;if(a)throw a;return t||0}}),{data:je,isLoading:fe,error:Q}=D({queryKey:["articles",c,x,g,p,j,u,b],queryFn:async()=>{const s=(c-1)*$,t=s+$-1;let a=y.from("blog_articles").select("*").order("updated_at",{ascending:!1}).range(s,t);a=G(a);const{data:d,error:m}=await a;if(m)throw m;return d||[]}}),{data:K}=D({queryKey:["cluster-ids"],queryFn:async()=>{const{data:s,error:t}=await y.from("blog_articles").select("cluster_id, cluster_theme").not("cluster_id","is",null);if(t)throw t;const a=new Map;return s.forEach(d=>{d.cluster_id&&!a.has(d.cluster_id)&&a.set(d.cluster_id,d.cluster_theme)}),Array.from(a.entries()).map(([d,m])=>({id:d,theme:m}))}}),{data:V}=D({queryKey:["categories"],queryFn:async()=>{const{data:s,error:t}=await y.from("categories").select("name").order("name");if(t)throw t;return s}}),A=De(),H=X({mutationFn:async s=>{const{error:t}=await y.from("blog_articles").delete().eq("id",s);if(t)throw t},onSuccess:()=>{A.invalidateQueries({queryKey:["articles"]}
1),A.invalidateQueries({queryKey:["articles-count"]}),T.success("Article deleted successfully"),O(null)},onError:s=>{T.error(`Failed to delete article: ${s.message}`)}}),R=X({mutationFn:async s=>{const{error:t}=await y.from("blog_articles").delete().in("id",s);if(t)throw t;return s.length},onSuccess:s=>{A.invalidateQueries({queryKey:["articles"]}),A.invalidateQueries({queryKey:["articles-count"]}),T.success(`Successfully deleted ${s} article${s>1?"s":""}`),f([]),B(!1)},onError:s=>{T.error(`Failed to delete articles: ${s.message}`)}});if(Q)return e.jsx(J,{children:e.jsx("div",{className:"container mx-auto p-6",children:e.jsx(P,{children:e.jsx(_,{className:"py-12",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(Me,{className:"h-16 w-16 mx-auto text-destructive"}),e.jsx("h2",{className:"text-2xl font-bold",children:"Unable to Load Articles"}),e.jsx("p",{className:"text-muted-foreground max-w-md mx-auto",children:Q instanceof Error?Q.message:"There was a problem loading your articles. Please try again."}),e.jsx(n,{onClick:()=>window.location.reload(),children:"Reload Page"})]})})})})});const ye=()=>{E("all"),M({})},o=Math.ceil((h||0)/$),N=je||[],be=s=>{f(s?N.map(t=>t.id):[])},ve=(s,t)=>{f(t?[...i,s]:i.filter(a=>a!==s))},I=N.length>0&&N.every(s=>i.includes(s.id)),Ne=i.length>0&&!I,Ce=s=>{switch(s){case"published":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300";case"draft":return"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300";case"archived":return"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"}},Se=s=>{switch(s){case"TOFU":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300";case"MOFU":return"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300";case"BOFU":return"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"}},we=()=>{const s=[];if(o<=7)return Array.from({length:o},(m,ke)=>ke+1);s.push(1),c>3&&s.push("...");const a=Math.max(2,c-1),d=Math.min(o-1,c+1);for(let m=a;m<=d;m++)s.push(m);return c<o-2&&s.push("..."),o>1&&s.push(o),s};return e.jsx(J,{children:e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Articles"}),e.jsxs("p",{className:"text-muted-foreground",children:["Manage your blog content",pe?e.jsx(ie,{className:"inline-block ml-2 h-4 w-4 animate-spin"}):e.jsxs("span",{children:[" (",(h==null?void 0:h.toLocaleString())||0," total)"]})]})]}),e.jsxs(n,{onClick:()=>L("/admin/articles/new"),size:"lg",children:[e.jsx(Ue,{className:"mr-2 h-5 w-5"}),"Create Article"]})]}),i.length>0&&e.jsx(P,{className:"border-amber-500/50 bg-amber-50 dark:bg-amber-950/20",children:e.jsx(_,{className:"py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("p",{className:"text-sm font-medium",children:[i.length," article",i.length>1?"s":""," selected"]}),e.jsx(n,{variant:"ghost",size:"sm",onClick:()=>f([]),children:"Clear Selection"})]}),e.jsxs(n,{variant:"destructive",size:"sm",onClick:()=>B(!0),disabled:R.isPending,children:[e.jsx(ne,{className:"mr-2 h-4 w-4"}),"Delete Selected"]})]})})}),e.jsxs(P,{children:[e.jsx(Te,{children:e.jsx(Le,{children:"Filters & Search"})}),e.jsxs(_,{className:"space-y-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(qe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(_e,{placeholder:"Search by headline or slug...",value:U,onChange:s=>oe(s.target.value),className:"pl-10"})]}),u!=="all"&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-primary/10 rounded-lg border border-primary/20",children:[e.jsx("span",{className:"text-sm font-medium",children:"Filtering by cluster:"}),e.jsxs("code",{className:"text-xs bg-muted px-2 py-0.5 rounded font-mono",children:[u.slice(0,8),"..."]}),e.jsxs(n,{variant:"ghost",size:"sm",className:"h-6 px-2 ml-auto",onClick:ye,children:[e.jsx(Pe,{className:"h-4 w-4 mr-1"}),"Clear"]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-5",children:[e.jsxs(C,{value:x,onValueChange:me,children:[e.jsx(S,{children:e.jsx(w,{placeholder:"Status"})}),e.jsxs(k,{children:[e.jsx(r,{value:"all",children:"All Statuses"}),e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"published",children:"Published"}),e.jsx(r,{value:"archived",children:"Archived"})]})]}),e.jsxs(C,{value:g,onValueChange:ue,children:[e.jsx(S,{children:e.jsx(w,{placeholder:"Category"})}),e.jsxs(k,{children:[e.jsx(r,{value:"all",children:"All Categories"}),V==null?void 0:V.map(s=>e.jsx(r,{value:s.name,children:s.name},s.name))]})]}),e.jsxs(C,{value:p,onValueChange:he,children:[e.jsx(S,{children:e.jsx(w,{placeholder:"Language"})}),e.jsxs(k,{children:[e.jsx(r,{value:"all",children:"All Languages"}),e.jsx(r,{value:"en",children:"English"}),e.jsx(r,{value:"es",children:"Spanish"}),e.jsx(r,{value:"de",children:"German"}),e.jsx(r,{value:"nl",children:"Dutch"}),e.jsx(r,{value:"fr",children:"French"}),e.jsx(r,{value:"pl",children:"Polish"}),e.jsx(r,{value:"sv",children:"Swedish"}),e.jsx(r,{value:"da",children:"Danish"}),e.jsx(r,{value:"hu",children:"Hungarian"}),e.jsx(r,{value:"fi",children:"Finnish"}),e.jsx(r,{value:"no",children:"Norwegian"})]})]}),e.jsxs(C,{value:j,onValueChange:xe,children:[e.jsx(S,{children:e.jsx(w,{placeholder:"Funnel Stage"})}),e.jsxs(k,{children:[e.jsx(r,{value:"all",children:"All Stages"}),e.jsx(r,{value:"TOFU",children:"TOFU"}),e.jsx(r,{value:"MOFU",children:"MOFU"}),e.jsx(r,{value:"BOFU",children:"BOFU"})]})]}),e.jsxs(C,{value:u,onValueChange:s=>{E(s),M(s==="all"?{}:{cluster:s})},children:[e.jsx(S,{children:e.jsx(w,{placeholder:"Cluster"})}),e.jsxs(k,{children:[e.jsx(r,{value:"all",children:"All Cluster
1s"}),K==null?void 0:K.map(s=>e.jsx(r,{value:s.id,children:s.theme?`${s.theme.slice(0,30)}...`:s.id.slice(0,8)},s.id))]})]})]})]})]}),e.jsx(P,{children:e.jsx(_,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"border-b bg-muted/50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left",children:e.jsx(W,{checked:I,onCheckedChange:be,"aria-label":"Select all articles",className:Ne?"data-[state=checked]:bg-amber-500":""})}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Headline"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Category"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Lang"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Funnel"}),e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium",children:"Updated"}),e.jsx("th",{className:"px-4 py-3 text-right text-sm font-medium",children:"Actions"})]})}),e.jsx("tbody",{className:"divide-y",children:fe?e.jsx("tr",{children:e.jsxs("td",{colSpan:8,className:"px-4 py-8 text-center text-muted-foreground",children:[e.jsx(ie,{className:"h-6 w-6 animate-spin mx-auto mb-2"}),"Loading articles..."]})}):N.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-8 text-center text-muted-foreground",children:"No articles found"})}):N.map(s=>e.jsxs("tr",{className:"hover:bg-muted/50",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsx(W,{checked:i.includes(s.id),onCheckedChange:t=>ve(s.id,t),"aria-label":`Select ${s.headline}`})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(q,{className:`capitalize ${Ce(s.status)}`,children:s.status})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("p",{className:"font-medium truncate",children:s.headline}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.slug})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(q,{variant:"outline",children:s.category})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(q,{variant:"secondary",children:s.language.toUpperCase()})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(q,{className:Se(s.funnel_stage),children:s.funnel_stage})}),e.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground",children:new Date(s.updated_at).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(n,{size:"sm",variant:"ghost",onClick:()=>L(`/admin/articles/${s.id}/edit`),children:e.jsx(Ee,{className:"h-4 w-4"})}),e.jsx(n,{size:"sm",variant:"ghost",onClick:()=>L(`/${s.language}/blog/${s.slug}`),children:e.jsx($e,{className:"h-4 w-4"})}),e.jsx(n,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>O(s.id),disabled:H.isPending,children:e.jsx(ne,{className:"h-4 w-4"})})]})})]},s.id))})]})})})}),o>1&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Page ",c," of ",o," (",h==null?void 0:h.toLocaleString()," articles)"]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(n,{variant:"outline",size:"sm",onClick:()=>v(s=>Math.max(1,s-1)),disabled:c===1,children:"Previous"}),we().map((s,t)=>typeof s=="number"?e.jsx(n,{variant:c===s?"default":"outline",size:"sm",onClick:()=>v(s),className:"min-w-[40px]",children:s},t):e.jsx("span",{className:"px-2 text-muted-foreground",children:s},t)),e.jsx(n,{variant:"outline",size:"sm",onClick:()=>v(s=>Math.min(o,s+1)),disabled:c===o,children:"Next"})]})]}),e.jsx(Y,{open:!!z,onOpenChange:()=>O(null),children:e.jsxs(Z,{children:[e.jsxs(ee,{children:[e.jsx(se,{children:"Delete Article?"}),e.jsx(te,{children:"This action cannot be undone. This will permanently delete the article and all its associated data."})]}),e.jsxs(re,{children:[e.jsx(ae,{children:"Cancel"}),e.jsx(le,{onClick:()=>z&&H.mutate(z),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:H.isPending?"Deleting...":"Delete"})]})]})}),e.jsx(Y,{open:ge,onOpenChange:B,children:e.jsxs(Z,{children:[e.jsxs(ee,{children:[e.jsxs(se,{children:["Delete ",i.length," Articles?"]}),e.jsxs(te,{children:["This action cannot be undone. This will permanently delete"," ",i.length," article",i.length>
11?"s":""," ","and all associated data."]})]}),e.jsxs(re,{children:[e.jsx(ae,{children:"Cancel"}),e.jsx(le,{onClick:()=>R.mutate(i),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:R.isPending?"Deleting...":"Delete All"})]})]})})]})})};export{Is 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.