Add download option on contextual menues

This commit is contained in:
Zoe Roux 2023-12-15 19:30:52 +01:00
parent 2603c1b29d
commit b51c77dfa7
3 changed files with 13 additions and 2 deletions

View File

@ -23,9 +23,11 @@ import { ComponentProps } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import MoreVert from "@material-symbols/svg-400/rounded/more_vert.svg"; import MoreVert from "@material-symbols/svg-400/rounded/more_vert.svg";
import Info from "@material-symbols/svg-400/rounded/info.svg"; import Info from "@material-symbols/svg-400/rounded/info.svg";
import Download from "@material-symbols/svg-400/rounded/download.svg";
import { WatchStatusV, queryFn, useAccount } from "@kyoo/models"; import { WatchStatusV, queryFn, useAccount } from "@kyoo/models";
import { useMutation, useQueryClient } from "@tanstack/react-query"; import { useMutation, useQueryClient } from "@tanstack/react-query";
import { watchListIcon } from "./watchlist-info"; import { watchListIcon } from "./watchlist-info";
import { downloadFile } from "../downloads/download";
export const EpisodesContext = ({ export const EpisodesContext = ({
type = "episode", type = "episode",
@ -74,6 +76,13 @@ export const EpisodesContext = ({
<Menu.Item label={t("show.watchlistMark.null")} onSelect={() => mutation.mutate(null)} /> <Menu.Item label={t("show.watchlistMark.null")} onSelect={() => mutation.mutate(null)} />
)} )}
</Menu.Sub> </Menu.Sub>
{type !== "show" && (
<Menu.Item
label={t("home.episodeMore.download")}
icon={Download}
onSelect={() => downloadFile(type, slug)}
/>
)}
</Menu> </Menu>
); );
}; };

View File

@ -7,7 +7,8 @@
"none": "No episodes", "none": "No episodes",
"watchlistLogin": "To keep track of what you watched or plan to watch, you need to login.", "watchlistLogin": "To keep track of what you watched or plan to watch, you need to login.",
"episodeMore": { "episodeMore": {
"goToShow": "Go to show" "goToShow": "Go to show",
"download": "Download"
} }
}, },
"show": { "show": {

View File

@ -7,7 +7,8 @@
"none": "Aucun episode", "none": "Aucun episode",
"watchlistLogin": "Pour suivre ce que vous avez regardé ou prévoyez de regarder, vous devez vous connecter.", "watchlistLogin": "Pour suivre ce que vous avez regardé ou prévoyez de regarder, vous devez vous connecter.",
"episodeMore": { "episodeMore": {
"goToShow": "Aller a la serie" "goToShow": "Aller a la serie",
"download": "Télécharger"
} }
}, },
"show": { "show": {