Tag select refactor (#4478)

* Add interface to load tags by id
* Use minimal data for tag select queries
* Center image/text in select list
* Overhaul tag select
* Support excludeIds. Comment out image in dropdown
* Replace existing selects
* Remove unused code
* Fix styling of aliases
This commit is contained in:
WithoutPants
2024-01-24 20:24:13 +11:00
committed by GitHub
parent dd8da7f339
commit 723211a620
21 changed files with 543 additions and 249 deletions

View File

@@ -344,7 +344,22 @@ export const queryFindTags = (filter: ListFilterModel) =>
},
});
export const useAllTagsForFilter = () => GQL.useAllTagsForFilterQuery();
export const queryFindTagsByIDForSelect = (tagIDs: number[]) =>
client.query<GQL.FindTagsForSelectQuery>({
query: GQL.FindTagsForSelectDocument,
variables: {
ids: tagIDs,
},
});
export const queryFindTagsForSelect = (filter: ListFilterModel) =>
client.query<GQL.FindTagsForSelectQuery>({
query: GQL.FindTagsForSelectDocument,
variables: {
filter: filter.makeFindFilter(),
tag_filter: filter.makeFilter(),
},
});
export const useFindSavedFilter = (id: string) =>
GQL.useFindSavedFilterQuery({
@@ -1598,8 +1613,6 @@ export const useTagCreate = () =>
const tag = result.data?.tagCreate;
if (!tag) return;
appendObject(cache, tag, GQL.AllTagsForFilterDocument);
// update stats
updateStats(cache, "tag_count", 1);