File tree Expand file tree Collapse file tree 3 files changed +22
-16
lines changed
app/(authenticated)/sessions/[id] Expand file tree Collapse file tree 3 files changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ import { PrizeTile } from "@/components/prize";
9
9
import AddToCalendarButton from "@/components/session/AddToCalendarButton" ;
10
10
import { SessionService } from "@/services/SessionService" ;
11
11
import { UserService } from "@/services/UserService" ;
12
- import { generateTimeInterval , isMember } from "@/utils/utils" ;
12
+ import {
13
+ generateTimeInterval ,
14
+ getSessionColorClassName ,
15
+ isMember ,
16
+ } from "@/utils/utils" ;
13
17
import { CalendarClock , MapPin , Scan , Users } from "lucide-react" ;
14
18
import { getServerSession } from "next-auth" ;
15
19
import Image from "next/image" ;
@@ -58,7 +62,9 @@ export default async function Session({ params }: { params: SessionParams }) {
58
62
{ sinfoSession . place }
59
63
</ span >
60
64
</ div >
61
- < span className = "bg-sinfo-secondary text-white rounded-md px-3 py-1 font-bold uppercase" >
65
+ < span
66
+ className = { `text-white rounded-md px-3 py-1 font-bold uppercase ${ getSessionColorClassName ( sinfoSession . kind ) } ` }
67
+ >
62
68
{ sinfoSession . kind }
63
69
</ span >
64
70
< ShowMore lines = { 5 } className = "font-light" >
Original file line number Diff line number Diff line change 1
1
import ListCard from "@/components/ListCard" ;
2
- import { generateTimeInterval } from "@/utils/utils" ;
2
+ import { generateTimeInterval , getSessionColorClassName } from "@/utils/utils" ;
3
3
4
4
interface SesionTileProps {
5
5
session : SINFOSession ;
6
6
onlyShowHours ?: boolean ;
7
7
}
8
8
9
- export function getLabelClassName ( text : string ) : string {
10
- switch ( text ) {
11
- case "Presentation" :
12
- return "!bg-sinfo-tertiary" ;
13
- case "Workshop" :
14
- return "!bg-sinfo-quaternary" ;
15
- case "Keynote" :
16
- default :
17
- return "" ; // Use default label color
18
- }
19
- }
20
-
21
9
export function SessionTile ( {
22
10
session,
23
11
onlyShowHours = false ,
@@ -41,7 +29,7 @@ export function SessionTile({
41
29
onlyHours : onlyShowHours ,
42
30
} ) }
43
31
label = { session . kind }
44
- labelExtraClassName = { getLabelClassName ( session . kind ) }
32
+ labelExtraClassName = { getSessionColorClassName ( session . kind ) }
45
33
link = { `/sessions/${ session . id } ` }
46
34
extraClassName = {
47
35
pastSession ? "!bg-neutral-200 hover:!bg-neutral-300" : ""
Original file line number Diff line number Diff line change @@ -131,3 +131,15 @@ export function isToday(date: Date | string): boolean {
131
131
date . getDate ( ) === today . getDate ( )
132
132
) ;
133
133
}
134
+
135
+ export function getSessionColorClassName ( sessionKind : string ) {
136
+ switch ( sessionKind ) {
137
+ case "Presentation" :
138
+ return "!bg-sinfo-tertiary" ;
139
+ case "Workshop" :
140
+ return "!bg-sinfo-quaternary" ;
141
+ case "Keynote" :
142
+ default :
143
+ return "!bg-sinfo-secondary" ;
144
+ }
145
+ }
You can’t perform that action at this time.
0 commit comments