Files
monisuo/monisuo-admin/dist/assets/appearance-B8dpX9x3.js
2026-03-23 01:50:00 +08:00

1 line
7.5 KiB
JavaScript

import{A as e,C as t,I as n,J as r,Q as i,St as a,_ as o,b as s,g as c,h as l,l as u,m as d,v as f,w as p,x as m,y as h,yt as g,z as _}from"./vue.runtime.esm-bundler-DS0mm12S.js";import{a as v,i as y,n as ee,r as b,t as x}from"./SelectValue-BXvq5Kkp.js";import{t as S}from"./use-sidebar-1HOdWNC3.js";import{t as C}from"./Spinner-DJesLX-i.js";import{n as w}from"./lib-CiHeuR38.js";import{n as T,r as E,t as D}from"./useMutation-d7gcLMcv.js";import{Y as O,s as k,u as A}from"./index-Cta5aHeD.js";import"./Teleport-C8puyUPF.js";import{n as j}from"./button-DQxx5HZh.js";import{n as M,r as N,t as P}from"./RadioGroupItem-BKiP5LFn.js";import{a as F,c as I,i as L,l as R,n as z,r as B,s as V,t as H}from"./vee-validate-zod-D6HZ7fRB.js";import{t as U}from"./Separator-6ZbuHEOH.js";import{n as W,r as G,t as K}from"./global-layout-DnpI9DBq.js";var q=A({theme:k([`light`,`dark`],{error:`Please select a theme.`}),font:k([`inter`,`manrope`,`system`],{error:`Please select a font.`})}),J=[{key:`appearance_config`,value:JSON.stringify({theme:`dark`,font:`inter`}),description:`Appearance configuration for the application, including theme color, border radius, and content layout.`}];function Y(e,t=!0){return{data:e,extra:{},code:200,message:`success`,success:t}}function X(e){return T({queryKey:[`useGetSystemConfigByKeyQuery`,e],queryFn:async()=>{let t=await new Promise((t,n)=>{setTimeout(()=>{let r=J.find(t=>t.key===e);r||n(Error(`Config not found`)),t(r)},1e3)});if(!t)throw Error(`Config not found`);return Y(t)}})}function Z(e){let t=E();return D({mutationKey:[`useUpdateSystemConfigByKeyMutation`,e],mutationFn:async e=>await new Promise(t=>{setTimeout(()=>{t(Y(e))},100)}),onSuccess:()=>{t.invalidateQueries({queryKey:[`useGetSystemConfigByKeyQuery`,e]})}})}function Q(){let e=E();return D({mutationKey:[`useCreateTaskMutation`],mutationFn:async e=>new Promise(t=>{setTimeout(()=>{t(Y(e))},100)}),onSuccess:()=>{e.invalidateQueries({queryKey:[`useGetSystemConfigByKeyQuery`]})}})}function te({key:e,defaultValue:t,description:n,schema:i}){let a={...t},{handleSubmit:o,resetForm:s}=I({validationSchema:H(i),initialValues:a}),c=O(e,a),{data:l,isPending:u}=X(e),{mutate:f,isPending:m}=Q(),{mutate:h,isPending:g}=Z(e),_=d(()=>m.value||g.value);return r(l,()=>{if(!u.value&&!l.value){c.value=l.value,f({key:e,description:n,value:JSON.stringify(t)},{onSuccess:()=>{c.value=a,w(`System config created with default value.`,{description:p(`pre`,{class:`mt-2 w-[340px] rounded-md bg-slate-950 p-4`},p(`code`,{class:`text-white`},JSON.stringify({key:e,description:n,value:t},null,2)))})}});return}let r=l.value?.data?.value?JSON.parse(l.value.data.value):a;c.value=r,s({values:{...r}})},{immediate:!0,deep:!0}),{isPending:_,isGetting:u,onSubmit:o(t=>{let r={key:e,value:t,description:n};c.value=t,h({...r,value:JSON.stringify(t)},{onSuccess:()=>{w(`You submitted the following values:`,{description:p(`pre`,{class:`mt-2 w-[340px] rounded-md bg-slate-950 p-4`},p(`code`,{class:`text-white`},JSON.stringify(r,null,2)))})}})})}}var $={key:0},ne={class:`flex justify-start`},re=`appearance_config`,ie=`Customize the appearance of the app. Automatically switch between day and night themes.`,ae=m({__name:`appearance-form`,setup(r){let{isGetting:d,isPending:p,onSubmit:m}=te({key:re,description:ie,defaultValue:{theme:`light`,font:`inter`},schema:q});return(r,_)=>{let S=x,w=ee,T=F,E=b,D=R,O=y,k=v;return n(),f(u,null,[_[14]||=l(`div`,null,[l(`h3`,{class:`text-lg font-medium`},` Appearance `),l(`p`,{class:`text-sm text-muted-foreground`},` Customize the appearance of the app. Automatically switch between day and night themes. `)],-1),s(g(U),{class:`my-4`}),g(d)?(n(),f(`div`,$,[s(g(j),{variant:`secondary`,disabled:``,size:`sm`},{default:i(()=>[s(g(C)),_[1]||=h(` Please wait `,-1)]),_:1})])):o(``,!0),g(d)?o(``,!0):(n(),f(`form`,{key:1,class:`space-y-8`,onSubmit:_[0]||=(...e)=>g(m)&&g(m)(...e)},[s(g(V),{name:`font`},{default:i(({componentField:e})=>[s(g(L),null,{default:i(()=>[s(g(B),null,{default:i(()=>[..._[2]||=[h(`Font`,-1)]]),_:1}),s(k,a(t(e)),{default:i(()=>[s(T,null,{default:i(()=>[s(w,null,{default:i(()=>[s(S,{placeholder:`Select a font`})]),_:1})]),_:1}),s(O,null,{default:i(()=>[s(D,null,{default:i(()=>[s(E,{value:`inter`},{default:i(()=>[..._[3]||=[h(` Inter `,-1)]]),_:1}),s(E,{value:`manrope`},{default:i(()=>[..._[4]||=[h(` Manrope `,-1)]]),_:1}),s(E,{value:`system`},{default:i(()=>[..._[5]||=[h(` System `,-1)]]),_:1})]),_:1})]),_:1})]),_:1},16),s(g(N),null,{default:i(()=>[..._[6]||=[h(` Set the font you want to use in the dashboard. `,-1)]]),_:1}),s(g(z))]),_:2},1024)]),_:1}),s(g(V),{type:`radio`,name:`theme`},{default:i(({componentField:t})=>[s(g(L),{class:`space-y-1`},{default:i(()=>[s(g(B),null,{default:i(()=>[..._[7]||=[h(`Theme`,-1)]]),_:1}),s(g(N),null,{default:i(()=>[..._[8]||=[h(` Select the theme for the dashboard. `,-1)]]),_:1}),s(g(z)),s(g(M),e({class:`grid max-w-md grid-cols-2 gap-8 pt-2`},t),{default:i(()=>[s(g(L),null,{default:i(()=>[s(g(B),{class:`[&:has([data-state=checked])>div]:border-primary flex flex-col`},{default:i(()=>[s(g(F),null,{default:i(()=>[s(g(P),{value:`light`,class:`sr-only`})]),_:1}),_[9]||=l(`div`,{class:`items-center p-1 border-2 rounded-md border-muted hover:border-accent`},[l(`div`,{class:`space-y-2 rounded-sm bg-[#ecedef] p-2`},[l(`div`,{class:`p-2 space-y-2 bg-white rounded-md shadow-xs`},[l(`div`,{class:`h-2 w-20 rounded-lg bg-[#ecedef]`}),l(`div`,{class:`h-2 w-[100px] rounded-lg bg-[#ecedef]`})]),l(`div`,{class:`flex items-center p-2 space-x-2 bg-white rounded-md shadow-xs`},[l(`div`,{class:`h-4 w-4 rounded-full bg-[#ecedef]`}),l(`div`,{class:`h-2 w-[100px] rounded-lg bg-[#ecedef]`})]),l(`div`,{class:`flex items-center p-2 space-x-2 bg-white rounded-md shadow-xs`},[l(`div`,{class:`h-4 w-4 rounded-full bg-[#ecedef]`}),l(`div`,{class:`h-2 w-[100px] rounded-lg bg-[#ecedef]`})])])],-1),_[10]||=l(`span`,{class:`block w-full p-2 font-normal text-center`},` Light `,-1)]),_:1})]),_:1}),s(g(L),null,{default:i(()=>[s(g(B),{class:`[&:has([data-state=checked])>div]:border-primary flex flex-col`},{default:i(()=>[s(g(F),null,{default:i(()=>[s(g(P),{value:`dark`,class:`sr-only`})]),_:1}),_[11]||=l(`div`,{class:`items-center p-1 border-2 rounded-md border-muted bg-popover hover:bg-accent hover:text-accent-foreground`},[l(`div`,{class:`p-2 space-y-2 rounded-sm bg-slate-950`},[l(`div`,{class:`p-2 space-y-2 rounded-md shadow-xs bg-slate-800`},[l(`div`,{class:`w-20 h-2 rounded-lg bg-slate-400`}),l(`div`,{class:`h-2 w-[100px] rounded-lg bg-slate-400`})]),l(`div`,{class:`flex items-center p-2 space-x-2 rounded-md shadow-xs bg-slate-800`},[l(`div`,{class:`size-4 rounded-full bg-slate-400`}),l(`div`,{class:`h-2 w-[100px] rounded-lg bg-slate-400`})]),l(`div`,{class:`flex items-center p-2 space-x-2 rounded-md shadow-xs bg-slate-800`},[l(`div`,{class:`size-4 rounded-full bg-slate-400`}),l(`div`,{class:`h-2 w-[100px] rounded-lg bg-slate-400`})])])],-1),_[12]||=l(`span`,{class:`block w-full p-2 font-normal text-center`},` Dark `,-1)]),_:1})]),_:1})]),_:1},16)]),_:2},1024)]),_:1}),l(`div`,ne,[s(g(j),{type:`submit`,disabled:g(p)},{default:i(()=>[g(p)?(n(),c(g(C),{key:0,size:`sm`})):o(``,!0),_[13]||=h(` Update preferences `,-1)]),_:1},8,[`disabled`])])],32))],64)}}}),oe=m({__name:`settings-layout`,setup(e){let{settingsNavItems:t}=S();return(e,r)=>(n(),c(g(G),{title:`Settings`,description:`Manage your store settings.`},{default:i(()=>[s(g(K),null,{aside:i(()=>[s(g(W),{nav:g(t)},null,8,[`nav`])]),default:i(()=>[_(e.$slots,`default`)]),_:3})]),_:3}))}}),se=m({__name:`appearance`,setup(e){return(e,t)=>(n(),c(oe,null,{default:i(()=>[s(ae)]),_:1}))}});export{se as default};