diff --git a/client/src/components/Apps/AppTable/AppTable.tsx b/client/src/components/Apps/AppTable/AppTable.tsx index 003e1a73ab163888eaf3e38d611a5320a8f78cfc..8279c7727e10948c5b249455c3cdddec4cfded69 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 d909caba25700a8d5589d1e622c9880ba86a1b1a..5a88097b0239566431b607a37e002aa6b58384c6 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 8c2e5fd3fc5ba4f53bb8e3299ee932c85afce904..4173c729a3135c66623aa8af909437ff1e51f554 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,40 +77,70 @@ export const GeneralSettings = (): JSX.Element => { return ( - {/* GENERAL SETTINGS */}
formSubmitHandler(e)} style={{ marginBottom: '30px' }} > + {/* === GENERAL OPTIONS === */} + {/* SORT TYPE */} - + + - return ( - - ); - })} + {/* === APPS OPTIONS === */} + + {/* PIN APPS */} + + + + {/* APPS OPPENING */} - + + {/* === BOOKMARKS OPTIONS === */} + + {/* PIN CATEGORIES */} + + + {/* BOOKMARKS OPPENING */} - + + {/* SEARCH SETTINGS */} + + + + + + - +