mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-12 00:15:48 +01:00
🐛 Fix Change Position not working with gridstack
This commit is contained in:
@@ -7,21 +7,26 @@ import { useConfigStore } from './store';
|
||||
export type ConfigContextType = {
|
||||
config: ConfigType | undefined;
|
||||
name: string | undefined;
|
||||
configVersion: number | undefined;
|
||||
increaseVersion: () => void;
|
||||
setConfigName: (name: string) => void;
|
||||
};
|
||||
|
||||
const ConfigContext = createContext<ConfigContextType>({
|
||||
name: 'unknown',
|
||||
config: undefined,
|
||||
configVersion: undefined,
|
||||
increaseVersion: () => console.error('Provider not set'),
|
||||
setConfigName: () => console.error('Provider not set'),
|
||||
});
|
||||
|
||||
export const ConfigProvider = ({ children }: { children: ReactNode }) => {
|
||||
const [configName, setConfigName] = useState<string>();
|
||||
const [configVersion, setConfigVersion] = useState(0);
|
||||
const { configs } = useConfigStore((s) => ({ configs: s.configs }), shallow);
|
||||
const { setPrimaryColor, setSecondaryColor, setPrimaryShade } = useColorTheme();
|
||||
|
||||
const currentConfig = configs.find((c) => c.configProperties.name === configName);
|
||||
const currentConfig = configs.find((c) => c.value.configProperties.name === configName)?.value;
|
||||
|
||||
useEffect(() => {
|
||||
setPrimaryColor(currentConfig?.settings.customization.colors.primary || 'red');
|
||||
@@ -34,6 +39,8 @@ export const ConfigProvider = ({ children }: { children: ReactNode }) => {
|
||||
value={{
|
||||
name: configName,
|
||||
config: currentConfig,
|
||||
configVersion,
|
||||
increaseVersion: () => setConfigVersion((v) => v + 1),
|
||||
setConfigName: (name: string) => setConfigName(name),
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user