PageSourceSearch

https://care.soberpedia.ai/assets/ServicesPatientView-Ci2DtEOg.js

js soberpedia.ai collected 2026-10-05 15:10:54 UTC 7,470 bytes, 1 lines download raw bytes

1import{r as o,j as e}from"./react-vendor-CU6Sz31W.js";import{q as D,o as O,e as L,f as R}from"./firebase-w6DYUbFN.js";import{u as V,al as G,g4 as H,as as z,f$ as E,C as h,cr as F,I as U,a0 as P,a1 as J,g5 as $,ef as K}from"./index-DEXJEDAi.js";import{P as Q}from"./pill-filter-CtZSNPVl.js";import{C as W}from"./clear-filters-button-DmPemFGr.js";import{R as X}from"./results-count-aqwZczYW.js";import{u as Y}from"./usePatientNavCopy-Cuv_jdT5.js";import{b as Z,f as ee,c as se,s as te}from"./publicBooking-BngukJGw.js";import{R as ae}from"./RoutePageHeader-9W0v4VlT.js";import"./payment-icons-Daq1K3F1.js";import"./RoutePageHeaderContent-FkxdZGox.js";const A="grid gap-4 sm:grid-cols-2 xl:grid-cols-3";function re(t){return typeof t!="number"||Number.isNaN(t)?null:t===0?"Included":`$${t.toFixed(2)}`}function ne(t){return typeof t!="number"||t<=0?null:`${t} min`}function le(t){const a=t.data()||{};return(a.status||"active")==="inactive"||a.addOnOnly===!0?null:{id:t.id,name:a.name||"Service",description:a.description||"",categoryId:a.categoryId||null,duration:typeof a.duration=="number"?a.duration:null,price:typeof a.price=="number"?a.price:null}}function oe(t){const a=t.data()||{};return{id:t.id,name:a.name||"Category",parentCategoryId:a.parentCategoryId||null,depth:typeof a.depth=="number"?a.depth:0,order:typeof a.order=="number"?a.order:0}}function ie({service:t,categoryName:a,accentColor:x}){const p=re(t.price),c=ne(t.duration);return e.jsx(h,{className:"flex h-full flex-col overflow-hidden rounded-2xl border border-subtle dark:bg-slate-800",children:e.jsxs("div",{className:"flex flex-1 flex-col p-5",children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"font-display text-base font-semibold text-content-primary",children:t.name}),a?e.jsx("p",{className:"mt-1 text-xs font-medium uppercase tracking-wide text-content-tertiary",children:a}):null]}),e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-full",style:{backgroundColor:`${x}14`,color:x},children:e.jsx($,{className:"size-4","aria-hidden":!0})})]}),t.description?e.jsx("p",{className:"mb-4 line-clamp-3 text-sm text-content-secondary",children:t.description}):e.jsx("div",{className:"mb-4 flex-1"}),e.jsxs("div",{className:"mt-auto flex flex-wrap items-center gap-3 border-t border-slate-100 pt-4 text-sm dark:border-slate-700",children:[p?e.jsx("span",{className:"font-semibold tabular-nums text-content-primary",children:p}):null,c?e.jsxs("span",{className:"inline-flex items-center gap-1 text-content-tertiary",children:[e.jsx(K,{className:"size-3.5","aria-hidden":!0}),c]}):null]})]})})}function je(){const{userDoc:t}=V(),{branding:a}=G(),x=Y("services",{title:"Services"}),p=(a==null?void 0:a.accentColor)||"#0f172a",c=(t==null?void 0:t.businessId)||null,y=H(t),[d,j]=o.useState([]),[m,N]=o.useState([]),[T,g]=o.useState(!0),[b,S]=o.useState(""),[f,I]=o.useState([]);o.useEffect(()=>{if(!y||!c){j([]),N([]),g(!1);return}g(!0);const s=D(L(z,"Businesses",c,"ServiceCategories"),O("order","asc")),r=L(z,"Businesses",c,"Services"),n=E(R(s,i=>{N(i.docs.map(oe))},()=>N([]))),l=E(R(r,i=>{j(i.docs.map(le).filter(Boolean)),g(!1)},()=>{j([]),g(!1)}));return()=>{n(),l()}},[y,c]);const k=o.useMemo(()=>Z(m),[m]),u=o.useMemo(()=>new Map(m.map(s=>[s.id,s])),[m]),w=o.useMemo(()=>{const s=new Set(d.map(n=>n.categoryId).filter(Boolean)),r=new Set(s);return s.forEach(n=>{let l=u.get(n);for(;l!=null&&l.parentCategoryId;)r.add(l.parentCategoryId),l=u.get(l.parentCategoryId)}),r},[d,u]),v=o.useMemo(()=>m.filter(s=>w.has(s.id)).sort((s,r)=>(s.order??0)-(r.order??0)||s.name.localeCompare(r.name)).map(s=>({value:s.id,label:s.name})),[m,w]),C=o.useMemo(()=>{let s=d;if(f.length>0){const n=new Set;f.forEach(l=>{const i=ee(k,l);i?se(i).forEach(q=>n.add(q)):n.add(l)}),s=te(s,n)}const r=b.trim().toLowerCase();return r&&(s=s.filter(n=>{var i;const l=n.categoryId&&((i=u.get(n.categoryId))==null?void 0:i.name)||"";return n.name.toLowerCase().includes(r)||n.description.toLowerCase().includes(r)||l.toLowerCase().includes(r)})),[...s].sort((n,l)=>n.name.localeCompare(l.name))},[d,f,k,b,u]),M=!!(f.length>0||b.trim()),B=T&&d.length===0;function _(){S(""),I([])}return y?e.jsxs("div",{className:"app-page-shell space-y-4 sm:sp
1ace-y-6",children:[e.jsx(ae,{title:x.title,description:x.description||"Browse services by category."}),e.jsx(h,{className:"overflow-hidden rounded-xl border border-subtle dark:bg-slate-800",children:e.jsxs("div",{className:"space-y-3 bg-surface-sunken p-3 sm:border-b sm:border-slate-200 sm:dark:border-slate-700",children:[e.jsxs("div",{className:"relative min-w-0",children:[e.jsx(F,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-slate-400"}),e.jsx(U,{value:b,onChange:s=>S(s.target.value),placeholder:"Search services","aria-label":"Search services",className:"h-10 pl-10 text-sm dark:border-slate-600 dark:bg-slate-700 sm:h-11"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[B?e.jsx("div",{className:"flex flex-wrap items-center gap-2","aria-hidden":"true",children:Array.from({length:4}).map((s,r)=>e.jsx(P,{className:`h-8 rounded-full ${r%3===0?"w-28":r%3===1?"w-20":"w-24"}`},`service-category-skeleton-${r}`))}):v.length>0?e.jsx(Q,{filters:v,activeFilters:f,onFilterChange:I,multiSelect:!0,defaultLabel:"All categories",searchable:v.length>6,branding:{accentColor:p}}):null,e.jsx(X,{filteredCount:C.length,totalCount:d.length}),e.jsx(W,{onClear:_,hasActiveFilters:M})]})]})}),e.jsx(J,{children:B?e.jsx("div",{className:A,children:Array.from({length:6}).map((s,r)=>e.jsx(P,{className:"h-48 rounded-2xl"},`service-card-skeleton-${r}`))}):d.length===0?e.jsx(h,{className:"rounded-2xl border border-subtle p-12 text-center dark:bg-slate-800",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-slate-100 p-3 dark:bg-slate-700",children:e.jsx($,{className:"size-6 text-slate-400 dark:text-slate-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-semibold text-content-primary",children:"No services available"}),e.jsx("p",{className:"mt-1 text-sm text-content-secondary",children:"Check back soon for updated offerings."})]})]})}):C.length===0?e.jsx(h,{className:"rounded-2xl border border-subtle p-12 text-center dark:bg-slate-800",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"rounded-full bg-slate-100 p-3 dark:bg-slate-700",children:e.jsx(F,{className:"size-6 text-slate-400 dark:text-slate-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-display font-semibold text-content-primary",children:"No services found"}),e.jsx("p",{className:"mt-1 text-sm text-content-secondary",children:"Try adjusting your search or category filters."})]})]})}):e.jsx("div",{className:A,children:C.map(s=>{var r;return e.jsx(ie,{service:s,categoryName:s.categoryId?(r=u.get(s.categoryId))==null?void 0:r.name:null,accentColor:p},s.id)})})})]}):e.jsx("div",{className:"app-page-shell",children:e.jsxs(h,{className:"rounded-2xl border border-subtle p-12 text-center dark:bg-slate-800",children:[e.jsx("h3",{className:"font-display font-semibold text-content-primary",children:"Services unavailable"}),e.jsx("p",{className:"mt-1 text-sm text-content-secondary",children:"This page is only available for business patients."})]})})}export{je 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.