1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-25 22:09:36 +02:00

Fixed bug with alphabetical order not working for bookmarks. Minor changes related to bookmarks form

This commit is contained in:
Paweł Malak 2021-11-26 14:04:46 +01:00
parent ec5f50aba4
commit d5610ad6be
12 changed files with 89 additions and 17 deletions

View file

@ -16,13 +16,14 @@ import { InputGroup, Button, SettingsHeadline } from '../../UI';
import { otherSettingsTemplate, inputHandler } from '../../../utility';
export const UISettings = (): JSX.Element => {
const { loading, config } = useSelector((state: State) => state.config);
const {
config: { loading, config },
bookmarks: { categories },
} = useSelector((state: State) => state);
const dispatch = useDispatch();
const { updateConfig, sortApps, sortCategories } = bindActionCreators(
actionCreators,
dispatch
);
const { updateConfig, sortApps, sortCategories, sortBookmarks } =
bindActionCreators(actionCreators, dispatch);
// Initial state
const [formData, setFormData] = useState<OtherSettingsForm>(
@ -46,9 +47,15 @@ export const UISettings = (): JSX.Element => {
// Update local page title
document.title = formData.customTitle;
// Sort apps and categories with new settings
sortApps();
sortCategories();
// Sort entities with new settings
if (formData.useOrdering !== config.useOrdering) {
sortApps();
sortCategories();
for (let { id } of categories) {
sortBookmarks(id);
}
}
};
// Input handler