PageSourceSearch

https://living-corporate.com/assets/lists-FehYSkAE.js

js living-corporate.com collected 2026-10-02 04:59:45 UTC 8,025 bytes, 1 lines download raw bytes

1import{r as N,u as q,v as E,f as k,i as C,j as e,o as h,m,h as z,I as B,k as g,d as F,B as f,L as Q}from"./index-QiiZ-xPT.js";import{N as S}from"./Navigation-r93ZBuy6.js";import{F as K}from"./Footer-3JNsJayo.js";import{A as T}from"./AppLayout-DS32LUNS.js";import{u as A}from"./use-org-context-CBkicTVV.js";import{S as M}from"./sparkles-C108-045.js";import{H as O}from"./hash-C8UiEKQ0.js";import{U as W}from"./users-JkJLChox.js";import{C as I}from"./chevron-right-f4G5e4zR.js";import"./label-BA9Xin3m.js";import"./checkbox-CrGTwbPu.js";import"./index-DqZlRfV5.js";import"./check-KTa2Xihg.js";import"./select-B1P2Vx_w.js";import"./index-BMyKsIJE.js";import"./Combination-TP2Egp2x.js";import"./chevron-down-BWOHa16b.js";import"./dialog-D2VXyQJN.js";import"./save-BsB7cS8F.js";import"./dropdown-menu-D4zjGRmc.js";import"./index-Bj3iuRQR.js";import"./circle-2nw1jhuN.js";import"./useTranslation-XedzLvcK.js";import"./globe-3tsuvpPT.js";import"./log-out-CqAuLeet.js";import"./building-2-Bz-h5bHH.js";import"./BrandSponsor-DEW6i_On.js";import"./card-DkXabqFf.js";import"./mail-Cr62Xklx.js";import"./twitter-BzZd48jL.js";import"./chevron-left-BlU_Pgs7.js";import"./gift-DGFeQbUI.js";import"./library-DGVSHwk6.js";import"./history-Db1-bwk2.js";import"./video-DCxcvy3M.js";function Ne(){const[t,o]=N.useState(""),{isAuthenticated:i}=q(),a=E(),{orgSlug:n,sidebarBranding:l}=A("/org/:slug/lists"),{data:c,isLoading:L}=k({queryKey:["/api/weekly-topics"],queryFn:async()=>{const s=await fetch("/api/weekly-topics");if(!s.ok)throw new Error("Failed to fetch topics");return s.json()}}),{data:y}=k({queryKey:["/api/topic-subscriptions"],queryFn:async()=>{const s=await fetch("/api/topic-subscriptions",{credentials:"include"});if(!s.ok)throw new Error("Failed to fetch subscriptions");return s.json()},enabled:i}),u=C({mutationFn:async s=>{const r=await fetch("/api/topic-subscriptions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topicSlug:s}),credentials:"include"});if(!r.ok)throw new Error("Failed to subscribe");return r.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/topic-subscriptions"]}),a.invalidateQueries({queryKey:["/api/weekly-topics"]})}}),p=C({mutationFn:async s=>{const r=await fetch(`/api/topic-subscriptions/${s}`,{method:"DELETE",credentials:"include"});if(!r.ok)throw new Error("Failed to unsubscribe");return r.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["/api/topic-subscriptions"]}),a.invalidateQueries({queryKey:["/api/weekly-topics"]})}}),x=s=>y?y.some(r=>r.topicSlug===s):!1,b=s=>{if(!i){window.location.href="/login";return}x(s)?p.mutate(s):u.mutate(s)},j=N.useMemo(()=>{if(!c)return[];if(!t)return c;const s=t.toLowerCase();return c.filter(r=>r.name.toLowerCase().includes(s)||r.description.toLowerCase().includes(s))},[c,t]),d=j.filter(s=>x(s.slug)),v=j.filter(s=>!x(s.slug));if(L)return n?e.jsx(T,{orgBranding:l,children:e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(h,{className:"w-8 h-8 animate-spin text-primary","data-testid":"loading-spinner"})})}):e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(S,{}),e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(h,{className:"w-8 h-8 animate-spin text-primary","data-testid":"loading-spinner"})})]});const w=e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:n?"pt-8 pb-8 relative overflow-hidden":"pt-32 pb-8 relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-accent/10 via-trans
1parent to-primary/10"}),e.jsxs("div",{className:"max-w-7xl mx-auto px-6 relative",children:[e.jsx(m.h1,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"font-display text-4xl md:text-5xl font-bold mb-4","data-testid":"text-page-title",children:"Weekly Topics"}),e.jsx(m.p,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"text-lg text-muted-foreground max-w-2xl",children:"Subscribe to topics you care about. Every week, we drop 4–6 fresh picks per topic — podcasts, articles, and learning modules — numbered so you never lose your place."})]})]}),e.jsx("section",{className:"py-8",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-6",children:[e.jsx(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"mb-8",children:e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(z,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-muted-foreground"}),e.jsx(B,{placeholder:"Search topics...",value:t,onChange:s=>o(s.target.value),className:"pl-12 h-12 rounded-full","data-testid":"input-search-topics"})]})}),i&&d.length>0&&e.jsxs("div",{className:"mb-12",children:[e.jsxs("h2",{className:"font-display text-2xl font-bold mb-6 flex items-center gap-2",children:[e.jsx(g,{className:"w-6 h-6 text-primary"}),"Your Subscriptions"]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:d.map((s,r)=>e.jsx($,{topic:s,index:r,subscribed:!0,onToggle:b,isLoading:p.isPending&&p.variables===s.slug,isAuthenticated:i},s.slug))})]}),e.jsxs("div",{children:[e.jsxs("h2",{className:"font-display text-2xl font-bold mb-6 flex items-center gap-2",children:[e.jsx(M,{className:"w-6 h-6 text-accent"}),i&&d.length>0?"Discover More Topics":"All Topics"]}),v.length===0&&d.length===0?e.jsxs("div",{className:"text-center py-12","data-testid":"empty-results",children:[e.jsx(F,{className:"w-16 h-16 mx-auto mb-4 text-muted-foreground"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-2",children:"No topics found"}),e.jsx(f,{onClick:()=>o(""),"data-testid":"button-clear-search",children:"Clear search"})]}):e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:v.map((s,r)=>e.jsx($,{topic:s,index:r,subscribed:!1,onToggle:b,isLoading:u.isPending&&u.variables===s.slug,isAuthenticated:i},s.slug))})]})]})})]});return n?e.jsx(T,{orgBranding:l,children:w}):e.jsxs("div",{className:"bg-background text-foreground min-h-screen",children:[e.jsx(S,{}),w,e.jsx(K,{})]})}function $({topic:t,index:o,subscribed:i,onToggle:a,isLoading:n,isAuthenticated:l}){return e.jsxs(m.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:o*.05},className:`p-6 rounded-2xl bg-card border transition-all ${i?"border-primary/30 hover:border-primary/50":"border-border hover:border-accent/50"}`,"data-testid":`card-topic-${t.slug}`,children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center ${i?"bg-primary/20":"bg-accent/20"}`,children:e.jsx(F,{className:`w-6 h-6 ${i?"text-primary":"text-accent"}`})}),l&&e.jsx(f,{variant:i?"ghost":"outline",size:i?"icon":"sm",className:i?"text-primary":"rounded-full",onClick:()=>a(t.slug),disabled:n,"data-testid":`button-${i?"unsubscribe":"subscribe"}-${t.slug}`,children:n?e.jsx(h,{size:14,className:"animate-spin"}):i?e.jsx(g,{size:18,fill:"currentColor"}):e.jsxs(e.Fragment,{children:[e.jsx(g,{size:14,className:"mr-1"}),"Subscribe"]})})]}),e.jsx("h3",{className:"font-display text-lg font-bold mt-1 mb-2","data-testid":`text-topic-name-${t.slug}`,children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4","data-testid":`text-topic-desc-${t.slug}`,children:t.description}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[t.latestWeek>0&&e.jsxs("span",{className:"flex items-center gap-1","data-testid":`text-topic-week-${t.slug}`,children:[e.jsx(O,{size:14})," Week ",t.latestWeek]}),e.jsxs("span",{className:"flex items-center gap-1","data-testid":`text-topic-subs-${t.slug}`,children:[e.jsx(W,{size:14})," ",t.subscriberCount]})]}),e.jsx(Q,{href:`/topics/${t.slug}`,children:e.jsxs(f,{variant:"ghost",size:"sm","data-testid":`button-view-topic-${t.slug}`,children:["View ",e.jsx(I,{size:16})]})})]})]})}export{Ne as default};

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.