Changed order and names of some setting tabs

This commit is contained in:
Paweł Malak 2022-02-04 13:09:47 +01:00
parent 750891cffa
commit 04e80b339c
9 changed files with 22 additions and 20 deletions

View file

@ -3,7 +3,7 @@ import { useState, useEffect, FormEvent, ChangeEvent, Fragment } from 'react';
import { useDispatch, useSelector } from 'react-redux';
// Typescript
import { Query, SearchForm } from '../../../interfaces';
import { Query, GeneralForm } from '../../../interfaces';
// Components
import { CustomQueries } from './CustomQueries/CustomQueries';
@ -12,7 +12,7 @@ import { CustomQueries } from './CustomQueries/CustomQueries';
import { Button, SettingsHeadline, InputGroup } from '../../UI';
// Utils
import { inputHandler, searchSettingsTemplate } from '../../../utility';
import { inputHandler, generalSettingsTemplate } from '../../../utility';
// Data
import { queries } from '../../../utility/searchQueries.json';
@ -22,7 +22,7 @@ import { State } from '../../../store/reducers';
import { bindActionCreators } from 'redux';
import { actionCreators } from '../../../store';
export const SearchSettings = (): JSX.Element => {
export const GeneralSettings = (): JSX.Element => {
const { loading, customQueries, config } = useSelector(
(state: State) => state.config
);
@ -31,7 +31,9 @@ export const SearchSettings = (): JSX.Element => {
const { updateConfig } = bindActionCreators(actionCreators, dispatch);
// Initial state
const [formData, setFormData] = useState<SearchForm>(searchSettingsTemplate);
const [formData, setFormData] = useState<GeneralForm>(
generalSettingsTemplate
);
// Get config
useEffect(() => {
@ -53,7 +55,7 @@ export const SearchSettings = (): JSX.Element => {
e: ChangeEvent<HTMLInputElement | HTMLSelectElement>,
options?: { isNumber?: boolean; isBool?: boolean }
) => {
inputHandler<SearchForm>({
inputHandler<GeneralForm>({
e,
options,
setStateHandler: setFormData,

View file

@ -16,7 +16,7 @@ import { WeatherSettings } from './WeatherSettings/WeatherSettings';
import { UISettings } from './UISettings/UISettings';
import { AppDetails } from './AppDetails/AppDetails';
import { StyleSettings } from './StyleSettings/StyleSettings';
import { SearchSettings } from './SearchSettings/SearchSettings';
import { GeneralSettings } from './GeneralSettings/GeneralSettings';
import { DockerSettings } from './DockerSettings/DockerSettings';
import { ProtectedRoute } from '../Routing/ProtectedRoute';
@ -59,8 +59,8 @@ export const Settings = (): JSX.Element => {
component={WeatherSettings}
/>
<ProtectedRoute
path="/settings/search"
component={SearchSettings}
path="/settings/general"
component={GeneralSettings}
/>
<ProtectedRoute path="/settings/interface" component={UISettings} />
<ProtectedRoute

View file

@ -6,13 +6,8 @@
"authRequired": false
},
{
"name": "Weather",
"dest": "/settings/weather",
"authRequired": true
},
{
"name": "Search",
"dest": "/settings/search",
"name": "General",
"dest": "/settings/general",
"authRequired": true
},
{
@ -20,6 +15,11 @@
"dest": "/settings/interface",
"authRequired": true
},
{
"name": "Weather",
"dest": "/settings/weather",
"authRequired": true
},
{
"name": "Docker",
"dest": "/settings/docker",

View file

@ -8,7 +8,7 @@ export interface WeatherForm {
weatherData: WeatherData;
}
export interface SearchForm {
export interface GeneralForm {
hideSearch: boolean;
defaultSearchProvider: string;
searchSameTab: boolean;

View file

@ -1,14 +1,14 @@
import {
DockerSettingsForm,
OtherSettingsForm,
SearchForm,
GeneralForm,
ThemeSettingsForm,
WeatherForm,
} from '../interfaces';
export type ConfigFormData =
| WeatherForm
| SearchForm
| GeneralForm
| DockerSettingsForm
| OtherSettingsForm
| ThemeSettingsForm;

View file

@ -1,7 +1,7 @@
import {
DockerSettingsForm,
OtherSettingsForm,
SearchForm,
GeneralForm,
ThemeSettingsForm,
WeatherForm,
} from '../../interfaces';
@ -33,7 +33,7 @@ export const weatherSettingsTemplate: WeatherForm = {
weatherData: 'cloud',
};
export const searchSettingsTemplate: SearchForm = {
export const generalSettingsTemplate: GeneralForm = {
hideSearch: false,
searchSameTab: false,
defaultSearchProvider: 'l',