Make color picker button prioritize config colors

This commit is contained in:
Larvey
2023-04-25 17:02:53 -04:00
parent cd433b0e3c
commit e2426ed6e5

View File

@@ -21,10 +21,13 @@ interface ColorControlProps {
export function ColorSelector({ type, defaultValue }: ColorControlProps) { export function ColorSelector({ type, defaultValue }: ColorControlProps) {
const { t } = useTranslation('settings/customization/color-selector'); const { t } = useTranslation('settings/customization/color-selector');
const [color, setColor] = useState(defaultValue); const { config, name: configName } = useConfigContext();
const [color, setColor] =
type === 'primary'
? useState(config?.settings.customization.colors.primary || defaultValue)
: useState(config?.settings.customization.colors.secondary || defaultValue);
const [popoverOpened, popover] = useDisclosure(false); const [popoverOpened, popover] = useDisclosure(false);
const { setPrimaryColor, setSecondaryColor } = useColorTheme(); const { setPrimaryColor, setSecondaryColor } = useColorTheme();
const { config, name: configName } = useConfigContext();
const updateConfig = useConfigStore((x) => x.updateConfig); const updateConfig = useConfigStore((x) => x.updateConfig);
const theme = useMantineTheme(); const theme = useMantineTheme();