PageSourceSearch

https://effulgent-bombolone-77534e.netlify.app/_next/static/chunks/pages/admin/categories-de5d246264bb69e9.js

js effulgent-bombolone-77534e.netlify.app collected 2026-10-03 10:41:36 UTC 3,347 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[444],{8386:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/categories",function(){return n(9499)}])},6307:function(e,t,n){"use strict";n.d(t,{GO:function(){return i}}),n(3465);let i="uncategorized"},3465:function(e,t,n){"use strict";var i=n(385);let s=n.g;s.prisma||new i.PrismaClient({log:["error"]})},9499:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return u},default:function(){return h}});var i=n(5893),s=n(7294),r=n(1664),a=n.n(r),c=n(9152),l=n(6307),o=n(9547),d=n.n(o),u=!0;function h(e){let{user:t,categories:n}=e,[r,o]=(0,s.useState)(n),[u,h]=(0,s.useState)(""),[g,j]=(0,s.useState)(""),[m,x]=(0,s.useState)(""),[f,p]=(0,s.useState)(""),N=async e=>{h(""),p(e.id);try{let t=await fetch("/api/admin/categories/".concat(e.id),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({replacementCategoryId:e.postCount>0?m:void 0})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Failed to delete category.");o(t=>t.filter(t=>t.id!==e.id)),j(""),x("")}catch(e){h(e.message)}finally{p("")}};return(0,i.jsxs)(c.L3,{user:t,title:"Categories",actions:(0,i.jsx)(a(),{className:d().button,href:"/admin/categories/new",children:"Add New Category"}),children:[u&&(0,i.jsx)("p",{className:d().error,children:u}),(0,i.jsx)("div",{className:d().tableWrap,children:(0,i.jsxs)("table",{className:d().table,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:"Name"}),(0,i.jsx)("th",{children:"Slug"}),(0,i.jsx)("th",{children:"Posts"}),(0,i.jsx)("th",{children:"Actions"})]})}),(0,i.jsxs)("tbody",{children:[r.map(e=>{let t=r.length>1,n=r.filter(t=>t.id!==e.id),s=e.postCount>0,c=e.slug===l.GO,o=g===e.id&&s,u=!t||f===e.id||c;return(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:e.name}),(0,i.jsxs)("td",{children:["/",e.slug]}),(0,i.jsx)("td",{children:e.postCount}),(0,i.jsxs)("td",{children:[(0,i.jsxs)("div",{className:d().actions,children:[(0,i.jsx)(a(),{className:d().secondaryButton,href:"/admin/categories/".concat(e.id,"/edit"),children:"Edit"}),!o&&(0,i.jsx)("button",{type:"button",className:d().dangerButton,disabled:u,onClick:()=>{var i;if(c){h("Uncategorized category cannot be deleted.");return}if(!t){h("You cannot delete the last remaining category.");return}if(!s){confirm("Delete this category?")&&N(e);return}j(e.id),x((null===(i=n.find(e=>e.slug===l.GO))||void 0===i?void 0:i.id)||"")},children:"Delete"})]}),o&&(0,i.jsxs)("div",{className:d().inlineActionPanel,children:[(0,i.jsx)("p",{className:d().helper,children:"Move posts to:"}),(0,i.jsxs)("select",{value:m,onChange:e=>x(e.target.value),children:[(0,i.jsx)("option",{value:"",children:"Select replacement category"}),n.map(e=>(0,i.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,i.jsxs)("div",{className:d().actions,children:[(0,i.jsx)("button",{type:"button",className:d().dangerButton,disabled:!m||f===e.id,onClick:()=>N(e),children:"Confirm Delete"}),(0,i.jsx)("button",{type:"button",className:d().ghostButton,onClick:()=>{j(""),x("")},children:"Cancel"})]})]})]})]},e.id)}),0===r.length&&(0,i.jsx)("tr",{children:(0,i.jsx)("td",{colSpan:4,children:"No categories found."})})]})]})})]})}h.noLayout=!0}},function(e){e.O(0,[385,774,888,179],function(){return e(e.s=8386)}),_N_E=e.O()}]);

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.