feat: add team collaboration sessions for admins, enhancing session management and visibility in the application
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
import { Suspense } from 'react';
|
||||
import { auth } from '@/lib/auth';
|
||||
import { getSessionsByUserId } from '@/services/sessions';
|
||||
import { getMotivatorSessionsByUserId } from '@/services/moving-motivators';
|
||||
import { getYearReviewSessionsByUserId } from '@/services/year-review';
|
||||
import { getWeeklyCheckInSessionsByUserId } from '@/services/weekly-checkin';
|
||||
import { getWeatherSessionsByUserId } from '@/services/weather';
|
||||
import {
|
||||
getSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamSwotSessions,
|
||||
} from '@/services/sessions';
|
||||
import {
|
||||
getMotivatorSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamMotivatorSessions,
|
||||
} from '@/services/moving-motivators';
|
||||
import {
|
||||
getYearReviewSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamYearReviewSessions,
|
||||
} from '@/services/year-review';
|
||||
import {
|
||||
getWeeklyCheckInSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamWeeklyCheckInSessions,
|
||||
} from '@/services/weekly-checkin';
|
||||
import {
|
||||
getWeatherSessionsByUserId,
|
||||
getTeamCollaboratorSessionsForAdmin as getTeamWeatherSessions,
|
||||
} from '@/services/weather';
|
||||
import { Card } from '@/components/ui';
|
||||
import { withWorkshopType } from '@/lib/workshops';
|
||||
import { WorkshopTabs } from './WorkshopTabs';
|
||||
@@ -36,15 +51,30 @@ export default async function SessionsPage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fetch SWOT, Moving Motivators, Year Review, Weekly Check-in, and Weather sessions
|
||||
const [swotSessions, motivatorSessions, yearReviewSessions, weeklyCheckInSessions, weatherSessions] =
|
||||
await Promise.all([
|
||||
getSessionsByUserId(session.user.id),
|
||||
getMotivatorSessionsByUserId(session.user.id),
|
||||
getYearReviewSessionsByUserId(session.user.id),
|
||||
getWeeklyCheckInSessionsByUserId(session.user.id),
|
||||
getWeatherSessionsByUserId(session.user.id),
|
||||
]);
|
||||
// Fetch sessions (owned + shared) and team collab sessions (for team admins, non-shared)
|
||||
const [
|
||||
swotSessions,
|
||||
motivatorSessions,
|
||||
yearReviewSessions,
|
||||
weeklyCheckInSessions,
|
||||
weatherSessions,
|
||||
teamSwotSessions,
|
||||
teamMotivatorSessions,
|
||||
teamYearReviewSessions,
|
||||
teamWeeklyCheckInSessions,
|
||||
teamWeatherSessions,
|
||||
] = await Promise.all([
|
||||
getSessionsByUserId(session.user.id),
|
||||
getMotivatorSessionsByUserId(session.user.id),
|
||||
getYearReviewSessionsByUserId(session.user.id),
|
||||
getWeeklyCheckInSessionsByUserId(session.user.id),
|
||||
getWeatherSessionsByUserId(session.user.id),
|
||||
getTeamSwotSessions(session.user.id),
|
||||
getTeamMotivatorSessions(session.user.id),
|
||||
getTeamYearReviewSessions(session.user.id),
|
||||
getTeamWeeklyCheckInSessions(session.user.id),
|
||||
getTeamWeatherSessions(session.user.id),
|
||||
]);
|
||||
|
||||
// Add workshopType to each session for unified display
|
||||
const allSwotSessions = withWorkshopType(swotSessions, 'swot');
|
||||
@@ -53,6 +83,12 @@ export default async function SessionsPage() {
|
||||
const allWeeklyCheckInSessions = withWorkshopType(weeklyCheckInSessions, 'weekly-checkin');
|
||||
const allWeatherSessions = withWorkshopType(weatherSessions, 'weather');
|
||||
|
||||
const teamSwotWithType = withWorkshopType(teamSwotSessions, 'swot');
|
||||
const teamMotivatorWithType = withWorkshopType(teamMotivatorSessions, 'motivators');
|
||||
const teamYearReviewWithType = withWorkshopType(teamYearReviewSessions, 'year-review');
|
||||
const teamWeeklyCheckInWithType = withWorkshopType(teamWeeklyCheckInSessions, 'weekly-checkin');
|
||||
const teamWeatherWithType = withWorkshopType(teamWeatherSessions, 'weather');
|
||||
|
||||
// Combine and sort by updatedAt
|
||||
const allSessions = [
|
||||
...allSwotSessions,
|
||||
@@ -99,6 +135,13 @@ export default async function SessionsPage() {
|
||||
yearReviewSessions={allYearReviewSessions}
|
||||
weeklyCheckInSessions={allWeeklyCheckInSessions}
|
||||
weatherSessions={allWeatherSessions}
|
||||
teamCollabSessions={[
|
||||
...teamSwotWithType,
|
||||
...teamMotivatorWithType,
|
||||
...teamYearReviewWithType,
|
||||
...teamWeeklyCheckInWithType,
|
||||
...teamWeatherWithType,
|
||||
]}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user