From 2ddfdb24ddb9e3ffc58dbeaa04a342ee18806b80 Mon Sep 17 00:00:00 2001 From: alexsparkes Date: Wed, 21 Aug 2024 15:16:19 +0100 Subject: [PATCH] fix: background options' routing & section icon shrink Co-authored-by: David Ralph --- .../Elements/MainModal/scss/index.scss | 1 + .../background/options/BackgroundOptions.jsx | 57 ++++++++++--------- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/components/Elements/MainModal/scss/index.scss b/src/components/Elements/MainModal/scss/index.scss index 6ce7cc93..c7b49a7b 100644 --- a/src/components/Elements/MainModal/scss/index.scss +++ b/src/components/Elements/MainModal/scss/index.scss @@ -292,6 +292,7 @@ h5 { flex-flow: row; align-items: center; gap: 25px; + flex-grow: 0; svg { @include themed { diff --git a/src/features/background/options/BackgroundOptions.jsx b/src/features/background/options/BackgroundOptions.jsx index 3ccb9bff..74c3e3f9 100644 --- a/src/features/background/options/BackgroundOptions.jsx +++ b/src/features/background/options/BackgroundOptions.jsx @@ -3,7 +3,7 @@ import variables from 'config/variables'; import { useState, useEffect } from 'react'; import { MdSource, MdOutlineKeyboardArrowRight, MdOutlineAutoAwesome } from 'react-icons/md'; -import { Header, PreferencesWrapper } from 'components/Layout/Settings'; +import { Header, PreferencesWrapper, Section } from 'components/Layout/Settings'; import { Checkbox, Dropdown, Slider, Radio, Text, ChipSelect } from 'components/Form/Settings'; import { Row, Content, Action } from 'components/Layout/Settings/Item'; //import Text from 'components/Form/Settings/Text/Text'; @@ -13,10 +13,13 @@ import CustomSettings from './Custom'; import values from 'utils/data/slider_values.json'; import { APIQualityOptions, backgroundImageEffects, getBackgroundOptionItems } from './optionTypes'; +import { useTab } from 'components/Elements/MainModal/backend/TabContext'; import defaults from './default'; function BackgroundOptions() { + const { subSection } = useTab(); + const [backgroundType, setBackgroundType] = useState( localStorage.getItem('backgroundType') || defaults.backgroundType, ); @@ -37,7 +40,7 @@ function BackgroundOptions() { useEffect(() => { return () => { controller.abort(); - } + }; }, []); async function getBackgroundCategories() { @@ -229,9 +232,9 @@ function BackgroundOptions() { return ( <> {header} - {backgroundSettingsSection !== true && effects !== true ? ( + {subSection === '' ? ( <> -
setBackgroundSettingsSection(true)}> + {/*
setBackgroundSettingsSection(true)}>
@@ -252,32 +255,34 @@ function BackgroundOptions() { items={getBackgroundOptionItems(marketplaceEnabled)} />
-
+
*/} +
} + > + this.setState({ backgroundType: value })} + category="background" + items={getBackgroundOptionItems(marketplaceEnabled)} + /> +
{backgroundType === 'api' || backgroundType === 'custom' || marketplaceEnabled ? ( <> -
setEffects(true)}> -
- -
- - {variables.getMessage('settings:sections.background.effects.title')} - - - {variables.getMessage('settings:sections.background.effects.subtitle')} - -
-
-
- {' '} - -
-
+
} + /> ) : null} ) : null} - {backgroundSettingsSection !== true && - effects !== true && + {subSection === '' && (backgroundType === 'api' || backgroundType === 'custom' || marketplaceEnabled) ? ( @@ -307,7 +312,7 @@ function BackgroundOptions() { ) : null} - {backgroundSettingsSection && ( + {subSection === 'source' && ( <> )} {(backgroundType === 'api' || backgroundType === 'custom' || marketplaceEnabled) && - effects ? ( + subSection === 'effects' ? (