mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
1 line
6.3 KiB
JavaScript
1 line
6.3 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2877],{72877:function(e,n,a){a.d(n,{h:function(){return z}});var t=a(47568),l=a(14924),s=a(26042),i=a(69396),o=a(29815),c=a(70655),r=a(85893),u=a(67294),d=a(84485),f=a(71577),m=a(69677),p=a(93626),h=a(85402),x=a(10010),j=a(39398),v=a(48689),N=a(38939),Z=a(25964),k=function(e){var n=e.iconList,a=e.selectedOption,t=e.onSelected,l=""===a?null:a;return(0,r.jsxs)("div",{className:"social-dropdown-container",children:[(0,r.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,r.jsxs)("div",{className:"formfield-container",children:[(0,r.jsx)("div",{className:"label-side",children:(0,r.jsx)("span",{className:"formfield-label",children:"Social Platform"})}),(0,r.jsx)("div",{className:"input-side",children:(0,r.jsxs)(N.Z,{style:{width:240},className:"social-dropdown",placeholder:"Social platform...",defaultValue:l,value:l,onSelect:function(e){t&&t(e)},children:[n.map((function(e){var n=e.platform,a=e.icon,t=e.key;return(0,r.jsxs)(N.Z.Option,{className:"social-option",value:t,children:[(0,r.jsx)("span",{className:"option-icon",children:(0,r.jsx)("img",{src:a,alt:"",className:"option-icon"})}),(0,r.jsx)("span",{className:"option-label",children:n})]},"platform-".concat(t))})),(0,r.jsx)(N.Z.Option,{className:"social-option",value:Z.z_,children:"Other..."},"platform-".concat(Z.z_))]})})]})]})},g=a(58827),y=a(35159),S=a(19411),b=a(24389),w=a(83192),C=a(25521),_=d.Z.Title,z=function(){var e=(0,u.useState)([]),n=e[0],a=e[1],d=(0,u.useState)([]),N=d[0],z=d[1],E=(0,u.useState)(!1),O=E[0],I=E[1],T=(0,u.useState)(!1),H=T[0],L=T[1],A=(0,u.useState)(!1),P=A[0],U=A[1],D=(0,u.useState)(-1),V=D[0],B=D[1],F=(0,u.useState)(Z.wC),K=F[0],Q=F[1],R=(0,u.useState)(null),Y=R[0],$=R[1],q=(0,u.useContext)(y.aC)||{},G=q.serverConfig,J=q.setFieldInConfigState,M=G.instanceDetails,W=M.socialHandles,X=null,ee=function(){var e=(0,t.Z)((function(){var e,n,t;return(0,c.__generator)(this,(function(l){switch(l.label){case 0:return l.trys.push([0,2,,3]),[4,(0,g.rQ)(g.$i,{auth:!1})];case 1:return e=l.sent(),n=Object.keys(e).map((function(n){return(0,s.Z)({key:n},e[n])})),a(n),[3,3];case 2:return t=l.sent(),console.log(t),[3,3];case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),ne=function(e){return n.find((function(n){return n.key===e}))||!1},ae=""!==K.platform&&!n.find((function(e){return e.key===K.platform}));(0,u.useEffect)((function(){ee()}),[]),(0,u.useEffect)((function(){M.socialHandles&&z(W)}),[M]);var te=function(){$(null),X=null,clearTimeout(X)},le=function(){I(!1),B(-1),L(!1),U(!1),Q((0,s.Z)({},Z.wC))},se=function(){le()},ie=function(e,n){Q((0,i.Z)((0,s.Z)({},K),(0,l.Z)({},e,n)))},oe=function(){var e=(0,t.Z)((function(e){return(0,c.__generator)(this,(function(n){switch(n.label){case 0:return[4,(0,Z.Si)({apiPath:Z.c9,data:{value:e},onSuccess:function(){J({fieldName:"socialHandles",value:e,path:"instanceDetails"}),U(!1),se(),$((0,w.kg)(w.zv)),X=setTimeout(te,Z.sI)},onError:function(e){$((0,w.kg)(w.Un,"There was an error: ".concat(e))),U(!1),X=setTimeout(te,Z.sI)}})];case 1:return n.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),ce=[{title:"Social Link",dataIndex:"",key:"combo",render:function(e,n){var a=n.platform,t=n.url,l=ne(a);if(!l)return(0,r.jsx)("div",{className:"social-handle-cell",children:(0,r.jsxs)("p",{className:"option-label",children:[(0,r.jsx)("strong",{children:a}),(0,r.jsx)("span",{className:"handle-url",title:t,children:t})]})});var s=l.icon,i=l.platform;return(0,r.jsxs)("div",{className:"social-handle-cell",children:[(0,r.jsx)("span",{className:"option-icon",children:(0,r.jsx)("img",{src:s,alt:"",className:"option-icon"})}),(0,r.jsxs)("p",{className:"option-label",children:[(0,r.jsx)("strong",{children:i}),(0,r.jsx)("span",{className:"handle-url",title:t,children:t})]})]})}},{title:"",dataIndex:"",key:"edit",render:function(e,n,a){return(0,r.jsxs)("div",{className:"actions",children:[(0,r.jsx)(f.Z,{size:"small",onClick:function(){var e=N[a];B(a),Q((0,s.Z)({},e)),I(!0),ne(e.platform)||L(!0)},children:"Edit"}),(0,r.jsx)(f.Z,{icon:(0,r.jsx)(x.Z,{}),size:"small",hidden:0===a,onClick:function(){return function(e){if(!(e<=0||e>=N.length)){var n=(0,o.Z)(N),a=n[e-1];n[e-1]=n[e],n[e]=a,oe(n)}}(a)}}),(0,r.jsx)(f.Z,{icon:(0,r.jsx)(j.Z,{}),size:"small",hidden:a===N.length-1,onClick:function(){return function(e){if(!(e<0||e>=N.length-1)){var n=(0,o.Z)(N),a=n[e+1];n[e+1]=n[e],n[e]=a,oe(n)}}(a)}}),(0,r.jsx)(f.Z,{className:"delete-button",icon:(0,r.jsx)(v.Z,{}),size:"small",onClick:function(){return function(e){var n=(0,o.Z)(N);n.splice(e,1),oe(n)}(a)}})]})}}],re={disabled:!(0,S.Z)(K.url)},ue=(0,r.jsxs)("div",{className:"other-field-container formfield-container",children:[(0,r.jsx)("div",{className:"label-side"}),(0,r.jsx)("div",{className:"input-side",children:(0,r.jsx)(m.Z,{placeholder:"Other platform name",defaultValue:K.platform,onChange:function(e){var n=e.target.value;ie("platform",n)}})})]});return(0,r.jsxs)("div",{className:"social-links-edit-container",children:[(0,r.jsx)(_,{level:3,className:"section-title",children:"Your Social Handles"}),(0,r.jsx)("p",{className:"description",children:"Add all your social media handles and links to your other profiles here."}),(0,r.jsx)(C.E,{status:Y}),(0,r.jsx)(p.Z,{className:"social-handles-table",pagination:!1,size:"small",rowKey:function(e){return"".concat(e.platform,"-").concat(e.url)},columns:ce,dataSource:N}),(0,r.jsx)(h.Z,{title:"Edit Social Handle",open:O,onOk:function(){U(!0);var e=N.length?(0,o.Z)(N):[];-1===V?e.push(K):e.splice(V,1,K),oe(e)},onCancel:se,confirmLoading:P,okButtonProps:re,children:(0,r.jsxs)("div",{className:"social-handle-modal-content",children:[(0,r.jsx)(k,{iconList:n,selectedOption:ae?Z.z_:K.platform,onSelected:function(e){e===Z.z_?(L(!0),ie("platform","")):(L(!1),ie("platform",e))}}),H&&ue,(0,r.jsx)("br",{}),(0,r.jsx)(b.nv,{fieldName:"social-url",label:"URL",placeholder:{mastodon:"https://mastodon.social/@username",twitter:"https://twitter.com/username"}[K.platform]||"Url to page",value:K.url,onChange:function(e){var n=e.value;ie("url",n)},useTrim:!0,type:"url",pattern:S.a}),(0,r.jsx)(C.E,{status:Y})]})}),(0,r.jsx)("br",{}),(0,r.jsx)(f.Z,{type:"primary",onClick:function(){le(),I(!0)},children:"Add a new social link"})]})}}}]); |