diff --git a/src/components/AccountSidebar.astro b/src/components/AccountSidebar.astro
index 1efb1dcb9..3ac54317b 100644
--- a/src/components/AccountSidebar.astro
+++ b/src/components/AccountSidebar.astro
@@ -1,6 +1,7 @@
---
import AstroIcon from './AstroIcon.astro';
import { TeamDropdown } from './TeamDropdown/TeamDropdown';
+import { SidebarFriendsCounter } from './Friends/SidebarFriendsCounter';
export interface Props {
activePageId: string;
@@ -142,11 +143,17 @@ const sidebarLinks = [
{sidebarLink.title}
- {sidebarLink.isNew && !isActive && (
-
-
-
-
+ {sidebarLink.isNew &&
+ sidebarLink.id !== 'friends' &&
+ !isActive && (
+
+
+
+
+ )}
+
+ {sidebarLink.id === 'friends' && (
+
)}
@@ -159,7 +166,12 @@ const sidebarLinks = [
}
-
diff --git a/src/components/Friends/EmptyFriends.tsx b/src/components/Friends/EmptyFriends.tsx
index e29261851..9b6042755 100644
--- a/src/components/Friends/EmptyFriends.tsx
+++ b/src/components/Friends/EmptyFriends.tsx
@@ -19,8 +19,8 @@ export function EmptyFriends(props: EmptyFriendsProps) {
class="mb-2 h-[60px] w-[60px] opacity-10 sm:h-[120px] sm:w-[120px]"
/>
Invite your Friends
-
- Invite your friends to join you on your learning journey.
+
+ Share the unique link below with your friends to track their skills and progress.
@@ -35,7 +35,7 @@ export function EmptyFriends(props: EmptyFriendsProps) {
readonly
/>
;
- }
-
const selectedGroupingType = groupingTypes.find(
(grouping) => grouping.value === selectedGrouping
);
diff --git a/src/components/Friends/SidebarFriendsCounter.tsx b/src/components/Friends/SidebarFriendsCounter.tsx
new file mode 100644
index 000000000..972844d08
--- /dev/null
+++ b/src/components/Friends/SidebarFriendsCounter.tsx
@@ -0,0 +1,46 @@
+import { httpGet } from '../../lib/http';
+import type { TeamListResponse } from '../TeamDropdown/TeamDropdown';
+import { useEffect, useState } from 'preact/hooks';
+
+type GetFriendCountsResponse = {
+ sentCount: number;
+ acceptedCount: number;
+ receivedCount: number;
+ rejectedCount: number;
+ gotRejectedCount: number;
+};
+
+export function SidebarFriendsCounter() {
+ const [friendCounts, setFriendCounts] = useState();
+ async function getFriendCounts() {
+ const { response, error } = await httpGet(
+ `${import.meta.env.PUBLIC_API_URL}/v1-get-friend-counts`
+ );
+
+ if (error || !response) {
+ return;
+ }
+
+ setFriendCounts(response);
+ }
+
+ useEffect(() => {
+ getFriendCounts().finally(() => null);
+ }, []);
+
+ const pendingCount = friendCounts?.receivedCount || 0;
+ if (!pendingCount) {
+ return (
+
+
+
+
+ );
+ }
+
+ return (
+
+ {pendingCount}
+
+ );
+}