diff --git a/client/src/components/Apps/AppTable/AppTable.tsx b/client/src/components/Apps/AppTable/AppTable.tsx index 003e1a7..8279c77 100644 --- a/client/src/components/Apps/AppTable/AppTable.tsx +++ b/client/src/components/Apps/AppTable/AppTable.tsx @@ -94,7 +94,7 @@ export const AppTable = (props: Props): JSX.Element => { ) : (

Custom order is disabled. You can change it in the{' '} - settings + settings

)} diff --git a/client/src/components/Bookmarks/Table/CategoryTable.tsx b/client/src/components/Bookmarks/Table/CategoryTable.tsx index d909cab..5a88097 100644 --- a/client/src/components/Bookmarks/Table/CategoryTable.tsx +++ b/client/src/components/Bookmarks/Table/CategoryTable.tsx @@ -102,7 +102,7 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => { ) : (

Custom order is disabled. You can change it in the{' '} - settings + settings

)} diff --git a/client/src/components/Settings/GeneralSettings/GeneralSettings.tsx b/client/src/components/Settings/GeneralSettings/GeneralSettings.tsx index 8c2e5fd..4173c72 100644 --- a/client/src/components/Settings/GeneralSettings/GeneralSettings.tsx +++ b/client/src/components/Settings/GeneralSettings/GeneralSettings.tsx @@ -23,12 +23,14 @@ import { bindActionCreators } from 'redux'; import { actionCreators } from '../../../store'; export const GeneralSettings = (): JSX.Element => { - const { loading, customQueries, config } = useSelector( - (state: State) => state.config - ); + const { + config: { loading, customQueries, config }, + bookmarks: { categories }, + } = useSelector((state: State) => state); const dispatch = useDispatch(); - const { updateConfig } = bindActionCreators(actionCreators, dispatch); + const { updateConfig, sortApps, sortCategories, sortBookmarks } = + bindActionCreators(actionCreators, dispatch); // Initial state const [formData, setFormData] = useState( @@ -48,6 +50,16 @@ export const GeneralSettings = (): JSX.Element => { // Save settings await updateConfig(formData); + + // Sort entities with new settings + if (formData.useOrdering !== config.useOrdering) { + sortApps(); + sortCategories(); + + for (let { id } of categories) { + sortBookmarks(id); + } + } }; // Input handler @@ -65,12 +77,95 @@ export const GeneralSettings = (): JSX.Element => { return ( - {/* GENERAL SETTINGS */}
formSubmitHandler(e)} style={{ marginBottom: '30px' }} > + {/* === GENERAL OPTIONS === */} + {/* SORT TYPE */} + + + + + + {/* === APPS OPTIONS === */} + + {/* PIN APPS */} + + + + + + {/* APPS OPPENING */} + + + + + + {/* === BOOKMARKS OPTIONS === */} + + {/* PIN CATEGORIES */} + + + + + + {/* BOOKMARKS OPPENING */} + + + + + + {/* SEARCH SETTINGS */} + - - - - - - - - - -