"use strict";(self["webpackChunk_quetz_frontend_main_app"]=self["webpackChunk_quetz_frontend_main_app"]||[]).push([[2328,9532],{72328:(e,a,n)=>{n.r(a);n.d(a,{CommandIDs:()=>C,default:()=>x});var t=n(30325);var r=n.n(t);var l=n(5089);var s=n.n(l);var c=n(40746);var o=n.n(c);var i=n(85168);var m=n.n(i);var d=n(79450);var u=n.n(d);var h=n(18303);var p=n.n(h);var v=n(98078);var g=n.n(v);var E=n(26074);var f=n.n(E);var _=n(71993);var w=n.n(_);var N=n(2411);var k=n.n(N);var C;(function(e){e.open="@quetz-frontend/home-extension:open"})(C||(C={}));const b={id:"@quetz-frontend/home-extension:plugin",autoStart:true,requires:[i.IRouter],activate:(e,a)=>{const{shell:n,commands:t}=e;t.addCommand(C.open,{execute:()=>{n.add(new H(a),"main")}});a.register({pattern:/^\/home.*/,command:C.open})}};const x=b;class H extends d.ReactWidget{constructor(e){super();this.id=d.DOMUtils.createDomID();this.title.label="Home page";this._router=e}_route(e){this._router.navigate(e)}render(){const e=v.ServerConnection.makeSettings();const a=h.URLExt.join(e.baseUrl,"/api/channels");return N.createElement("div",{className:"page-contents-width-limit"},N.createElement("h2",{className:"heading2"},"Home"),N.createElement("div",{className:"flex"},N.createElement("h3",{className:"section-heading"},"Recently updated channels")," ",N.createElement("p",{className:"minor-paragraph"},N.createElement("a",{className:"link",onClick:()=>this._route("/channels")},"View all"))),N.createElement("div",{className:"padding-side"},N.createElement(E.FetchHoc,{url:a,loadingMessage:"Fetching list of channels",genericErrorMessage:"Error fetching list of channels"},(e=>e.length>0?N.createElement(_.List,{data:e.slice(0,5),columns:q(),to:e=>this._route(`/channels/${e.name}`)}):N.createElement("p",{className:"paragraph"},"No channels available")))))}}const q=()=>[{Header:"",accessor:"name",Cell:({row:e})=>{const[a,n]=N.useState(null);return N.createElement(N.Fragment,null,N.createElement("span",{ref:e=>{n(e)}},N.createElement(l.FontAwesomeIcon,{icon:e.original.private?t.faUnlockAlt:t.faGlobeAmericas})),N.createElement(c.Tooltip,{anchorElement:a,position:"right"},e.original.private?"Private":"Public"))},width:5},{Header:"",accessor:"user.profile.name",Cell:({row:e})=>N.createElement("div",null,N.createElement("p",{className:"text"},e.original.name),N.createElement("p",{className:"minor-paragraph channel-list-description"},e.original.description)),width:45},{Header:"",accessor:"user.username",Cell:({row:e})=>(0,E.formatPlural)(e.original.packages_count,"package"),width:35},{Header:"",accessor:"role",Cell:({row:e})=>(0,E.formatPlural)(e.original.members_count,"member"),width:20}]}}]);