Bundle embedded web app

This commit is contained in:
gabek
2022-12-17 04:27:39 +00:00
parent 60419008b9
commit 49e60ab56b
35 changed files with 36 additions and 36 deletions
@@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6559],{10887:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/chat/emojis",function(){return n(14518)}])},14518:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var i=n(85893),a=n(48689),o=n(84485),r=n(26713),s=n(71577),l=n(52206),u=n(77916),c=n(67294),d=n(39664),m=n(64777),f=n(60956),j=n(41983),p=n(90745);let{Title:h,Paragraph:g}=o.Z,w=()=>{let[e,t]=(0,c.useState)([]),[n,o]=(0,c.useState)(!1),[w,y]=(0,c.useState)(null),[k,x]=(0,c.useState)(null),E=null,_=()=>{y(null),clearTimeout(E),E=null};async function T(){o(!0);try{let e=await (0,m.rQ)("/api/emoji");t(e)}catch(n){console.error("error fetching emojis",n)}o(!1)}async function v(e){o(!0),y((0,j.kg)(j.Jk,"Deleting emoji..."));try{let t=await (0,m.rQ)(m.Ff,{method:"POST",data:{name:e}});if(t instanceof Error)throw t;y((0,j.kg)(j.zv,"Emoji deleted")),E=setTimeout(_,p.sI)}catch(n){y((0,j.kg)(j.Un,"".concat(n))),o(!1),E=setTimeout(_,p.sI)}T()}async function Z(){o(!0);try{y((0,j.kg)(j.Jk,"Converting emoji..."));let e=await new Promise((e,t)=>{if(!f.d.includes(k.type)){let n="File type is not supported: ".concat(k.type);return t(n)}(0,f.y)(k,t=>e({name:k.name,url:t}))});y((0,j.kg)(j.Jk,"Uploading emoji..."));let t=await (0,m.rQ)(m.Qc,{method:"POST",data:{name:e.name,data:e.url}});if(t instanceof Error)throw t;y((0,j.kg)(j.zv,"Emoji uploaded successfully!")),T()}catch(n){y((0,j.kg)(j.Un,"".concat(n)))}E=setTimeout(_,p.sI),o(!1)}return(0,c.useEffect)(()=>{T()},[]),(0,i.jsxs)("div",{children:[(0,i.jsx)(h,{children:"Emojis"}),(0,i.jsx)(g,{children:"Here you can upload new custom emojis for usage in the chat. When uploading a new emoji, the filename will be used as emoji name."}),(0,i.jsx)(l.Z,{rowKey:e=>e.url,dataSource:e,columns:[{title:"",key:"delete",render:(e,t)=>(0,i.jsx)(r.Z,{size:"middle",children:(0,i.jsx)(s.Z,{onClick:()=>v(t.name),icon:(0,i.jsx)(a.Z,{})})})},{title:"Name",key:"name",dataIndex:"name"},{title:"Emoji",key:"url",render:(e,t)=>(0,i.jsx)("img",{src:t.url,alt:t.name,style:{maxWidth:"2vw"}})}],pagination:!1}),(0,i.jsx)("br",{}),(0,i.jsx)(u.Z,{name:"emoji",listType:"picture",className:"emoji-uploader",showUploadList:!1,accept:f.d.join(","),beforeUpload:x,customRequest:Z,disabled:n,children:(0,i.jsx)(s.Z,{type:"primary",disabled:n,children:"Upload new emoji"})}),(0,i.jsx)(d.Z,{status:w})]})};var y=w},60956:function(e,t,n){"use strict";n.d(t,{d:function(){return i},y:function(){return a}});let i=["image/png","image/jpeg","image/gif"];function a(e,t){let n=new FileReader;n.addEventListener("load",()=>t(n.result)),n.readAsDataURL(e)}}},function(e){e.O(0,[8909,3903,4267,2206,5577,2938,9774,2888,179],function(){return e(e.s=10887)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6559],{10887:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/chat/emojis",function(){return n(14518)}])},14518:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return y}});var i=n(85893),a=n(48689),o=n(84485),s=n(26713),l=n(71577),r=n(52206),c=n(77916),u=n(67294),d=n(39664),m=n(64777),j=n(60956),f=n(41983),p=n(90745);let{Title:h,Paragraph:g}=o.Z,w=()=>{let[e,t]=(0,u.useState)([]),[n,o]=(0,u.useState)(!1),[w,y]=(0,u.useState)(null),[k,x]=(0,u.useState)(null),E=null,_=()=>{y(null),clearTimeout(E),E=null};async function T(){o(!0);try{let e=await (0,m.rQ)("/api/emoji");t(e)}catch(n){console.error("error fetching emojis",n)}o(!1)}async function v(e){let t="/".concat(e.split("/").slice(3).join("/"));console.log(t),o(!0),y((0,f.kg)(f.Jk,"Deleting emoji..."));try{let n=await (0,m.rQ)(m.Ff,{method:"POST",data:{name:t}});if(n instanceof Error)throw n;y((0,f.kg)(f.zv,"Emoji deleted")),E=setTimeout(_,p.sI)}catch(i){y((0,f.kg)(f.Un,"".concat(i))),o(!1),E=setTimeout(_,p.sI)}T()}async function Z(){o(!0);try{y((0,f.kg)(f.Jk,"Converting emoji..."));let e=await new Promise((e,t)=>{if(!j.d.includes(k.type)){let n="File type is not supported: ".concat(k.type);return t(n)}(0,j.y)(k,t=>e({name:k.name,url:t}))});y((0,f.kg)(f.Jk,"Uploading emoji..."));let t=await (0,m.rQ)(m.Qc,{method:"POST",data:{name:e.name,data:e.url}});if(t instanceof Error)throw t;y((0,f.kg)(f.zv,"Emoji uploaded successfully!")),T()}catch(n){y((0,f.kg)(f.Un,"".concat(n)))}E=setTimeout(_,p.sI),o(!1)}return(0,u.useEffect)(()=>{T()},[]),(0,i.jsxs)("div",{children:[(0,i.jsx)(h,{children:"Emojis"}),(0,i.jsx)(g,{children:"Here you can upload new custom emojis for usage in the chat. When uploading a new emoji, the filename will be used as emoji name."}),(0,i.jsx)(r.Z,{rowKey:e=>e.url,dataSource:e,columns:[{title:"",key:"delete",render:(e,t)=>(0,i.jsx)(s.Z,{size:"middle",children:(0,i.jsx)(l.Z,{onClick:()=>v(t.url),icon:(0,i.jsx)(a.Z,{})})})},{title:"Name",key:"name",dataIndex:"name"},{title:"Emoji",key:"url",render:(e,t)=>(0,i.jsx)("img",{src:t.url,alt:t.name,style:{maxWidth:"2vw"}})}],pagination:!1}),(0,i.jsx)("br",{}),(0,i.jsx)(c.Z,{name:"emoji",listType:"picture",className:"emoji-uploader",showUploadList:!1,accept:j.d.join(","),beforeUpload:x,customRequest:Z,disabled:n,children:(0,i.jsx)(l.Z,{type:"primary",disabled:n,children:"Upload new emoji"})}),(0,i.jsx)(d.Z,{status:w})]})};var y=w},60956:function(e,t,n){"use strict";n.d(t,{d:function(){return i},y:function(){return a}});let i=["image/png","image/jpeg","image/gif"];function a(e,t){let n=new FileReader;n.addEventListener("load",()=>t(n.result)),n.readAsDataURL(e)}}},function(e){e.O(0,[8909,3903,4267,2206,5577,2938,9774,2888,179],function(){return e(e.s=10887)}),_N_E=e.O()}]);