Skip to content

Commit 902489f

Browse files
committed
Add room number to calendar entries
1 parent 1a2c968 commit 902489f

File tree

6 files changed

+98
-9
lines changed

6 files changed

+98
-9
lines changed

components/schedule/day.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface DayProps {
1313
duration: string;
1414
color?: string;
1515
link?: string;
16+
room?: string | string[];
1617
widthFactor?: number;
1718
position?: number;
1819
}[]
@@ -23,7 +24,7 @@ export const Day = (props: DayProps) => {
2324
const dateString = formatDate(props.date);
2425
const events = props.events.map((event, i) => {
2526
return <Event
26-
key={i}
27+
key={i}
2728
name={event.name}
2829
time={event.time}
2930
dayStartTime={props.startTime}
@@ -34,6 +35,7 @@ export const Day = (props: DayProps) => {
3435
padding={10}
3536
color={event.color}
3637
link={event.link}
38+
room={event.room}
3739
/>
3840
});
3941

components/schedule/event.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ interface EventProps {
99
padding: number;
1010
link?: string;
1111
color?: string;
12+
room?: string | string[];
1213
}
1314

1415
const colorLookup = {
@@ -34,6 +35,8 @@ export const Event = (props: EventProps) => {
3435
const leftPadding = left ? 2 : 0;
3536
const rightPadding = right ? 2 : 0;
3637

38+
const room_str = props.room ? getRoomStr(props.room) : null;
39+
3740
const el = (
3841
<div
3942
className="event"
@@ -47,6 +50,10 @@ export const Event = (props: EventProps) => {
4750
>
4851
<p className="event-name">{props.name}</p>
4952
<p className="event-time">{to12Hr(props.time)}</p>
53+
{
54+
room_str ? <p className="event-room">{room_str}</p>: null
55+
}
56+
5057
{
5158
props.link ? <p className="event-more-info">more info</p> : null
5259
}
@@ -72,4 +79,27 @@ const to12Hr = (time: string) => {
7279
const hrMin = time.split(":");
7380
const hr = (Number(hrMin[0]) - 1) % 12 + 1;
7481
return `${hr}:${hrMin[1]}`;
82+
}
83+
84+
const getRoomStr = (room: string | string[]) => {
85+
if (room instanceof Array) {
86+
return join_br(room);
87+
}
88+
return <>{room}</>;
89+
}
90+
91+
const join_br = (items: string[]) => {
92+
const firstline = items[0];
93+
const rest = items.slice(1);
94+
return (
95+
<>
96+
{firstline}
97+
{rest.map(line => (
98+
<>
99+
<br />
100+
{line}
101+
</>
102+
))}
103+
</>
104+
)
75105
}

config.yaml

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,108 +56,154 @@ schedule:
5656
- name: Breakfast
5757
time: "8:00"
5858
duration: "1:00"
59+
room: WIRB 4190
5960
- name: Welcome & Project Pitches
6061
time: "9:00"
6162
duration: "1:30"
63+
room:
64+
- WIRB 1170
65+
- Zoom Room 1
6266
- name: Hacking
6367
time: "10:30"
6468
duration: "1:30"
6569
color: red
70+
room: WIRB 1130
6671
- name: Lunch
6772
time: "12:00"
6873
duration: "1:30"
74+
room: WIRB 4190
6975
- name: MRI Data in Python
7076
time: "13:30"
7177
duration: "1:00"
7278
color: "#1f331e"
7379
link: "#python"
7480
priority: 1
81+
room:
82+
- WIRB 1110
83+
- Zoom Room 1
7584
- name: Intro to Datalad
7685
time: "14:30"
7786
duration: "1:30"
7887
color: "#1f331e"
7988
link: "#datalad"
8089
priority: 1
90+
room:
91+
- WIRB 1160
92+
- Zoom Room 2
8193
- name: Hacking
8294
time: "13:30"
8395
duration: "2:30"
8496
color: red
97+
room: WIRB 4190
8598
- day: 2
8699
month: 12
87100
year: 2021
88101
events:
89102
- name: Breakfast
90103
time: "8:00"
91104
duration: "1:00"
105+
room: WIRB 4190
92106
- name: fMRI/fMRIPrep
93107
time: "9:00"
94108
duration: "1:30"
95109
color: "#1f331e"
96110
link: "#frmi"
97111
priority: 1
112+
room:
113+
- WIRB 1170
114+
- Zoom Room 1
98115
- name: Introduction to Meta-analyses
99116
time: "10:30"
100117
duration: "1:30"
101118
color: "#1f331e"
102119
link: "#meta-analysis"
103120
priority: 1
121+
room:
122+
- WIRB 4190
123+
- Zoom Room 2
104124
- name: Lunch
105125
time: "12:00"
106126
duration: "1:30"
127+
room: WIRB 4190
107128
- name: Intro to fNIRS
108129
time: "13:30"
109130
duration: "2:30"
110131
color: "#1f331e"
111132
link: "#fnirs"
112133
priority: 1
134+
room:
135+
- WIRB 1110
136+
- Zoom Room 1
113137
- name: Hacking
114138
time: "13:30"
115139
duration: "2:30"
116140
color: red
141+
room:
142+
- NSC 1 (9:00-12:00)
143+
- WIRB 1160 (10:30-12:00)
117144
- name: Hacking
118145
time: "9:00"
119146
duration: "3:00"
120147
color: red
148+
room:
149+
- WIRB 4190 (1:30-2:30)
150+
- VAC 100 (1:30-4:00)
121151
- name: "Diversity in Academia"
122152
time: "12:30"
123-
duration: "1:00"
153+
duration: "0:45"
124154
color: blue
125155
link: "https://github.com/BrainhackWestern/BrainhackWestern.github.io/wiki/Lunch-and-Learn#winrepo"
126156

127-
128157
- day: 3
129158
month: 12
130159
year: 2021
131160
events:
132161
- name: Breakfast
133162
time: "8:00"
134163
duration: "1:00"
164+
room: WIRB 4190
135165
- name: Intro to Machine Learning
136166
time: "9:00"
137167
duration: "1:30"
138168
color: "#1f331e"
139169
link: "#machine-learning"
140170
priority: 1
171+
room:
172+
- WIRB 1130
173+
- Zoom Room 1
141174
- name: Intro to Deep Learning
142175
time: "10:30"
143176
duration: "1:30"
144177
color: "#1f331e"
145178
link: "#deep-learning"
146179
priority: 1
180+
room:
181+
- WIRB 1130
182+
- Zoom Room 2
147183
- name: Lunch
148184
time: "12:00"
149185
duration: "1:30"
186+
room: WIRB 4190
150187
- name: Hacking
151188
time: "9:00"
152189
duration: "3:00"
153190
color: red
191+
room:
192+
- WIRB 4190 (9:30-12:00)
193+
- VAC 100 (9:00-12:00)
154194
- name: Hacking
155195
time: "13:30"
156196
duration: "1:00"
157197
color: red
198+
room:
199+
- WIRB 4190 (1:30-2:00)
200+
- VAC 100 (1:30-2:30)
158201
- name: Project presentations & Wrap-up
159202
time: "14:30"
160203
duration: "1:30"
204+
room:
205+
- VAC 100
206+
- Zoom Room 1
161207
tutorials:
162208
- day: 1
163209
month: 12

interfaces/schedule.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ export interface ScheduleDay extends BasicDate {
4444
*/
4545
priority?: number;
4646

47+
/**
48+
* Optional string or list of strings listing the rooms.
49+
*/
50+
room?: string | string[];
51+
4752
/**
4853
* For internal use only. Do not manually set. This will be used in config
4954
* generated by the calendar creator

pages/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,15 @@ const Home = ({ config, calendar }: InferGetStaticPropsType<typeof getStaticProp
147147
<Schedule
148148
config={config.schedule}
149149
calendar={calendar}
150-
lineHeight={100}
150+
lineHeight={120}
151151
show={config.displaySections.schedule ?? true}
152152
/>
153153

154-
<TutorialList
154+
<TutorialList
155155
config={config.tutorials}
156156
show={config.displaySections.tutorial ?? true }
157157
/>
158-
159-
158+
160159
<div id="location" className="content-space container-lg">
161160
<div className="row">
162161
<div className="col-lg-4 d-flex flex-column justify-content-start align-items-start">

styles/components/_schedule.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
.day-col {
3232
max-width: 80%;
33-
width: 300px;
33+
width: 320px;
3434
margin: 0 0.5em;
3535
}
3636

@@ -55,12 +55,19 @@
5555
}
5656

5757
.event-name {
58-
font-size: var.$body_norm;
58+
font-size: var.$body_small;
59+
font-weight: var.$weight_bold;
5960
margin-bottom: 0;
6061
}
6162

6263
.event-time {
6364
font-size: var.$body_small;
65+
margin-bottom: 0;
66+
}
67+
68+
.event-room {
69+
font-size: var.$body_small;
70+
height: 1.5em;
6471
}
6572

6673
.event-more-info {

0 commit comments

Comments
 (0)