diff --git a/front/packages/ui/src/admin/scanner.tsx b/front/packages/ui/src/admin/scanner.tsx index 59d0af30..a267a822 100644 --- a/front/packages/ui/src/admin/scanner.tsx +++ b/front/packages/ui/src/admin/scanner.tsx @@ -18,24 +18,44 @@ * along with Kyoo. If not, see . */ -import { Issue, IssueP, QueryIdentifier, useFetch } from "@kyoo/models"; +import { Issue, IssueP, QueryIdentifier, queryFn, useFetch } from "@kyoo/models"; import { useTranslation } from "react-i18next"; import { SettingsContainer } from "../settings/base"; -import { Icon, P, Skeleton, tooltip, ts } from "@kyoo/primitives"; +import { Button, Icon, P, Skeleton, tooltip, ts } from "@kyoo/primitives"; import { ErrorView } from "../errors"; import { z } from "zod"; import { View } from "react-native"; import { useYoshiki } from "yoshiki/native"; import Info from "@material-symbols/svg-400/outlined/info.svg"; +import Scan from "@material-symbols/svg-400/outlined/sensors.svg"; +import { useMutation } from "@tanstack/react-query"; export const Scanner = () => { const { css } = useYoshiki(); const { t } = useTranslation(); const { data, error } = useFetch(Scanner.query()); + const metadataRefreshMutation = useMutation({ + mutationFn: () => + queryFn({ + path: ["rescan"], + method: "POST", + }), + }); + return ( - + } + text={t("admin.scanner.scan")} + onPress={() => metadataRefreshMutation.mutate()} + {...css({ marginBottom: ts(2), })} + /> + } + > <> {error != null ? ( diff --git a/front/packages/ui/src/settings/base.tsx b/front/packages/ui/src/settings/base.tsx index e2bbec68..4c6cfbe0 100644 --- a/front/packages/ui/src/settings/base.tsx +++ b/front/packages/ui/src/settings/base.tsx @@ -88,17 +88,20 @@ export const SettingsContainer = ({ children, title, extra, + extraTop, ...props }: { children: ReactElement | (ReactElement | Falsy)[] | Falsy; title: string; extra?: ReactElement; + extraTop?: ReactElement; }) => { const { css } = useYoshiki(); return (

{title}

+ {extraTop} {({ css }) => (