Skip to content

Commit 4a4b4cc

Browse files
committed
Add a Google Meet join button on calendar events with one
1 parent 32018f9 commit 4a4b4cc

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

static/calendar.css

+19-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
--cal-cell-today-disabled: #b0a8b9;
1515
--cal-primary: #443752;
1616
--cal-cover: #000000ad;
17+
--cal-info-padding: 10px;
1718

1819
font-size: 14px;
1920
}
@@ -122,7 +123,7 @@
122123
width: 300px;
123124
background-color: white;
124125
border: 1px solid black;
125-
padding: 10px;
126+
padding: var(--cal-info-padding);
126127
z-index: 999;
127128
word-wrap: break-word;
128129
white-space: normal;
@@ -140,6 +141,23 @@
140141
text-align: unset;
141142
}
142143

144+
#calendar #calendar-info #calendar-join-button {
145+
display: block;
146+
margin-top: 10px;
147+
padding: 5px;
148+
text-align: center;
149+
150+
/* width: 100% will spill over the right padding, so use ✨calc magic✨ */
151+
width: calc(100% - var(--cal-info-padding));
152+
153+
background-color: var(--cal-primary);
154+
color: white;
155+
}
156+
157+
#calendar #calendar-info #calendar-join-button.hidden {
158+
display: none;
159+
}
160+
143161
#calendar #calendar-info #calendar-info-where, #calendar #calendar-info #calendar-info-when {
144162
display: inline-block;
145163
margin-top: 5px;

static/js/calendar.js

+10
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,16 @@ function displayInfoPanel(target, event) {
249249
while (desc.firstChild.nodeName.toLowerCase() == "br") {
250250
desc.removeChild(desc.firstChild);
251251
}
252+
253+
// Only show the "Join Meeting" box if there's a meeting to join, and set
254+
// the correct href
255+
const meetingButton = document.getElementById('calendar-join-button');
256+
if (event.meeting_link) {
257+
meetingButton.href = event.meeting_link;
258+
meetingButton.classList.remove("hidden");
259+
} else {
260+
meetingButton.classList.add("hidden");
261+
}
252262
}
253263

254264
/**

templates/calendar.handlebars

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<b id="calendar-info-when"></b>
5151
<br>
5252
<b id="calendar-info-where"></b>
53+
<a href="#" id="calendar-join-button" class="hidden">Join Google Meet</a>
5354
<div id="calendar-info-description"></div>
5455
</div>
5556
</div>

0 commit comments

Comments
 (0)