Files
owncast/static/admin/_next/static/chunks/pages/config-social-items-a7f65f614734b1284dc5.js
Gabe Kangas f0bd7d2528 Replace pkger with go:embed for bundling the admin. Closes #844 (#1464)
* Replace pkger with go:embed for bundling the admin. Closes #844

* Remove references to pkged.go

* Point tests to use an updated version of Go

* Add comment to new exported function

* Cleanup

* Add a dummy pkged.go to alert people to stop using it.

* Add simple browser test to make sure the admin is available and renders

* Don't panic
2021-10-11 14:56:00 -07:00

1 line
7.7 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[269],{73171:function(e,n,t){"use strict";t.d(n,{Z:function(){return i}});var a=t(1413),s=t(67294),l={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"}}]},name:"delete",theme:"outlined"},r=t(30076),c=function(e,n){return s.createElement(r.Z,(0,a.Z)((0,a.Z)({},e),{},{ref:n,icon:l}))};c.displayName="DeleteOutlined";var i=s.forwardRef(c)},39424:function(e,n,t){"use strict";t.d(n,{Z:function(){return _}});var a=t(93433),s=t(4942),l=t(15861),r=t(87757),c=t.n(r),i=t(67294),o=t(4525),u=t(71577),d=t(4107),f=t(2023),p=t(37614),m=t(73171),h=t(7031),v=t(94853),j=t(95828),x=t(85893);function N(e){var n=e.iconList,t=e.selectedOption,a=e.onSelected,s=""===t?null:t;return(0,x.jsxs)("div",{className:"social-dropdown-container",children:[(0,x.jsx)("p",{className:"description",children:"If you are looking for a platform name not on this list, please select Other and type in your own name. A logo will not be provided."}),(0,x.jsxs)("div",{className:"formfield-container",children:[(0,x.jsx)("div",{className:"label-side",children:(0,x.jsx)("span",{className:"formfield-label",children:"Social Platform"})}),(0,x.jsx)("div",{className:"input-side",children:(0,x.jsxs)(h.Z,{style:{width:240},className:"social-dropdown",placeholder:"Social platform...",defaultValue:s,value:s,onSelect:function(e){a&&a(e)},children:[n.map((function(e){var n=e.platform,t=e.icon,a=e.key,s="".concat(v.WB).concat(t.slice(1));return(0,x.jsxs)(h.Z.Option,{className:"social-option",value:a,children:[(0,x.jsx)("span",{className:"option-icon",children:(0,x.jsx)("img",{src:s,alt:"",className:"option-icon"})}),(0,x.jsx)("span",{className:"option-label",children:n})]},"platform-".concat(a))})),(0,x.jsx)(h.Z.Option,{className:"social-option",value:j.z_,children:"Other..."},"platform-".concat(j.z_))]})})]})]})}var b=t(60293),y=t(31820),g=t(60764),w=t(74071),O=t(91486);function Z(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function k(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?Z(Object(t),!0).forEach((function(n){(0,s.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var S=o.Z.Title;function _(){var e=(0,i.useState)([]),n=e[0],t=e[1],r=(0,i.useState)([]),o=r[0],h=r[1],Z=(0,i.useState)(!1),_=Z[0],C=Z[1],P=(0,i.useState)(!1),E=P[0],z=P[1],H=(0,i.useState)(!1),T=H[0],D=H[1],I=(0,i.useState)(-1),L=I[0],B=I[1],A=(0,i.useState)(j.wC),U=A[0],M=A[1],R=(0,i.useState)(null),V=R[0],W=R[1],X=(0,i.useContext)(b.aC)||{},F=X.serverConfig,K=X.setFieldInConfigState,Q=F.instanceDetails,Y=Q.socialHandles,$=null,q=function(){var e=(0,l.Z)(c().mark((function e(){var n,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,v.rQ)(v.$i,{auth:!1});case 3:n=e.sent,a=Object.keys(n).map((function(e){return k({key:e},n[e])})),t(a),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}(),G=function(e){return n.find((function(n){return n.key===e}))||!1},J=""!==U.platform&&!n.find((function(e){return e.key===U.platform}));(0,i.useEffect)((function(){q()}),[]),(0,i.useEffect)((function(){Q.socialHandles&&h(Y)}),[Q]);var ee=function(){W(null),$=null,clearTimeout($)},ne=function(){C(!1),B(-1),z(!1),D(!1),M(k({},j.wC))},te=function(){ne()},ae=function(e,n){M(k(k({},U),{},(0,s.Z)({},e,n)))},se=function(){var e=(0,l.Z)(c().mark((function e(n){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,j.Si)({apiPath:j.c9,data:{value:n},onSuccess:function(){K({fieldName:"socialHandles",value:n,path:"instanceDetails"}),D(!1),te(),W((0,w.kg)(w.zv)),$=setTimeout(ee,j.sI)},onError:function(e){W((0,w.kg)(w.Un,"There was an error: ".concat(e))),D(!1),$=setTimeout(ee,j.sI)}});case 2:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),le=[{title:"Social Link",dataIndex:"",key:"combo",render:function(e,n){var t=n.platform,a=n.url,s=G(t);if(!s)return(0,x.jsx)("div",{className:"social-handle-cell",children:(0,x.jsxs)("p",{className:"option-label",children:[(0,x.jsx)("strong",{children:t}),(0,x.jsx)("span",{className:"handle-url",title:a,children:a})]})});var l=s.icon,r=s.platform,c="".concat(v.WB).concat(l.slice(1));return(0,x.jsxs)("div",{className:"social-handle-cell",children:[(0,x.jsx)("span",{className:"option-icon",children:(0,x.jsx)("img",{src:c,alt:"",className:"option-icon"})}),(0,x.jsxs)("p",{className:"option-label",children:[(0,x.jsx)("strong",{children:r}),(0,x.jsx)("span",{className:"handle-url",title:a,children:a})]})]})}},{title:"",dataIndex:"",key:"edit",render:function(e,n,t){return(0,x.jsxs)("div",{className:"actions",children:[(0,x.jsx)(u.Z,{size:"small",onClick:function(){var e=o[t];B(t),M(k({},e)),C(!0),G(e.platform)||z(!0)},children:"Edit"}),(0,x.jsx)(u.Z,{className:"delete-button",icon:(0,x.jsx)(m.Z,{}),size:"small",onClick:function(){return function(e){var n=(0,a.Z)(o);n.splice(e,1),se(n)}(t)}})]})}}],re={disabled:!(0,y.Z)(U.url)},ce=(0,x.jsxs)("div",{className:"other-field-container formfield-container",children:[(0,x.jsx)("div",{className:"label-side"}),(0,x.jsx)("div",{className:"input-side",children:(0,x.jsx)(d.Z,{placeholder:"Other platform name",defaultValue:U.platform,onChange:function(e){var n=e.target.value;ae("platform",n)}})})]});return(0,x.jsxs)("div",{className:"social-links-edit-container",children:[(0,x.jsx)(S,{level:3,className:"section-title",children:"Your Social Handles"}),(0,x.jsx)("p",{className:"description",children:"Add all your social media handles and links to your other profiles here."}),(0,x.jsx)(O.Z,{status:V}),(0,x.jsx)(f.Z,{className:"social-handles-table",pagination:!1,size:"small",rowKey:function(e){return"".concat(e.platform,"-").concat(e.url)},columns:le,dataSource:o}),(0,x.jsx)(p.Z,{title:"Edit Social Handle",visible:_,onOk:function(){D(!0);var e=o.length?(0,a.Z)(o):[];-1===L?e.push(U):e.splice(L,1,U),se(e)},onCancel:te,confirmLoading:T,okButtonProps:re,children:(0,x.jsxs)("div",{className:"social-handle-modal-content",children:[(0,x.jsx)(N,{iconList:n,selectedOption:J?j.z_:U.platform,onSelected:function(e){e===j.z_?(z(!0),ae("platform","")):(z(!1),ae("platform",e))}}),E&&ce,(0,x.jsx)("br",{}),(0,x.jsx)(g.ZP,{fieldName:"social-url",label:"URL",placeholder:{mastodon:"https://mastodon.social/@username",twitter:"https://twitter.com/username"}[U.platform]||"Url to page",value:U.url,onChange:function(e){var n=e.value;ae("url",n)},useTrim:!0,type:"url",pattern:y.a}),(0,x.jsx)(O.Z,{status:V})]})}),(0,x.jsx)("br",{}),(0,x.jsx)(u.Z,{type:"primary",onClick:function(){ne(),C(!0)},children:"Add a new social link"})]})}},29019:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return c}});t(67294);var a=t(4525),s=t(39424),l=t(85893),r=a.Z.Title;function c(){return(0,l.jsxs)("div",{className:"config-social-items",children:[(0,l.jsx)(r,{children:"Social Items"}),(0,l.jsx)(s.Z,{})]})}},23999:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/config-social-items",function(){return t(29019)}])}},function(e){e.O(0,[23,614,774,888,179],(function(){return n=23999,e(e.s=n);var n}));var n=e.O();_N_E=n}]);