PageSourceSearch

https://xynergy.ai/_next/static/chunks/6267.b72fcf2b8bdc6581.js

js xynergy.ai collected 2026-10-05 16:02:25 UTC 7,873 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6267],{16267:(e,s,a)=>{a.r(s),a.d(s,{default:()=>y});var r=a(85047),t=a(31615),l=a(82520),d=a(21410),n=a(6386),c=a(38187),i=a(41178),o=a(73521),m=a(19548),x=a(54306),u=a(34961);let h=(0,a(46775).A)("medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);var f=a(94477),j=a(75020),g=a(32326);function N({rank:e}){return 1===e?(0,r.jsx)("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-gradient-to-br from-yellow-400 to-yellow-600 shadow-lg",children:(0,r.jsx)(h,{className:"h-6 w-6 text-white"})}):2===e?(0,r.jsx)("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-gradient-to-br from-gray-300 to-gray-500 shadow-lg",children:(0,r.jsx)(h,{className:"h-6 w-6 text-white"})}):3===e?(0,r.jsx)("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-gradient-to-br from-orange-400 to-orange-600 shadow-lg",children:(0,r.jsx)(h,{className:"h-6 w-6 text-white"})}):(0,r.jsx)("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-muted border-2 border-border",children:(0,r.jsx)("span",{className:"text-sm font-bold",children:e})})}function p({entry:e,isCurrentUser:s}){let a=e.value>=0?"text-green-600":"text-red-600",t=e.value>=0?"+":"";return(0,r.jsxs)("div",{className:(0,u.cn)("flex items-center gap-4 p-4 rounded-lg border transition-colors",s?"bg-primary/10 border-primary/50":"bg-card hover:bg-muted/50"),children:[(0,r.jsx)(N,{rank:e.rank}),(0,r.jsx)("div",{className:"flex-1 min-w-0",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:(0,u.cn)("font-medium",s&&"text-primary font-bold"),children:e.displayName}),s&&(0,r.jsx)(c.E,{variant:"secondary",className:"text-xs",children:"您"})]})}),(0,r.jsxs)("div",{className:(0,u.cn)("text-lg font-bold",a),children:[t,e.value.toFixed(2),"%"]})]})}function y({incompleteTasks:e,incompleteAchievements:s,onSwitchToTasks:a,onSwitchToAchievements:u}){let{user:h}=(0,o.A)(),{toast:N}=(0,i.dj)(),[w,b]=(0,t.useState)("monthly"),[v,k]=(0,t.useState)(null),[I,E]=(0,t.useState)(!0);(0,t.useEffect)(()=>{(async()=>{if(!h)return E(!1);E(!0);try{let e=await h.getIdToken(),s=new URLSearchParams({period:w,limit:"100",userId:h.uid}),a=await fetch(`/api/gamification/leaderboard?${s}`,{headers:{Authorization:`Bearer ${e}`}}),r=await a.json().catch(()=>({}));if(!a.ok){if("INDEX_BUILDING"===r.error)throw Error("INDEX_BUILDING");throw Error(r.message||r.error||"Failed to fetch leaderboard")}if(r.success)return void k(r.data);if("INDEX_BUILDING"===r.error)throw Error("INDEX_BUILDING");throw Error(r.message||r.error||"Failed to fetch leaderboard")}catch(s){let e=s instanceof Error?s:Error(String(s));m.Cp(e,{level:"error",extra:{message:"[tasks/leaderboard] 載入排行榜失敗",period:w},tags:{source:"LeaderboardTab.fetchLeaderboard"}}),"INDEX_BUILDING"===e.message||e.message?.includes("index is currently building")?N({title:"排行榜準備中",description:"排行榜索引正在建立中,請稍候幾分鐘後再試。索引建立完成後即可查看排行榜。",variant:"default",duration:5e3}):N({title:"載入失敗",description:e.message||"無法載入排行榜資料",variant:"destructive"})}finally{E(!1)}})()},[w,h,N]);let A=!I&&v&&0===v.leaderboard.length,D=e.slice(0,5),_=s.slice(0,5),L=D.length>0||_.length>0;return(0,r.jsx)(n.av,{value:"leaderboard",className:"space-y-4",children:(0,r.jsxs)(l.Zp,{children:[(0,r.jsx)(l.aR,{children:(0,r.jsxs)(l.ZB,{className:"flex items-center gap-2",children:[(0,r.jsx)(f.A,{className:"h-5 w-5"}),"淨值成長比率排行榜"]})}),(0,r.jsx)(l.Wu,{children:(0,r.jsxs)(n.tU,{value:w,onValueChange:e=>b(e),children:[(0,r.jsxs)(n.j7,{className:"grid w-full grid-cols-3 mb-6",children:[(0,r.jsx)(n.Xi,{value:"weekly",children:"週排行"}),(0,r.jsx)(n.Xi,{value:"monthly",children:"月排行"}),(0,r.jsx)(n.Xi,{value:"alltime",children:"總排行"})]}),(0,r.jsx)(n.av,{value:w,children:I?(0,r.jsx)(x.default,{className:"py-12",size:64,variant:"outline"}):v&&v.leaderboard.length>0?(0,r.jsxs)("div",{className:"space-y-3",children:[v.leaderboard.map(e=>(0,r.jsx)(p,{entry:e,isCurrentUser:e.userId===h?.uid},`${e.userId}-${e.rank}`)),v.userRank&&!v.leaderboard.some(e=>e.userId===h?.uid)&&(0,r.jsxs)("div",{className:"mt-6 pt-6 border-t",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,r.jsx)(j.A,{className:"h-5 w-5 text-muted-foreground"}),(0,r.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"您的排名"})]}),(0,r.jsx)(p,{entry:{userId:h?.uid||"",type:"networth_growth_rate",period:w,value:v.userRank.value,rank:v.userRank.rank,displayName:"您",updatedAt:new Date().toISOString()},isCurrentUser:!0})]})]}):A?(0,r.jsxs)("div",{className:"flex flex-col items-center py-12 text-center space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(f.A,{className:"h-12 w-12 text-muted-foreground mx-auto"}),(0,r.jsx)("p",{className:"font-medium text-foreground",children:"趁現在完成任務賺 XP,之後排行榜就會有你的名次"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"先完成下方任務與成就,再回來看排名"})]}
1),L?(0,r.jsxs)("div",{className:"w-full max-w-md space-y-4 text-left",children:[D.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[(0,r.jsx)(g.A,{className:"h-4 w-4"}),"可完成的任務"]}),(0,r.jsx)("ul",{className:"space-y-2",children:D.map(e=>(0,r.jsxs)("li",{className:"flex items-center justify-between gap-2 p-3 rounded-lg border bg-card",children:[(0,r.jsx)("span",{className:"text-sm",children:e.label}),(0,r.jsxs)(c.E,{variant:"secondary",className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200 shrink-0",children:["+",e.xp]})]},e.id))})]}),_.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[(0,r.jsx)(f.A,{className:"h-4 w-4"}),"可獲得的成就"]}),(0,r.jsx)("ul",{className:"space-y-2",children:_.map(e=>(0,r.jsxs)("li",{className:"flex items-center justify-between gap-2 p-3 rounded-lg border bg-card",children:[(0,r.jsx)("span",{className:"text-sm",children:e.label}),(0,r.jsxs)(c.E,{variant:"secondary",className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200 shrink-0",children:["+",e.xp]})]},e.id))})]})]}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"您已完成目前所有任務與成就,請稍後再來看排行榜"}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[(0,r.jsxs)(d.$,{onClick:a,className:"gap-2",children:[(0,r.jsx)(g.A,{className:"h-4 w-4"}),"前往任務"]}),(0,r.jsxs)(d.$,{variant:"outline",onClick:u,className:"gap-2",children:[(0,r.jsx)(f.A,{className:"h-4 w-4"}),"前往成就"]})]})]}):(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)(f.A,{className:"h-12 w-12 text-muted-foreground mb-4"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:"目前尚無排行榜資料"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mt-2",children:"排行榜資料每天更新一次"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-4",children:"如果這是首次使用,索引可能需要幾分鐘時間建立"})]})})]})})]})})}}}]);

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.