@@ -12,10 +12,15 @@ import Link from "next/link";
1212import { getServerSession } from "next-auth" ;
1313import authOptions from "@/app/api/auth/[...nextauth]/authOptions" ;
1414import { UserService } from "@/services/UserService" ;
15- import { getUserActiveSignatureData , isAttendee } from "@/utils/utils" ;
15+ import {
16+ getUserActiveSignatureData ,
17+ isAttendee ,
18+ isCompany ,
19+ } from "@/utils/utils" ;
1620import UserSignOut from "@/components/UserSignOut" ;
1721import { SPIN_WHEEL_MAXIMUM } from "@/constants" ;
1822import { EventService } from "@/services/EventService" ;
23+ import { FileUser , Users } from "lucide-react" ;
1924
2025const N_SESSION_TILES = 3 ;
2126const N_COMPANY_TILES = 15 ;
@@ -58,14 +63,22 @@ export default async function Home() {
5863
5964 let standDates = new Set (
6065 companies ?. flatMap (
61- ( c ) => c . stands ?. flatMap ( ( cs ) => cs . date . slice ( 0 , 10 ) ) ?? [ ]
62- ) ?? [ ]
66+ ( c ) => c . stands ?. flatMap ( ( cs ) => cs . date . slice ( 0 , 10 ) ) ?? [ ] ,
67+ ) ?? [ ] ,
6368 ) ;
6469 let today = new Date ( ) . toISOString ( ) . split ( "T" ) [ 0 ] ;
6570 const spinWheelData = getUserActiveSignatureData ( user , event ?. id ?? `` ) ;
6671 const showSpinWheelSection =
6772 standDates . has ( today ) && isAttendee ( user . role ) && ! spinWheelData ?. redeemed ;
6873
74+ const downloadCVsLinks =
75+ isCompany ( user . role ) &&
76+ ! ! user . company ?. length &&
77+ ( await CompanyService . getDownloadLinks (
78+ session . cannonToken ,
79+ user . company [ 0 ] . company ,
80+ ) ) ;
81+
6982 return (
7083 < div className = "container mx-auto" >
7184 { /* Spin the Wheel Section */ }
@@ -89,6 +102,32 @@ export default async function Home() {
89102 </ ProgressBar >
90103 ) }
91104
105+ { /* Download CVs section */ }
106+ { downloadCVsLinks && (
107+ < List title = "Download CVs" >
108+ { downloadCVsLinks . all && (
109+ < Link
110+ className = "button-primary text-sm"
111+ href = { downloadCVsLinks . all }
112+ download
113+ >
114+ < FileUser size = { 16 } />
115+ Download all
116+ </ Link >
117+ ) }
118+ { downloadCVsLinks . all && (
119+ < Link
120+ className = "button-tertiary text-sm"
121+ href = { downloadCVsLinks . all }
122+ download
123+ >
124+ < Users size = { 16 } />
125+ Download company connections
126+ </ Link >
127+ ) }
128+ </ List >
129+ ) }
130+
92131 { /* Upcoming Sessions */ }
93132 < List
94133 title = { upcomingSessions . length > 0 ? "Next Up" : "Sessions" }
0 commit comments