From 8e4ad901b06c458f191534870b6c6b2b143ddb22 Mon Sep 17 00:00:00 2001 From: Johan Nyman Date: Thu, 18 Jan 2024 14:43:16 +0100 Subject: [PATCH] chore: merge fixes --- packages/apps/client/src/Output/Output.tsx | 18 +++++++++--------- packages/apps/client/src/TestController.tsx | 10 +++++----- .../client/src/stores/OutputSettingsStore.ts | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/apps/client/src/Output/Output.tsx b/packages/apps/client/src/Output/Output.tsx index 858c971..5c55c29 100644 --- a/packages/apps/client/src/Output/Output.tsx +++ b/packages/apps/client/src/Output/Output.tsx @@ -1,44 +1,44 @@ import React, { useEffect, useMemo, useReducer, useRef } from 'react' import { observer } from 'mobx-react-lite' -import { AppStore } from '../stores/AppStore' +import { RootAppStore } from '../stores/RootAppStore.ts' const Output = observer(function Output() { const speed = useRef(0) // On startup useEffect(() => { - AppStore.outputSettingsStore.initialize() // load and subscribe + RootAppStore.outputSettingsStore.initialize() // load and subscribe - AppStore.connection.controller.on('message', (message) => { + RootAppStore.connection.controller.on('message', (message) => { console.log('received message', message) speed.current = message.speed }) - AppStore.connection.controller.subscribeToMessages().catch(console.error) + RootAppStore.connection.controller.subscribeToMessages().catch(console.error) // don't do this, it's just for testing: const interval = setInterval(() => { window.scrollBy(0, speed.current) }, 1000 / 60) return () => { - AppStore.connection.controller.off('message') + RootAppStore.connection.controller.off('message') clearInterval(interval) } }, []) - const outputSettings = AppStore.outputSettingsStore.outputSettings + const outputSettings = RootAppStore.outputSettingsStore.outputSettings const activeRundownPlaylistId = outputSettings?.activeRundownPlaylistId useEffect(() => { if (activeRundownPlaylistId) { - AppStore.rundownStore.loadRundown(activeRundownPlaylistId) + RootAppStore.rundownStore.loadRundown(activeRundownPlaylistId) } else { // TODO: unload rundown? } }, [activeRundownPlaylistId]) - const rundown = AppStore.rundownStore.openRundown + const rundown = RootAppStore.rundownStore.openRundown /* Implementation notes: @@ -111,7 +111,7 @@ const Output = observer(function Output() { return ( <>

Prompter output

-
Initialized: {AppStore.outputSettingsStore.initialized ? 'YES' : 'NO'}
+
Initialized: {RootAppStore.outputSettingsStore.initialized ? 'YES' : 'NO'}
{JSON.stringify(outputSettings)}
{rundown ? <>Rundown: {rundown.name} : <>No active rundown}
diff --git a/packages/apps/client/src/TestController.tsx b/packages/apps/client/src/TestController.tsx index a162fd9..d6c33f8 100644 --- a/packages/apps/client/src/TestController.tsx +++ b/packages/apps/client/src/TestController.tsx @@ -3,7 +3,7 @@ import { observer } from 'mobx-react-lite' import { APIConnection } from './api/ApiConnection.ts' import { OutputSettings } from '@sofie-prompter-editor/shared-model' import { EditObject, useApiConnection } from './TestUtil.tsx' -import { AppStore } from './stores/AppStore.ts' +import { RootAppStore } from './stores/RootAppStore.ts' import { computed } from 'mobx' const TestController: React.FC = observer(() => { @@ -13,9 +13,9 @@ const TestController: React.FC = observer(() => { // On startup useEffect(() => { - AppStore.outputSettingsStore.initialize() // load and subscribe + RootAppStore.outputSettingsStore.initialize() // load and subscribe }, []) - const outputSettings = computed(() => AppStore.outputSettingsStore.outputSettings).get() + const outputSettings = computed(() => RootAppStore.outputSettingsStore.outputSettings).get() console.log('outputSettings', outputSettings) @@ -73,7 +73,7 @@ const TestController: React.FC = observer(() => { // ) const sendSpeed = useCallback((speed: number) => { - AppStore.connection.controller + RootAppStore.connection.controller .sendMessage({ offset: null, speed: speed, @@ -92,7 +92,7 @@ const TestController: React.FC = observer(() => { obj={outputSettings} onChange={(newData) => { // console.log('newdata', newData) - AppStore.connection.outputSettings.update(null, newData).catch(console.error) + RootAppStore.connection.outputSettings.update(null, newData).catch(console.error) }} /> ) : ( diff --git a/packages/apps/client/src/stores/OutputSettingsStore.ts b/packages/apps/client/src/stores/OutputSettingsStore.ts index 20b8b26..825b5e4 100644 --- a/packages/apps/client/src/stores/OutputSettingsStore.ts +++ b/packages/apps/client/src/stores/OutputSettingsStore.ts @@ -1,6 +1,6 @@ import { observable, action, flow, makeObservable, IReactionDisposer, reaction } from 'mobx' import { OutputSettings } from '@sofie-prompter-editor/shared-model' -import { APIConnection, AppStore } from './AppStore' +import { APIConnection, RootAppStore } from './RootAppStore.ts' export class OutputSettingsStore { // showingOnlyScripts = false @@ -15,7 +15,7 @@ export class OutputSettingsStore { reactions: IReactionDisposer[] = [] - constructor(public appStore: typeof AppStore, public connection: APIConnection) { + constructor(public appStore: typeof RootAppStore, public connection: APIConnection) { makeObservable(this, { outputSettings: observable, initialized: observable,