From 1b40c5f76694a79595d62bdffe149d5df799fed7 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 14 Mar 2026 19:26:56 +0100 Subject: [PATCH] Add video mapping modal for movies --- .../movies/{[slug].tsx => [slug]/index.tsx} | 0 front/src/app/(app)/movies/[slug]/videos.tsx | 5 + .../src/ui/admin/videos-modal/movie-modal.tsx | 135 ++++++++++++++++++ front/src/ui/details/header.tsx | 3 +- 4 files changed, 142 insertions(+), 1 deletion(-) rename front/src/app/(app)/movies/{[slug].tsx => [slug]/index.tsx} (100%) create mode 100644 front/src/app/(app)/movies/[slug]/videos.tsx create mode 100644 front/src/ui/admin/videos-modal/movie-modal.tsx diff --git a/front/src/app/(app)/movies/[slug].tsx b/front/src/app/(app)/movies/[slug]/index.tsx similarity index 100% rename from front/src/app/(app)/movies/[slug].tsx rename to front/src/app/(app)/movies/[slug]/index.tsx diff --git a/front/src/app/(app)/movies/[slug]/videos.tsx b/front/src/app/(app)/movies/[slug]/videos.tsx new file mode 100644 index 00000000..2d7ea977 --- /dev/null +++ b/front/src/app/(app)/movies/[slug]/videos.tsx @@ -0,0 +1,5 @@ +import { MovieVideosModal } from "~/ui/admin/videos-modal/movie-modal"; + +export { ErrorBoundary } from "~/ui/error-boundary"; + +export default MovieVideosModal; diff --git a/front/src/ui/admin/videos-modal/movie-modal.tsx b/front/src/ui/admin/videos-modal/movie-modal.tsx new file mode 100644 index 00000000..1404eff1 --- /dev/null +++ b/front/src/ui/admin/videos-modal/movie-modal.tsx @@ -0,0 +1,135 @@ +import Close from "@material-symbols/svg-400/rounded/close-fill.svg"; +import LibraryAdd from "@material-symbols/svg-400/rounded/library_add-fill.svg"; +import { useTranslation } from "react-i18next"; +import { View } from "react-native"; +import { FullVideo, type Movie } from "~/models"; +import { + Button, + ComboBox, + IconButton, + Modal, + P, + Skeleton, + tooltip, +} from "~/primitives"; +import { useFetch, useMutation } from "~/query"; +import { useQueryState } from "~/utils"; +import { Header } from "../../details/header"; + +const MoviePathItem = ({ + id, + path, + movieSlug, +}: { + id: string; + path: string; + movieSlug: string; +}) => { + const { t } = useTranslation(); + const { mutateAsync } = useMutation({ + method: "PUT", + path: ["api", "videos", "link"], + compute: (videoId: string) => ({ + body: [{ id: videoId, for: [] }], + }), + invalidate: ["api", "movies", movieSlug], + }); + + return ( + + + { + await mutateAsync(id); + }} + {...tooltip(t("videos-map.delete"))} + /> +

{path}

+
+
+ ); +}; + +MoviePathItem.Loader = () => { + return ( + + + + + + + ); +}; + +const AddMovieVideoFooter = ({ slug }: { slug: string }) => { + const { t } = useTranslation(); + const { mutateAsync } = useMutation({ + method: "PUT", + path: ["api", "videos", "link"], + compute: (videoId: string) => ({ + body: [{ id: videoId, for: [{ movie: slug }] }], + }), + invalidate: ["api", "movies", slug], + }); + + return ( + ( +