diff options
author | JayZed <[email protected]> | 2024-07-08 17:33:43 -0400 |
---|---|---|
committer | JayZed <[email protected]> | 2024-07-08 17:33:43 -0400 |
commit | 4cc6806193127f9d6d3f2dab26969471d9bbf159 (patch) | |
tree | bfc90e4b55fa0f48f83e51c4e5947c1f7d7d7a2d /frontend/src/pages/Movies/index.tsx | |
parent | d875dc7733c901246881325ee3a84fe5d44b10b9 (diff) | |
parent | 5886c20c9c7929bf46836a99c2d9d4eb834638bd (diff) | |
download | bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.tar.gz bazarr-4cc6806193127f9d6d3f2dab26969471d9bbf159.zip |
Merge branch 'development' of https://github.com/morpheus65535/bazarr into development
Diffstat (limited to 'frontend/src/pages/Movies/index.tsx')
-rw-r--r-- | frontend/src/pages/Movies/index.tsx | 103 |
1 files changed, 62 insertions, 41 deletions
diff --git a/frontend/src/pages/Movies/index.tsx b/frontend/src/pages/Movies/index.tsx index dd9f531e1..0429e1fdd 100644 --- a/frontend/src/pages/Movies/index.tsx +++ b/frontend/src/pages/Movies/index.tsx @@ -1,3 +1,11 @@ +import { FunctionComponent, useMemo } from "react"; +import { Link } from "react-router-dom"; +import { Anchor, Badge, Container } from "@mantine/core"; +import { useDocumentTitle } from "@mantine/hooks"; +import { faBookmark as farBookmark } from "@fortawesome/free-regular-svg-icons"; +import { faBookmark, faWrench } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { ColumnDef } from "@tanstack/react-table"; import { useMovieModification, useMoviesPagination } from "@/apis/hooks"; import { Action } from "@/components"; import { AudioList } from "@/components/bazarr"; @@ -6,68 +14,84 @@ import LanguageProfileName from "@/components/bazarr/LanguageProfile"; import { ItemEditModal } from "@/components/forms/ItemEditForm"; import { useModals } from "@/modules/modals"; import ItemView from "@/pages/views/ItemView"; -import { useTableStyles } from "@/styles"; import { BuildKey } from "@/utilities"; -import { faBookmark as farBookmark } from "@fortawesome/free-regular-svg-icons"; -import { faBookmark, faWrench } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { Anchor, Badge, Container } from "@mantine/core"; -import { useDocumentTitle } from "@mantine/hooks"; -import { FunctionComponent, useMemo } from "react"; -import { Link } from "react-router-dom"; -import { Column } from "react-table"; const MovieView: FunctionComponent = () => { + const modifyMovie = useMovieModification(); + + const modals = useModals(); + const query = useMoviesPagination(); - const columns: Column<Item.Movie>[] = useMemo<Column<Item.Movie>[]>( + const columns = useMemo<ColumnDef<Item.Movie>[]>( () => [ { - accessor: "monitored", - Cell: ({ value }) => ( + id: "monitored", + cell: ({ + row: { + original: { monitored }, + }, + }) => ( <FontAwesomeIcon - title={value ? "monitored" : "unmonitored"} - icon={value ? faBookmark : farBookmark} + title={monitored ? "monitored" : "unmonitored"} + icon={monitored ? faBookmark : farBookmark} ></FontAwesomeIcon> ), }, { - Header: "Name", - accessor: "title", - Cell: ({ row, value }) => { - const { classes } = useTableStyles(); - const target = `/movies/${row.original.radarrId}`; + header: "Name", + accessorKey: "title", + cell: ({ + row: { + original: { title, radarrId }, + }, + }) => { + const target = `/movies/${radarrId}`; return ( - <Anchor className={classes.primary} component={Link} to={target}> - {value} + <Anchor className="table-primary" component={Link} to={target}> + {title} </Anchor> ); }, }, { - Header: "Audio", - accessor: "audio_language", - Cell: ({ value }) => { - return <AudioList audios={value}></AudioList>; + header: "Audio", + accessorKey: "audio_language", + cell: ({ + row: { + original: { audio_language: audioLanguage }, + }, + }) => { + return <AudioList audios={audioLanguage}></AudioList>; }, }, { - Header: "Languages Profile", - accessor: "profileId", - Cell: ({ value }) => { + header: "Languages Profile", + accessorKey: "profileId", + cell: ({ + row: { + original: { profileId }, + }, + }) => { return ( - <LanguageProfileName index={value} empty=""></LanguageProfileName> + <LanguageProfileName + index={profileId} + empty="" + ></LanguageProfileName> ); }, }, { - Header: "Missing Subtitles", - accessor: "missing_subtitles", - Cell: (row) => { - const missing = row.value; + header: "Missing Subtitles", + accessorKey: "missing_subtitles", + cell: ({ + row: { + original: { missing_subtitles: missingSubtitles }, + }, + }) => { return ( <> - {missing.map((v) => ( + {missingSubtitles.map((v) => ( <Badge mr="xs" color="yellow" @@ -81,20 +105,17 @@ const MovieView: FunctionComponent = () => { }, }, { - accessor: "radarrId", - Cell: ({ row }) => { - const modals = useModals(); - const mutation = useMovieModification(); + id: "radarrId", + cell: ({ row }) => { return ( <Action label="Edit Movie" tooltip={{ position: "left" }} - variant="light" onClick={() => modals.openContextModal( ItemEditModal, { - mutation, + mutation: modifyMovie, item: row.original, }, { @@ -108,7 +129,7 @@ const MovieView: FunctionComponent = () => { }, }, ], - [], + [modals, modifyMovie], ); useDocumentTitle("Movies - Bazarr"); |