Skip to content

Commit

Permalink
Merge pull request #242 from Suwayomi/main
Browse files Browse the repository at this point in the history
update mangas categories change + fix lightswitch warping
  • Loading branch information
Robonau authored Nov 16, 2024
2 parents 8d7ca49 + 99a6dea commit 30b251d
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 352 deletions.
10 changes: 5 additions & 5 deletions src/lib/components/lightswitch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
height?: CssClasses;
ring?: CssClasses;
rounded?: CssClasses;
class?: CssClasses;
[key: string]: unknown;
}
let {
bgLight = 'bg-surface-50',
bgDark = 'bg-surface-900',
fillLight = 'fill-surface-50',
fillDark = 'fill-surface-900',
width = 'w-12',
height = 'h-6',
width = 'w-16',
height = 'h-8',
ring = 'ring-[1px] ring-surface-500/30',
rounded = 'rounded-token',
class: className
...rest
}: Props = $props();
const cTransition = `transition-all duration-[200ms]`;
Expand All @@ -49,7 +49,7 @@
let thumbPosition = $derived(!gmState.value.dark ? 'translate-x-[100%]' : '');
// Reactive
let classesTrack = $derived(
`cursor-pointer ${cTransition} ${width} ${height} ${ring} ${rounded} ${trackBg} ${className ?? ''}`
`cursor-pointer ${cTransition} ${width} ${height} ${ring} ${rounded} ${trackBg} ${rest.class ?? ''}`
);
let classesThumb = $derived(
`aspect-square scale-[0.8] flex justify-center items-center ${cTransition} ${height} ${rounded} ${thumbBg} ${thumbPosition}`
Expand Down
3 changes: 3 additions & 0 deletions src/lib/gql/Fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export const MangaTypeFragment = graphql(
fetchedAt
id
}
chapters {
totalCount
}
latestUploadedChapter {
uploadDate
id
Expand Down
34 changes: 6 additions & 28 deletions src/lib/gql/Mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,41 +485,19 @@ export const updateMangasCategories = graphql(
$addTo: [Int!] = null
$clear: Boolean = null
$id: [Int!]!
$removeFrom: [Int!] = null
) {
updateMangasCategories(
input: {
ids: $id
patch: { addToCategories: $addTo, clearCategories: $clear }
}
) {
mangas {
id
categories {
nodes {
id
}
patch: {
addToCategories: $addTo
clearCategories: $clear
removeFromCategories: $removeFrom
}
}
}
}
`,
[]
);

export const updateMangaCategories = graphql(
`
mutation updateMangaCategories(
$addTo: [Int!] = null
$clear: Boolean = null
$id: Int!
) {
updateMangaCategories(
input: {
id: $id
patch: { addToCategories: $addTo, clearCategories: $clear }
}
) {
manga {
mangas {
id
categories {
nodes {
Expand Down
41 changes: 3 additions & 38 deletions src/lib/gql/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import {
MangaTypeFragment,
PreferenceFragment,
SourceTypeFragment,
TrackerTypeFragment,
TrackRecordTypeFragment
TrackerTypeFragment
} from './Fragments';
import { graphql } from './graphql';

Expand All @@ -36,47 +35,13 @@ export const getCategory = graphql(
id
mangas {
nodes {
id
title
inLibrary
thumbnailUrl
unreadCount
downloadCount
latestFetchedChapter {
fetchedAt
id
}
latestUploadedChapter {
uploadDate
id
}
lastReadChapter {
lastReadAt
id
}
chapters {
totalCount
}
artist
author
description
genre
status
source {
displayName
id
}
trackRecords {
nodes {
...TrackRecordTypeFragment
}
}
...MangaTypeFragment
}
}
}
}
`,
[TrackRecordTypeFragment]
[MangaTypeFragment]
);

export const getManga = graphql(
Expand Down
Loading

0 comments on commit 30b251d

Please sign in to comment.