diff --git a/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx b/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx index 47f93eaa8..7ac544de2 100644 --- a/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx +++ b/frontend/app/components/Assist/components/AssistTabs/AssistTabs.tsx @@ -1,37 +1,29 @@ import { useModal } from 'App/components/Modal'; -import React, { useState } from 'react'; +import React from 'react'; import SessionList from '../SessionList'; -import stl from './assistTabs.module.css' +import stl from './assistTabs.module.css'; interface Props { - userId: any, - userNumericHash: any, + userId: any; } const AssistTabs = (props: Props) => { - const [showMenu, setShowMenu] = useState(false) const { showModal } = useModal(); return (
{props.userId && ( - <> -
showModal(, { right: true, width: 700 })} - > - Active Sessions -
- +
+ showModal(, { right: true, width: 700 }) + } + > + Active Sessions +
)}
- {/* {props.userId}'s Live Sessions
} - isDisplayed={ showMenu } - content={ showMenu && } - onClose={ () => setShowMenu(false) } - /> */} ); }; diff --git a/frontend/app/components/Assist/components/SessionList/SessionList.tsx b/frontend/app/components/Assist/components/SessionList/SessionList.tsx index a919fcf09..4f297d2c5 100644 --- a/frontend/app/components/Assist/components/SessionList/SessionList.tsx +++ b/frontend/app/components/Assist/components/SessionList/SessionList.tsx @@ -46,7 +46,7 @@ function SessionList(props: Props) { >
{props.list.map((session: any) => ( -
+
{session.pageTitle && session.pageTitle !== '' && (
)} - hideModal()} key={session.sessionId} session={session} /> +
))}
diff --git a/frontend/app/components/Session/LivePlayer.tsx b/frontend/app/components/Session/LivePlayer.tsx index 060ff1b8f..b73cf4ea9 100644 --- a/frontend/app/components/Session/LivePlayer.tsx +++ b/frontend/app/components/Session/LivePlayer.tsx @@ -71,12 +71,13 @@ function LivePlayer({ return () => { if (!location.pathname.includes('multiview') || !location.pathname.includes(usedSession.sessionId)) { + console.debug('unmount', usedSession.sessionId) playerInst?.clean?.(); // @ts-ignore default empty setContextValue(defaultContextValue) } } - }, [location.pathname]); + }, [location.pathname, usedSession.sessionId]); // LAYOUT (TODO: local layout state - useContext or something..) useEffect(() => { diff --git a/frontend/app/components/Session/Player/LivePlayer/LivePlayerBlockHeader.tsx b/frontend/app/components/Session/Player/LivePlayer/LivePlayerBlockHeader.tsx index 1fd3b503e..2394e81ca 100644 --- a/frontend/app/components/Session/Player/LivePlayer/LivePlayerBlockHeader.tsx +++ b/frontend/app/components/Session/Player/LivePlayer/LivePlayerBlockHeader.tsx @@ -46,7 +46,7 @@ function LivePlayerBlockHeader(props: any) { history.push(withSiteId(ASSIST_ROUTE, siteId)); }; - const { userId, userNumericHash, metadata, isCallActive, agentIds } = session; + const { userId, metadata, isCallActive, agentIds } = session; let _metaList = Object.keys(metadata) .filter((i) => metaList.includes(i)) .map((key) => { @@ -87,7 +87,7 @@ function LivePlayerBlockHeader(props: any) {
)} - +
{_metaList.length > 0 && ( diff --git a/frontend/app/components/shared/SessionItem/SessionItem.tsx b/frontend/app/components/shared/SessionItem/SessionItem.tsx index 1c9d756a3..3642c2981 100644 --- a/frontend/app/components/shared/SessionItem/SessionItem.tsx +++ b/frontend/app/components/shared/SessionItem/SessionItem.tsx @@ -55,6 +55,7 @@ interface Props { compact?: boolean; isDisabled?: boolean; isAdd?: boolean; + ignoreAssist?: boolean; } function SessionItem(props: RouteComponentProps & Props) { @@ -70,6 +71,7 @@ function SessionItem(props: RouteComponentProps & Props) { lastPlayedSessionId, onClick = null, compact = false, + ignoreAssist = false, } = props; const { @@ -99,9 +101,10 @@ function SessionItem(props: RouteComponentProps & Props) { const hasUserId = userId || userAnonymousId; const isSessions = isRoute(SESSIONS_ROUTE, location.pathname); const isAssist = - isRoute(ASSIST_ROUTE, location.pathname) || - isRoute(ASSIST_LIVE_SESSION, location.pathname) || - location.pathname.includes('multiview'); + !ignoreAssist && + (isRoute(ASSIST_ROUTE, location.pathname) || + isRoute(ASSIST_LIVE_SESSION, location.pathname) || + location.pathname.includes('multiview')); const isLastPlayed = lastPlayedSessionId === sessionId; const _metaList = Object.keys(metadata) diff --git a/frontend/app/components/shared/UserSessionsModal/UserSessionsModal.tsx b/frontend/app/components/shared/UserSessionsModal/UserSessionsModal.tsx index 0c8b1b480..8a76e8ed9 100644 --- a/frontend/app/components/shared/UserSessionsModal/UserSessionsModal.tsx +++ b/frontend/app/components/shared/UserSessionsModal/UserSessionsModal.tsx @@ -70,7 +70,7 @@ function UserSessionsModal(props: Props) { {data.sessions.map((session: any) => (
- +
))}
diff --git a/frontend/app/player/web/WebLivePlayer.ts b/frontend/app/player/web/WebLivePlayer.ts index 6bcb20fcb..8753190b5 100644 --- a/frontend/app/player/web/WebLivePlayer.ts +++ b/frontend/app/player/web/WebLivePlayer.ts @@ -90,7 +90,7 @@ export default class WebLivePlayer extends WebPlayer { clean = () => { this.incomingMessages.length = 0 this.assistManager.clean() - this.screen.clean() + this.screen?.clean?.() // @ts-ignore this.screen = undefined; super.clean() diff --git a/frontend/app/player/web/managers/DOM/DOMManager.ts b/frontend/app/player/web/managers/DOM/DOMManager.ts index f6291fa0a..85d21e85d 100644 --- a/frontend/app/player/web/managers/DOM/DOMManager.ts +++ b/frontend/app/player/web/managers/DOM/DOMManager.ts @@ -38,7 +38,6 @@ export default class DOMManager extends ListWalker { private olStyleSheets: Map = new Map() /** @depreacted since tracker 4.0.2 Mapping by nodeID */ private olStyleSheetsDeprecated: Map = new Map() - private stringDict: Record = {} private upperBodyId: number = -1; private nodeScrollManagers: Map> = new Map() @@ -49,6 +48,7 @@ export default class DOMManager extends ListWalker { constructor( private readonly screen: Screen, private readonly isMobile: boolean, + private stringDict: Record, public readonly time: number, setCssLoading: ConstructorParameters[1], ) { @@ -57,6 +57,10 @@ export default class DOMManager extends ListWalker { this.stylesManager = new StylesManager(screen, setCssLoading) } + setStringDict(stringDict: Record) { + this.stringDict = stringDict + } + append(m: Message): void { if (m.tp === MType.SetNodeScroll) { let scrollManager = this.nodeScrollManagers.get(m.id) @@ -192,7 +196,6 @@ export default class DOMManager extends ListWalker { // Maybetodo: start Document as 0-node in tracker this.vTexts.clear() this.stylesManager.reset() - this.stringDict = {} return } case MType.CreateTextNode: { @@ -227,12 +230,9 @@ export default class DOMManager extends ListWalker { case MType.SetNodeAttribute: this.setNodeAttribute(msg) return - case MType.StringDict: - this.stringDict[msg.key] = msg.value - return case MType.SetNodeAttributeDict: - this.stringDict[msg.nameKey] === undefined && logger.error("No dictionary key for msg 'name': ", msg) - this.stringDict[msg.valueKey] === undefined && logger.error("No dictionary key for msg 'value': ", msg) + this.stringDict[msg.nameKey] === undefined && logger.error("No dictionary key for msg 'name': ", msg, this.stringDict) + this.stringDict[msg.valueKey] === undefined && logger.error("No dictionary key for msg 'value': ", msg, this.stringDict) if (this.stringDict[msg.nameKey] === undefined || this.stringDict[msg.valueKey] === undefined ) { return } this.setNodeAttribute({ id: msg.id, diff --git a/frontend/app/player/web/managers/DOM/safeCSSRules.ts b/frontend/app/player/web/managers/DOM/safeCSSRules.ts index a65c0cf6c..ba62ad0db 100644 --- a/frontend/app/player/web/managers/DOM/safeCSSRules.ts +++ b/frontend/app/player/web/managers/DOM/safeCSSRules.ts @@ -1,14 +1,15 @@ import logger from 'App/logger'; -export type { PostponedStyleSheet } from './VirtualDOM' - -export function insertRule(sheet: CSSStyleSheet | PostponedStyleSheet, msg: { rule: string, index: number }) { +export function insertRule( + sheet: { insertRule: (rule: string, index: number) => void }, + msg: { rule: string, index: number } +) { try { sheet.insertRule(msg.rule, msg.index) } catch (e) { logger.warn(e, msg) try { - sheet.insertRule(msg.rule, 0) + sheet.insertRule(msg.rule, 0) // TODO: index renumeration in case of subsequent rule deletion logger.warn("Inserting rule into 0-index", e, msg) } catch (e) { logger.warn("Cannot insert rule.", e, msg) @@ -16,7 +17,10 @@ export function insertRule(sheet: CSSStyleSheet | PostponedStyleSheet, msg: { ru } } -export function deleteRule(sheet: CSSStyleSheet | PostponedStyleSheet, msg: { index: number }) { +export function deleteRule( + sheet: { deleteRule: (index: number) => void }, + msg: { index: number } +) { try { sheet.deleteRule(msg.index) } catch (e) { diff --git a/frontend/app/player/web/managers/PagesManager.ts b/frontend/app/player/web/managers/PagesManager.ts index dbc64bb72..1b3fd9bdf 100644 --- a/frontend/app/player/web/managers/PagesManager.ts +++ b/frontend/app/player/web/managers/PagesManager.ts @@ -1,13 +1,21 @@ -import type Screen from '../Screen/Screen'; -import type { Message } from '../messages'; +import logger from 'App/logger'; -import { MType } from '../messages'; +import type Screen from '../Screen/Screen'; +import type { Message, StringDict } from '../messages'; + +import { MType} from '../messages'; import ListWalker from '../../common/ListWalker'; import DOMManager from './DOM/DOMManager'; export default class PagesManager extends ListWalker { private currentPage: DOMManager | null = null + /** + * String Dictionary in tracker may be desync with CreateDocument (why???) + * e.g. some StringDictionary and other messages before any 'CreateDocument' one + * TODO: understand why and fix + */ + private currentStringDict: Record = {} constructor( private screen: Screen, @@ -19,11 +27,19 @@ export default class PagesManager extends ListWalker { Assumed that messages added in a correct time sequence. */ appendMessage(m: Message): void { + if (m.tp === MType.StringDict) { + if (this.currentStringDict[m.key] !== undefined) { + this.currentStringDict = {} /* refresh stringDict */ + this.last?.setStringDict(this.currentStringDict) + } + this.currentStringDict[m.key] = m.value + return + } if (m.tp === MType.CreateDocument) { - super.append(new DOMManager(this.screen, this.isMobile, m.time, this.setCssLoading)) + super.append(new DOMManager(this.screen, this.isMobile, this.currentStringDict, m.time, this.setCssLoading)) } if (this.last === null) { - // Log wrong + logger.warn("DOMMessage before any document created, skipping:", m) return; } this.last.append(m)