import { faWrench } from "@fortawesome/free-solid-svg-icons"; import React, { FunctionComponent, useMemo } from "react"; import { Badge, ProgressBar } from "react-bootstrap"; import { Link } from "react-router-dom"; import { Column } from "react-table"; import { seriesUpdateAll, seriesUpdateByRange } from "../../@redux/actions"; import { useLanguageProfiles, useSerieEntities } from "../../@redux/hooks"; import { useReduxAction } from "../../@redux/hooks/base"; import { SeriesApi } from "../../apis"; import { ActionBadge } from "../../components"; import { BuildKey } from "../../utilities"; import BaseItemView from "../generic/BaseItemView"; interface Props {} const SeriesView: FunctionComponent = () => { const series = useSerieEntities(); const loader = useReduxAction(seriesUpdateByRange); const profiles = useLanguageProfiles(); const columns: Column[] = useMemo[]>( () => [ { Header: "Name", accessor: "title", className: "text-nowrap", Cell: ({ row, value, isSelecting: select }) => { if (select) { return value; } else { const target = `/series/${row.original.sonarrSeriesId}`; return ( {value} ); } }, }, { Header: "Audio", accessor: "audio_language", Cell: (row) => { return row.value.map((v) => ( {v.name} )); }, }, { Header: "Languages Profile", accessor: "profileId", Cell: ({ value }) => { return profiles?.find((v) => v.profileId === value)?.name ?? null; }, }, { Header: "Episodes", accessor: "episodeFileCount", selectHide: true, Cell: (row) => { const { episodeFileCount, episodeMissingCount, profileId } = row.row.original; let progress = 0; let label = ""; if (episodeFileCount === 0 || !profileId) { progress = 0.0; } else { progress = episodeFileCount - episodeMissingCount; label = `${ episodeFileCount - episodeMissingCount }/${episodeFileCount}`; } const color = episodeMissingCount === 0 ? "primary" : "warning"; return ( ); }, }, { accessor: "sonarrSeriesId", selectHide: true, Cell: ({ row, update }) => ( { update && update(row, "edit"); }} > ), }, ], [profiles] ); return ( SeriesApi.modify(form)} > ); }; export default SeriesView;