refactor(app): rename ComponentDispatch to ComponentBus (#1844)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-24 12:29:38 +02:00
1 parent 01a29d629b
commit c285854b71
68 files changed
+219 -219

No files matched your search

@@ -5,7 +5,7 @@ import {MobileSettingsView} from '@app/features/app/components/dialogs/component
import * as Modal from '@app/features/app/components/dialogs/Modal';
import {SettingsModalContainer} from '@app/features/app/components/dialogs/shared/SettingsModalLayout';
import DeveloperOptions from '@app/features/devtools/state/DeveloperOptions';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import * as UnsavedChangesCommands from '@app/features/ui/commands/UnsavedChangesCommands';
import MobileLayout from '@app/features/ui/state/MobileLayout';
@@ -141,7 +141,7 @@ export const UserSettingsModal: React.FC<UserSettingsModalProps> = observer(
}
}, [resolveVisibleTab, selectedTab]);
useEffect(() => {
const unsubscribe = ComponentDispatch.subscribe('USER_SETTINGS_TAB_SELECT', (args?: unknown) => {
const unsubscribe = ComponentBus.subscribe('USER_SETTINGS_TAB_SELECT', (args?: unknown) => {
const {tab, section} = (args ?? {}) as {tab?: string; section?: string};
if (tab && typeof tab === 'string') {
const accountSection =
@@ -3,7 +3,7 @@
import {SettingsSearch} from '@app/features/app/components/dialogs/components/SettingsSearch';
import {SettingsHeadingLinkButton} from '@app/features/app/components/dialogs/shared/SettingsHeadingLinkButton';
import {SettingsTabContainer, SettingsTabContent} from '@app/features/app/components/dialogs/shared/SettingsTabLayout';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import styles from '@app/features/user/components/modals/tabs/AdvancedSettingsTab.module.css';
import {AdvancedSettingRow} from '@app/features/user/components/modals/tabs/advanced_settings_tab/AdvancedSettingRow';
import {
@@ -80,7 +80,7 @@ export const AdvancedSettingsTab = observer(() => {
const groups = useMemo(() => groupAdvancedItemsByCategory(remainingItems, tagLabels), [remainingItems, tagLabels]);
const showGroupLinks = groups.length > 1;
const handleOpenSource = useCallback((item: SearchableSettingItem) => {
ComponentDispatch.dispatch('USER_SETTINGS_TAB_SELECT', {
ComponentBus.dispatch('USER_SETTINGS_TAB_SELECT', {
tab: getAdvancedSettingSourceTab(item),
section: getAdvancedSettingSourceSection(item),
});
@@ -13,7 +13,7 @@ import {EditPackModal} from '@app/features/expressions/components/modals/EditPac
import {PackInviteModal} from '@app/features/expressions/components/modals/PackInviteModal';
import Packs from '@app/features/expressions/state/ExpressionsPacks';
import {NO_DESCRIPTION_PROVIDED_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import {Button} from '@app/features/ui/button/Button';
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
import {modal} from '@app/features/ui/commands/ModalCommands';
@@ -189,7 +189,7 @@ const ExpressionPacksTab: React.FC = observer(() => {
actions={[
{
text: i18n._(LEARN_ABOUT_PREMIUM_DESCRIPTOR, {premiumProductName: PREMIUM_PRODUCT_NAME}),
onClick: () => ComponentDispatch.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'plutonium'}),
onClick: () => ComponentBus.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'plutonium'}),
variant: 'primary',
fitContent: true,
},
@@ -18,7 +18,7 @@ import {
TRY_AGAIN_IN_A_MOMENT_DESCRIPTOR,
} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {Logger} from '@app/features/platform/utils/AppLogger';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import {Button} from '@app/features/ui/button/Button';
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
@@ -445,7 +445,7 @@ const GiftInventoryTab: React.FC = observer(() => {
actions={[
{
text: i18n._(GO_TO_PREMIUM_DESCRIPTOR, {premiumProductName: PREMIUM_PRODUCT_NAME}),
onClick: () => ComponentDispatch.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'plutonium'}),
onClick: () => ComponentBus.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'plutonium'}),
variant: 'primary',
fitContent: true,
},
@@ -11,7 +11,7 @@ import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import {LimitResolver} from '@app/features/app/utils/LimitResolverAdapter';
import {isLimitToggleEnabled} from '@app/features/app/utils/LimitUtils';
import {GET_PREMIUM_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import * as PremiumModalCommands from '@app/features/premium/commands/PremiumModalCommands';
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import {Button} from '@app/features/ui/button/Button';
@@ -198,7 +198,7 @@ export const VideoTab: React.FC<VideoTabProps> = observer(
VoiceSettingsCommands.update({videoFrameRate: value, streamingMode: 'custom'});
}, []);
const handleOpenAdvancedVideoSettings = useCallback(() => {
ComponentDispatch.dispatch('USER_SETTINGS_TAB_SELECT', {
ComponentBus.dispatch('USER_SETTINGS_TAB_SELECT', {
tab: 'advanced_settings',
section: getAdvancedSettingsCategorySectionId('media'),
});
@@ -4,7 +4,7 @@ import {
getCachedDesktopTroubleshootingSettings,
getDesktopTroubleshootingSettings,
} from '@app/features/devtools/utils/DesktopTroubleshootingUtils';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import type {RadioOption} from '@app/features/ui/radio_group/RadioGroup';
import {RadioGroup} from '@app/features/ui/radio_group/RadioGroup';
import {isDesktop} from '@app/features/ui/utils/NativeUtils';
@@ -114,7 +114,7 @@ export const CodecSelectorSection = observer(() => {
}, []);
const openAdvancedSettingsTab = useCallback((event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
ComponentDispatch.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'advanced_settings'});
ComponentBus.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'advanced_settings'});
}, []);
const hardwareAccelOff = isDesktopClient && hardwareAccelDisabled === true;
return (
@@ -2,7 +2,7 @@
import * as AccessibilityCommands from '@app/features/accessibility/commands/AccessibilityCommands';
import Accessibility from '@app/features/accessibility/state/Accessibility';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import {Switch} from '@app/features/ui/components/form/FormSwitch';
import {RadioGroup, type RadioOption} from '@app/features/ui/radio_group/RadioGroup';
@@ -64,7 +64,7 @@ export const TextToSpeech = observer(() => {
AccessibilityCommands.update({enableTTSCommand: value});
}, []);
const handleAccessibilityLinkClick = useCallback(() => {
ComponentDispatch.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'accessibility', section: 'tts'});
ComponentBus.dispatch('USER_SETTINGS_TAB_SELECT', {tab: 'accessibility', section: 'tts'});
}, []);
const ttsNotificationMode = Notification.getTTSNotificationMode();
const ttsNotificationOptions: Array<RadioOption<TTSNotificationMode>> = [