pl-fe: only update if changed(?)
Signed-off-by: mkljczk <git@mkljczk.pl>
This commit is contained in:
parent
5881c592d7
commit
bec1f8b3a9
1 changed files with 6 additions and 4 deletions
|
@ -112,6 +112,8 @@ const Preferences = () => {
|
||||||
const plFeConfig = usePlFeConfig();
|
const plFeConfig = usePlFeConfig();
|
||||||
const instance = useInstance();
|
const instance = useInstance();
|
||||||
|
|
||||||
|
const brandColor = settings.theme?.brandColor || plFeConfig.brandColor || '#d80482';
|
||||||
|
|
||||||
const onSelectChange = (event: React.ChangeEvent<HTMLSelectElement>, path: string[]) => {
|
const onSelectChange = (event: React.ChangeEvent<HTMLSelectElement>, path: string[]) => {
|
||||||
dispatch(changeSetting(path, event.target.value, { showAlert: true }));
|
dispatch(changeSetting(path, event.target.value, { showAlert: true }));
|
||||||
};
|
};
|
||||||
|
@ -124,10 +126,10 @@ const Preferences = () => {
|
||||||
dispatch(changeSetting(key, checked));
|
dispatch(changeSetting(key, checked));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onBrandColorChange = (brandColor: string) => {
|
const onBrandColorChange = (newBrandColor: string) => {
|
||||||
if (!settings.theme?.brandColor && brandColor === (plFeConfig.brandColor || '#d80482')) return;
|
if (!settings.theme?.brandColor && newBrandColor === brandColor) return;
|
||||||
|
|
||||||
dispatch(changeSetting(['theme', 'brandColor'], brandColor, { showAlert: true, save: false }));
|
dispatch(changeSetting(['theme', 'brandColor'], newBrandColor, { showAlert: true, save: false }));
|
||||||
debouncedSave(dispatch);
|
debouncedSave(dispatch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -173,7 +175,7 @@ const Preferences = () => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<PaletteListItem
|
<PaletteListItem
|
||||||
label={intl.formatMessage(messages.brandColor)}
|
label={intl.formatMessage(messages.brandColor)}
|
||||||
palette={colors(settings.theme?.brandColor || plFeConfig.brandColor || '#d80482')}
|
palette={colors(brandColor)}
|
||||||
onChange={(palette) => onBrandColorChange(palette['500'])}
|
onChange={(palette) => onBrandColorChange(palette['500'])}
|
||||||
allowTintChange={false}
|
allowTintChange={false}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in a new issue