PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings/profile-backgrounds-8e386ff8ff845d6c.js

js lidomatrip.com collected 2026-10-02 20:26:38 UTC 5,178 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2725],{14664:function(e,a,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/profile-backgrounds",function(){return t(10201)}])},10201:function(e,a,t){"use strict";t.r(a);var n=t(85893),i=t(67294),l=t(44389),r=t(49759),s=t(84858),d=t(32474);function c(e){let{item:a}=e;return(0,n.jsx)("span",{className:"block h-full w-full",style:"IMAGE"===a.kind?{backgroundImage:`url(${a.value})`,backgroundSize:"cover",backgroundPosition:"center"}:{background:a.value}})}a.default=function(){let{data:e,error:a,isLoading:t,mutate:o}=(0,l.u)("/api/admin/profile-backgrounds",e=>(0,s.SC)(e)),u=(0,i.useRef)(null),[x,g]=(0,i.useState)(""),[m,h]=(0,i.useState)("#0EA5A8"),[p,b]=(0,i.useState)("#0B4F6C"),[f,j]=(0,i.useState)(!1),[v,N]=(0,i.useState)(null),y=e||[],w=y.filter(e=>e.isActive).length;async function k(e){j(!0),N(null);try{let a=new FormData;a.append("image",e),x.trim()&&a.append("alt",x.trim()),await (0,s.SC)("/api/admin/profile-backgrounds",{method:"POST",body:a}),g(""),u.current&&(u.current.value=""),await o()}catch(e){N((null==e?void 0:e.message)||"بارگذاری انجام نشد")}finally{j(!1)}}async function C(){j(!0),N(null);try{let e=`linear-gradient(135deg, ${m} 0%, ${p} 100%)`;await (0,s.SC)("/api/admin/profile-backgrounds/gradient",{method:"POST",body:JSON.stringify({value:e,alt:x.trim()||void 0})}),g(""),await o()}catch(e){N((null==e?void 0:e.message)||"افزودن انجام نشد")}finally{j(!1)}}async function E(e){await (0,s.SC)(`/api/admin/profile-backgrounds/${e.id}`,{method:"PATCH",body:JSON.stringify({isActive:!e.isActive})}),await o()}async function S(e){window.confirm("این پس‌زمینه حذف شود؟")&&(await (0,s.SC)(`/api/admin/profile-backgrounds/${e.id}`,{method:"DELETE"}),await o())}return(0,n.jsxs)(r.Z,{title:"تصاویر پس‌زمینه پروفایل",children:[(0,n.jsxs)(d.Zb,{children:[(0,n.jsx)("p",{className:"text-14 leading-24 font-m text-black",children:"این پس‌زمینه‌ها کجا دیده می‌شوند"}),(0,n.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-6C6A7D",children:"در صفحه‌ی جزئیات کاربر پنل ادمین، پشت هدر پروفایل. یک ادمین از این فهرست برای هر کاربر یکی را انتخاب می‌کند؛ روی حساب خودِ کاربر یا سایت اصلی اثری ندارد."}),(0,n.jsxs)("div",{className:"mt-16 border-t-1 border-solid border-gray-F0F0F0 pt-16",children:[(0,n.jsx)(d.gN,{label:"عنوان (اختیاری)",className:"max-w-[260px] mb-12",children:(0,n.jsx)(d.II,{value:x,onChange:e=>g(e.target.value),placeholder:"مثلاً: اقیانوسی"})}),(0,n.jsxs)("div",{className:"flex flex-wrap items-end gap-24",children:[(0,n.jsxs)("div",{className:"flex items-end gap-12",children:[(0,n.jsx)(d.gN,{label:"از رنگ",children:(0,n.jsx)("input",{type:"color",value:m,onChange:e=>h(e.target.value),className:"h-38 w-52 rounded-8 border border-gray-E5E5E6 cursor-pointer"})}),(0,n.jsx)(d.gN,{label:"به رنگ",children:(0,n.jsx)("input",{type:"color",value:p,onChange:e=>b(e.target.value),className:"h-38 w-52 rounded-8 border border-gray-E5E5E6 cursor-pointer"})}),(0,n.jsx)("span",{className:"h-38 w-72 rounded-8 border border-gray-E5E5E6",style:{background:`linear-gradient(135deg, ${m} 0%, ${p} 100%)`}}),(0,n.jsx)(d.zx,{disabled:f,onClick:C,children:"افزودن گرادیان"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:e=>{var a;let t=null===(a=e.target.files)||void 0===a?void 0:a[0];t&&k(t)}}),(0,n.jsx)(d.zx,{variant:"secondary",disabled:f,onClick:()=>{var e;return null===(e=u.current)||void 0===e?void 0:e.click()},children:f?"در حال بارگذاری…":"یا بارگذاری تصویر"})]})]})]}),v&&(0,n.jsx)("p",{className:"mt-12 text-12 leading-20 text-error",children:v})]}),(0,n.jsxs)(d.Zb,{className:"mt-16",children:[(0,n.jsxs)("div",{className:"mb-12 flex items-center justify-between",children:[(0,n.jsx)("p",{className:"text-14 leading-24 font-m text-black",children:"پس‌زمینه‌ها"}),(0,n.jsxs)(d.Ct,{children:[w," فعال"]})]}),t?(0,n.jsx)(d.Od,{}):a?(0,n.jsx)(d.ub,{text:"فهرست بارگذاری نشد"}):0===y.length?(0,n.jsx)(d.ub,{text:"هنوز پس‌زمینه‌ای اضافه نشده"}):(0,n.jsx)("ul",{className:"flex flex-wrap gap-16",children:y.map(e=>(0,n.jsxs)("li",{className:"flex w-[150px] flex-col items-center gap-8 rounded-12 border-1 border-solid border-gray-F0F0F0 p-12",children:[(0,n.jsx)("span",{className:"overflow-hidden rounded-10",style:{height:64,width:102.4},children:(0,n.jsx)(c,{item:e})}),(0,n.jsx)("span",{className:"truncate text-11 leading-18 text-gray-6C6A7D",title:e.alt||"",children:e.alt||("GRADIENT"===e.kind?"گرادیان":"—")}),(0,n.jsx)(d.ZD,{checked:e.isActive,onChange:()=>void E(e)}),(0,n.jsx)("button",{type:"button",onClick:()=>void S(e),className:"text-11 leading-18 text-error hover:underline",children:"حذف"})]},e.id))})]})]})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=14
1664)}),_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.