Implement manual metadata refresh

This commit is contained in:
Zoe Roux
2026-03-27 17:46:55 +01:00
parent 59187a024b
commit 93bc58a2d0
6 changed files with 122 additions and 29 deletions
+17 -16
View File
@@ -1,11 +1,12 @@
// import Download from "@material-symbols/svg-400/rounded/download.svg";
import Refresh from "@material-symbols/svg-400/rounded/autorenew.svg";
import Info from "@material-symbols/svg-400/rounded/info.svg";
import MoreVert from "@material-symbols/svg-400/rounded/more_vert.svg";
import MovieInfo from "@material-symbols/svg-400/rounded/movie_info.svg";
import type { ComponentProps } from "react";
import { useTranslation } from "react-i18next";
import { WatchStatusV } from "~/models";
import { IconButton, Menu, tooltip } from "~/primitives";
import { HR, IconButton, Menu, tooltip } from "~/primitives";
import { useAccount } from "~/providers/account-context";
import { useMutation } from "~/query";
import { cn } from "~/utils";
@@ -89,11 +90,11 @@ export const ItemContext = ({
invalidate: [kind, slug],
});
// const metadataRefreshMutation = useMutation({
// method: "POST",
// path: [kind, slug, "refresh"],
// invalidate: null,
// });
const metadataRefreshMutation = useMutation({
method: "POST",
path: ["scanner", `${kind}s`, slug, "refresh"],
invalidate: null,
});
return (
<Menu
@@ -139,16 +140,16 @@ export const ItemContext = ({
/>
</>
)}
{/* {account?.isAdmin === true && ( */}
{/* <> */}
{/* <HR /> */}
{/* <Menu.Item */}
{/* label={t("home.refreshMetadata")} */}
{/* icon={Refresh} */}
{/* onSelect={() => metadataRefreshMutation.mutate()} */}
{/* /> */}
{/* </> */}
{/* )} */}
{account?.isAdmin === true && (
<>
<HR />
<Menu.Item
label={t("home.refreshMetadata")}
icon={Refresh}
onSelect={() => metadataRefreshMutation.mutate()}
/>
</>
)}
</Menu>
);
};