@@ -2,7 +2,7 @@ import { computed } from "@preact/signals";
22import { useState } from "preact/hooks" ;
33import { talks , currentTimeSecs , sendCommand , currentUser } from "../store" ;
44import { TalkCard } from "./TalkCard" ;
5- import { type Talk } from "../types" ;
5+ import { AttendanceMode , type Talk } from "../types" ;
66
77export function TalkList ( ) {
88 const user = currentUser . value ! ;
@@ -115,20 +115,72 @@ function Section({
115115}
116116
117117function Header ( ) {
118+ const user = currentUser . value ;
119+ const isRemote = user ?. attendance_mode === AttendanceMode . Remote ;
120+
121+ const toggleMode = ( e : Event ) => {
122+ const checked = ( e . currentTarget as HTMLInputElement ) . checked ;
123+ const newMode = checked ? AttendanceMode . Remote : AttendanceMode . OnSite ;
124+
125+ sendCommand ( {
126+ SetAttendanceMode : { attendance_mode : newMode } ,
127+ } ) ;
128+ } ;
129+
118130 return (
119131 < div class = "title" >
120132 < h1 > MOPAD</ h1 >
121- < a
122- class = "calendar"
123- href = "#calendar"
124- onClick = { ( e ) => {
125- e . preventDefault ( ) ;
126- const dialog = document . querySelector ( ".calendar-dialog" ) ;
127- dialog ?. classList . add ( "open" ) ;
133+
134+ { /* Wrapper to group right-aligned elements */ }
135+ < div
136+ style = { {
137+ justifySelf : "end" ,
138+ display : "flex" ,
139+ flexDirection : "column" ,
140+ alignItems : "flex-end" ,
141+ gap : "0.5rem" ,
128142 } }
129143 >
130- Subscribe as calendar
131- </ a >
144+ < a
145+ class = "calendar"
146+ href = "#calendar"
147+ onClick = { ( e ) => {
148+ e . preventDefault ( ) ;
149+ const dialog = document . querySelector ( ".calendar-dialog" ) ;
150+ dialog ?. classList . add ( "open" ) ;
151+ } }
152+ >
153+ Subscribe as calendar
154+ </ a >
155+
156+ { /* New Attendance Checkbox */ }
157+ < div
158+ style = { {
159+ fontSize : "0.9rem" ,
160+ display : "flex" ,
161+ alignItems : "center" ,
162+ gap : "0.5rem" ,
163+ } }
164+ >
165+ < input
166+ type = "checkbox"
167+ id = "attendance-mode-toggle"
168+ checked = { isRemote }
169+ onChange = { toggleMode }
170+ style = { { width : "auto" , margin : 0 } }
171+ />
172+ < label
173+ htmlFor = "attendance-mode-toggle"
174+ style = { {
175+ cursor : "pointer" ,
176+ userSelect : "none" ,
177+ color : "var(--color-primary)" ,
178+ } }
179+ >
180+ Participating remotely
181+ </ label >
182+ </ div >
183+ </ div >
132184 </ div >
133185 ) ;
134186}
0 commit comments