hive-react-kit 0.0.38 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1098,7 +1098,7 @@ and ensure you are accounting for this risk.
|
|
|
1098
1098
|
rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500`})]}),t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:`text-lg font-semibold ${a==="dark"?"text-white":"text-gray-900"} mb-2`,children:"Failed to load communities"}),t.jsx("p",{className:`${a==="dark"?"text-gray-400":"text-gray-500"} mb-4`,children:x}),t.jsxs("button",{onClick:_,className:`m-2 inline-flex items-center justify-center rounded-md border ${a==="dark"?"border-gray-800 bg-slate-900 text-gray-400 hover:bg-gray-800 hover:text-white":"border-gray-200 bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-900"} p-2 text-sm font-medium shadow-sm transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})})]}):t.jsxs("div",{className:`space-y-6 ${a==="dark"?"bg-slate-950":"bg-white"}`,children:[t.jsx("div",{className:"",children:t.jsx("h2",{className:`text-xl font-semibold ${a==="dark"?"text-white":"text-gray-900"}`,children:"Communities"})}),t.jsxs("div",{className:"relative flex justify-between items-center",children:[t.jsx(z.Search,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 ${a==="dark"?"text-gray-400":"text-gray-500"} w-5 h-5`}),t.jsx("input",{type:"text",placeholder:"Search communities...",value:r,onChange:y=>n(y.target.value),ref:g,autoFocus:!0,className:`w-full pl-10 pr-4 py-3 ${a==="dark"?"bg-slate-900 border-gray-800 text-white placeholder-gray-400":"bg-white border-gray-200 text-gray-900 placeholder-gray-500"}
|
|
1099
1099
|
rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-500`}),t.jsx("button",{onClick:_,className:`m-2 inline-flex items-center justify-center rounded-md border ${a==="dark"?"border-gray-800 bg-slate-900 text-gray-400 hover:bg-gray-800 hover:text-white":"border-gray-200 bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-900"} p-2 text-sm font-medium shadow-sm transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:t.jsx(z.RefreshCw,{className:"w-4 h-4"})})]}),i.length===0?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:`text-lg font-semibold ${a==="dark"?"text-white":"text-gray-900"} mb-2`,children:"No communities found"}),t.jsx("p",{className:`${a==="dark"?"text-gray-400":"text-gray-500"}`,children:r?"Try adjusting your search terms":"Check back later for new communities"})]})}):t.jsxs("div",{className:"space-y-4",children:[i.map(y=>t.jsx("div",{className:`${a==="dark"?"bg-slate-900 border-gray-800 hover:bg-slate-800":"bg-white border-gray-200 hover:bg-gray-100"} border rounded-xl p-4 transition-colors cursor-pointer`,onClick:()=>e(y.name||""),children:t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("img",{src:ot.communityIcon(y.name||""),alt:y.title,className:"w-12 h-12 rounded-full object-cover",onError:m=>{m.target.src=`https://ui-avatars.com/api/?name=${y.title}&background=random`}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:`font-semibold truncate ${a==="dark"?"text-white":"text-gray-900"}`,children:y.title}),t.jsx("p",{className:`text-sm line-clamp-2 ${a==="dark"?"text-gray-400":"text-gray-500"}`,children:y.about})]}),t.jsx("div",{className:"text-right",children:t.jsxs("p",{className:`text-sm ${a==="dark"?"text-gray-400":"text-gray-500"}`,children:[(y.subscribers||0).toLocaleString()," members"]})})]})},y.id)),o&&t.jsx("div",{className:"flex justify-center pt-4",children:d?t.jsxs("div",{className:`flex items-center gap-2 ${a==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading more communities..."]}):t.jsx("button",{onClick:()=>v(),className:`m-2 inline-flex items-center justify-center rounded-md border ${a==="dark"?"border-gray-800 bg-slate-900 text-gray-400 hover:bg-gray-800 hover:text-white":"border-gray-200 bg-white text-gray-500 hover:bg-gray-100 hover:text-gray-900"} p-2 text-sm font-medium shadow-sm transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:"Load More Communities"})})]})]})},jd=({communityId:e})=>{const[a,i]=P.useState(null),[s,r]=P.useState(!0),[n,u]=P.useState(null),c=async()=>{try{r(!0),u(null);const h=await ot.getCommunityDetails(e);i(h)}catch(h){u(h instanceof Error?h.message:"Failed to load community details")}finally{r(!1)}};P.useEffect(()=>{c()},[e]);const d=h=>{try{return new Date(h).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return h}},f=h=>h.replace(/<[^>]*>/g,"");if(s)return t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading community details..."]})});if(n)return t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load community details"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:n}),t.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!a?.result)return t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No community details available"})});const o=a.result;return t.jsx("div",{className:"space-y-6",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[o.about&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:f(o.about)})]}),o.description&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"Information"}),t.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(o.description)})]}),o.flag_text&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"Community Rules"}),t.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(o.flag_text)})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Total Authors"}),t.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:o.num_authors?.toLocaleString()||"0"})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Subscribers"}),t.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:o.subscribers?.toLocaleString()||"0"})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Created"}),t.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o.created_at?d(o.created_at):"Unknown"})]}),o.lang&&t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Language"}),t.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o.lang.toUpperCase()})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Pending Posts"}),t.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o.num_pending?.toLocaleString()||"0"})]}),t.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[t.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Type"}),t.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o.is_nsfw?"NSFW":"Safe"})]})]})]})})},Ed=({communityId:e,onSelectTeamMember:a})=>{const[i,s]=P.useState(null),[r,n]=P.useState(!0),[u,c]=P.useState(null),d=async()=>{try{n(!0),c(null);const o=await ot.getCommunityDetails(e);s(o)}catch(o){c(o instanceof Error?o.message:"Failed to load team details")}finally{n(!1)}};P.useEffect(()=>{d()},[e]);const f=i?.result?.team||[];return r?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading team members..."]})}):u?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load team details"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),t.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):f.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No team members found"})}):t.jsx("div",{className:"space-y-6",children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:f.map((o,h)=>{const l=o[0],p=o.length>1?o[1]:"";return t.jsx("div",{onClick:()=>a&&a(l),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
|
|
1100
1100
|
rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
|
|
1101
|
-
transition-colors cursor-pointer`,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:ot.userOwnerThumb(l),alt:l,className:"w-12 h-12 rounded-full object-cover",onError:x=>{x.target.src=`https://ui-avatars.com/api/?name=${l}&background=random`}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",l]}),p&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 capitalize truncate",children:p})]})]})},`${l}-${h}`)})})})},Ad=({communityId:e,onSelectCommunityMember:a})=>{const[i,s]=P.useState([]),[r,n]=P.useState(!0),[u,c]=P.useState(!1),[d,f]=P.useState(!0),[o,h]=P.useState(null),[l,p]=P.useState(null),x=100,w=P.useCallback(async(b=!1)=>{if(!(u&&!b))try{b?(n(!0),p(null),s([]),h(null),f(!0)):c(!0);const g=await ot.getCommunitySubscribers(e,x,b?void 0:o||void 0);g.length===0?f(!1):(s(v=>{if(b)return g;const _=new Set(v.map(y=>y.username)),N=g.filter(y=>!_.has(y.username));return[...v,...N]}),g.length>0&&h(g[g.length-1].username),f(g.length===x))}catch(g){p(g instanceof Error?g.message:"Failed to load members")}finally{n(!1),c(!1)}},[e,u,o]);return P.useEffect(()=>{w(!0)},[e]),P.useEffect(()=>{const b=()=>{window.innerHeight+document.documentElement.scrollTop>=document.documentElement.offsetHeight-200&&!u&&!r&&d&&w()};return window.addEventListener("scroll",b),()=>window.removeEventListener("scroll",b)},[w,u,r,d]),r&&i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading members..."]})}):l&&i.length===0?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load members"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:l}),t.jsxs("button",{onClick:()=>w(!0),className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No community members found"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map((b,g)=>t.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors cursor-pointer",onClick:()=>a?.(b.username),children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:ot.userOwnerThumb(b.username),alt:b.username,className:"w-12 h-12 rounded-full object-cover",onError:v=>{v.target.src=`https://ui-avatars.com/api/?name=${b.username}&background=random`}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",b.username]}),b.role&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 capitalize truncate",children:b.role})]})]})},`${b.username}-${g}`))}),d&&t.jsx("div",{className:"flex justify-center pt-4",children:u?t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading more members..."]}):t.jsx("button",{onClick:()=>w(),className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:"Load More Members"})})]})},Gp=({communityId:e,onVideoClick:a,onAuthorClick:i,onBack:s,onclickAboutTab:r,onclickTeamTab:n,onclickMemberTab:u,onShare:c,onFavourite:d,onRss:f,onMoreVertical:o,showMoreVertical:h=!0})=>{const l=wc.useNavigate(),[p,x]=P.useState("videos"),[w,b]=P.useState(null),[g,v]=P.useState(!1),[_,N]=P.useState(!0);P.useEffect(()=>{(async()=>{try{N(!0);const D=await ot.getCommunityDetails(e);b(D)}catch(D){console.error("Failed to fetch community details:",D)}finally{N(!1)}})()},[e]);const y=()=>{const A=`https://3speak.tv/user/${e}`;navigator.share?navigator.share({title:w?.result?.title||e,url:A}):navigator.clipboard.writeText(A)},m=()=>{window.open(`https://3speak.tv/rss/${e}.xml`,"_blank")},k=A=>{l(`/user/${A}`)};if(_)return t.jsx("div",{className:"space-y-6",children:t.jsxs("div",{className:"animate-pulse",children:[t.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[t.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),t.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),t.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((A,D)=>t.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},D))})]})]})});const j=w?.result;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("button",{onClick:s,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[t.jsx(z.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:t.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[t.jsx("img",{src:ot.userOwnerThumb(e),alt:j?.title||e,className:"w-16 h-16 rounded-full object-cover",onError:A=>{A.target.src=`https://images.hive.blog/u/${j?.title||e}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:j?.title||e}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:j?.about||"Community description"}),t.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Users,{className:"w-4 h-4"}),t.jsxs("span",{children:[(j?.subscribers||0).toLocaleString()," members"]})]}),t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Calendar,{className:"w-4 h-4"}),t.jsxs("span",{children:["Created"," ",j?.created_at?new Date(j.created_at).getFullYear():"Unknown"]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ao,{id:e,toastType:"community",onAdd:(A,D)=>console.log("Added:",A,D),onRemove:(A,D)=>console.log("Removed:",A,D),onFavourite:d}),t.jsx("button",{onClick:f||m,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:t.jsx(z.Rss,{className:"w-4 h-4"})}),t.jsx("button",{onClick:c||y,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:t.jsx(z.Share2,{className:"w-4 h-4"})}),h&&t.jsx("button",{onClick:o||(()=>{}),className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:t.jsx(z.MoreVertical,{className:"w-4 h-4"})})]})]})}),t.jsxs("div",{children:[t.jsxs("div",{className:"grid grid-cols-4 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsx("button",{onClick:()=>x("videos"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="videos"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Videos"}),t.jsx("button",{onClick:()=>r?r():x("about"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="about"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"About"}),t.jsx("button",{onClick:()=>n?n():x("team"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="team"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Team"}),t.jsx("button",{onClick:()=>u?u():x("members"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="members"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Members"})]}),t.jsxs("div",{className:"mt-6",children:[p==="videos"&&t.jsx(ss,{feedType:Ge.COMMUNITY,communityId:e,onVideoClick:a,onAuthorClick:i}),p==="about"&&!r&&t.jsx(jd,{communityId:e}),p==="team"&&!n&&t.jsx(Ed,{communityId:e,onSelectTeamMember:k}),p==="members"&&!u&&t.jsx(Ad,{communityId:e,onSelectCommunityMember:k})]})]})]})},Jp=({communityId:e,onAuthorClick:a,onPostClick:i,onCommunityClick:s,onPayoutClick:r,onUpvoteClick:n,onCommentClick:u,onReblogClick:c,theme:d="dark"})=>{const[f,o]=P.useState("posts"),[h,l]=P.useState(null),[p,x]=P.useState([]),[w,b]=P.useState([]),[g,v]=P.useState(!0),[_,N]=P.useState(!1),[y,m]=P.useState(!1),[k,j]=P.useState(null);P.useEffect(()=>{(async()=>{try{v(!0),j(null);const H=await ot.getCommunityDetails(e);l(H.result)}catch(H){j(H instanceof Error?H.message:"Failed to fetch community details")}finally{v(!1)}})()},[e]),P.useEffect(()=>{f==="subscribers"&&h?A():f==="activities"&&h&&D()},[f,h]);const A=async()=>{try{N(!0);const $=await ot.getCommunitySubscribersList(e,100);x($)}catch($){console.error("Failed to fetch subscribers:",$)}finally{N(!1)}},D=async()=>{try{m(!0);const $=await ot.getCommunityActivities(e,100);b($)}catch($){console.error("Failed to fetch activities:",$)}finally{m(!1)}},C=$=>{try{const H=new Date($),q=new Date().getTime()-H.getTime(),M=Math.floor(q/1e3),Y=Math.floor(M/60),X=Math.floor(Y/60),ae=Math.floor(X/24),I=Math.floor(ae/30),ie=Math.floor(ae/365);return ie>0?`${ie} year${ie>1?"s":""} ago`:I>0?`${I} month${I>1?"s":""} ago`:ae>0?`${ae} day${ae>1?"s":""} ago`:X>0?`${X} hour${X>1?"s":""} ago`:Y>0?`${Y} minute${Y>1?"s":""} ago`:"just now"}catch{return $}},O=$=>$.replace(/<[^>]*>/g,"");return g?t.jsx("div",{className:`flex items-center justify-center min-h-[400px] ${d==="dark"?"bg-slate-950":"bg-white"}`,children:t.jsxs("div",{className:`flex items-center gap-2 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading community details..."]})}):k||!h?t.jsxs("div",{className:`flex flex-col items-center justify-center min-h-[400px] space-y-4 ${d==="dark"?"bg-slate-950":"bg-white"}`,children:[t.jsx("h3",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:"Failed to load community details"}),t.jsx("p",{className:`${d==="dark"?"text-gray-400":"text-gray-500"}`,children:k})]}):t.jsxs("div",{className:`space-y-6 ${d==="dark"?"bg-slate-950":"bg-white"}`,children:[t.jsx("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:t.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[t.jsx("img",{src:ot.userOwnerThumb(e),alt:h.title,className:"w-16 h-16 rounded-full object-cover",onError:$=>{$.target.src=`https://images.hive.blog/u/${h.title}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:`text-2xl font-bold mb-2 ${d==="dark"?"text-white":"text-gray-900"}`,children:h.title}),t.jsx("p",{className:`${d==="dark"?"text-gray-400":"text-gray-600"} mb-4`,children:h.about}),t.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[t.jsxs("div",{className:`flex items-center gap-2 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Users,{className:"w-4 h-4"}),t.jsxs("span",{children:[h.subscribers.toLocaleString()," members"]})]}),t.jsxs("div",{className:`flex items-center gap-2 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Calendar,{className:"w-4 h-4"}),t.jsxs("span",{children:["Created ",C(h.created_at)]})]})]})]})]})}),t.jsxs("div",{children:[t.jsxs("div",{className:`flex md:grid md:grid-cols-4 overflow-x-auto md:overflow-visible w-full ${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-lg`,children:[t.jsx("button",{onClick:()=>o("posts"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="posts"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"Posts"}),t.jsx("button",{onClick:()=>o("about"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="about"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"About"}),t.jsx("button",{onClick:()=>o("subscribers"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="subscribers"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"Subscribers"}),t.jsx("button",{onClick:()=>o("activities"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="activities"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"Activities"})]}),t.jsxs("div",{className:"mt-6",children:[f==="posts"&&t.jsx(_d,{tag:e,sort:"created",limit:20,showSortDropdown:!1,onAuthorClick:a,onPostClick:i,onCommunityClick:s,onPayoutClick:r,onUpvoteClick:n,onCommentClick:u,onReblogClick:c,theme:d}),f==="about"&&t.jsxs("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:[h.about&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:`text-lg font-semibold mb-3 ${d==="dark"?"text-white":"text-gray-900"}`,children:"About"}),t.jsx("p",{className:`${d==="dark"?"text-gray-300":"text-gray-600"} leading-relaxed`,children:O(h.about)})]}),h.description&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:`text-lg font-semibold mb-3 ${d==="dark"?"text-white":"text-gray-900"}`,children:"Information"}),t.jsx("div",{className:`${d==="dark"?"text-gray-300":"text-gray-600"} leading-relaxed whitespace-pre-wrap`,children:O(h.description)})]}),h.flag_text&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:`text-lg font-semibold mb-3 ${d==="dark"?"text-white":"text-gray-900"}`,children:"Community Rules"}),t.jsx("div",{className:`${d==="dark"?"text-gray-300":"text-gray-600"} leading-relaxed whitespace-pre-wrap`,children:O(h.flag_text)})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Total Authors"}),t.jsx("p",{className:`text-2xl font-bold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.num_authors.toLocaleString()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Subscribers"}),t.jsx("p",{className:`text-2xl font-bold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.subscribers.toLocaleString()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Created"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:C(h.created_at)})]}),h.lang&&t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Language"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.lang.toUpperCase()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Pending Posts"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.num_pending.toLocaleString()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Type"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.is_nsfw?"NSFW":"Safe"})]})]})]}),f==="subscribers"&&t.jsx("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:_?t.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"})}):p.length>0?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("h3",{className:`text-lg font-semibold mb-4 ${d==="dark"?"text-white":"text-gray-900"}`,children:["Subscribers (",p.length,")"]}),p.map($=>t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} flex items-center gap-4 p-4 rounded-lg`,children:[t.jsx("img",{src:ot.userOwnerThumb($.username),alt:$.username,className:"w-10 h-10 rounded-full object-cover",onError:H=>{H.target.src=`https://images.hive.blog/u/${$.username}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("p",{className:`font-medium ${d==="dark"?"text-white":"text-gray-900"}`,children:["@",$.username]}),t.jsxs("p",{className:`text-sm ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:["Role: ",$.role," • Subscribed"," ",C($.subscribedAt)]})]})]},$.username))]}):t.jsx("div",{className:`text-center py-8 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"No subscribers found"})}),f==="activities"&&t.jsx("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:y?t.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"})}):w.length>0?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("h3",{className:`text-lg font-semibold mb-4 ${d==="dark"?"text-white":"text-gray-900"}`,children:["Recent Activities (",w.length,")"]}),w.map($=>{const H=$.msg.split(" ")[0].substring(1);return t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} flex items-center gap-4 p-4 rounded-lg`,children:[t.jsx("img",{src:ot.userOwnerThumb(H),alt:H,className:"w-10 h-10 rounded-full object-cover",onError:F=>{F.target.src=`https://images.hive.blog/u/${H}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:`mb-1 ${d==="dark"?"text-white":"text-gray-900"}`,children:$.msg}),t.jsxs("p",{className:`text-sm ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[C($.date),$.score&&` • Score: ${$.score}`]})]})]},$.id)})]}):t.jsx("div",{className:`text-center py-8 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"No activities found"})})]})]})]})},Yp=({currentUser:e,onTabChanged:a,onPublish:i,onViewMyVideo:s,onMoreOptions:r,onTapBackButton:n,shouldShowBackButton:u=!0,shouldShowPublishButton:c=!1,shouldShowMoreOptionsButton:d=!1})=>{const f=wc.useNavigate(),[o,h]=P.useState(0),[l,p]=P.useState([]),[x,w]=P.useState(!0),[b,g]=P.useState(null),v=l.filter(C=>["encoding","uploaded","encoding_queued","encoding_preparing","ipfs_pinning","ipfs_pinning_failed","encoding_failed","encoding_ipfs"].includes(C.status||"")),_=l.filter(C=>C.status==="publish_manual"),N=l.filter(C=>C.status==="published");P.useEffect(()=>{e?.token&&y()},[e]);const y=async()=>{if(!e?.token){g("No authentication token provided"),w(!1);return}w(!0),g(null);try{const C=await Ue.getMyVideos(e.token);p(C)}catch(C){console.error("Error fetching videos:",C),g(`Failed to load videos: ${C instanceof Error?C.message:"Unknown error"}`)}finally{w(!1)}},m=C=>{h(C),a?.(C)},k=C=>{C.owner&&C.permlink&&f(`/video/${C.owner}/${C.permlink}`)},j=C=>{switch(C.toLowerCase()){case"published":return"bg-green-500";case"encoding":case"encoding_queued":return"bg-orange-500";case"uploaded":return"bg-blue-500";case"publish_manual":return"bg-purple-500";default:return"bg-gray-500"}},A=["ipfs_pinning","ipfs_pinning_failed","encoding","encoding_failed","encoding_ipfs"],D=(C,O)=>{if(C.length===0){let $="";switch(O){case"publishNow":$="No videos ready to publish.";break;case"myVideos":$="No published videos found.";break;case"encoding":$="No videos currently encoding.";break}return t.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[t.jsx(z.Video,{className:"w-16 h-16 text-gray-400 mb-4"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-center",children:$})]})}return t.jsx("div",{className:"space-y-3 w-full",children:C.map(($,H)=>{const F=$.thumbnail||"",q=$.title||"No Title",M=$.permlink||"",Y=$.owner||e?.username||"",X=$.id||"",ae=A.includes($.status||"");return t.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-3 hover:shadow-md transition-shadow",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative flex-shrink-0",children:[t.jsx("img",{src:Br(F)||`https://images.hive.blog/u/${e?.username}/avatar`,alt:q,className:"w-24 h-16 rounded-lg object-cover",onError:I=>{I.target.src=`https://images.hive.blog/u/${e?.username}/avatar`}}),A.includes($.status||"")?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 rounded-lg",children:t.jsx(z.Ban,{className:"w-6 h-6 text-red-500"})}):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 opacity-0 hover:opacity-100 transition-opacity cursor-pointer rounded-lg",onClick:()=>k($),children:t.jsx(z.Play,{className:"w-6 h-6 text-white"})})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-sm cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>k($),style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},children:q}),t.jsxs("p",{className:"text-gray-600 dark:text-gray-400 text-xs mt-1",children:["By ",Y]}),$.status&&t.jsx("div",{className:"mt-2",children:t.jsx("span",{className:`inline-block px-2 py-1 rounded-full text-xs font-semibold text-white ${j($.status)}`,children:$.status.toUpperCase()})})]}),ae?t.jsx("div",{className:"flex-shrink-0 pl-2",children:t.jsx(z.Ban,{className:"w-5 h-5 text-red-500"})}):t.jsxs("div",{className:"flex flex-col items-end gap-2",children:[O==="publishNow"&&c&&t.jsx("button",{onClick:()=>i?.(Y,M),className:"bg-green-600 hover:bg-green-700 text-white text-xs px-3 py-1 rounded-md transition-colors",children:"Publish"}),O==="myVideos"&&t.jsx("button",{onClick:()=>s?s(Y,M):k($),className:"bg-blue-600 hover:bg-blue-700 text-white text-xs px-3 py-1 rounded-md transition-colors",children:"View"}),d&&t.jsx("button",{onClick:()=>r?.(X),className:"p-1 h-6 w-6 rounded-md hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:t.jsx(z.MoreVertical,{className:"w-4 h-4"})})]})]})},`${X}-${H}`)})})};return e?t.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[u&&t.jsxs("button",{onClick:n,className:"flex items-center justify-center mr-4 my-2 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[t.jsx(z.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between p-4",children:[t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:`https://images.hive.blog/u/${e.username}/avatar`,alt:e.username,className:"w-12 h-12 md:w-16 md:h-16 rounded-full object-cover border-2 border-gray-200 dark:border-gray-700",onError:C=>{C.target.src=`https://ui-avatars.com/api/?name=${e.username}&background=random&size=64`}}),t.jsx("div",{children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold text-gray-900 dark:text-white",children:e.username})})]})}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("button",{onClick:y,className:"p-2 rounded-md hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:t.jsx(z.RefreshCw,{className:"w-5 h-5"})})})]}),t.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex overflow-x-auto scrollbar-hide",children:[t.jsxs("button",{onClick:()=>m(0),className:`flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${o===0?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[t.jsx(z.Upload,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Publish Now"}),t.jsx("span",{className:"sm:hidden",children:"Publish"}),_.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full",children:_.length})]}),t.jsxs("button",{onClick:()=>m(1),className:`flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${o===1?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[t.jsx(z.Video,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"My Videos"}),t.jsx("span",{className:"sm:hidden",children:"Videos"}),N.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full",children:N.length})]}),t.jsxs("button",{onClick:()=>m(2),className:`flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${o===2?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[t.jsx(z.Hourglass,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Encoding"}),t.jsx("span",{className:"sm:hidden",children:"Encoding"}),v.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full",children:v.length})]})]})})]}),t.jsx("div",{className:"py-4 md:py-6 w-full",children:x?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):b?t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] text-center",children:[t.jsx("div",{className:"w-16 h-16 bg-red-100 dark:bg-red-900 rounded-full flex items-center justify-center mb-4",children:t.jsx(z.Info,{className:"w-8 h-8 text-red-600 dark:text-red-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load videos"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:b}),t.jsx("button",{onClick:y,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md transition-colors",children:"Retry"})]}):t.jsxs("div",{className:"space-y-6",children:[o===0&&D(_,"publishNow"),o===1&&D(N,"myVideos"),o===2&&D(v,"encoding")]})})]}):t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Please login to view your account"})})},Sd=({username:e,onSelectUser:a})=>{const[i,s]=P.useState([]),[r,n]=P.useState(!0),[u,c]=P.useState(null),d=async()=>{try{n(!0),c(null);const f=await ge.getFollowers(e);s(f)}catch(f){c(f instanceof Error?f.message:"Failed to load followers")}finally{n(!1)}};return P.useEffect(()=>{d()},[e]),r?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading followers..."]})}):u?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load followers"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),t.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user has no followers."})}):t.jsx("div",{className:"space-y-6",children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map((f,o)=>t.jsx("div",{onClick:()=>a&&a(f.follower),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
|
|
1101
|
+
transition-colors cursor-pointer`,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:ot.userOwnerThumb(l),alt:l,className:"w-12 h-12 rounded-full object-cover",onError:x=>{x.target.src=`https://ui-avatars.com/api/?name=${l}&background=random`}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",l]}),p&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 capitalize truncate",children:p})]})]})},`${l}-${h}`)})})})},Ad=({communityId:e,onSelectCommunityMember:a})=>{const[i,s]=P.useState([]),[r,n]=P.useState(!0),[u,c]=P.useState(!1),[d,f]=P.useState(!0),[o,h]=P.useState(null),[l,p]=P.useState(null),x=100,w=P.useCallback(async(b=!1)=>{if(!(u&&!b))try{b?(n(!0),p(null),s([]),h(null),f(!0)):c(!0);const g=await ot.getCommunitySubscribers(e,x,b?void 0:o||void 0);g.length===0?f(!1):(s(v=>{if(b)return g;const _=new Set(v.map(y=>y.username)),N=g.filter(y=>!_.has(y.username));return[...v,...N]}),g.length>0&&h(g[g.length-1].username),f(g.length===x))}catch(g){p(g instanceof Error?g.message:"Failed to load members")}finally{n(!1),c(!1)}},[e,u,o]);return P.useEffect(()=>{w(!0)},[e]),P.useEffect(()=>{const b=()=>{window.innerHeight+document.documentElement.scrollTop>=document.documentElement.offsetHeight-200&&!u&&!r&&d&&w()};return window.addEventListener("scroll",b),()=>window.removeEventListener("scroll",b)},[w,u,r,d]),r&&i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading members..."]})}):l&&i.length===0?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load members"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:l}),t.jsxs("button",{onClick:()=>w(!0),className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No community members found"})}):t.jsxs("div",{className:"space-y-6",children:[t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map((b,g)=>t.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors cursor-pointer",onClick:()=>a?.(b.username),children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:ot.userOwnerThumb(b.username),alt:b.username,className:"w-12 h-12 rounded-full object-cover",onError:v=>{v.target.src=`https://ui-avatars.com/api/?name=${b.username}&background=random`}}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",b.username]}),b.role&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 capitalize truncate",children:b.role})]})]})},`${b.username}-${g}`))}),d&&t.jsx("div",{className:"flex justify-center pt-4",children:u?t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading more members..."]}):t.jsx("button",{onClick:()=>w(),className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:"Load More Members"})})]})},Gp=({communityId:e,onVideoClick:a,onAuthorClick:i,onBack:s,onclickAboutTab:r,onclickTeamTab:n,onclickMemberTab:u,onShare:c,onFavourite:d,onRss:f,onMoreVertical:o,showMoreVertical:h=!0})=>{const l=wc.useNavigate(),[p,x]=P.useState("videos"),[w,b]=P.useState(null),[g,v]=P.useState(!1),[_,N]=P.useState(!0);P.useEffect(()=>{(async()=>{try{N(!0);const D=await ot.getCommunityDetails(e);b(D)}catch(D){console.error("Failed to fetch community details:",D)}finally{N(!1)}})()},[e]);const y=()=>{const A=`https://3speak.tv/user/${e}`;navigator.share?navigator.share({title:w?.result?.title||e,url:A}):navigator.clipboard.writeText(A)},m=()=>{window.open(`https://3speak.tv/rss/${e}.xml`,"_blank")},k=A=>{l(`/user/${A}`)};if(_)return t.jsx("div",{className:"space-y-6",children:t.jsxs("div",{className:"animate-pulse",children:[t.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[t.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),t.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),t.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((A,D)=>t.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},D))})]})]})});const j=w?.result;return t.jsxs("div",{className:"space-y-6",children:[t.jsxs("button",{onClick:s,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[t.jsx(z.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),t.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:t.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[t.jsx("img",{src:ot.userOwnerThumb(e),alt:j?.title||e,className:"w-16 h-16 rounded-full object-cover",onError:A=>{A.target.src=`https://images.hive.blog/u/${j?.title||e}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:j?.title||e}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:j?.about||"Community description"}),t.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Users,{className:"w-4 h-4"}),t.jsxs("span",{children:[(j?.subscribers||0).toLocaleString()," members"]})]}),t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Calendar,{className:"w-4 h-4"}),t.jsxs("span",{children:["Created"," ",j?.created_at?new Date(j.created_at).getFullYear():"Unknown"]})]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ao,{id:e,toastType:"community",onAdd:(A,D)=>console.log("Added:",A,D),onRemove:(A,D)=>console.log("Removed:",A,D),onFavourite:d}),t.jsx("button",{onClick:f||m,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:t.jsx(z.Rss,{className:"w-4 h-4"})}),t.jsx("button",{onClick:c||y,className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:t.jsx(z.Share2,{className:"w-4 h-4"})}),h&&t.jsx("button",{onClick:o||(()=>{}),className:"p-2 rounded-lg border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:t.jsx(z.MoreVertical,{className:"w-4 h-4"})})]})]})}),t.jsxs("div",{children:[t.jsxs("div",{className:"grid grid-cols-4 w-full bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[t.jsx("button",{onClick:()=>x("videos"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="videos"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Videos"}),t.jsx("button",{onClick:()=>r?r():x("about"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="about"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"About"}),t.jsx("button",{onClick:()=>n?n():x("team"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="team"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Team"}),t.jsx("button",{onClick:()=>u?u():x("members"),className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${p==="members"?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:"Members"})]}),t.jsxs("div",{className:"mt-6",children:[p==="videos"&&t.jsx(ss,{feedType:Ge.COMMUNITY,communityId:e,onVideoClick:a,onAuthorClick:i}),p==="about"&&!r&&t.jsx(jd,{communityId:e}),p==="team"&&!n&&t.jsx(Ed,{communityId:e,onSelectTeamMember:k}),p==="members"&&!u&&t.jsx(Ad,{communityId:e,onSelectCommunityMember:k})]})]})]})},Jp=({communityId:e,onAuthorClick:a,onPostClick:i,onCommunityClick:s,onPayoutClick:r,onUpvoteClick:n,onCommentClick:u,onReblogClick:c,theme:d="dark"})=>{const[f,o]=P.useState("posts"),[h,l]=P.useState(null),[p,x]=P.useState([]),[w,b]=P.useState([]),[g,v]=P.useState(!0),[_,N]=P.useState(!1),[y,m]=P.useState(!1),[k,j]=P.useState(null);P.useEffect(()=>{(async()=>{try{v(!0),j(null);const H=await ot.getCommunityDetails(e);l(H.result)}catch(H){j(H instanceof Error?H.message:"Failed to fetch community details")}finally{v(!1)}})()},[e]),P.useEffect(()=>{f==="subscribers"&&h?A():f==="activities"&&h&&D()},[f,h]);const A=async()=>{try{N(!0);const $=await ot.getCommunitySubscribersList(e,100);x($)}catch($){console.error("Failed to fetch subscribers:",$)}finally{N(!1)}},D=async()=>{try{m(!0);const $=await ot.getCommunityActivities(e,100);b($)}catch($){console.error("Failed to fetch activities:",$)}finally{m(!1)}},C=$=>{try{const H=new Date($),q=new Date().getTime()-H.getTime(),M=Math.floor(q/1e3),Y=Math.floor(M/60),X=Math.floor(Y/60),ae=Math.floor(X/24),I=Math.floor(ae/30),ie=Math.floor(ae/365);return ie>0?`${ie} year${ie>1?"s":""} ago`:I>0?`${I} month${I>1?"s":""} ago`:ae>0?`${ae} day${ae>1?"s":""} ago`:X>0?`${X} hour${X>1?"s":""} ago`:Y>0?`${Y} minute${Y>1?"s":""} ago`:"just now"}catch{return $}},O=$=>$.replace(/<[^>]*>/g,"");return g?t.jsx("div",{className:`flex items-center justify-center min-h-[400px] ${d==="dark"?"bg-slate-950":"bg-white"}`,children:t.jsxs("div",{className:`flex items-center gap-2 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading community details..."]})}):k||!h?t.jsxs("div",{className:`flex flex-col items-center justify-center min-h-[400px] space-y-4 ${d==="dark"?"bg-slate-950":"bg-white"}`,children:[t.jsx("h3",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:"Failed to load community details"}),t.jsx("p",{className:`${d==="dark"?"text-gray-400":"text-gray-500"}`,children:k})]}):t.jsxs("div",{className:`space-y-6 ${d==="dark"?"bg-slate-950":"bg-white"}`,children:[t.jsx("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:t.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[t.jsx("img",{src:ot.userOwnerThumb(e),alt:h.title,className:"w-16 h-16 rounded-full object-cover",onError:$=>{$.target.src=`https://images.hive.blog/u/${h.title}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsx("h1",{className:`text-2xl font-bold mb-2 ${d==="dark"?"text-white":"text-gray-900"}`,children:h.title}),t.jsx("p",{className:`${d==="dark"?"text-gray-400":"text-gray-600"} mb-4`,children:h.about}),t.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[t.jsxs("div",{className:`flex items-center gap-2 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Users,{className:"w-4 h-4"}),t.jsxs("span",{children:[h.subscribers.toLocaleString()," members"]})]}),t.jsxs("div",{className:`flex items-center gap-2 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[t.jsx(z.Calendar,{className:"w-4 h-4"}),t.jsxs("span",{children:["Created ",C(h.created_at)]})]})]})]})]})}),t.jsxs("div",{children:[t.jsxs("div",{className:`flex md:grid md:grid-cols-4 overflow-x-auto md:overflow-visible w-full ${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-lg`,children:[t.jsx("button",{onClick:()=>o("posts"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="posts"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-500 hover:bg-gray-300"}`}`,children:"Posts"}),t.jsx("button",{onClick:()=>o("about"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="about"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"About"}),t.jsx("button",{onClick:()=>o("subscribers"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="subscribers"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"Subscribers"}),t.jsx("button",{onClick:()=>o("activities"),className:`flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f==="activities"?`${d==="dark"?"bg-blue-500 text-white":"bg-blue-600 text-white"}`:`${d==="dark"?"text-gray-300 hover:bg-gray-700":"text-gray-700 hover:bg-gray-300"}`}`,children:"Activities"})]}),t.jsxs("div",{className:"mt-6",children:[f==="posts"&&t.jsx(_d,{tag:e,sort:"created",limit:20,showSortDropdown:!1,onAuthorClick:a,onPostClick:i,onCommunityClick:s,onPayoutClick:r,onUpvoteClick:n,onCommentClick:u,onReblogClick:c,theme:d}),f==="about"&&t.jsxs("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:[h.about&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:`text-lg font-semibold mb-3 ${d==="dark"?"text-white":"text-gray-900"}`,children:"About"}),t.jsx("p",{className:`${d==="dark"?"text-gray-300":"text-gray-600"} leading-relaxed`,children:O(h.about)})]}),h.description&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:`text-lg font-semibold mb-3 ${d==="dark"?"text-white":"text-gray-900"}`,children:"Information"}),t.jsx("div",{className:`${d==="dark"?"text-gray-300":"text-gray-600"} leading-relaxed whitespace-pre-wrap`,children:O(h.description)})]}),h.flag_text&&t.jsxs("div",{className:"mb-6",children:[t.jsx("h3",{className:`text-lg font-semibold mb-3 ${d==="dark"?"text-white":"text-gray-900"}`,children:"Community Rules"}),t.jsx("div",{className:`${d==="dark"?"text-gray-300":"text-gray-600"} leading-relaxed whitespace-pre-wrap`,children:O(h.flag_text)})]}),t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Total Authors"}),t.jsx("p",{className:`text-2xl font-bold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.num_authors.toLocaleString()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Subscribers"}),t.jsx("p",{className:`text-2xl font-bold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.subscribers.toLocaleString()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Created"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:C(h.created_at)})]}),h.lang&&t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Language"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.lang.toUpperCase()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Pending Posts"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.num_pending.toLocaleString()})]}),t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} p-4 rounded-lg`,children:[t.jsx("h4",{className:`text-sm font-medium mb-1 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"Type"}),t.jsx("p",{className:`text-lg font-semibold ${d==="dark"?"text-white":"text-gray-900"}`,children:h.is_nsfw?"NSFW":"Safe"})]})]})]}),f==="subscribers"&&t.jsx("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:_?t.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"})}):p.length>0?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("h3",{className:`text-lg font-semibold mb-4 ${d==="dark"?"text-white":"text-gray-900"}`,children:["Subscribers (",p.length,")"]}),p.map($=>t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} flex items-center gap-4 p-4 rounded-lg`,children:[t.jsx("img",{src:ot.userOwnerThumb($.username),alt:$.username,className:"w-10 h-10 rounded-full object-cover",onError:H=>{H.target.src=`https://images.hive.blog/u/${$.username}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsxs("p",{className:`font-medium ${d==="dark"?"text-white":"text-gray-900"}`,children:["@",$.username]}),t.jsxs("p",{className:`text-sm ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:["Role: ",$.role," • Subscribed"," ",C($.subscribedAt)]})]})]},$.username))]}):t.jsx("div",{className:`text-center py-8 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"No subscribers found"})}),f==="activities"&&t.jsx("div",{className:`${d==="dark"?"bg-slate-900 border-gray-800":"bg-white border-gray-200"} border rounded-xl p-6`,children:y?t.jsx("div",{className:"flex items-center justify-center min-h-[200px]",children:t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"})}):w.length>0?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("h3",{className:`text-lg font-semibold mb-4 ${d==="dark"?"text-white":"text-gray-900"}`,children:["Recent Activities (",w.length,")"]}),w.map($=>{const H=$.msg.split(" ")[0].substring(1);return t.jsxs("div",{className:`${d==="dark"?"bg-slate-800":"bg-gray-50"} flex items-center gap-4 p-4 rounded-lg`,children:[t.jsx("img",{src:ot.userOwnerThumb(H),alt:H,className:"w-10 h-10 rounded-full object-cover",onError:F=>{F.target.src=`https://images.hive.blog/u/${H}/avatar`}}),t.jsxs("div",{className:"flex-1",children:[t.jsx("p",{className:`mb-1 ${d==="dark"?"text-white":"text-gray-900"}`,children:$.msg}),t.jsxs("p",{className:`text-sm ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:[C($.date),$.score&&` • Score: ${$.score}`]})]})]},$.id)})]}):t.jsx("div",{className:`text-center py-8 ${d==="dark"?"text-gray-400":"text-gray-500"}`,children:"No activities found"})})]})]})]})},Yp=({currentUser:e,onTabChanged:a,onPublish:i,onViewMyVideo:s,onMoreOptions:r,onTapBackButton:n,shouldShowBackButton:u=!0,shouldShowPublishButton:c=!1,shouldShowMoreOptionsButton:d=!1})=>{const f=wc.useNavigate(),[o,h]=P.useState(0),[l,p]=P.useState([]),[x,w]=P.useState(!0),[b,g]=P.useState(null),v=l.filter(C=>["encoding","uploaded","encoding_queued","encoding_preparing","ipfs_pinning","ipfs_pinning_failed","encoding_failed","encoding_ipfs"].includes(C.status||"")),_=l.filter(C=>C.status==="publish_manual"),N=l.filter(C=>C.status==="published");P.useEffect(()=>{e?.token&&y()},[e]);const y=async()=>{if(!e?.token){g("No authentication token provided"),w(!1);return}w(!0),g(null);try{const C=await Ue.getMyVideos(e.token);p(C)}catch(C){console.error("Error fetching videos:",C),g(`Failed to load videos: ${C instanceof Error?C.message:"Unknown error"}`)}finally{w(!1)}},m=C=>{h(C),a?.(C)},k=C=>{C.owner&&C.permlink&&f(`/video/${C.owner}/${C.permlink}`)},j=C=>{switch(C.toLowerCase()){case"published":return"bg-green-500";case"encoding":case"encoding_queued":return"bg-orange-500";case"uploaded":return"bg-blue-500";case"publish_manual":return"bg-purple-500";default:return"bg-gray-500"}},A=["ipfs_pinning","ipfs_pinning_failed","encoding","encoding_failed","encoding_ipfs"],D=(C,O)=>{if(C.length===0){let $="";switch(O){case"publishNow":$="No videos ready to publish.";break;case"myVideos":$="No published videos found.";break;case"encoding":$="No videos currently encoding.";break}return t.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[t.jsx(z.Video,{className:"w-16 h-16 text-gray-400 mb-4"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-center",children:$})]})}return t.jsx("div",{className:"space-y-3 w-full",children:C.map(($,H)=>{const F=$.thumbnail||"",q=$.title||"No Title",M=$.permlink||"",Y=$.owner||e?.username||"",X=$.id||"",ae=A.includes($.status||"");return t.jsx("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-3 hover:shadow-md transition-shadow",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("div",{className:"relative flex-shrink-0",children:[t.jsx("img",{src:Br(F)||`https://images.hive.blog/u/${e?.username}/avatar`,alt:q,className:"w-24 h-16 rounded-lg object-cover",onError:I=>{I.target.src=`https://images.hive.blog/u/${e?.username}/avatar`}}),A.includes($.status||"")?t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 rounded-lg",children:t.jsx(z.Ban,{className:"w-6 h-6 text-red-500"})}):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/20 opacity-0 hover:opacity-100 transition-opacity cursor-pointer rounded-lg",onClick:()=>k($),children:t.jsx(z.Play,{className:"w-6 h-6 text-white"})})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"font-semibold text-gray-900 dark:text-white text-sm cursor-pointer hover:text-blue-600 dark:hover:text-blue-400",onClick:()=>k($),style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"},children:q}),t.jsxs("p",{className:"text-gray-600 dark:text-gray-400 text-xs mt-1",children:["By ",Y]}),$.status&&t.jsx("div",{className:"mt-2",children:t.jsx("span",{className:`inline-block px-2 py-1 rounded-full text-xs font-semibold text-white ${j($.status)}`,children:$.status.toUpperCase()})})]}),ae?t.jsx("div",{className:"flex-shrink-0 pl-2",children:t.jsx(z.Ban,{className:"w-5 h-5 text-red-500"})}):t.jsxs("div",{className:"flex flex-col items-end gap-2",children:[O==="publishNow"&&c&&t.jsx("button",{onClick:()=>i?.(Y,M),className:"bg-green-600 hover:bg-green-700 text-white text-xs px-3 py-1 rounded-md transition-colors",children:"Publish"}),O==="myVideos"&&t.jsx("button",{onClick:()=>s?s(Y,M):k($),className:"bg-blue-600 hover:bg-blue-700 text-white text-xs px-3 py-1 rounded-md transition-colors",children:"View"}),d&&t.jsx("button",{onClick:()=>r?.(X),className:"p-1 h-6 w-6 rounded-md hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:t.jsx(z.MoreVertical,{className:"w-4 h-4"})})]})]})},`${X}-${H}`)})})};return e?t.jsxs("div",{className:"min-h-screen bg-gray-50 dark:bg-gray-900",children:[u&&t.jsxs("button",{onClick:n,className:"flex items-center justify-center mr-4 my-2 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[t.jsx(z.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),t.jsxs("div",{className:"bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700",children:[t.jsxs("div",{className:"flex items-center justify-between p-4",children:[t.jsx("div",{className:"flex items-center gap-3",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:`https://images.hive.blog/u/${e.username}/avatar`,alt:e.username,className:"w-12 h-12 md:w-16 md:h-16 rounded-full object-cover border-2 border-gray-200 dark:border-gray-700",onError:C=>{C.target.src=`https://ui-avatars.com/api/?name=${e.username}&background=random&size=64`}}),t.jsx("div",{children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold text-gray-900 dark:text-white",children:e.username})})]})}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("button",{onClick:y,className:"p-2 rounded-md hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",children:t.jsx(z.RefreshCw,{className:"w-5 h-5"})})})]}),t.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:t.jsxs("div",{className:"flex overflow-x-auto scrollbar-hide",children:[t.jsxs("button",{onClick:()=>m(0),className:`flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${o===0?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[t.jsx(z.Upload,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Publish Now"}),t.jsx("span",{className:"sm:hidden",children:"Publish"}),_.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full",children:_.length})]}),t.jsxs("button",{onClick:()=>m(1),className:`flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${o===1?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[t.jsx(z.Video,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"My Videos"}),t.jsx("span",{className:"sm:hidden",children:"Videos"}),N.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full",children:N.length})]}),t.jsxs("button",{onClick:()=>m(2),className:`flex items-center gap-2 px-4 md:px-6 py-3 border-b-2 font-medium text-sm transition-colors whitespace-nowrap flex-shrink-0 ${o===2?"border-blue-500 text-blue-600 dark:text-blue-400":"border-transparent text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"}`,children:[t.jsx(z.Hourglass,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Encoding"}),t.jsx("span",{className:"sm:hidden",children:"Encoding"}),v.length>0&&t.jsx("span",{className:"bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 text-xs px-2 py-1 rounded-full",children:v.length})]})]})})]}),t.jsx("div",{className:"py-4 md:py-6 w-full",children:x?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}):b?t.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[400px] text-center",children:[t.jsx("div",{className:"w-16 h-16 bg-red-100 dark:bg-red-900 rounded-full flex items-center justify-center mb-4",children:t.jsx(z.Info,{className:"w-8 h-8 text-red-600 dark:text-red-400"})}),t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load videos"}),t.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:b}),t.jsx("button",{onClick:y,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md transition-colors",children:"Retry"})]}):t.jsxs("div",{className:"space-y-6",children:[o===0&&D(_,"publishNow"),o===1&&D(N,"myVideos"),o===2&&D(v,"encoding")]})})]}):t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Please login to view your account"})})},Sd=({username:e,onSelectUser:a})=>{const[i,s]=P.useState([]),[r,n]=P.useState(!0),[u,c]=P.useState(null),d=async()=>{try{n(!0),c(null);const f=await ge.getFollowers(e);s(f)}catch(f){c(f instanceof Error?f.message:"Failed to load followers")}finally{n(!1)}};return P.useEffect(()=>{d()},[e]),r?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading followers..."]})}):u?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load followers"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),t.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user has no followers."})}):t.jsx("div",{className:"space-y-6",children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map((f,o)=>t.jsx("div",{onClick:()=>a&&a(f.follower),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
|
|
1102
1102
|
rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
|
|
1103
1103
|
transition-colors cursor-pointer`,children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("img",{src:ge.userAvatar(f.follower),alt:f.follower,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.follower}&background=random`}}),t.jsx("div",{className:"flex-1 min-w-0",children:t.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.follower]})})]})},`${f.follower}-${o}`))})})},Cd=({username:e,onSelectUser:a})=>{const[i,s]=P.useState([]),[r,n]=P.useState(!0),[u,c]=P.useState(null),d=async()=>{try{n(!0),c(null);const f=await ge.getFollowing(e);s(f)}catch(f){c(f instanceof Error?f.message:"Failed to load following list")}finally{n(!1)}};return P.useEffect(()=>{d()},[e]),r?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[t.jsx(z.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following list..."]})}):u?t.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following list"}),t.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:u}),t.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[t.jsx(z.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):i.length===0?t.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:t.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):t.jsx("div",{className:"space-y-6",children:t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:i.map((f,o)=>t.jsx("div",{onClick:()=>a&&a(f.following),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
|
|
1104
1104
|
rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
|
package/dist/index.esm.js
CHANGED
|
@@ -26075,7 +26075,7 @@ const lt = new wm(), cg = ({
|
|
|
26075
26075
|
"button",
|
|
26076
26076
|
{
|
|
26077
26077
|
onClick: () => o("posts"),
|
|
26078
|
-
className: `flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f === "posts" ? `${d === "dark" ? "bg-blue-500 text-white" : "bg-blue-600 text-white"}` : `${d === "dark" ? "text-gray-300 hover:bg-gray-700" : "text-gray-
|
|
26078
|
+
className: `flex-shrink-0 md:flex-shrink px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${f === "posts" ? `${d === "dark" ? "bg-blue-500 text-white" : "bg-blue-600 text-white"}` : `${d === "dark" ? "text-gray-300 hover:bg-gray-700" : "text-gray-500 hover:bg-gray-300"}`}`,
|
|
26079
26079
|
children: "Posts"
|
|
26080
26080
|
}
|
|
26081
26081
|
),
|