From 3ab21224df3d9a233d4aad9871018c59963920d9 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 24 Mar 2022 16:42:53 -0600 Subject: [PATCH] Step 8.5: Move user tab enum --- src/components/structures/LoggedInView.tsx | 2 +- src/components/structures/MatrixChat.tsx | 3 +- src/components/structures/UserMenu.tsx | 2 +- .../views/dialogs/BetaFeedbackDialog.tsx | 2 +- .../views/dialogs/SpotlightDialog.tsx | 2 +- .../views/dialogs/UserSettingsDialog.tsx | 15 +--------- src/components/views/dialogs/UserTab.ts | 29 +++++++++++++++++++ .../views/elements/DesktopBuildsNotice.tsx | 2 +- src/components/views/right_panel/UserInfo.tsx | 2 +- .../tabs/room/NotificationSettingsTab.tsx | 2 +- .../tabs/user/HelpUserSettingsTab.tsx | 2 +- .../tabs/user/PreferencesUserSettingsTab.tsx | 2 +- .../views/spaces/QuickSettingsButton.tsx | 2 +- src/toasts/BulkUnverifiedSessionsToast.ts | 2 +- src/toasts/UnverifiedSessionToast.ts | 2 +- 15 files changed, 44 insertions(+), 27 deletions(-) create mode 100644 src/components/views/dialogs/UserTab.ts diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 7de08843b5..de60ca71fa 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -62,7 +62,7 @@ import ToastContainer from './ToastContainer'; import UserView from "./UserView"; import BackdropPanel from "./BackdropPanel"; import { mediaFromMxc } from "../../customisations/Media"; -import { UserTab } from "../views/dialogs/UserSettingsDialog"; +import { UserTab } from "../views/dialogs/UserTab"; import { OpenToTabPayload } from "../../dispatcher/payloads/OpenToTabPayload"; import RightPanelStore from '../../stores/right-panel/RightPanelStore'; import { TimelineRenderingType } from "../../contexts/RoomContext"; diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index 82a832d85e..56c41739dd 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -93,7 +93,8 @@ import { RoomUpdateCause } from "../../stores/room-list/models"; import SecurityCustomisations from "../../customisations/Security"; import Spinner from "../views/elements/Spinner"; import QuestionDialog from "../views/dialogs/QuestionDialog"; -import UserSettingsDialog, { UserTab } from '../views/dialogs/UserSettingsDialog'; +import UserSettingsDialog from '../views/dialogs/UserSettingsDialog'; +import { UserTab } from "../views/dialogs/UserTab"; import CreateRoomDialog from '../views/dialogs/CreateRoomDialog'; import RoomDirectory from './RoomDirectory'; import KeySignatureUploadFailedDialog from "../views/dialogs/KeySignatureUploadFailedDialog"; diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index c00bb6170e..27cc08f0bc 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -25,7 +25,7 @@ import { ActionPayload } from "../../dispatcher/payloads"; import { Action } from "../../dispatcher/actions"; import { _t } from "../../languageHandler"; import { ChevronFace, ContextMenuButton } from "./ContextMenu"; -import { UserTab } from "../views/dialogs/UserSettingsDialog"; +import { UserTab } from "../views/dialogs/UserTab"; import { OpenToTabPayload } from "../../dispatcher/payloads/OpenToTabPayload"; import FeedbackDialog from "../views/dialogs/FeedbackDialog"; import Modal from "../../Modal"; diff --git a/src/components/views/dialogs/BetaFeedbackDialog.tsx b/src/components/views/dialogs/BetaFeedbackDialog.tsx index c5fba52b51..487ba37b01 100644 --- a/src/components/views/dialogs/BetaFeedbackDialog.tsx +++ b/src/components/views/dialogs/BetaFeedbackDialog.tsx @@ -22,7 +22,7 @@ import SettingsStore from "../../../settings/SettingsStore"; import AccessibleButton from "../elements/AccessibleButton"; import defaultDispatcher from "../../../dispatcher/dispatcher"; import { Action } from "../../../dispatcher/actions"; -import { UserTab } from "./UserSettingsDialog"; +import { UserTab } from "./UserTab"; import GenericFeatureFeedbackDialog from "./GenericFeatureFeedbackDialog"; // XXX: Keep this around for re-use in future Betas diff --git a/src/components/views/dialogs/SpotlightDialog.tsx b/src/components/views/dialogs/SpotlightDialog.tsx index 8b4e8ed701..f579e26287 100644 --- a/src/components/views/dialogs/SpotlightDialog.tsx +++ b/src/components/views/dialogs/SpotlightDialog.tsx @@ -64,7 +64,7 @@ import { SettingLevel } from "../../../settings/SettingLevel"; import NotificationBadge from "../rooms/NotificationBadge"; import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore"; import { BetaPill } from "../beta/BetaCard"; -import { UserTab } from "./UserSettingsDialog"; +import { UserTab } from "./UserTab"; import BetaFeedbackDialog from "./BetaFeedbackDialog"; import SdkConfig from "../../../SdkConfig"; import { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload"; diff --git a/src/components/views/dialogs/UserSettingsDialog.tsx b/src/components/views/dialogs/UserSettingsDialog.tsx index a170b71929..8f5e1a6108 100644 --- a/src/components/views/dialogs/UserSettingsDialog.tsx +++ b/src/components/views/dialogs/UserSettingsDialog.tsx @@ -35,20 +35,7 @@ import BaseDialog from "./BaseDialog"; import { IDialogProps } from "./IDialogProps"; import SidebarUserSettingsTab from "../settings/tabs/user/SidebarUserSettingsTab"; import KeyboardUserSettingsTab from "../settings/tabs/user/KeyboardUserSettingsTab"; - -export enum UserTab { - General = "USER_GENERAL_TAB", - Appearance = "USER_APPEARANCE_TAB", - Notifications = "USER_NOTIFICATIONS_TAB", - Preferences = "USER_PREFERENCES_TAB", - Keyboard = "USER_KEYBOARD_TAB", - Sidebar = "USER_SIDEBAR_TAB", - Voice = "USER_VOICE_TAB", - Security = "USER_SECURITY_TAB", - Labs = "USER_LABS_TAB", - Mjolnir = "USER_MJOLNIR_TAB", - Help = "USER_HELP_TAB", -} +import { UserTab } from "./UserTab"; interface IProps extends IDialogProps { initialTabId?: UserTab; diff --git a/src/components/views/dialogs/UserTab.ts b/src/components/views/dialogs/UserTab.ts new file mode 100644 index 0000000000..b5b2782c0d --- /dev/null +++ b/src/components/views/dialogs/UserTab.ts @@ -0,0 +1,29 @@ +/* +Copyright 2022 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +export enum UserTab { + General = "USER_GENERAL_TAB", + Appearance = "USER_APPEARANCE_TAB", + Notifications = "USER_NOTIFICATIONS_TAB", + Preferences = "USER_PREFERENCES_TAB", + Keyboard = "USER_KEYBOARD_TAB", + Sidebar = "USER_SIDEBAR_TAB", + Voice = "USER_VOICE_TAB", + Security = "USER_SECURITY_TAB", + Labs = "USER_LABS_TAB", + Mjolnir = "USER_MJOLNIR_TAB", + Help = "USER_HELP_TAB", +} diff --git a/src/components/views/elements/DesktopBuildsNotice.tsx b/src/components/views/elements/DesktopBuildsNotice.tsx index ac9b591e95..cb664f02d0 100644 --- a/src/components/views/elements/DesktopBuildsNotice.tsx +++ b/src/components/views/elements/DesktopBuildsNotice.tsx @@ -22,7 +22,7 @@ import { _t } from "../../../languageHandler"; import SdkConfig from "../../../SdkConfig"; import dis from "../../../dispatcher/dispatcher"; import { Action } from "../../../dispatcher/actions"; -import { UserTab } from "../dialogs/UserSettingsDialog"; +import { UserTab } from "../dialogs/UserTab"; import AccessibleButton from "./AccessibleButton"; export enum WarningKind { diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index 01da603300..12a2a12f6e 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -49,7 +49,7 @@ import EncryptionPanel from "./EncryptionPanel"; import { useAsyncMemo } from '../../../hooks/useAsyncMemo'; import { legacyVerifyUser, verifyDevice, verifyUser } from '../../../verification'; import { Action } from "../../../dispatcher/actions"; -import { UserTab } from "../dialogs/UserSettingsDialog"; +import { UserTab } from "../dialogs/UserTab"; import { useIsEncrypted } from "../../../hooks/useIsEncrypted"; import BaseCard from "./BaseCard"; import { E2EStatus } from "../../../utils/ShieldUtils"; diff --git a/src/components/views/settings/tabs/room/NotificationSettingsTab.tsx b/src/components/views/settings/tabs/room/NotificationSettingsTab.tsx index 6084d500ce..b13277e744 100644 --- a/src/components/views/settings/tabs/room/NotificationSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/NotificationSettingsTab.tsx @@ -30,7 +30,7 @@ import StyledRadioGroup from "../../../elements/StyledRadioGroup"; import { RoomNotifState } from '../../../../../RoomNotifs'; import defaultDispatcher from "../../../../../dispatcher/dispatcher"; import { Action } from "../../../../../dispatcher/actions"; -import { UserTab } from "../../../dialogs/UserSettingsDialog"; +import { UserTab } from "../../../dialogs/UserTab"; interface IProps { roomId: string; diff --git a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx index 527dd1ae44..346c0c5bb1 100644 --- a/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx @@ -28,7 +28,7 @@ import UpdateCheckButton from "../../UpdateCheckButton"; import BugReportDialog from '../../../dialogs/BugReportDialog'; import { OpenToTabPayload } from "../../../../../dispatcher/payloads/OpenToTabPayload"; import { Action } from "../../../../../dispatcher/actions"; -import { UserTab } from "../../../dialogs/UserSettingsDialog"; +import { UserTab } from "../../../dialogs/UserTab"; import dis from "../../../../../dispatcher/dispatcher"; import CopyableText from "../../../elements/CopyableText"; diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx index e6457605cc..a7a54da66e 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx @@ -26,7 +26,7 @@ import { SettingLevel } from "../../../../../settings/SettingLevel"; import SettingsFlag from '../../../elements/SettingsFlag'; import AccessibleButton from "../../../elements/AccessibleButton"; import dis from "../../../../../dispatcher/dispatcher"; -import { UserTab } from "../../../dialogs/UserSettingsDialog"; +import { UserTab } from "../../../dialogs/UserTab"; import { OpenToTabPayload } from "../../../../../dispatcher/payloads/OpenToTabPayload"; import { Action } from "../../../../../dispatcher/actions"; diff --git a/src/components/views/spaces/QuickSettingsButton.tsx b/src/components/views/spaces/QuickSettingsButton.tsx index 8c3ee07199..2f4ee9315f 100644 --- a/src/components/views/spaces/QuickSettingsButton.tsx +++ b/src/components/views/spaces/QuickSettingsButton.tsx @@ -27,7 +27,7 @@ import { useSettingValue } from "../../../hooks/useSettings"; import { onMetaSpaceChangeFactory } from "../settings/tabs/user/SidebarUserSettingsTab"; import defaultDispatcher from "../../../dispatcher/dispatcher"; import { Action } from "../../../dispatcher/actions"; -import { UserTab } from "../dialogs/UserSettingsDialog"; +import { UserTab } from "../dialogs/UserTab"; import QuickThemeSwitcher from "./QuickThemeSwitcher"; import { Icon as PinUprightIcon } from '../../../../res/img/element-icons/room/pin-upright.svg'; import { Icon as EllipsisIcon } from '../../../../res/img/element-icons/room/ellipsis.svg'; diff --git a/src/toasts/BulkUnverifiedSessionsToast.ts b/src/toasts/BulkUnverifiedSessionsToast.ts index 0a35a91345..6ddb0d7db5 100644 --- a/src/toasts/BulkUnverifiedSessionsToast.ts +++ b/src/toasts/BulkUnverifiedSessionsToast.ts @@ -20,7 +20,7 @@ import DeviceListener from '../DeviceListener'; import GenericToast from "../components/views/toasts/GenericToast"; import ToastStore from "../stores/ToastStore"; import { Action } from "../dispatcher/actions"; -import { UserTab } from "../components/views/dialogs/UserSettingsDialog"; +import { UserTab } from "../components/views/dialogs/UserTab"; const TOAST_KEY = "reviewsessions"; diff --git a/src/toasts/UnverifiedSessionToast.ts b/src/toasts/UnverifiedSessionToast.ts index 05425b93c0..d0db97cd08 100644 --- a/src/toasts/UnverifiedSessionToast.ts +++ b/src/toasts/UnverifiedSessionToast.ts @@ -21,7 +21,7 @@ import DeviceListener from '../DeviceListener'; import ToastStore from "../stores/ToastStore"; import GenericToast from "../components/views/toasts/GenericToast"; import { Action } from "../dispatcher/actions"; -import { UserTab } from "../components/views/dialogs/UserSettingsDialog"; +import { UserTab } from "../components/views/dialogs/UserTab"; function toastKey(deviceId: string) { return "unverified_session_" + deviceId;