-
Notifications
You must be signed in to change notification settings - Fork 2
/
component---src-pages-config-js-9397dad95fff365468c0.js
1 lines (1 loc) · 7.96 KB
/
component---src-pages-config-js-9397dad95fff365468c0.js
1
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[61],{4147:function(e,t,a){a.r(t),a.d(t,{default:function(){return R}});var l=a(9474),s=a(328),n=a(9980),r=a(4310),o=a(7557),i=a(8626),c=a(2025);var d=a(5765),m=a(7205),u=a(3274),f="Switch",[x,g]=(0,i.A)(f),[p,h]=x(f),b=l.forwardRef(((e,t)=>{const{__scopeSwitch:a,name:s,checked:n,defaultChecked:i,required:d,disabled:f,value:x="on",onCheckedChange:g,form:h,...b}=e,[w,v]=l.useState(null),E=(0,o.s)(t,(e=>v(e))),N=l.useRef(!1),C=!w||(h||!!w.closest("form")),[S=!1,A]=(0,c.i)({prop:n,defaultProp:i,onChange:g});return(0,u.jsxs)(p,{scope:a,checked:S,disabled:f,children:[(0,u.jsx)(m.sG.button,{type:"button",role:"switch","aria-checked":S,"aria-required":d,"data-state":k(S),"data-disabled":f?"":void 0,disabled:f,value:x,...b,ref:E,onClick:(0,r.m)(e.onClick,(e=>{A((e=>!e)),C&&(N.current=e.isPropagationStopped(),N.current||e.stopPropagation())}))}),C&&(0,u.jsx)(y,{control:w,bubbles:!N.current,name:s,value:x,checked:S,required:d,disabled:f,form:h,style:{transform:"translateX(-100%)"}})]})}));b.displayName=f;var w="SwitchThumb",v=l.forwardRef(((e,t)=>{const{__scopeSwitch:a,...l}=e,s=h(w,a);return(0,u.jsx)(m.sG.span,{"data-state":k(s.checked),"data-disabled":s.disabled?"":void 0,...l,ref:t})}));v.displayName=w;var y=e=>{const{control:t,checked:a,bubbles:s=!0,...n}=e,r=l.useRef(null),o=function(e){const t=l.useRef({value:e,previous:e});return l.useMemo((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}(a),i=(0,d.X)(t);return l.useEffect((()=>{const e=r.current,t=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(t,"checked").set;if(o!==a&&l){const t=new Event("click",{bubbles:s});l.call(e,a),e.dispatchEvent(t)}}),[o,a,s]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...n,tabIndex:-1,ref:r,style:{...e.style,...i,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function k(e){return e?"checked":"unchecked"}var E=b,N=v,C=a(2365),S=a(4723),A=a(1877),j=a(6787),z=a(9443);s.A.defaults.withCredentials=!0;const D="https://api.keycap-archivist.com";var R=()=>{const{0:e,1:t}=(0,l.useState)((0,A.zj)()),{0:a,1:r}=(0,l.useState)(!1),{0:o,1:i}=(0,l.useState)(!1),{0:c,1:d}=(0,l.useState)(null),{0:m,1:u}=(0,l.useState)(null);(0,l.useEffect)((()=>{t((0,A.zj)()),s.A.get(`${D}/auth/current-session`,{timeout:2e4}).then((a=>{let{data:l}=a;console.log(l),e.authorized=!0,t(e),(0,A.Nk)(e),r(!0),d(l.avatar),u(l.name),i(!0)})).catch((()=>{r(!1),d(null),u(null),i(!0)}))}),[]);return l.createElement(C.A,null,l.createElement(S.A,{title:"Configuration",img:"/android-chrome-512x512.png"}),l.createElement("h1",{className:"mt-10 text-xl font-bold lg:text-3xl"},"Configuration panel"),l.createElement("div",{className:"lg:flex lg:gap-x-16"},l.createElement("aside",{className:(0,z.A)("my-6 flex overflow-x-auto border-b border-slate-900/5 py-4","dark:border-slate-100/5","lg:my-0 lg:block lg:w-64 lg:flex-none lg:border-0 lg:py-20")},l.createElement("nav",{className:"mt-0 flex-none px-0"},l.createElement("ul",{role:"list",className:"flex gap-x-3 gap-y-1 whitespace-nowrap lg:flex-col"},l.createElement("li",null,l.createElement("div",{className:"group flex gap-x-3 rounded-md text-lg font-semibold leading-6 text-slate-800 dark:text-slate-200"},l.createElement(n.g,{icon:["fas","user"],className:"text-xl text-indigo-500"}),"Cloudsync"))))),l.createElement("div",{className:"p-0 pb-6 lg:flex-auto lg:py-20"},l.createElement("div",{className:"mx-auto max-w-2xl space-y-16 sm:space-y-20 lg:mx-0 lg:max-w-none"},l.createElement("div",null,l.createElement("p",{className:"mt-1 text-sm leading-6 text-slate-500"},"Cloud Synchronization feature is currently in beta. If you encounter any issue please share your problem on Github or on Discord."),o?a?l.createElement("dl",{className:(0,z.A)("mt-6 space-y-6 divide-y divide-slate-100 border-t border-slate-200 text-sm leading-6","dark:divide-slate-800 dark:border-slate-700")},l.createElement("div",{className:"pt-6 sm:flex"},l.createElement("dt",{className:"font-medium text-slate-900 dark:text-slate-100 sm:w-64 sm:flex-none sm:pr-6"},"Discord ID"),l.createElement("dd",{className:"mt-4 flex justify-between gap-x-6 sm:mt-0 sm:flex-auto lg:mt-1"},l.createElement("div",{className:"inline-flex items-center gap-x-2 text-slate-900 dark:text-slate-100"},l.createElement("img",{className:"inline-block h-6 w-6 rounded-full",src:c}),l.createElement("span",null,m)))),l.createElement("div",{className:"pt-6 sm:flex"},l.createElement("dt",{className:"font-medium text-slate-900 dark:text-slate-100 sm:w-64 sm:flex-none sm:pr-6"},"Cloud sync"),l.createElement("dd",{className:"mt-1 flex justify-between gap-x-6 sm:mt-0 sm:flex-auto"},l.createElement("div",{className:"text-slate-900 dark:text-slate-100"},"This feature will allow you to save every change you make to your wishlist in the cloud storage."),l.createElement(E,{checked:!0===e.cloudAutoSync,onCheckedChange:a=>{var l;l=a,e["cloudAutoSync"]=l,(0,A.Nk)(e),t({...e})},className:(0,z.A)("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400","focus-visible:ring-offset-2 focus-visible:ring-offset-slate-800","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-indigo-500 data-[state=unchecked]:bg-slate-200 data-[state=unchecked]:dark:bg-slate-700")},l.createElement(N,{className:(0,z.A)("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform","data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0","dark:bg-slate-800")})))),l.createElement("div",{className:"pt-6 sm:flex"},l.createElement("dt",{className:"font-medium text-slate-900 dark:text-slate-100 sm:w-64 sm:flex-none sm:pr-6"},"Upload wishlist"),l.createElement("dd",{className:"mt-1 flex flex-col justify-between gap-x-6 max-lg:gap-y-4 sm:mt-0 sm:flex-auto lg:flex-row"},l.createElement("div",{className:"text-slate-900 dark:text-slate-100"},"Manually upload your wishlist to the cloud storage"),l.createElement("button",{onClick:()=>(0,j.xj)(e),className:(0,z.A)("inline-flex w-full items-center justify-center gap-x-2 rounded-md bg-indigo-500 px-3 py-2 text-xs font-bold text-white","transition-colors","hover:bg-indigo-700","lg:w-fit")},l.createElement(n.g,{icon:["fa","upload"]})," Upload wishlist"))),l.createElement("div",{className:"pt-6 sm:flex"},l.createElement("dt",{className:"font-medium text-slate-900 dark:text-slate-100 sm:w-64 sm:flex-none sm:pr-6"},"Download wishlist"),l.createElement("dd",{className:"mt-1 flex flex-col justify-between gap-x-6 max-lg:gap-y-4 sm:mt-0 sm:flex-auto lg:flex-row"},l.createElement("div",{className:"text-slate-900 dark:text-slate-100"},"Manually download your wishlist from the cloud storage"),l.createElement("button",{onClick:()=>(0,j.MY)(e),className:(0,z.A)("inline-flex items-center justify-center gap-x-2 rounded-md bg-indigo-500 px-3 py-2 text-xs font-bold text-white transition-colors","hover:bg-indigo-700")},l.createElement(n.g,{icon:["fa","download"]})," Download wishlist")))):l.createElement("a",{href:`${D}/auth/discord`,className:(0,z.A)("mt-4 inline-flex items-center justify-center gap-x-2 rounded-md bg-indigo-500 px-3 py-2 text-xs font-bold text-white","transition-colors","hover:bg-indigo-700")},l.createElement(n.g,{icon:["fab","discord"]})," Login with Discord"," "):l.createElement("p",{className:"pt-6 text-sm font-semibold"},"Currently loading..."))))))}},5765:function(e,t,a){a.d(t,{X:function(){return n}});var l=a(9474),s=a(2005);function n(e){const[t,a]=l.useState(void 0);return(0,s.N)((()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const l=t[0];let s,n;if("borderBoxSize"in l){const e=l.borderBoxSize,t=Array.isArray(e)?e[0]:e;s=t.inlineSize,n=t.blockSize}else s=e.offsetWidth,n=e.offsetHeight;a({width:s,height:n})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}a(void 0)}),[e]),t}}}]);