From 46d7912854595a647783117d530cd8af9c3c02c8 Mon Sep 17 00:00:00 2001 From: bunker-admin Date: Thu, 5 Mar 2026 09:37:04 -0700 Subject: [PATCH] Add Referrals navigation button to volunteer social feed page Bunker Admin --- admin/src/pages/volunteer/SocialFeedPage.tsx | 51 +++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/admin/src/pages/volunteer/SocialFeedPage.tsx b/admin/src/pages/volunteer/SocialFeedPage.tsx index 171a0700..602a5b01 100644 --- a/admin/src/pages/volunteer/SocialFeedPage.tsx +++ b/admin/src/pages/volunteer/SocialFeedPage.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; -import { Typography, Skeleton, Empty, Pagination, Button, Space, Card, List } from 'antd'; -import { TeamOutlined, CompassOutlined, TrophyOutlined } from '@ant-design/icons'; +import { Typography, Skeleton, Empty, Pagination, Button, Space, Card, List, Tag } from 'antd'; +import { TeamOutlined, CompassOutlined, TrophyOutlined, FlagOutlined, ThunderboltOutlined, GiftOutlined } from '@ant-design/icons'; import { useNavigate } from 'react-router-dom'; import { api } from '@/lib/api'; import FeedCard from '@/components/social/FeedCard'; @@ -26,12 +26,14 @@ export default function SocialFeedPage() { const [items, setItems] = useState([]); const [pagination, setPagination] = useState(null); const [topVolunteers, setTopVolunteers] = useState([]); + const [activeChallenge, setActiveChallenge] = useState<{ id: string; title: string; teamName: string; score: number } | null>(null); const [loading, setLoading] = useState(true); const [page, setPage] = useState(1); useEffect(() => { loadFeed(page); loadTopVolunteers(); + loadActiveChallenge(); }, [page]); const loadFeed = async (p: number) => { @@ -52,6 +54,22 @@ export default function SocialFeedPage() { } catch {} }; + const loadActiveChallenge = async () => { + try { + const { data } = await api.get('/social/challenges', { params: { status: 'ACTIVE' } }); + const challenges = data.challenges || []; + for (const c of challenges) { + try { + const { data: teamData } = await api.get(`/social/challenges/${c.id}/my-team`); + if (teamData.team) { + setActiveChallenge({ id: c.id, title: c.title, teamName: teamData.team.name, score: teamData.team.score }); + break; + } + } catch {} + } + } catch {} + }; + return (
@@ -63,9 +81,38 @@ export default function SocialFeedPage() { + + {activeChallenge && ( + navigate(`/volunteer/challenges/${activeChallenge.id}`)} + > +
+ +
+ + + Active Challenge: {activeChallenge.title} + + + Team "{activeChallenge.teamName}" — {activeChallenge.score} pts + +
+ LIVE +
+
+ )} + {topVolunteers.length > 0 && (