Files
suwayomi-material-you-webui/src/lib/graphql/queries/ChapterQuery.ts
schroda 446deeae06 Feature/library manga actions (#506)
* Extend "IMangaGridProps" from "DefaultGridProps"

* Move library manga filtering into hook

* Add logic to select mangas

* Add manga actions

* Remove cache only policy for category mangas

Unclear why this was added

* Prevent SelectionFAB from being hidden by the mobile footer

On e.g. the library page, the footer is visible and thus, the fab was not completely visible

* Update categories of manga only after clicking "OK"

Previously, selecting a category resulted in an immediate mutation.
To be able to reuse the "CategorySelect" component to change the categories of multiple mangas at once, this behaviour is not suited.

* Add action to change categories of multiple mangas

* Cancel selection mode after removal from library

The mangas would still be selected and other action could get performed. However, this should only be possible for mangas that are in the library

* Remove unintentionally added console log

Accidentally added with 980da657d9
2023-12-25 21:37:45 +01:00

79 lines
2.0 KiB
TypeScript

/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
import { FULL_CHAPTER_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments';
// returns the current chapter from the database
export const GET_CHAPTER = gql`
${FULL_CHAPTER_FIELDS}
query GET_CHAPTER($id: Int!) {
chapter(id: $id) {
...FULL_CHAPTER_FIELDS
}
}
`;
// returns the current chapters from the database
export const GET_CHAPTERS = gql`
${FULL_CHAPTER_FIELDS}
${PAGE_INFO}
query GET_CHAPTERS(
$after: Cursor
$before: Cursor
$condition: ChapterConditionInput
$filter: ChapterFilterInput
$first: Int
$last: Int
$offset: Int
$orderBy: ChapterOrderBy
$orderByType: SortOrder
) {
chapters(
after: $after
before: $before
condition: $condition
filter: $filter
first: $first
last: $last
offset: $offset
orderBy: $orderBy
orderByType: $orderByType
) {
nodes {
...FULL_CHAPTER_FIELDS
}
pageInfo {
...PAGE_INFO
}
totalCount
}
}
`;
export const GET_MANGAS_CHAPTER_IDS_WITH_STATE = gql`
query GET_MANGAS_CHAPTER_IDS_WITH_STATE(
$mangaIds: [Int!]!
$isDownloaded: Boolean = null
$isRead: Boolean = null
$isBookmarked: Boolean = null
) {
chapters(
filter: { mangaId: { in: $mangaIds } }
condition: { isDownloaded: $isDownloaded, isRead: $isRead, isBookmarked: $isBookmarked }
) {
nodes {
id
isDownloaded
isRead
isBookmarked
}
}
}
`;