Changed order and names of some setting tabs
This commit is contained in:
parent
750891cffa
commit
04e80b339c
9 changed files with 22 additions and 20 deletions
|
@ -3,7 +3,7 @@ import { useState, useEffect, FormEvent, ChangeEvent, Fragment } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
// Typescript
|
// Typescript
|
||||||
import { Query, SearchForm } from '../../../interfaces';
|
import { Query, GeneralForm } from '../../../interfaces';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { CustomQueries } from './CustomQueries/CustomQueries';
|
import { CustomQueries } from './CustomQueries/CustomQueries';
|
||||||
|
@ -12,7 +12,7 @@ import { CustomQueries } from './CustomQueries/CustomQueries';
|
||||||
import { Button, SettingsHeadline, InputGroup } from '../../UI';
|
import { Button, SettingsHeadline, InputGroup } from '../../UI';
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { inputHandler, searchSettingsTemplate } from '../../../utility';
|
import { inputHandler, generalSettingsTemplate } from '../../../utility';
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
import { queries } from '../../../utility/searchQueries.json';
|
import { queries } from '../../../utility/searchQueries.json';
|
||||||
|
@ -22,7 +22,7 @@ import { State } from '../../../store/reducers';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
import { actionCreators } from '../../../store';
|
import { actionCreators } from '../../../store';
|
||||||
|
|
||||||
export const SearchSettings = (): JSX.Element => {
|
export const GeneralSettings = (): JSX.Element => {
|
||||||
const { loading, customQueries, config } = useSelector(
|
const { loading, customQueries, config } = useSelector(
|
||||||
(state: State) => state.config
|
(state: State) => state.config
|
||||||
);
|
);
|
||||||
|
@ -31,7 +31,9 @@ export const SearchSettings = (): JSX.Element => {
|
||||||
const { updateConfig } = bindActionCreators(actionCreators, dispatch);
|
const { updateConfig } = bindActionCreators(actionCreators, dispatch);
|
||||||
|
|
||||||
// Initial state
|
// Initial state
|
||||||
const [formData, setFormData] = useState<SearchForm>(searchSettingsTemplate);
|
const [formData, setFormData] = useState<GeneralForm>(
|
||||||
|
generalSettingsTemplate
|
||||||
|
);
|
||||||
|
|
||||||
// Get config
|
// Get config
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -53,7 +55,7 @@ export const SearchSettings = (): JSX.Element => {
|
||||||
e: ChangeEvent<HTMLInputElement | HTMLSelectElement>,
|
e: ChangeEvent<HTMLInputElement | HTMLSelectElement>,
|
||||||
options?: { isNumber?: boolean; isBool?: boolean }
|
options?: { isNumber?: boolean; isBool?: boolean }
|
||||||
) => {
|
) => {
|
||||||
inputHandler<SearchForm>({
|
inputHandler<GeneralForm>({
|
||||||
e,
|
e,
|
||||||
options,
|
options,
|
||||||
setStateHandler: setFormData,
|
setStateHandler: setFormData,
|
|
@ -16,7 +16,7 @@ import { WeatherSettings } from './WeatherSettings/WeatherSettings';
|
||||||
import { UISettings } from './UISettings/UISettings';
|
import { UISettings } from './UISettings/UISettings';
|
||||||
import { AppDetails } from './AppDetails/AppDetails';
|
import { AppDetails } from './AppDetails/AppDetails';
|
||||||
import { StyleSettings } from './StyleSettings/StyleSettings';
|
import { StyleSettings } from './StyleSettings/StyleSettings';
|
||||||
import { SearchSettings } from './SearchSettings/SearchSettings';
|
import { GeneralSettings } from './GeneralSettings/GeneralSettings';
|
||||||
import { DockerSettings } from './DockerSettings/DockerSettings';
|
import { DockerSettings } from './DockerSettings/DockerSettings';
|
||||||
import { ProtectedRoute } from '../Routing/ProtectedRoute';
|
import { ProtectedRoute } from '../Routing/ProtectedRoute';
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ export const Settings = (): JSX.Element => {
|
||||||
component={WeatherSettings}
|
component={WeatherSettings}
|
||||||
/>
|
/>
|
||||||
<ProtectedRoute
|
<ProtectedRoute
|
||||||
path="/settings/search"
|
path="/settings/general"
|
||||||
component={SearchSettings}
|
component={GeneralSettings}
|
||||||
/>
|
/>
|
||||||
<ProtectedRoute path="/settings/interface" component={UISettings} />
|
<ProtectedRoute path="/settings/interface" component={UISettings} />
|
||||||
<ProtectedRoute
|
<ProtectedRoute
|
||||||
|
|
|
@ -6,13 +6,8 @@
|
||||||
"authRequired": false
|
"authRequired": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Weather",
|
"name": "General",
|
||||||
"dest": "/settings/weather",
|
"dest": "/settings/general",
|
||||||
"authRequired": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Search",
|
|
||||||
"dest": "/settings/search",
|
|
||||||
"authRequired": true
|
"authRequired": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -20,6 +15,11 @@
|
||||||
"dest": "/settings/interface",
|
"dest": "/settings/interface",
|
||||||
"authRequired": true
|
"authRequired": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Weather",
|
||||||
|
"dest": "/settings/weather",
|
||||||
|
"authRequired": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Docker",
|
"name": "Docker",
|
||||||
"dest": "/settings/docker",
|
"dest": "/settings/docker",
|
||||||
|
|
|
@ -8,7 +8,7 @@ export interface WeatherForm {
|
||||||
weatherData: WeatherData;
|
weatherData: WeatherData;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchForm {
|
export interface GeneralForm {
|
||||||
hideSearch: boolean;
|
hideSearch: boolean;
|
||||||
defaultSearchProvider: string;
|
defaultSearchProvider: string;
|
||||||
searchSameTab: boolean;
|
searchSameTab: boolean;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import {
|
import {
|
||||||
DockerSettingsForm,
|
DockerSettingsForm,
|
||||||
OtherSettingsForm,
|
OtherSettingsForm,
|
||||||
SearchForm,
|
GeneralForm,
|
||||||
ThemeSettingsForm,
|
ThemeSettingsForm,
|
||||||
WeatherForm,
|
WeatherForm,
|
||||||
} from '../interfaces';
|
} from '../interfaces';
|
||||||
|
|
||||||
export type ConfigFormData =
|
export type ConfigFormData =
|
||||||
| WeatherForm
|
| WeatherForm
|
||||||
| SearchForm
|
| GeneralForm
|
||||||
| DockerSettingsForm
|
| DockerSettingsForm
|
||||||
| OtherSettingsForm
|
| OtherSettingsForm
|
||||||
| ThemeSettingsForm;
|
| ThemeSettingsForm;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import {
|
import {
|
||||||
DockerSettingsForm,
|
DockerSettingsForm,
|
||||||
OtherSettingsForm,
|
OtherSettingsForm,
|
||||||
SearchForm,
|
GeneralForm,
|
||||||
ThemeSettingsForm,
|
ThemeSettingsForm,
|
||||||
WeatherForm,
|
WeatherForm,
|
||||||
} from '../../interfaces';
|
} from '../../interfaces';
|
||||||
|
@ -33,7 +33,7 @@ export const weatherSettingsTemplate: WeatherForm = {
|
||||||
weatherData: 'cloud',
|
weatherData: 'cloud',
|
||||||
};
|
};
|
||||||
|
|
||||||
export const searchSettingsTemplate: SearchForm = {
|
export const generalSettingsTemplate: GeneralForm = {
|
||||||
hideSearch: false,
|
hideSearch: false,
|
||||||
searchSameTab: false,
|
searchSameTab: false,
|
||||||
defaultSearchProvider: 'l',
|
defaultSearchProvider: 'l',
|
||||||
|
|
Loading…
Reference in a new issue