mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-05 04:55:58 +01:00
Rename config to settings in files using it
This commit is contained in:
@@ -2,18 +2,18 @@ import { ActionIcon, Group, Modal, Switch, Title, Text, Tooltip, TextInput } fro
|
|||||||
import { showNotification } from '@mantine/notifications';
|
import { showNotification } from '@mantine/notifications';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { CSSProperties, useEffect, useState } from 'react';
|
import { CSSProperties, useEffect, useState } from 'react';
|
||||||
import { Mail, Settings, X } from 'tabler-icons-react';
|
import { Mail, Settings as SettingsIcon, X } from 'tabler-icons-react';
|
||||||
import { Config, loadConfig } from '../../tools/config';
|
import { Settings, loadSettings } from '../../tools/settings';
|
||||||
import SaveConfigComponent from '../Config/SaveConfig';
|
import SaveConfigComponent from '../Config/SaveConfig';
|
||||||
|
|
||||||
function SettingsMenu(props: any) {
|
function SettingsMenu(props: any) {
|
||||||
const [config, setConfig] = useState<Config>({
|
const [config, setConfig] = useState<Settings>({
|
||||||
searchUrl: 'https://www.google.com/search?q=',
|
searchUrl: 'https://www.google.com/search?q=',
|
||||||
searchBar: true,
|
searchBar: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const config = loadConfig('settings');
|
const config = loadSettings('settings');
|
||||||
if (config) {
|
if (config) {
|
||||||
setConfig(config);
|
setConfig(config);
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,14 @@ function SettingsMenu(props: any) {
|
|||||||
return (
|
return (
|
||||||
<Group direction="column" grow>
|
<Group direction="column" grow>
|
||||||
|
|
||||||
<TextInput label='Search bar querry url' defaultValue={config.searchUrl} onChange={
|
<TextInput
|
||||||
|
label="Search bar querry url"
|
||||||
|
defaultValue={config.searchUrl}
|
||||||
|
onChange={
|
||||||
(e) => {
|
(e) => {
|
||||||
setConfig({
|
setConfig({
|
||||||
...config,
|
...config,
|
||||||
searchUrl: e.target.value
|
searchUrl: e.target.value,
|
||||||
});
|
});
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
'settings',
|
'settings',
|
||||||
@@ -35,8 +38,9 @@ function SettingsMenu(props: any) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} />
|
}
|
||||||
<Group direction="column" >
|
/>
|
||||||
|
<Group direction="column">
|
||||||
<Switch
|
<Switch
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setConfig({
|
setConfig({
|
||||||
@@ -75,7 +79,7 @@ export function SettingsMenuButton(props: any) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
size={'md'}
|
size="md"
|
||||||
title={<Title order={3}>Settings</Title>}
|
title={<Title order={3}>Settings</Title>}
|
||||||
opened={props.opened || opened}
|
opened={props.opened || opened}
|
||||||
onClose={() => setOpened(false)}
|
onClose={() => setOpened(false)}
|
||||||
@@ -85,13 +89,13 @@ export function SettingsMenuButton(props: any) {
|
|||||||
<ActionIcon
|
<ActionIcon
|
||||||
variant="default"
|
variant="default"
|
||||||
radius="xl"
|
radius="xl"
|
||||||
size={'xl'}
|
size="xl"
|
||||||
color={'blue'}
|
color="blue"
|
||||||
style={props.style}
|
style={props.style}
|
||||||
onClick={() => setOpened(true)}
|
onClick={() => setOpened(true)}
|
||||||
>
|
>
|
||||||
<Tooltip label="Settings">
|
<Tooltip label="Settings">
|
||||||
<Settings />
|
<SettingsIcon />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ActionIcon>
|
</ActionIcon>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user