@@ -123,6 +123,10 @@ export class FourUpComponent extends BaseComponent<IProps, IState> {
123
123
this . resizeObserver . disconnect ( ) ;
124
124
}
125
125
126
+ private get tabName ( ) {
127
+ return getUIStudentWorkTab ( this . props . documentViewMode ) ;
128
+ }
129
+
126
130
/**
127
131
* When the four-up is used in the dashboard it can be showing published
128
132
* documents. In that case we use a fake tab called student-work-published
@@ -131,14 +135,14 @@ export class FourUpComponent extends BaseComponent<IProps, IState> {
131
135
*
132
136
* @returns
133
137
*/
134
- private getNavTabName ( ) {
135
- return getUIStudentWorkTab ( this . props . documentViewMode ) ;
138
+ private get tabUIModel ( ) {
139
+ const { persistentUI} = this . stores ;
140
+ return persistentUI . tabs . get ( this . tabName ) ;
136
141
}
137
142
138
143
private getFocusedUserDocKey ( ) {
139
- const { persistentUI} = this . stores ;
140
144
const { group} = this . props ;
141
- return persistentUI . tabs . get ( this . getNavTabName ( ) ) ?. openDocuments . get ( group . id ) ;
145
+ return this . tabUIModel ?. getDocumentGroup ( group . id ) ?. primaryDocumentKey ;
142
146
}
143
147
144
148
private getFocusedGroupUser ( ) {
@@ -400,24 +404,25 @@ export class FourUpComponent extends BaseComponent<IProps, IState> {
400
404
} ;
401
405
402
406
private handleFourUpClick = ( ) => {
403
- const { persistentUI } = this . stores ;
404
407
const { group } = this . props ;
405
- persistentUI . closeSubTabDocument ( this . getNavTabName ( ) , group . id ) ;
408
+ this . tabUIModel ?. getDocumentGroup ( group . id ) ?. closePrimaryDocument ( ) ;
406
409
} ;
407
410
408
411
private handleOverlayClick = ( groupUser ?: GroupUserModelType ) => {
409
- const { persistentUI } = this . stores ;
410
412
const { group } = this . props ;
411
413
const focusedUser = this . getFocusedGroupUser ( ) ;
412
414
const document = this . getGroupUserDoc ( groupUser ) ;
415
+ const { persistentUI} = this . stores ;
413
416
414
417
if ( groupUser && document ) {
415
418
const logInfo = { groupId : group . id , studentId : groupUser . id } ;
416
419
if ( focusedUser ) {
417
- persistentUI . closeSubTabDocument ( this . getNavTabName ( ) , group . id ) ;
420
+ // This needs to create the tabModel if it doesn't exist so we can use this.tabModel
421
+ persistentUI . closeDocumentGroupPrimaryDocument ( this . tabName , group . id ) ;
418
422
Logger . log ( LogEventName . DASHBOARD_DESELECT_STUDENT , logInfo ) ;
419
423
} else {
420
- persistentUI . setOpenSubTabDocument ( this . getNavTabName ( ) , group . id , document . key ) ; //sets the focus document;
424
+ // This needs to create the tabModel if it doesn't exist so we can use this.tabModel
425
+ persistentUI . setDocumentGroupPrimaryDocument ( this . tabName , group . id , document . key ) ; //sets the focus document;
421
426
Logger . log ( LogEventName . DASHBOARD_SELECT_STUDENT , logInfo ) ;
422
427
}
423
428
}
0 commit comments