feat(frontend): navigate non-library entries to TMDB preview page
- Add TmdbPreviewPage showing TMDB details without adding to library - Display backdrop, poster, title, tagline, genres, rating, storyline - Show season/episode count for TV series - Add "Add to Library" button that creates entry then redirects to details page - Show "Already in Library — View" if entry exists in DB - Add /entry/tmdb/:type/:tmdbId route in router.tsx - Add TmdbPreview type, entriesApi.previewTmdb(), and useTmdbPreview() hook - Update EntryCard to navigate to preview page instead of auto-adding Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
1 parent
25b645a16f
commit
02cdcf733d
18 files changed
+949
-204
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { api } from '@/lib/api';
|
||||
import { normalizeEntry } from '@/lib/normalizers';
|
||||
import type { Entry } from '@/types';
|
||||
import type { Entry, TmdbPreview } from '@/types';
|
||||
|
||||
export const entriesApi = {
|
||||
getAll: () =>
|
||||
@@ -44,6 +44,9 @@ export const entriesApi = {
|
||||
|
||||
syncSeries: () => api.get('/entries/sync-series').then((r) => r.data),
|
||||
|
||||
previewTmdb: (tmdbId: number, type: 'movie' | 'tv') =>
|
||||
api.get<TmdbPreview>(`/entries/tmdb/preview/${type}/${tmdbId}`).then((r) => r.data),
|
||||
|
||||
uploadMedia: (id: number, formData: FormData) =>
|
||||
api
|
||||
.post(`/entries/${id}/media`, formData, {
|
||||
|
||||
@@ -7,6 +7,10 @@ export interface OrphanResult {
|
||||
stills: number;
|
||||
}
|
||||
|
||||
export interface OrphanPeopleResult {
|
||||
count: number;
|
||||
}
|
||||
|
||||
export const maintenanceApi = {
|
||||
scanOrphanFiles: () =>
|
||||
api.get<OrphanResult>('/maintenance/orphan-files').then((r) => r.data),
|
||||
@@ -19,4 +23,10 @@ export const maintenanceApi = {
|
||||
|
||||
deleteOrphanMediaRecords: () =>
|
||||
api.delete<OrphanResult>('/maintenance/orphan-media-records').then((r) => r.data),
|
||||
|
||||
scanOrphanPeople: () =>
|
||||
api.get<OrphanPeopleResult>('/maintenance/orphan-people').then((r) => r.data),
|
||||
|
||||
deleteOrphanPeople: () =>
|
||||
api.delete<OrphanPeopleResult>('/maintenance/orphan-people').then((r) => r.data),
|
||||
};
|
||||
@@ -33,6 +33,12 @@ export const peopleApi = {
|
||||
getTmdbFilmography: (id: number) =>
|
||||
api.get<TmdbFilmographyResponse>(`/people/${id}/tmdb-filmography`).then((r) => r.data),
|
||||
|
||||
fetchByTmdbId: (tmdb_id: number) =>
|
||||
api.post<People>('/people/fetch', { tmdb_id }).then((r) => r.data),
|
||||
fetchByTmdbId: (tmdb_id: number, pinned = false) =>
|
||||
api.post<People>('/people/fetch', { tmdb_id, pinned }).then((r) => r.data),
|
||||
|
||||
update: (id: number, data: Partial<People>) =>
|
||||
api.put<People>(`/people/${id}`, data).then((r) => r.data),
|
||||
|
||||
search: (query: string) =>
|
||||
api.get<People[]>('/people/search', { params: { query } }).then((r) => r.data),
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { api } from '@/lib/api';
|
||||
import type { Season } from '@/types';
|
||||
import type { Season, Episode } from '@/types';
|
||||
|
||||
export const seasonsApi = {
|
||||
getAll: () => api.get<Season[]>('/seasons').then((r) => r.data),
|
||||
@@ -8,7 +8,7 @@ export const seasonsApi = {
|
||||
api.get<Season>(`/seasons/${id}`).then((r) => r.data),
|
||||
|
||||
getEpisodes: (id: number) =>
|
||||
api.get(`/seasons/${id}/episodes`).then((r) => r.data),
|
||||
api.get<Episode[]>(`/seasons/${id}/episodes`).then((r) => r.data),
|
||||
|
||||
create: (data: Partial<Season>) =>
|
||||
api.post<Season>('/seasons', data).then((r) => r.data),
|
||||
|
||||
Reference in new issue
Block a user