2.2 KiB
2.2 KiB
description
| description |
|---|
| Add subtitles to Genres and Specials |
Implementation Plan - Add Subtitles to Genres and Specials
The goal is to add a subtitle field to both Genre and Special models, allowing administrators to provide descriptions. These subtitles will be displayed as tooltips on the homepage.
1. Database Schema Changes
- Modify
prisma/schema.prisma:- Add
subtitle String?to theGenremodel. - Add
subtitle String?to theSpecialmodel.
- Add
- Create a migration:
npx prisma migrate dev --name add_subtitles
2. Backend API Updates
- Update
app/api/genres/route.ts:- Update
POSTto acceptsubtitle. - Add
PUTmethod to allow updating genre name and subtitle.
- Update
- Update
app/api/specials/route.ts:- Update
POSTto acceptsubtitle. - Update
PUTto acceptsubtitle.
- Update
3. Admin UI Updates
- Update
app/admin/page.tsx:- Genres:
- Update the "Add Genre" form to include an input for
subtitle. - Add an "Edit" button for each genre.
- Implement a form/modal to edit genre name and subtitle.
- Display the subtitle in the list of genres.
- Update the "Add Genre" form to include an input for
- Specials:
- Update the "Create Special" form to include an input for
subtitle. - Update the "Edit Special" form (in the conditional rendering) to include
subtitle.
- Update the "Create Special" form to include an input for
- Genres:
- Update
app/admin/specials/[id]/page.tsx:- Update the display to show the subtitle under the title.
4. Frontend Updates
- Update
app/page.tsx:- Fetch
subtitlefor genres and specials (already covered byfindMany). - Add a tooltip to the links.
- For
Linkcomponents, we can use thetitleattribute for a native tooltip, or build a custom CSS tooltip. The user asked for "gut lesbarer Tooltip" (readable tooltip). Nativetitleis often small and delayed. A custom CSS tooltip (using a group/hover pattern) would be better. - I will implement a simple CSS-based tooltip component or style.
- For
- Fetch
5. Verification
- Verify database migration.
- Verify creating a genre with a subtitle.
- Verify creating/editing a special with a subtitle.
- Verify tooltips on the homepage.