mirror of
https://github.com/pawelmalak/flame.git
synced 2025-08-07 03:35:18 +02:00
Fixed bug with alphabetical order not working for bookmarks. Minor changes related to bookmarks form
This commit is contained in:
parent
ec5f50aba4
commit
d5610ad6be
12 changed files with 89 additions and 17 deletions
|
@ -216,6 +216,29 @@ export const bookmarksReducer = (
|
|||
};
|
||||
}
|
||||
|
||||
case ActionType.sortBookmarks: {
|
||||
const categoryIdx = state.categories.findIndex(
|
||||
(category) => category.id === action.payload.categoryId
|
||||
);
|
||||
|
||||
const sortedBookmarks = sortData<Bookmark>(
|
||||
state.categories[categoryIdx].bookmarks,
|
||||
action.payload.orderType
|
||||
);
|
||||
|
||||
return {
|
||||
...state,
|
||||
categories: [
|
||||
...state.categories.slice(0, categoryIdx),
|
||||
{
|
||||
...state.categories[categoryIdx],
|
||||
bookmarks: sortedBookmarks,
|
||||
},
|
||||
...state.categories.slice(categoryIdx + 1),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue