refactor: replace genre with tags in frontend TypeScript

- Add fetchTagValues() function in bookshelf.ts
- Update custom-section-builder field id from "genre" to "tags"
- Genre code preserved as comments for easy restoration if needed
- collection-rules.ts already supports both genre and tags

Updates the frontend TypeScript to use tags instead of genre for filtering.
Genre code is preserved in comments for future use if the genre field
is populated.

Relates to IMPLEMENTATION_TAGS_FILTER.md Phase 4
This commit is contained in:
2026-03-25 20:38:21 -04:00
parent b16ee343f8
commit 4ea110cfeb
2 changed files with 33 additions and 5 deletions
+8 -3
View File
@@ -294,11 +294,16 @@ Alpine.data("bookshelf", () => ({
await this.fetchFieldValues("author", input.value, "author-datalist");
},
// Fetch genre values for autocomplete
async fetchGenreValues(input: HTMLInputElement): Promise<void> {
await this.fetchFieldValues("genre", input.value, "genre-datalist");
// Fetch tag values for autocomplete
async fetchTagValues(input: HTMLInputElement): Promise<void> {
await this.fetchFieldValues("tags", input.value, "tags-datalist");
},
// // Fetch genre values for autocomplete
// async fetchGenreValues(input: HTMLInputElement): Promise<void> {
// await this.fetchFieldValues("genre", input.value, "genre-datalist");
// },
// Fetch series values for autocomplete
async fetchSeriesValues(input: HTMLInputElement): Promise<void> {
await this.fetchFieldValues("series", input.value, "series-datalist");
+25 -2
View File
@@ -45,9 +45,32 @@ const FILTER_FIELDS: FilterField[] = [
],
valueType: "text",
},
// {
// id: "genre",
// label: "Genre",
// operators: [
// { id: "equals", label: "Equals", requiresValue: true },
// { id: "not_equals", label: "Not Equals", requiresValue: true },
// { id: "in", label: "In", requiresValue: true },
// { id: "not_in", label: "Not In", requiresValue: true },
// ],
// valueType: "select",
// options: [
// "Fiction",
// "Non-Fiction",
// "Sci-Fi",
// "Fantasy",
// "Mystery",
// "Romance",
// "Thriller",
// "Biography",
// "History",
// "Self-Help",
// ],
// },
{
id: "genre",
label: "Genre",
id: "tags",
label: "Tags",
operators: [
{ id: "equals", label: "Equals", requiresValue: true },
{ id: "not_equals", label: "Not Equals", requiresValue: true },