assorted minor changes

This commit is contained in:
Oscar Beaumont 2022-09-09 07:57:35 +08:00
parent c972928161
commit b6a2c98ae5
3 changed files with 18 additions and 11 deletions

View file

@ -126,7 +126,7 @@ impl Node {
&str, /* Content-Type */
Vec<u8>, /* Body */
) {
match path.get(0).copied() {
match path.first().copied() {
Some("thumbnail") => {
if path.len() != 2 {
return (

View file

@ -2,6 +2,8 @@ import { RSPCError, createReactQueryHooks } from '@rspc/client';
import { LibraryArgs, Operations } from '@sd/core';
import {
QueryClient,
UseInfiniteQueryOptions,
UseInfiniteQueryResult,
UseMutationOptions,
UseMutationResult,
UseQueryOptions,
@ -51,6 +53,21 @@ export function useLibraryQuery<K extends LibraryQueryKey>(
);
}
export function useInfiniteLibraryQuery<K extends LibraryQueryKey>(
key: LibraryQueryArgs<K> extends null | undefined ? [K] : [K, LibraryQueryArgs<K>],
options?: UseInfiniteQueryOptions<LibraryQueryResult<K>, RSPCError>
): UseInfiniteQueryResult<LibraryQueryResult<K>, RSPCError> {
const { library } = useCurrentLibrary();
if (!library?.uuid) throw new Error(`Attempted to do library query with no library set!`);
// @ts-ignore
return rspc.useInfiniteQuery(
// @ts-ignore
[key[0], { library_id: library?.uuid || '', arg: key[1] || null }],
options
);
}
type LibraryMutations = Extract<Operations['mutations'], { key: [string, LibraryArgs<any>] }>;
type LibraryMutation<K extends LibraryMutationKey> = Extract<LibraryMutations, { key: [K, any] }>;
type LibraryMutationKey = LibraryMutations['key'][0];

View file

@ -148,16 +148,6 @@ export const OverviewScreen = () => {
<div className="flex w-full">
{/* STAT CONTAINER */}
<div className="flex -mb-1 overflow-hidden">
{!libraryStatistics && (
<div className="mb-2 ml-2">
<div className="font-semibold text-gray-200">
<ExclamationCircleIcon className="inline w-4 h-4 mr-1 -mt-1 " /> Missing library
</div>
<span className="text-xs text-gray-400 ">
Ensure the library you have loaded still exists on disk
</span>
</div>
)}
{Object.entries(overviewStats).map(([key, value]) => {
if (!displayableStatItems.includes(key)) return null;