From 2f0e993af33442a42c10c40a7b2bdbf3b012680a Mon Sep 17 00:00:00 2001 From: William Grant Date: Mon, 10 Oct 2022 16:29:19 +1100 Subject: [PATCH] feat: moved constants into a constants folder --- .../avatar/AvatarPlaceHolder/AvatarPlaceHolder.tsx | 2 +- ts/components/conversation/SessionEmojiPanel.tsx | 7 ++++++- ts/components/leftpane/ActionsPanel.tsx | 2 +- ts/components/settings/SettingsThemeSwitcher.tsx | 2 +- ts/session/utils/Theme.tsx | 2 +- ts/state/ducks/primaryColor.tsx | 2 +- ts/state/ducks/theme.tsx | 2 +- ts/state/reducer.ts | 2 +- ts/state/selectors/primaryColor.ts | 2 +- ts/state/selectors/theme.ts | 2 +- ts/themes/{ => constants}/colors.tsx | 0 11 files changed, 15 insertions(+), 10 deletions(-) rename ts/themes/{ => constants}/colors.tsx (100%) diff --git a/ts/components/avatar/AvatarPlaceHolder/AvatarPlaceHolder.tsx b/ts/components/avatar/AvatarPlaceHolder/AvatarPlaceHolder.tsx index 752655d1c..c51fe3412 100644 --- a/ts/components/avatar/AvatarPlaceHolder/AvatarPlaceHolder.tsx +++ b/ts/components/avatar/AvatarPlaceHolder/AvatarPlaceHolder.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { COLORS } from '../../../themes/colors'; +import { COLORS } from '../../../themes/constants/colors'; import { getInitials } from '../../../util/getInitials'; type Props = { diff --git a/ts/components/conversation/SessionEmojiPanel.tsx b/ts/components/conversation/SessionEmojiPanel.tsx index 5eddc6fb0..e06cc55e6 100644 --- a/ts/components/conversation/SessionEmojiPanel.tsx +++ b/ts/components/conversation/SessionEmojiPanel.tsx @@ -6,7 +6,12 @@ import Picker from '@emoji-mart/react'; import { useSelector } from 'react-redux'; import { getTheme } from '../../state/selectors/theme'; import { FixedBaseEmoji, FixedPickerProps } from '../../types/Reaction'; -import { COLORS, PrimaryColorStateType, THEMES, ThemeStateType } from '../../themes/colors.js'; +import { + COLORS, + PrimaryColorStateType, + THEMES, + ThemeStateType, +} from '../../themes/constants/colors.js'; import { hexColorToRGB } from '../../util/hexColorToRGB'; import { getPrimaryColor } from '../../state/selectors/primaryColor'; import { i18nEmojiData } from '../../util/emoji'; diff --git a/ts/components/leftpane/ActionsPanel.tsx b/ts/components/leftpane/ActionsPanel.tsx index c7a4a0d17..478bb44d0 100644 --- a/ts/components/leftpane/ActionsPanel.tsx +++ b/ts/components/leftpane/ActionsPanel.tsx @@ -50,7 +50,7 @@ import { UserUtils } from '../../session/utils'; import { getLatestReleaseFromFileServer } from '../../session/apis/file_server_api/FileServerApi'; import { switchThemeTo } from '../../session/utils/Theme'; -import { ThemeStateType } from '../../themes/colors'; +import { ThemeStateType } from '../../themes/constants/colors'; import { getTheme } from '../../state/selectors/theme'; import { switchPrimaryColor } from '../../themes/switchPrimaryColor'; diff --git a/ts/components/settings/SettingsThemeSwitcher.tsx b/ts/components/settings/SettingsThemeSwitcher.tsx index 6e4753ab7..27a1e396f 100644 --- a/ts/components/settings/SettingsThemeSwitcher.tsx +++ b/ts/components/settings/SettingsThemeSwitcher.tsx @@ -6,7 +6,7 @@ import { getTheme } from '../../state/selectors/theme'; import { SessionRadio, SessionRadioPrimaryColors } from '../basic/SessionRadio'; import { SpacerLG, SpacerMD } from '../basic/Text'; import { StyledDescriptionSettingsItem, StyledTitleSettingsItem } from './SessionSettingListItem'; -import { getPrimaryColors, THEMES, ThemeStateType } from '../../themes/colors'; +import { getPrimaryColors, THEMES, ThemeStateType } from '../../themes/constants/colors'; import { switchPrimaryColor } from '../../themes/switchPrimaryColor'; import { getPrimaryColor } from '../../state/selectors/primaryColor'; diff --git a/ts/session/utils/Theme.tsx b/ts/session/utils/Theme.tsx index 6fc332817..2c93f2955 100644 --- a/ts/session/utils/Theme.tsx +++ b/ts/session/utils/Theme.tsx @@ -1,6 +1,6 @@ import { Dispatch } from 'redux'; import { applyTheme } from '../../state/ducks/theme'; -import { ThemeStateType } from '../../themes/colors'; +import { ThemeStateType } from '../../themes/constants/colors'; import { switchHtmlToDarkTheme, switchHtmlToLightTheme } from '../../themes/SessionTheme'; import { switchTheme } from '../../themes/switchTheme'; diff --git a/ts/state/ducks/primaryColor.tsx b/ts/state/ducks/primaryColor.tsx index ea00fcf65..75bcfc645 100644 --- a/ts/state/ducks/primaryColor.tsx +++ b/ts/state/ducks/primaryColor.tsx @@ -1,4 +1,4 @@ -import { PrimaryColorStateType } from '../../themes/colors'; +import { PrimaryColorStateType } from '../../themes/constants/colors'; export const APPLY_PRIMARY_COLOR = 'APPLY_PRIMARY_COLOR'; diff --git a/ts/state/ducks/theme.tsx b/ts/state/ducks/theme.tsx index d8b09a6fb..54edce7ef 100644 --- a/ts/state/ducks/theme.tsx +++ b/ts/state/ducks/theme.tsx @@ -1,4 +1,4 @@ -import { ThemeStateType } from '../../themes/colors'; +import { ThemeStateType } from '../../themes/constants/colors'; export const APPLY_THEME = 'APPLY_THEME'; diff --git a/ts/state/reducer.ts b/ts/state/reducer.ts index f113900dd..4a4603a4e 100644 --- a/ts/state/reducer.ts +++ b/ts/state/reducer.ts @@ -17,7 +17,7 @@ import { reducer as stagedAttachments, StagedAttachmentsStateType, } from './ducks/stagedAttachments'; -import { PrimaryColorStateType, ThemeStateType } from '../themes/colors'; +import { PrimaryColorStateType, ThemeStateType } from '../themes/constants/colors'; export type StateType = { search: SearchStateType; diff --git a/ts/state/selectors/primaryColor.ts b/ts/state/selectors/primaryColor.ts index 9829eba6e..f0f608942 100644 --- a/ts/state/selectors/primaryColor.ts +++ b/ts/state/selectors/primaryColor.ts @@ -1,4 +1,4 @@ -import { PrimaryColorStateType } from '../../themes/colors'; +import { PrimaryColorStateType } from '../../themes/constants/colors'; import { StateType } from '../reducer'; export const getPrimaryColor = (state: StateType): PrimaryColorStateType => state.primaryColor; diff --git a/ts/state/selectors/theme.ts b/ts/state/selectors/theme.ts index 21b9e7bd9..5f24e5471 100644 --- a/ts/state/selectors/theme.ts +++ b/ts/state/selectors/theme.ts @@ -1,4 +1,4 @@ -import { ThemeStateType } from '../../themes/colors'; +import { ThemeStateType } from '../../themes/constants/colors'; import { StateType } from '../reducer'; export const getTheme = (state: StateType): ThemeStateType => state.theme; diff --git a/ts/themes/colors.tsx b/ts/themes/constants/colors.tsx similarity index 100% rename from ts/themes/colors.tsx rename to ts/themes/constants/colors.tsx