PageSourceSearch

https://panews.io/assets/contributors-BH7-uMu4.js

js panews.io collected 2026-10-03 23:26:29 UTC 8,555 bytes, 1 lines download raw bytes

1import{r as l,o as t,L as f,z as U}from"./chunk-4N6VE7H7-DzH4tAf6.js";import{P as T,A as _}from"./ApplyColumnistModal-C6vKFPOh.js";import{L as G}from"./LoadMoreButton-wZfPyn6c.js";import{S as D}from"./StaticPageHero-BQfDnW7X.js";import{u as H}from"./SiteAuthContext-rDcCJ5SK.js";import{U as J}from"./users-round-Bntx2NYu.js";import{C as K}from"./check-BC9K7OM6.js";import{P as V}from"./plus-jwM4GU8W.js";import{A as q}from"./arrow-up-right-BS5vSFoh.js";import{c as z,p as W}from"./seo-CQwlt2tl.js";import"./createLucideIcon-CH70JErn.js";import"./x-CtmSW_gC.js";import"./copy-B41wPkfV.js";const A="panews-profile-following",k=5,Y=2;function L(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function Z(){const e=L();if(!e)return[];try{const s=JSON.parse(e.getItem(A)||"[]");return Array.isArray(s)?s.filter(o=>!!o&&typeof o=="object"&&"id"in o&&"name"in o):[]}catch{return[]}}function Q(e){var s;(s=L())==null||s.setItem(A,JSON.stringify(e))}function I(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString("en-US")}function X(e){return e?new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric"}).format(new Date(e)):"Recently"}function ee(e){const s=e.recommended.filter(o=>!e.contributors.some(r=>r.id===o.id));return s.length?s:e.contributors}function te(e,s,o){if(!e.length)return[];const r=[];for(let c=0;c<Math.min(o,e.length);c+=1)r.push(e[(s+c)%e.length]);return r}function se(e){const s=[],o=ee(e);let r=0;for(let c=0;c<e.contributors.length;c+=k){const x=s.length%2===0?3:4;s.push({contributors:e.contributors.slice(c,c+k),recommended:te(o,r,x)}),r+=x}return s}function ne(e){return{id:e.id,name:e.name,role:"Column",avatar:e.avatar,description:e.signature}}function re({contributor:e,isFollowing:s,onToggleFollow:o}){return t.jsxs("article",{className:"rounded-[8px] border border-slate-100 bg-white p-5 md:p-6",children:[t.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[t.jsxs(f,{to:`/contributors/${e.id}`,className:"group/profile flex min-w-0 items-start gap-4",children:[t.jsx("img",{src:e.avatar,alt:e.name,className:"h-16 w-16 rounded-full bg-slate-100 object-cover"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-[22px] font-black leading-tight text-heading transition-colors group-hover/profile:text-primary",children:e.name}),t.jsx("p",{className:"mt-1 line-clamp-2 text-[14px] leading-6 text-slate-500",children:e.signature}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-[13px] font-bold text-slate-400",children:[t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(J,{className:"h-4 w-4"}),I(e.followers)," followers"]}),t.jsxs("span",{children:[e.publishedCount.toLocaleString("en-US")," posts"]})]})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4 md:justify-end",children:[t.jsx("span",{className:"text-[13px] font-bold text-slate-400",children:X(e.lastPostAt)}),t.jsxs("button",{type:"button",onClick:()=>o(e),"aria-pressed":s,className:`inline-flex h-9 items-center justify-center gap-2 rounded-[8px] px-4 text-[14px] font-bold transition-colors ${s?"border border-primary bg-white text-primary hover:bg-primary/5":"bg-primary text-white hover:bg-blue-700"}`,children:[s?t.jsx(K,{className:"h-4 w-4"}):t.jsx(V,{className:"h-4 w-4"}),s?"Following":"Follow"]})]})]}),t.jsx("div",{className:"mt-6 space-y-4",children:e.recentArticles.length?e.recentArticles.slice(0,2).map(r=>t.jsxs(f,{to:`/articles/${r.id}`,className:"group block border-l-2 border-primary/10 pl-4 transition-colors hover:border-primary",children:[t.jsx("h3",{className:"line-clamp-1 text-[17px] font-black leading-6 text-heading transition-colors group-hover:text-primary",children:r.title}),r.desc?t.jsx("p",{className:"mt-2 line-clamp-2 text-[14px] leading-6 text-slate-500",children:r.desc}):t.jsx("time",{className:"mt-2 block text-[13px] font-medium text-slate-400",children:r.label})]},r.id)):t.jsx("div",{className:"rounded-[8px] border border-dashed border-slate-200 bg-slate-50/60 px-4 py-5 text-[13px] leading-5 text-slate-500",children:"Recent English articles are being indexed for this contributor."})})]})}function oe({contributor:e}){return t.jsxs(f,{to:`/contributors/${e.id}`,className:"group relative flex min-h-[220px] flex-col items-center justify-center rounded-[8px] border border-slate-100 bg-white px-6 py-8 text-center transition-all duration-200 hover:border-primary/60",children:[t.jsx("span",{"aria-hidden":"true",className:"absolute right-5 top-5 flex h-10 w-10 translate-y-1 items-center justify-center rounded-[8px] bg-primary text-white opacity-0 transition-all duration-200 group-hover:translate-y-0 group-hover:opacity-100",children:t.jsx(q,{className:"h-[18px] w-[18px]"})}),t.jsx("img",{src:e.avatar,alt:e.name,className:"h-16 w-16 rounded-full bg-slate-100 object-cover"}),t.jsx("h2",{className:"mt-4 max-w-full truncate text-[18px] font-black text-heading",children:e.name}),t.jsxs("div",{className:"mt-3 flex items-center justify-center gap-3 text-[14px] font-bold text-heading",children:[t.jsxs("span",{children:[I(e.followers)," followers"]}),t.jsx("span",{className:"text-slate-300",children:"/"}
1),t.jsxs("span",{children:[e.publishedCount.toLocaleString("en-US")," posts"]})]}),t.jsx("p",{className:"mt-4 line-clamp-3 text-[13px] leading-5 text-slate-500",children:e.signature})]})}function ae({payload:e}){const{isLoggedIn:s,openAuthModal:o}=H(),[r,c]=l.useState(e.contributors),[p,x]=l.useState(!!e.hasMore),[g,P]=l.useState(e.nextSkip||e.contributors.length),[b,j]=l.useState(!1),[w,N]=l.useState(),[y,S]=l.useState([]),[E,C]=l.useState(!1),[h,v]=l.useState(Y),M=l.useMemo(()=>({...e,contributors:r}),[r,e]),m=l.useMemo(()=>se(M),[M]),F=m.slice(0,h),R=h<m.length||p,$=l.useMemo(()=>new Set(y.map(n=>n.id)),[y]);l.useEffect(()=>{S(Z())},[]);const O=n=>{if(!s){o("signin");return}S(i=>{const a=i.some(d=>d.id===n.id)?i.filter(d=>d.id!==n.id):[...i,ne(n)];return Q(a),a})},B=async()=>{if(N(void 0),h<m.length){v(n=>Math.min(n+1,m.length));return}if(!(!p||b)){j(!0);try{const n=await fetch(`/api/contributors?skip=${g}`);if(!n.ok)throw new Error("Failed to load more columns");const i=await n.json();c(a=>{const d=new Set(a.map(u=>u.id));return[...a,...i.contributors.filter(u=>d.has(u.id)?!1:(d.add(u.id),!0))]}),x(!!i.hasMore),P(i.nextSkip||g+i.contributors.length),v(a=>a+1)}catch(n){N(n instanceof Error?n.message:"Failed to load more columns")}finally{j(!1)}}};return t.jsxs("div",{className:"-mb-16 min-h-screen bg-slate-50/70 pb-16 text-slate-900",children:[t.jsx(D,{current:"Column",title:"Column",summary:"Explore PANews signature columns ordered by their latest updates, with recommended columnist voices mixed into the feed.",showAccent:!1,aside:t.jsxs("div",{className:"flex w-full flex-col items-center lg:w-[320px]",children:[t.jsx("img",{src:"/contributors.png",alt:"PANews column mascot",className:"mb-[-6px] w-[142px] max-w-full object-contain md:w-[168px]"}),t.jsxs("button",{type:"button",onClick:()=>C(!0),className:"inline-flex h-12 w-full max-w-[300px] items-center justify-center gap-2 rounded-[8px] bg-primary px-4 text-[15px] font-bold text-white transition-colors hover:bg-blue-700",children:[t.jsx(T,{className:"h-4 w-4"}),"Apply to Become a Columnist"]})]})}),t.jsx("main",{className:"bg-slate-50/70",children:t.jsx("div",{className:"mx-auto max-w-[1480px] px-6 py-7 pb-16 lg:px-8",children:m.length?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-5",children:F.map((n,i)=>t.jsxs("div",{className:"space-y-5",children:[n.contributors.map(a=>t.jsx(re,{contributor:a,isFollowing:$.has(a.id),onToggleFollow:O},a.id)),n.recommended.length?t.jsx("div",{className:`grid gap-5 ${n.recommended.length>=4?"md:grid-cols-2 xl:grid-cols-4":"md:grid-cols-3"}`,children:n.recommended.map((a,d)=>t.jsx(oe,{contributor:a},`recommended-${i}-${a.id}-${d}`))}):null]},`section-${i}`))}),t.jsxs("div",{className:"mt-6",children:[t.jsx(G,{hasMore:R,loading:b,onClick:()=>void B()}),w?t.jsx("p",{className:"text-center text-[13px] font-medium text-red-500",children:w}):null]})]}):t.jsx("div",{className:"flex min-h-[220px] items-center justify-center rounded-[8px] border border-dashed border-slate-200 bg-white text-[15px] text-slate-500",children:"No columns found."})})}),t.jsx(_,{isOpen:E,onClose:()=>C(!1)})]})}const we=()=>z(W.contributors),Ne=U(function({loaderData:s}){return t.jsx(ae,{payload:s.payload})});export{Ne as default,we as meta};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.