fix: Create typed services and allow lower case access to agree with naming conventions (#3141)
* fix: Add typed services * fix: Typed services - PR changes * remaining of the cineService and toolbarService renaming --------- Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
1 parent
0e1a58da79
commit
7f799b8e3d
55 files changed
+302
-233
No files matched your search
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import classnames from 'classnames';
|
||||
|
||||
export default function Toolbar({ servicesManager }) {
|
||||
const { ToolBarService } = servicesManager.services;
|
||||
const { toolbarService } = servicesManager.services;
|
||||
const [toolbarButtons, setToolbarButtons] = useState([]);
|
||||
const [buttonState, setButtonState] = useState({
|
||||
primaryToolId: '',
|
||||
@@ -12,20 +12,20 @@ export default function Toolbar({ servicesManager }) {
|
||||
|
||||
// Could track buttons and state separately...?
|
||||
useEffect(() => {
|
||||
const { unsubscribe: unsub1 } = ToolBarService.subscribe(
|
||||
ToolBarService.EVENTS.TOOL_BAR_MODIFIED,
|
||||
() => setToolbarButtons(ToolBarService.getButtonSection('primary'))
|
||||
const { unsubscribe: unsub1 } = toolbarService.subscribe(
|
||||
toolbarService.EVENTS.TOOL_BAR_MODIFIED,
|
||||
() => setToolbarButtons(toolbarService.getButtonSection('primary'))
|
||||
);
|
||||
const { unsubscribe: unsub2 } = ToolBarService.subscribe(
|
||||
ToolBarService.EVENTS.TOOL_BAR_STATE_MODIFIED,
|
||||
() => setButtonState({ ...ToolBarService.state })
|
||||
const { unsubscribe: unsub2 } = toolbarService.subscribe(
|
||||
toolbarService.EVENTS.TOOL_BAR_STATE_MODIFIED,
|
||||
() => setButtonState({ ...toolbarService.state })
|
||||
);
|
||||
|
||||
return () => {
|
||||
unsub1();
|
||||
unsub2();
|
||||
};
|
||||
}, [ToolBarService]);
|
||||
}, [toolbarService]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -55,7 +55,7 @@ export default function Toolbar({ servicesManager }) {
|
||||
{...componentProps}
|
||||
bState={buttonState}
|
||||
isActive={isActive}
|
||||
onInteraction={args => ToolBarService.recordInteraction(args)}
|
||||
onInteraction={args => toolbarService.recordInteraction(args)}
|
||||
servicesManager={servicesManager}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user