diff --git a/AGENTS.md b/AGENTS.md index b075289cc..c1c532278 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -238,6 +238,9 @@ Artifact specifications should serve as a source of truth for the feature's life ### Best Practices +- **Use for Every Feature**: For *every* new feature or significant development, start by creating a specification file in today's dated folder. +- **Initialization**: Always run `make` (or `make today`) in the `artifacts/` directory before starting work on a new specification to ensure the correct dated folder exists. +- **Relevant Naming**: Name the specification file according to the task/feature (e.g., `feature_name_specification.md`). - **Update as you go**: The artifact should be updated during implementation if the plan changes. - **Be Specific**: Avoid vague descriptions. If a function is moved to a controller, name the function and the controller. - **Use Tables**: Tables are great for listing files or comparing before/after states. diff --git a/artifacts/2026-02-15/consolidation_badge.md b/artifacts/2026-02-15/consolidation_badge.md new file mode 100644 index 000000000..836fc4e2f --- /dev/null +++ b/artifacts/2026-02-15/consolidation_badge.md @@ -0,0 +1,35 @@ +# Not Consolidated Badge Specification + +## Overview +Add a visual indicator (badge) to the book thumbnail card in listings to identify books that are not "consolidated". Consolidation means the book's folder name matches the standard `Author - Title` format. + +## Requirements +- The badge should only appear if the folder name does not match the sanitized `Author - Title` format. +- Only applicable to Books (not Podcasts). +- Only applicable to library items in folders (not single files). +- The badge should have a descriptive tooltip ("Not Consolidated"). +- The badge should be clearly visible but not obstructive. +- The badge position should account for other status indicators (RSS, shared icon) to avoid overlap. + +## Implementation Details + +### Backend (Server) +- **Model**: `LibraryItem` (`server/models/LibraryItem.js`) +- **Logic**: Added `checkIsNotConsolidated()` which: + 1. Checks if the item is a book folder. + 2. Sanitizes the `Author - Title` name using `sanitizeFilename`. + 3. Compares the sanitized name with the folder's name (`Path.basename(this.path)`). +- **API**: The flag `isNotConsolidated` is included in the JSON response for library items. + +### Frontend (Client) +- **Component**: `LazyBookCard` (`client/components/cards/LazyBookCard.vue`) +- **UI**: Added a folder icon badge with a yellow background (`bg-warning`). +- **Logic**: Toggles visibility based on the `libraryItem.isNotConsolidated` flag. +- **Positioning**: Absolute positioning on the bottom-left side (`bottom: 0.375em`, `left: 0`). + +### View Book Page +- **Component**: `client/pages/item/_id/index.vue` +- **UI (Badge)**: Badge added next to the book title when `isNotConsolidated` is true. +- **UI (Button)**: "Consolidate" button added to the primary action row (after Edit and Mark as Finished). +- **Behavior**: The "Consolidate" button is disabled if the book is already consolidated. +- **Cleanup**: The "Consolidate" option has been removed from the context menu on this page. diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 1703833d2..12649eae6 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -115,6 +115,13 @@
{{ numEpisodesIncomplete }}