@@ -104,9 +104,17 @@ export class LiveWidget {
104
104
}
105
105
106
106
public static async scoreboardForTalk ( talk : Talk , client : MatrixClient ) : Promise < IStateEvent < IWidget > > {
107
- const widgetId = sha256 ( JSON . stringify ( await talk . getDefinition ( ) ) + "_SCOREBOARD" ) ;
108
- const aud = await config . RUNTIME . conference . getAuditorium ( await talk . getAuditoriumId ( ) ) ;
109
- const title = aud ? `Messages from ${ await aud . getCanonicalAlias ( ) } ` : `Messages from ${ await talk . getAuditoriumId ( ) } ` ;
107
+ const aud = config . RUNTIME . conference . getAuditorium ( await talk . getAuditoriumId ( ) ) ;
108
+ if ( aud === undefined ) {
109
+ throw new Error ( `No auditorium ${ await talk . getAuditoriumId ( ) } for talk ${ await talk . getId ( ) } ` ) ;
110
+ }
111
+ return this . scoreboardForAuditorium ( aud , client , talk ) ;
112
+ }
113
+
114
+ public static async scoreboardForAuditorium ( aud : Auditorium , client : MatrixClient , talk ?: Talk ) : Promise < IStateEvent < IWidget > > {
115
+ // note: this is a little bit awkward, but there's nothing special about the widget ID, it just needs to be unique
116
+ const widgetId = sha256 ( JSON . stringify ( [ await aud . getId ( ) , talk ? await talk . getId ( ) : "" ] ) + "_SCOREBOARD" ) ;
117
+ const title = `Messages from ${ await aud . getCanonicalAlias ( ) } ` ;
110
118
return {
111
119
type : "im.vector.modular.widgets" ,
112
120
state_key : widgetId ,
@@ -120,8 +128,8 @@ export class LiveWidget {
120
128
url : config . webserver . publicBaseUrl + "/widgets/scoreboard.html?widgetId=$matrix_widget_id&auditoriumId=$auditoriumId&talkId=$talkId&theme=$theme" ,
121
129
data : {
122
130
title : title ,
123
- auditoriumId : await talk . getAuditoriumId ( ) ,
124
- talkId : await talk . getId ( ) ,
131
+ auditoriumId : await aud . getId ( ) ,
132
+ talkId : talk ? await talk . getId ( ) : null
125
133
} ,
126
134
} as IWidget ,
127
135
} ;
@@ -168,6 +176,23 @@ export class LiveWidget {
168
176
} ;
169
177
}
170
178
179
+ public static layoutForPhysicalAudBackstage ( scoreboard : IStateEvent < IWidget > ) : IStateEvent < ILayout > {
180
+ return {
181
+ type : "io.element.widgets.layout" ,
182
+ state_key : "" ,
183
+ content : {
184
+ widgets : {
185
+ [ scoreboard . state_key ] : {
186
+ container : "top" ,
187
+ index : 0 ,
188
+ width : 100 ,
189
+ height : 60 ,
190
+ } ,
191
+ } ,
192
+ } ,
193
+ } ;
194
+ }
195
+
171
196
public static layoutForTalk ( qa : IStateEvent < IWidget > , scoreboard : IStateEvent < IWidget > | null ) : IStateEvent < ILayout > {
172
197
const val : IStateEvent < ILayout > = {
173
198
type : "io.element.widgets.layout" ,
0 commit comments