Skip to content

Commit

Permalink
downloads done
Browse files Browse the repository at this point in the history
  • Loading branch information
Robonau committed Sep 19, 2023
1 parent d7a2ae2 commit 4a252db
Show file tree
Hide file tree
Showing 9 changed files with 486 additions and 43 deletions.
1 change: 1 addition & 0 deletions src/app.sass
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
@apply rounded-b-box
& > *:first-child
@apply rounded-t-box

.tooltip-bottom-align-right
@apply tooltip-bottom
&::before
Expand Down
19 changes: 19 additions & 0 deletions src/gql/Mutations.gql
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,22 @@ mutation stopDownloader {
}
}
}

mutation deleteDownloadedChapter($id: Int!) {
deleteDownloadedChapter(input: { id: $id }) {
chapters {
isBookmarked
isDownloaded
isRead
id
chapterNumber
fetchedAt
lastPageRead
name
sourceOrder
uploadDate
pageCount
scanlator
}
}
}
17 changes: 17 additions & 0 deletions src/gql/Queries.gql
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ query manga($id: Int!) {
}
}

query getSingleChapter($id: Int!) {
chapter(id: $id) {
isBookmarked
isDownloaded
isRead
id
chapterNumber
fetchedAt
lastPageRead
name
sourceOrder
uploadDate
pageCount
scanlator
}
}

query extentions {
extensions {
nodes {
Expand Down
16 changes: 16 additions & 0 deletions src/gql/Subscriptions.gql
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,19 @@ subscription downloadChanged {
state
}
}

subscription downloadsOnChapters {
downloadChanged {
queue {
progress
state
chapter {
id
}
manga {
id
}
}
state
}
}
141 changes: 141 additions & 0 deletions src/lib/generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2249,6 +2249,13 @@ export type StopDownloaderMutationVariables = Exact<{ [key: string]: never; }>;

export type StopDownloaderMutation = { __typename?: 'Mutation', stopDownloader: { __typename?: 'StopDownloaderPayload', downloadStatus: { __typename?: 'DownloadStatus', state: DownloaderState } } };

export type DeleteDownloadedChapterMutationVariables = Exact<{
id: Scalars['Int']['input'];
}>;


export type DeleteDownloadedChapterMutation = { __typename?: 'Mutation', deleteDownloadedChapter: { __typename?: 'DeleteDownloadedChapterPayload', chapters: { __typename?: 'ChapterType', isBookmarked: boolean, isDownloaded: boolean, isRead: boolean, id: number, chapterNumber: number, fetchedAt: any, lastPageRead: number, name: string, sourceOrder: number, uploadDate: any, pageCount: number, scanlator?: string | null } } };

export type CategoriesQueryVariables = Exact<{
notEqualTo?: InputMaybe<Scalars['Int']['input']>;
}>;
Expand All @@ -2270,6 +2277,13 @@ export type MangaQueryVariables = Exact<{

export type MangaQuery = { __typename?: 'Query', manga: { __typename?: 'MangaType', artist?: string | null, author?: string | null, description?: string | null, genre: Array<string>, id: number, inLibrary: boolean, lastFetchedAt?: any | null, realUrl?: string | null, status: MangaStatus, title: string, thumbnailUrl?: string | null, meta: Array<{ __typename?: 'MangaMetaType', value: string, key: string }>, source?: { __typename?: 'SourceType', displayName: string } | null, chapters: { __typename?: 'ChapterNodeList', nodes: Array<{ __typename?: 'ChapterType', isBookmarked: boolean, isDownloaded: boolean, isRead: boolean, id: number, chapterNumber: number, fetchedAt: any, lastPageRead: number, name: string, sourceOrder: number, uploadDate: any, pageCount: number, scanlator?: string | null }> } } };

export type GetSingleChapterQueryVariables = Exact<{
id: Scalars['Int']['input'];
}>;


export type GetSingleChapterQuery = { __typename?: 'Query', chapter: { __typename?: 'ChapterType', isBookmarked: boolean, isDownloaded: boolean, isRead: boolean, id: number, chapterNumber: number, fetchedAt: any, lastPageRead: number, name: string, sourceOrder: number, uploadDate: any, pageCount: number, scanlator?: string | null } };

export type ExtentionsQueryVariables = Exact<{ [key: string]: never; }>;


Expand Down Expand Up @@ -2349,6 +2363,11 @@ export type DownloadChangedSubscriptionVariables = Exact<{ [key: string]: never;

export type DownloadChangedSubscription = { __typename?: 'Subscription', downloadChanged: { __typename?: 'DownloadStatus', state: DownloaderState, queue: Array<{ __typename?: 'DownloadType', progress: number, state: DownloadState, tries: number, chapter: { __typename?: 'ChapterType', name: string, id: number }, manga: { __typename?: 'MangaType', title: string, thumbnailUrl?: string | null, id: number } }> } };

export type DownloadsOnChaptersSubscriptionVariables = Exact<{ [key: string]: never; }>;


export type DownloadsOnChaptersSubscription = { __typename?: 'Subscription', downloadChanged: { __typename?: 'DownloadStatus', state: DownloaderState, queue: Array<{ __typename?: 'DownloadType', progress: number, state: DownloadState, chapter: { __typename?: 'ChapterType', id: number }, manga: { __typename?: 'MangaType', id: number } }> } };


export const FetchExtensionsDoc = gql`
mutation fetchExtensions {
Expand Down Expand Up @@ -2655,6 +2674,26 @@ export const StopDownloaderDoc = gql`
}
}
`;
export const DeleteDownloadedChapterDoc = gql`
mutation deleteDownloadedChapter($id: Int!) {
deleteDownloadedChapter(input: {id: $id}) {
chapters {
isBookmarked
isDownloaded
isRead
id
chapterNumber
fetchedAt
lastPageRead
name
sourceOrder
uploadDate
pageCount
scanlator
}
}
}
`;
export const CategoriesDoc = gql`
query categories($notEqualTo: Int = null) {
categories(filter: {id: {notEqualTo: $notEqualTo}}) {
Expand Down Expand Up @@ -2729,6 +2768,24 @@ export const MangaDoc = gql`
}
}
`;
export const GetSingleChapterDoc = gql`
query getSingleChapter($id: Int!) {
chapter(id: $id) {
isBookmarked
isDownloaded
isRead
id
chapterNumber
fetchedAt
lastPageRead
name
sourceOrder
uploadDate
pageCount
scanlator
}
}
`;
export const ExtentionsDoc = gql`
query extentions {
extensions {
Expand Down Expand Up @@ -3058,6 +3115,23 @@ export const DownloadChangedDoc = gql`
}
}
`;
export const DownloadsOnChaptersDoc = gql`
subscription downloadsOnChapters {
downloadChanged {
queue {
progress
state
chapter {
id
}
manga {
id
}
}
state
}
}
`;
export const fetchExtensions = (
options: Omit<
MutationOptions<any, FetchExtensionsMutationVariables>,
Expand Down Expand Up @@ -3382,6 +3456,18 @@ export const stopDownloader = (
});
return m;
}
export const deleteDownloadedChapter = (
options: Omit<
MutationOptions<any, DeleteDownloadedChapterMutationVariables>,
"mutation"
>
) => {
const m = client.mutate<DeleteDownloadedChapterMutation, DeleteDownloadedChapterMutationVariables>({
mutation: DeleteDownloadedChapterDoc,
...options,
});
return m;
}
export const categories = (
options: Omit<
WatchQueryOptions<CategoriesQueryVariables>,
Expand Down Expand Up @@ -3514,6 +3600,50 @@ export const manga = (
return client.query<MangaQuery>({query: MangaDoc, ...options})
}

export const getSingleChapter = (
options: Omit<
WatchQueryOptions<GetSingleChapterQueryVariables>,
"query"
>
): Readable<
ApolloQueryResult<GetSingleChapterQuery> & {
query: ObservableQuery<
GetSingleChapterQuery,
GetSingleChapterQueryVariables
>;
}
> => {
const q = client.watchQuery({
query: GetSingleChapterDoc,
...options,
});
var result = readable<
ApolloQueryResult<GetSingleChapterQuery> & {
query: ObservableQuery<
GetSingleChapterQuery,
GetSingleChapterQueryVariables
>;
}
>(
{ data: {} as any, loading: true, error: undefined, networkStatus: 1, query: q },
(set) => {
q.subscribe((v: any) => {
set({ ...v, query: q });
});
}
);
return result;
}

export const AsyncgetSingleChapter = (
options: Omit<
QueryOptions<GetSingleChapterQueryVariables>,
"query"
>
) => {
return client.query<GetSingleChapterQuery>({query: GetSingleChapterDoc, ...options})
}

export const extentions = (
options: Omit<
WatchQueryOptions<ExtentionsQueryVariables>,
Expand Down Expand Up @@ -4052,4 +4182,15 @@ export const downloadChanged = (
}
)
return q;
}
export const downloadsOnChapters = (
options: Omit<SubscriptionOptions<DownloadsOnChaptersSubscriptionVariables>, "query">
) => {
const q = client.subscribe<DownloadsOnChaptersSubscription, DownloadsOnChaptersSubscriptionVariables>(
{
query: DownloadsOnChaptersDoc,
...options,
}
)
return q;
}
Loading

0 comments on commit 4a252db

Please sign in to comment.