@@ -12,10 +12,15 @@ import Link from "next/link";
12
12
import { getServerSession } from "next-auth" ;
13
13
import authOptions from "@/app/api/auth/[...nextauth]/authOptions" ;
14
14
import { UserService } from "@/services/UserService" ;
15
- import { getUserActiveSignatureData , isAttendee } from "@/utils/utils" ;
15
+ import {
16
+ getUserActiveSignatureData ,
17
+ isAttendee ,
18
+ isCompany ,
19
+ } from "@/utils/utils" ;
16
20
import UserSignOut from "@/components/UserSignOut" ;
17
21
import { SPIN_WHEEL_MAXIMUM } from "@/constants" ;
18
22
import { EventService } from "@/services/EventService" ;
23
+ import { FileUser , Users } from "lucide-react" ;
19
24
20
25
const N_SESSION_TILES = 3 ;
21
26
const N_COMPANY_TILES = 15 ;
@@ -58,14 +63,22 @@ export default async function Home() {
58
63
59
64
let standDates = new Set (
60
65
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
+ ) ?? [ ] ,
63
68
) ;
64
69
let today = new Date ( ) . toISOString ( ) . split ( "T" ) [ 0 ] ;
65
70
const spinWheelData = getUserActiveSignatureData ( user , event ?. id ?? `` ) ;
66
71
const showSpinWheelSection =
67
72
standDates . has ( today ) && isAttendee ( user . role ) && ! spinWheelData ?. redeemed ;
68
73
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
+
69
82
return (
70
83
< div className = "container mx-auto" >
71
84
{ /* Spin the Wheel Section */ }
@@ -89,6 +102,32 @@ export default async function Home() {
89
102
</ ProgressBar >
90
103
) }
91
104
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
+
92
131
{ /* Upcoming Sessions */ }
93
132
< List
94
133
title = { upcomingSessions . length > 0 ? "Next Up" : "Sessions" }
0 commit comments