diff --git a/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx b/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx index f5d757119..9930ffbd9 100644 --- a/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/Header/ContentListHeader.tsx @@ -65,7 +65,6 @@ const ContentListHeader = ({ > = ({ - closeDisplayOptionsMenu, application, isOpen, isFilesSmartView, @@ -179,7 +178,9 @@ const DisplayOptionsMenu: FunctionComponent = ({ + ) } diff --git a/packages/web/src/javascripts/Components/QuickSettingsMenu/PanelSettingsSection.tsx b/packages/web/src/javascripts/Components/QuickSettingsMenu/PanelSettingsSection.tsx index 4e3dcf0ba..0383538e3 100644 --- a/packages/web/src/javascripts/Components/QuickSettingsMenu/PanelSettingsSection.tsx +++ b/packages/web/src/javascripts/Components/QuickSettingsMenu/PanelSettingsSection.tsx @@ -24,7 +24,7 @@ const PanelSettingsSection = () => { return (
{ Show Tags Panel = ({ application, quickSet }, [application, deactivateAnyNonLayerableTheme]) return ( -
+ {toggleableComponents.length > 0 && ( <>
Tools
{toggleableComponents.map((component) => ( - + + {component.displayName} + ))} )}
Appearance
- + {themes.map((theme) => ( ))} @@ -200,7 +184,7 @@ const QuickSettingsMenu: FunctionComponent = ({ application, quickSet isEnabled={focusModeEnabled} /> -
+ ) } diff --git a/packages/web/src/javascripts/Components/QuickSettingsMenu/ThemesMenuButton.tsx b/packages/web/src/javascripts/Components/QuickSettingsMenu/ThemesMenuButton.tsx index 3fa4b2dd1..fb46afce3 100644 --- a/packages/web/src/javascripts/Components/QuickSettingsMenu/ThemesMenuButton.tsx +++ b/packages/web/src/javascripts/Components/QuickSettingsMenu/ThemesMenuButton.tsx @@ -3,12 +3,12 @@ import { FeatureIdentifier, FeatureStatus } from '@standardnotes/snjs' import { FunctionComponent, MouseEventHandler, useCallback, useMemo } from 'react' import Icon from '@/Components/Icon/Icon' import { usePremiumModal } from '@/Hooks/usePremiumModal' -import Switch from '@/Components/Switch/Switch' import { ThemeItem } from './ThemeItem' -import RadioIndicator from '../Radio/RadioIndicator' import { PremiumFeatureIconClass, PremiumFeatureIconName } from '../Icon/PremiumFeatureIcon' import { isMobileScreen } from '@/Utils' import { classNames } from '@standardnotes/utils' +import MenuSwitchButtonItem from '../Menu/MenuSwitchButtonItem' +import MenuRadioButtonItem from '../Menu/MenuRadioButtonItem' type Props = { item: ThemeItem @@ -28,22 +28,25 @@ const ThemesMenuButton: FunctionComponent = ({ application, item }) => { ) const canActivateTheme = useMemo(() => isEntitledToTheme || isThirdPartyTheme, [isEntitledToTheme, isThirdPartyTheme]) - const toggleTheme: MouseEventHandler = useCallback( - (e) => { - e.preventDefault() + const toggleTheme = useCallback(() => { + if (item.component && canActivateTheme) { + const isThemeLayerable = item.component.isLayerable() + const themeIsLayerableOrNotActive = isThemeLayerable || !item.component.active - if (item.component && canActivateTheme) { - const isThemeLayerable = item.component.isLayerable() - const themeIsLayerableOrNotActive = isThemeLayerable || !item.component.active - - if (themeIsLayerableOrNotActive) { - application.mutator.toggleTheme(item.component).catch(console.error) - } - } else { - premiumModal.activate(`${item.name} theme`) + if (themeIsLayerableOrNotActive) { + application.mutator.toggleTheme(item.component).catch(console.error) } + } else { + premiumModal.activate(`${item.name} theme`) + } + }, [application, canActivateTheme, item, premiumModal]) + + const onClick: MouseEventHandler = useCallback( + (event) => { + event.preventDefault() + toggleTheme() }, - [application, canActivateTheme, item, premiumModal], + [toggleTheme], ) const isMobile = application.isNativeMobileWeb() || isMobileScreen() @@ -53,42 +56,27 @@ const ThemesMenuButton: FunctionComponent = ({ application, item }) => { return null } - return ( - + ) }