diff --git a/app/page.tsx b/app/page.tsx index 5b8a855..fceb539 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -14,7 +14,7 @@ import { api } from "@/services/url"; import { MixpanelTracking } from "@/services/mixpanel"; export default function Home() { - const { loggedIn, userId, userDbId } = useAuth(); + const { loggedIn, userId, userDbId, group } = useAuth(); const [liveClasses, setLiveClasses] = useState([]); const [isLoading, setIsLoading] = useState(true); const [quizzes, setQuizzes] = useState([]); @@ -78,7 +78,7 @@ export default function Home() { const fetchUserSessions = async () => { try { const [liveSessionData, quizSessionData] = await Promise.all([ - fetchUserSession(userDbId!), + group !== 'AllIndiaStudents' ? fetchUserSession(userDbId!) : Promise.resolve([]), fetchUserSession(userDbId!, true) ]); @@ -91,15 +91,17 @@ export default function Home() { const quizSessions = flattenedQuizData.filter(flattenedSessionsData => flattenedSessionsData.session.platform === 'quiz'); setQuizzes(quizSessions); - const sessionsData = await Promise.all(liveSessionData.map(async (liveSession: Session) => { - const sessionOccurrenceData = await getSessionOccurrences(liveSession.session_id); - if (!sessionOccurrenceData) return null; - return sessionOccurrenceData; - })); - const flattenedSessionsData = sessionsData.flat(); - const liveSessions = flattenedSessionsData.filter(flattenedSessionsData => flattenedSessionsData.session.platform === 'meet'); + if (group !== 'AllIndiaStudents') { + const sessionsData = await Promise.all(liveSessionData.map(async (liveSession: Session) => { + const sessionOccurrenceData = await getSessionOccurrences(liveSession.session_id); + if (!sessionOccurrenceData) return null; + return sessionOccurrenceData; + })); + const flattenedSessionsData = sessionsData.flat(); + const liveSessions = flattenedSessionsData.filter(flattenedSessionsData => flattenedSessionsData.session.platform === 'meet'); + setLiveClasses(liveSessions); + } - setLiveClasses(liveSessions); MixpanelTracking.getInstance().identify(userId!); } catch (error) { console.error("Error fetching user sessions:", error); @@ -278,10 +280,12 @@ export default function Home() { ) : (
-
-

Live Classes

- {renderLiveClasses()} -
+ {group !== 'AllIndiaStudents' && ( +
+

Live Classes

+ {renderLiveClasses()} +
+ )}
{renderTestSection("Tests", [...nonChapterTests, ...chapterTests])}