mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
appease the knip
This commit is contained in:
parent
84ffd36071
commit
715dd983b0
@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* Comparator function for sorting dates in ascending order
|
|
||||||
*/
|
|
||||||
export const dateComparator = (a: string, b: string) => {
|
|
||||||
const dateA = new Date(a);
|
|
||||||
const dateB = new Date(b);
|
|
||||||
|
|
||||||
// sort in ascending order
|
|
||||||
if (dateA > dateB) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (dateA < dateB) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
};
|
|
@ -1,5 +1,5 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetBoardImagesTotalQuery } from 'services/api/endpoints/boards';
|
import { useGetBoardAssetsTotalQuery, useGetBoardImagesTotalQuery } from 'services/api/endpoints/boards';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
board_id: string;
|
board_id: string;
|
||||||
@ -12,7 +12,7 @@ export const BoardTotalsTooltip = ({ board_id }: Props) => {
|
|||||||
return { imagesTotal: data?.total ?? 0 };
|
return { imagesTotal: data?.total ?? 0 };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { assetsTotal } = useGetBoardImagesTotalQuery(board_id, {
|
const { assetsTotal } = useGetBoardAssetsTotalQuery(board_id, {
|
||||||
selectFromResult: ({ data }) => {
|
selectFromResult: ({ data }) => {
|
||||||
return { assetsTotal: data?.total ?? 0 };
|
return { assetsTotal: data?.total ?? 0 };
|
||||||
},
|
},
|
||||||
|
@ -4,8 +4,6 @@ import type { O } from 'ts-toolbelt';
|
|||||||
|
|
||||||
export type S = components['schemas'];
|
export type S = components['schemas'];
|
||||||
|
|
||||||
export type ImageCache = EntityState<ImageDTO, string>;
|
|
||||||
|
|
||||||
export type ListImagesArgs = NonNullable<paths['/api/v1/images/']['get']['parameters']['query']>;
|
export type ListImagesArgs = NonNullable<paths['/api/v1/images/']['get']['parameters']['query']>;
|
||||||
export type ListImagesResponse = paths['/api/v1/images/']['get']['responses']['200']['content']['application/json'];
|
export type ListImagesResponse = paths['/api/v1/images/']['get']['responses']['200']['content']['application/json'];
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { dateComparator } from 'common/util/dateComparator';
|
|
||||||
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
|
import { ASSETS_CATEGORIES, IMAGE_CATEGORIES } from 'features/gallery/store/types';
|
||||||
import queryString from 'query-string';
|
import queryString from 'query-string';
|
||||||
import { buildV1Url } from 'services/api';
|
import { buildV1Url } from 'services/api';
|
||||||
@ -12,18 +11,6 @@ export const getCategories = (imageDTO: ImageDTO) => {
|
|||||||
return ASSETS_CATEGORIES;
|
return ASSETS_CATEGORIES;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const imageListDefaultSort = () => {
|
|
||||||
return (a: ImageDTO, b: ImageDTO) => {
|
|
||||||
if (a.starred && !b.starred) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (!a.starred && b.starred) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return dateComparator(b.created_at, a.created_at);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
// Helper to create the url for the listImages endpoint. Also we use it to create the cache key.
|
// Helper to create the url for the listImages endpoint. Also we use it to create the cache key.
|
||||||
export const getListImagesUrl = (queryArgs: ListImagesArgs) =>
|
export const getListImagesUrl = (queryArgs: ListImagesArgs) =>
|
||||||
buildV1Url(`images/?${queryString.stringify(queryArgs, { arrayFormat: 'none' })}`);
|
buildV1Url(`images/?${queryString.stringify(queryArgs, { arrayFormat: 'none' })}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user