PageSourceSearch

https://moscribe.com/assets/tags-c1DUd-t-.js

js moscribe.com collected 2026-09-24 12:38:31 UTC 3,561 bytes, 1 lines download raw bytes

1import{r as n,bi as v,j as s,v as u,b9 as w,ba as y,bb as D,bc as E,bd as F,n as C,t as B,aD as k,ah as H,ai as o}from"./index-DqOFIc4-.js";import{D as I}from"./admin-navigate-czAO56MF.js";import{T as P,a as V,b as x,c as l,d as L,e as t}from"./table-DatwDodu.js";import{b as O,s as A}from"./zod-DQa1rv8T.js";import{u as R}from"./use-blog-tags-D5P01neW.js";import{c as q,P as z,S as G}from"./index-Bq6HRH0k.js";import{I as f}from"./input-8lNKXG-w.js";import{d as _,F as h,a as g,e as j,c as p}from"./field-xUMm8toA.js";import"./breadcrumb-Bzt5YvPp.js";import"./chevron-right-B1jZy9-9.js";function ss(){const{data:b=[],refetch:N}=R(),[T,r]=n.useState(!1),[c,m]=n.useState(!1),e=O({resolver:A(v),defaultValues:{name:"",slug:""}}),i=e.watch("name"),S=async a=>{if(!c)try{m(!0),await H.adminBlogTag.upsert(a),await N(),r(!1),e.reset({name:"",slug:""}),a.id?o.success("Tag updated successfully"):o.success("Tag added successfully")}catch{o.error("An error occurred")}finally{m(!1)}};return n.useEffect(()=>{i?e.setValue("slug",q(i)):e.setValue("slug","")},[i]),s.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsx(I,{back:[{href:"/admin",title:"Admin"},{href:"/admin/blog",title:"Blog"}],current:{title:"Blog Tags"}}),s.jsxs("div",{className:"flex-1 overflow-auto",children:[s.jsxs("div",{className:"mb-auto w-full space-y-4 pt-4 text-start md:container",children:[s.jsx("div",{className:"flex w-full flex-row justify-end",children:s.jsxs(u,{variant:"outline",onClick:()=>{e.reset({name:"",slug:""}),r(!0)},children:[s.jsx(z,{className:"mr-1 h-4 w-4"}),"New"]})}),s.jsxs(P,{children:[s.jsx(V,{className:"[&_tr]:border-b-0",children:s.jsxs(x,{className:"bg-muted",children:[s.jsx(l,{className:"font-normal"}),s.jsx(l,{className:"font-normal",children:"Name"}),s.jsx(l,{className:"font-normal",children:"slug"}),s.jsx(l,{className:"font-normal"})]})}),s.jsx(L,{children:b.map((a,d)=>s.jsxs(x,{children:[s.jsx(t,{className:"text-muted-foreground w-8 py-4",children:s.jsx("span",{className:"text-sm",children:d+1})}),s.jsx(t,{className:"font-medium",children:s.jsx("span",{className:"text-sm",children:a.name})}),s.jsx(t,{className:"mx-auto",children:s.jsx("span",{className:"text-sm",children:a.slug})}),s.jsx(t,{className:"mx-auto",children:s.jsx(u,{variant:"ghost",size:"icon",onClick:()=>{e.reset({id:a.id,name:a.name}),r(!0)},children:s.jsx(G,{className:"h-4 w-4"})})})]},a.id))})]})]}),s.jsx(w,{open:T,onOpenChange:r,children:s.jsxs(y,{children:[s.jsxs(D,{children:[s.jsx(E,{children:"Tag"}),s.jsx(F,{className:"sr-only"})]}),s.jsxs("form",{onSubmit:e.handleSubmit(S),className:"flex flex-col gap-4",children:[s.jsxs(_,{className:"gap-4",children:[s.jsxs(h,{"data-invalid":!!e.formState.errors.name,children:[s.jsx(g,{htmlFor:"tag-name",children:"Name *"}),s.jsxs(j,{children:[s.jsx(f,{id:"tag-name",placeholder:"Enter name","aria-invalid":!!e.formState.errors.name,...e.register("name")}),s.jsx(p,{errors:[e.formState.errors.name]})]})]}),s.jsxs(h,{"data-invalid":!!e.formState.errors.slug,children:[s.jsx(g,{htmlFor:"tag-slug",children:"Slug *"}),s.jsxs(j,{children:[s.jsx(f,{id:"tag-slug",placeholder:"Enter Slug","aria-invalid":!!e.formState.errors.slug,...e.register("slug")}),s.jsx(p,{errors:[e.formState.errors.slug]})]})]})]}),s.jsxs("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",children:[s.jsx("p",{className:C(B({variant:"outline"}),"cursor-pointer"),onClick:()=>{e.reset({}),r(!1)},children:"Cancel"}),s.jsx(k,{isSubmitting:c,type:"submit",children:"Save"})]})]})]})})]})]})}export{ss as component};

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.