mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-07-14 16:51:10 +00:00
Add per-shelf autoRequest toggle
Introduce an autoRequest boolean on Goodreads and Hardcover shelves (default true) so users can pause/resume automatic request creation. Schema, API handlers, hooks and types were updated to accept and persist autoRequest when creating or updating shelves; add endpoints only trigger an immediate resync when the feed/token changes. The shelf sync core and service code now respect autoRequest (skipping request creation and annotating logs when disabled). UI updates include an AddShelf toggle, manage/update payload changes, shelf list props, and visual indicators + toggle actions in the shelf cards.
This commit is contained in:
@@ -16,6 +16,7 @@ export interface GoodreadsShelf {
|
||||
lastSyncAt: string | null;
|
||||
createdAt: string;
|
||||
bookCount: number | null;
|
||||
autoRequest: boolean;
|
||||
books: ShelfBook[];
|
||||
}
|
||||
|
||||
@@ -27,8 +28,8 @@ export const useGoodreadsShelves = useList;
|
||||
export function useAddGoodreadsShelf() {
|
||||
const { addShelf: addGeneric, isLoading, error } = useAdd();
|
||||
|
||||
const addShelf = async (rssUrl: string) => {
|
||||
return addGeneric({ rssUrl });
|
||||
const addShelf = async (rssUrl: string, autoRequest: boolean = true) => {
|
||||
return addGeneric({ rssUrl, autoRequest });
|
||||
};
|
||||
|
||||
return { addShelf, isLoading, error };
|
||||
@@ -39,8 +40,8 @@ export const useDeleteGoodreadsShelf = useDelete;
|
||||
export function useUpdateGoodreadsShelf() {
|
||||
const { updateShelf: updateGeneric, isLoading, error } = useUpdate();
|
||||
|
||||
const updateShelf = async (shelfId: string, rssUrl: string) => {
|
||||
return updateGeneric(shelfId, { rssUrl });
|
||||
const updateShelf = async (shelfId: string, updates: { rssUrl?: string; autoRequest?: boolean }) => {
|
||||
return updateGeneric(shelfId, updates);
|
||||
};
|
||||
|
||||
return { updateShelf, isLoading, error };
|
||||
|
||||
Reference in New Issue
Block a user