PageSourceSearch

https://www.himumsaiddad.com/assets/TagsManager-BS4pAKF-.js

js himumsaiddad.com collected 2026-09-25 02:50:04 UTC 10,531 bytes, 1 lines download raw bytes

1import{r as l,j as e,a3 as M,u as F,I as T,T as b,G as $}from"./index-DH68tAln.js";import{B as y}from"./button-Bp1aHZjY.js";import{I as E}from"./input-BI36L7Tx.js";import{L as I}from"./label-DWwn4K3l.js";import{S as H,a as Y,b as B,c as V,d as D}from"./select-DMgt7Zhx.js";import{D as q,e as U,a as J,b as W,c as X,d as Z}from"./dialog-D7-PmJlK.js";import{A as ee,a as se,b as re,c as te,d as ie,e as ne,f as ae,g as oe,h as le}from"./alert-dialog-CgIXDfUp.js";import{s as P}from"./CircleNotch.es-B4W_QKyd.js";import{m as ce}from"./Pencil.es-ophNggc8.js";import{n as de}from"./Plus.es-C1gWyydy.js";import{n as me}from"./Trash.es-B8mPxW-E.js";import{T as k,c as ue}from"./tagsCms-B2VtiLwX.js";import{g as Q,r as z,R as _,a as K}from"./tagIcon-BkJQaV0w.js";import{P as pe,a as ge,b as he}from"./popover-C4dfSZG7.js";import{a as L,S as xe}from"./statIconRegistry-CphJmViy.js";import{S as fe}from"./SortableList-DF-lw6SD.js";import"./index-BdQq_4o_.js";import"./index-IKAmclmT.js";import"./index-CVWy4ejT.js";import"./index-DuDhQ_ib.js";import"./CaretDown.es-BxzOeJD8.js";import"./CaretUp.es-BQF6dzj2.js";import"./Check.es-BhWQCISM.js";import"./index-DtggFIne.js";import"./Newspaper.es-p6Ku_01I.js";import"./FilmSlate.es-CoYapE-a.js";import"./AppWindow.es-E7RfmaX6.js";import"./ArrowsClockwise.es-BIo-Fkhy.js";import"./BookOpen.es-BQ4Bl1jV.js";import"./Brain.es-D7IAyK69.js";import"./Buildings.es-DqR-3GO4.js";import"./Calendar.es-Cxgp7CPd.js";import"./ThumbsUp.es-CNLvjADT.js";import"./ChartLineUp.es-DWmIRizy.js";import"./ChatsCircle.es-sJVbpIgC.js";import"./CheckCircle.es-BS7lnkuY.js";import"./Clock.es-C_nlFmxz.js";import"./Code.es-BgN5HFj6.js";import"./Compass.es-qaBsmgp9.js";import"./Cpu.es-CRes3NQl.js";import"./Leaf.es-CLal6nDK.js";import"./Database.es-piN-TL_B.js";import"./DeviceMobile.es-BFjGLDan.js";import"./Eye.es-B5Vpi38_.js";import"./Globe.es-BwRXYO6m.js";import"./GraduationCap.es-B6eeR8xm.js";import"./Stack.es-CfSsQXWz.js";import"./Rocket.es-krSMxdyh.js";import"./Heartbeat.es-BLkrXQ3C.js";import"./House.es-DKuSwkTn.js";import"./Lightbulb.es-CCTtjrXA.js";import"./Lightning.es-BDdNUcva.js";import"./MagnifyingGlass.es-HfLEXlgU.js";import"./Target.es-DLPxcwco.js";import"./Megaphone.es-Bv2d4ms6.js";import"./Package.es-hmZDhGPO.js";import"./Path.es-Rw4452k9.js";import"./ShieldCheck.es-WkfUh7W5.js";import"./Sparkle.es-CMh88DRD.js";import"./Star.es-DxhcJ_V4.js";import"./User.es-Do3o_yN8.js";import"./Users.es-r6irAqdn.js";import"./UsersThree.es-CRKPLxTt.js";import"./Wrench.es-D62kreSd.js";function je({tagName:a,iconName:r,onChange:u}){const[p,i]=l.useState(!1),[n,o]=l.useState(""),c=!r,g=r??Q(a),f=z(g),x=l.useMemo(()=>{const t=n.trim().toLowerCase();return t?_.filter(s=>s.toLowerCase().includes(t)||K[s].label.toLowerCase().includes(t)):_},[n]),v=l.useMemo(()=>{const t=n.trim().toLowerCase();return t?L.filter(s=>s.toLowerCase().includes(t)):L},[n]);return e.jsxs(pe,{open:p,onOpenChange:i,children:[e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",title:c?"Auto-guessed, click to change":`Icon: ${r}, click to change`,className:"flex items-center justify-center h-10 w-10 rounded-full bg-brand-cream text-brand-teal shrink-0 hover:bg-brand-cream/80 transition-colors",children:e.jsx(f,{weight:"light",size:20})})}),e.jsxs(he,{align:"start",className:"w-80 p-3 bg-popover",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(E,{autoFocus:!0,placeholder:"Search icons…",value:n,onChange:t=>o(t.target.value),className:"h-8"}),e.jsx(y,{type:"button",variant:"ghost",size:"sm",className:"shrink-0",disabled:c,onClick:()=>{u(null),i(!1)},children:"Auto"})]}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[10px] font-600 tracking-wide text-muted-foreground mb-1",children:"Regions"}),e.jsx("div",{className:"grid grid-cols-8 gap-1 mb-3",children:x.map(t=>{const{Icon:s,label:d}=K[t],m=t===r;return e.jsx("button",{type:"button",title:d,onClick:()=>{u(t),i(!1)},className:`flex items-center justify-center h-8 w-8 rounded-md transition-colors ${m?"bg-brand-teal text-brand-cream":"text-foreground/70 hover:bg-muted"}`,children:e.jsx(s,{size:20})},t)})}),e.jsx("p",{className:"text-[10px] font-600 tracking-wide text-muted-foreground mb-1",children:"Phosphor"})]}),e.jsxs("div",{className:"grid grid-cols-8 gap-1 max-h-64 overflow-y-auto",children:[v.map(t=>{const s=xe[t],d=t===g;return e.jsx("button",{type:"button",title:t,onClick:()=>{u(t),i(!1)},className:`flex items-center justify-center h-8 w-8 rounded-md transition-colors ${d?"bg-brand-teal text-brand-cream":"text-foreground
1/70 hover:bg-muted"}`,children:e.jsx(s,{weight:"light",size:18})},t)}),v.length===0&&x.length===0&&e.jsxs("p",{className:"col-span-8 text-sm text-muted-foreground py-6 text-center",children:['No icons match "',n,'"']})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:c?"Auto-guessed from the tag name. Pick one to override.":"Click Auto to revert to the name-based guess."})]})]})}const ve={service:"bg-brand-lemon",industry:"bg-brand-teal",region:"bg-brand-dusty-charcoal"};function A(a){return a.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"")}function As(){l.useEffect(()=>{document.title="Tags | CMS"},[]);const a=M(),{data:r=[],isLoading:u}=F({queryKey:k,queryFn:ue}),[p,i]=l.useState(null),[n,o]=l.useState(!1);function c(){a.invalidateQueries({queryKey:k}),a.invalidateQueries({queryKey:["public","insights"]}),a.invalidateQueries({queryKey:["public","case_studies"]})}async function g(s){const{error:d}=await T.from("tags").delete().eq("id",s.id);if(d)return b.error(d.message);b.success("Tag deleted"),c()}async function f(s,d){var C;a.setQueryData(k,h=>{if(!h)return h;const N=h.filter(j=>j.kind!==s),G=d.map((j,S)=>({...j,position:S}));return[...N,...G].sort((j,S)=>j.kind.localeCompare(S.kind)||j.position-S.position||j.name.localeCompare(S.name))});const w=(C=(await Promise.all(d.map((h,N)=>T.from("tags").update({position:N}).eq("id",h.id)))).find(h=>h.error))==null?void 0:C.error;if(w){b.error(w.message),a.invalidateQueries({queryKey:k});return}c()}const x=r.filter(s=>s.kind==="service"),v=r.filter(s=>s.kind==="industry"),t=r.filter(s=>s.kind==="region");return e.jsxs("div",{className:"max-w-5xl mx-auto p-6 sm:p-10 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Tags"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Shared across insights and case studies. Services and industries are colour-coded."})]}),e.jsxs(q,{open:n,onOpenChange:o,children:[e.jsx(U,{asChild:!0,children:e.jsxs(y,{children:[e.jsx(de,{className:"h-4 w-4 mr-2"})," New tag"]})}),e.jsx(O,{mode:"create",onClose:()=>o(!1),onSaved:()=>{o(!1),c()}})]})]}),u?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(P,{className:"h-6 w-6 animate-spin"})}):e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsx(R,{title:"Services",rows:x,onEdit:i,onRemove:g,onReorder:s=>f("service",s)}),e.jsx(R,{title:"Industries",rows:v,onEdit:i,onRemove:g,onReorder:s=>f("industry",s)}),e.jsx(R,{title:"Regions",rows:t,onEdit:i,onRemove:g,onReorder:s=>f("region",s)})]}),e.jsx(q,{open:!!p,onOpenChange:s=>!s&&i(null),children:p&&e.jsx(O,{mode:"edit",tag:p,onClose:()=>i(null),onSaved:()=>{i(null),c()}})})]})}function R({title:a,rows:r,onEdit:u,onRemove:p,onReorder:i}){return e.jsxs("div",{className:"bg-card rounded-card p-5 space-y-3",children:[e.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wider text-muted-foreground",children:a}),r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"None yet."}):e.jsx(fe,{items:r,onReorder:i,withDefaultHandle:!0,className:"divide-y divide-border/50",renderItem:n=>{const o=z(n.icon_name,{kind:n.kind,name:n.name});return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsxs("span",{className:"relative shrink-0",children:[e.jsx(o,{weight:"light",size:20,className:"text-foreground/80"}),e.jsx("span",{className:$("absolute -bottom-0.5 -right-0.5 h-2 w-2 rounded-full ring-2 ring-card",ve[n.kind])})]}),e.jsx("span",{className:"flex-1 truncate",children:n.name}),e.jsx(y,{size:"sm",variant:"ghost",onClick:()=>u(n),children:e.jsx(ce,{className:"h-4 w-4"})}),e.jsxs(ee,{children:[e.jsx(se,{asChild:!0,children:e.jsx(y,{size:"sm",variant:"ghost",children:e.jsx(me,{className:"h-4 w-4"})})}),e.jsxs(re,{children:[e.jsxs(te,{children:[e.jsxs(ie,{children:['Delete "',n.name,'"?']}),e.jsx(ne,{children:"This removes the tag from every insight and case study using it."})]}),e.jsxs(ae,{children:[e.jsx(oe,{children:"Cancel"}),e.jsx(le,{onClick:()=>p(n),children:"Delete"})]})]})]})]})}})]})}function O({mode:a,tag:r,onClose:u,onSaved:p}){const[i,n]=l.useState((r==null?void 0:r.name)??""),[o,c]=l.useState((r==null?void 0:r.slug)??""),[g,f]=l.useState((r==null?void 0:r.kind)??"service"),[x,v]=l.useState((r==null?void 0:r.icon_name)??null),[t,s]=l.useState(!1);async function d(){if(!i.trim())return b.error("Name is required");s(!0);const m=o.trim()||A(i),w=x??(a==="create"?Q(i.trim()):null),C={name:i.trim(),slug:m,kind:g,icon_name:w},h=a==="create"?T.from("tags").insert(C):T.from("tags").update(C).eq("id",r.id),{error:N}=await h;if(s(!1),N)return b.error(N.message);b.success(a==="create"?"Tag created":"Tag saved"),p()}return e.jsxs(J,{children:[e.jsx(W,{children:e.jsx(X,{children:a==="create"?"New tag":"Edit tag"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{children:"Name"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(je,{tagName:i,iconName:x,onChange:v}),e.jsx(E,{className:"flex-1",value:i,onChange:m=>{n(m.target.value),a==="create"&&(!o||o===A(i))&&c(A(m.target.value))}})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{children:"Slug"}),e.jsx(E,{value:o,onChange:m=>c(m.target.value),placeholder:"auto from name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(I,{children:"Kind"}),e.jsxs(H,{value:g,onValueChange:m=>f(m),children:[e.jsx(Y,{children:e.jsx(B,{})}),e.jsxs(V,{children:[e.jsx(D,{value:"service",children:"Service"}),e.jsx(D,{value:"industry",children:"Industry"}),e.jsx(D,{value:"region",children:"Region"})]})]})]})]}),e.jsxs(Z,{children:[e.jsx(y,{variant:"ghost",onClick:u,disabled:t,children:"Cancel"}),e.jsx(y,{onClick:d,disabled:t,children:t?e.jsx(P,{className:"h-4 w-4 animate-spin"}):"Save"})]})]})}export{As 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.