Simplify medioinfo popup

This commit is contained in:
Zoe Roux 2024-01-22 18:14:02 +01:00
parent 53ac4a2050
commit 992b64df8a

View File

@ -18,7 +18,7 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>. * along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Audio, Subtitle, WatchInfo, WatchInfoP } from "@kyoo/models"; import { Audio, QueryIdentifier, Subtitle, WatchInfo, WatchInfoP } from "@kyoo/models";
import { Button, HR, P, Popup, Skeleton } from "@kyoo/primitives"; import { Button, HR, P, Popup, Skeleton } from "@kyoo/primitives";
import { Fetch } from "../fetch"; import { Fetch } from "../fetch";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -108,23 +108,24 @@ export const MediaInfoPopup = ({
mediaType: "episode" | "movie"; mediaType: "episode" | "movie";
mediaSlug: string; mediaSlug: string;
}) => { }) => {
const y = useYoshiki(); const { css } = useYoshiki();
const mediaInfoQuery = { const mediaInfoQuery = {
path: ["video", mediaType, mediaSlug, "info"], path: ["video", mediaType, mediaSlug, "info"],
parser: WatchInfoP, parser: WatchInfoP,
}; };
return ( return (
<Popup> <Popup>
{() => (
<>
<ScrollView> <ScrollView>
<Fetch query={mediaInfoQuery}> <Fetch query={MediaInfoPopup.query(mediaType, mediaSlug)}>
{(mediaInfo) => <MediaInfoTable mediaInfo={mediaInfo} />} {(mediaInfo) => <MediaInfoTable mediaInfo={mediaInfo} />}
</Fetch> </Fetch>
</ScrollView> </ScrollView>
<Button text="OK" onPress={() => close()} /> <Button text="OK" onPress={() => close()} />
</>
)}
</Popup> </Popup>
); );
}; };
MediaInfoPopup.query = (mediaType: string, mediaSlug: string): QueryIdentifier<WatchInfo> => ({
path: ["video", mediaType, mediaSlug, "info"],
parser: WatchInfoP,
});