Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update mangas categories change + fix lightswitch warping #242

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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