diff --git a/client/components/settings/RealmSwitcher.tsx b/client/components/settings/RealmSwitcher.tsx index 38369601..8bbdeb05 100644 --- a/client/components/settings/RealmSwitcher.tsx +++ b/client/components/settings/RealmSwitcher.tsx @@ -160,7 +160,12 @@ const RealmSwitcher = memo(function RealmSwitcher({ }: RealmSwitcherProps) { const { roles } = useAuth(); const canSeeStaff = useMemo( - () => roles.some((r) => ["owner", "admin", "founder", "staff", "employee"].includes(r.toLowerCase())), + () => + roles.some((r) => + ["owner", "admin", "founder", "staff", "employee"].includes( + r.toLowerCase(), + ), + ), [roles], ); const visibleOptions = useMemo( diff --git a/client/pages/Dashboard.tsx b/client/pages/Dashboard.tsx index 0c16c7c8..f0187888 100644 --- a/client/pages/Dashboard.tsx +++ b/client/pages/Dashboard.tsx @@ -85,7 +85,9 @@ export default function Dashboard() { const [invites, setInvites] = useState([]); const [achievements, setAchievements] = useState([]); // earned achievements const [allAchievements, setAllAchievements] = useState([]); - const [achievementFilter, setAchievementFilter] = useState<"all" | "earned" | "locked">("earned"); + const [achievementFilter, setAchievementFilter] = useState< + "all" | "earned" | "locked" + >("earned"); const [followingIds, setFollowingIds] = useState([]); const [followerIds, setFollowerIds] = useState([]); const [connectionsList, setConnectionsList] = useState([]); @@ -1148,33 +1150,48 @@ export default function Dashboard() { Your network

- People you follow, your followers, and direct connections. + People you follow, your followers, and direct + connections.

- Following + + Following + {followingIds.length} people {followingIds.length === 0 ? ( -
You're not following anyone yet.
+
+ You're not following anyone yet. +
) : ( followingIds.slice(0, 6).map((id) => ( -
-
{id}
+
+
+ {id} +
+ + +
-
- - - -
-
-
- {(() => { - const earnedIds = new Set((achievements || []).map((a: any) => a.id)); - const source = (achievementFilter === "earned" - ? (achievements || []) - : achievementFilter === "locked" - ? (allAchievements || []).filter((a: any) => !earnedIds.has(a.id)) - : (allAchievements || [])).map((a: any) => ({ ...a, earned: earnedIds.has(a.id) })); - if (!source.length) { - return ( -
- -

No achievements to display.

-
+
+ {(() => { + const earnedIds = new Set( + (achievements || []).map((a: any) => a.id), ); - } - return source - .sort((a: any, b: any) => Number(b.earned) - Number(a.earned)) - .map((achievement: any, index: number) => { - const Icon = getAchievementIcon(achievement.icon || "star"); + const source = ( + achievementFilter === "earned" + ? achievements || [] + : achievementFilter === "locked" + ? (allAchievements || []).filter( + (a: any) => !earnedIds.has(a.id), + ) + : allAchievements || [] + ).map((a: any) => ({ + ...a, + earned: earnedIds.has(a.id), + })); + if (!source.length) { return ( -
-
-
-
- -
-
-

- {achievement.title} -

-

{achievement.description}

-
-
- {achievement.earned && ( - - )} -
+
+ +

No achievements to display.

); - }); - })()} -
- + } + return source + .sort( + (a: any, b: any) => + Number(b.earned) - Number(a.earned), + ) + .map((achievement: any, index: number) => { + const Icon = getAchievementIcon( + achievement.icon || "star", + ); + return ( +
+
+
+
+ +
+
+

+ {achievement.title} +

+

+ {achievement.description} +

+
+
+ {achievement.earned && ( + + )} +
+
+ ); + }); + })()} +
+ {/* Teams & Invitations */}