mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-12-04 12:15:12 -05:00
Fix some typescript issues
This commit is contained in:
parent
0ea10c4024
commit
69673d92f0
@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
|
||||
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"formatWithErrors": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Platform, View } from "react-native";
|
||||
import { View } from "react-native";
|
||||
import {
|
||||
percent,
|
||||
rem,
|
||||
@ -8,14 +8,11 @@ import {
|
||||
type Theme,
|
||||
useYoshiki,
|
||||
} from "yoshiki/native";
|
||||
import { EntryContext } from "~/components/items/context-menus";
|
||||
import { ItemProgress } from "~/components/items/item-grid";
|
||||
import type { KImage, WatchStatusV } from "~/models";
|
||||
import type { KImage } from "~/models";
|
||||
import {
|
||||
focusReset,
|
||||
Image,
|
||||
ImageBackground,
|
||||
important,
|
||||
Link,
|
||||
P,
|
||||
Skeleton,
|
||||
@ -31,7 +28,7 @@ export const EntryBox = ({
|
||||
thumbnail,
|
||||
href,
|
||||
watchedPercent,
|
||||
watchedStatus,
|
||||
// watchedStatus,
|
||||
...props
|
||||
}: Stylable & {
|
||||
slug: string;
|
||||
@ -42,7 +39,7 @@ export const EntryBox = ({
|
||||
href: string;
|
||||
thumbnail: KImage | null;
|
||||
watchedPercent: number | null;
|
||||
watchedStatus: WatchStatusV | null;
|
||||
// watchedStatus: WatchStatusV | null;
|
||||
}) => {
|
||||
const [moreOpened, setMoreOpened] = useState(false);
|
||||
const { css } = useYoshiki("episodebox");
|
||||
@ -89,27 +86,27 @@ export const EntryBox = ({
|
||||
layout={{ width: percent(100), aspectRatio: 16 / 9 }}
|
||||
{...(css("poster") as any)}
|
||||
>
|
||||
{(watchedPercent || watchedStatus === "completed") && (
|
||||
<ItemProgress watchPercent={watchedPercent ?? 100} />
|
||||
)}
|
||||
<EntryContext
|
||||
slug={slug}
|
||||
serieSlug={serieSlug}
|
||||
status={watchedStatus}
|
||||
isOpen={moreOpened}
|
||||
setOpen={(v) => setMoreOpened(v)}
|
||||
{...css([
|
||||
{
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
right: 0,
|
||||
bg: (theme) => theme.darkOverlay,
|
||||
},
|
||||
"more",
|
||||
Platform.OS === "web" &&
|
||||
moreOpened && { display: important("flex") },
|
||||
])}
|
||||
/>
|
||||
{/* {(watchedPercent || watchedStatus === "completed") && ( */}
|
||||
{/* <ItemProgress watchPercent={watchedPercent ?? 100} /> */}
|
||||
{/* )} */}
|
||||
{/* <EntryContext */}
|
||||
{/* slug={slug} */}
|
||||
{/* serieSlug={serieSlug} */}
|
||||
{/* status={watchedStatus} */}
|
||||
{/* isOpen={moreOpened} */}
|
||||
{/* setOpen={(v) => setMoreOpened(v)} */}
|
||||
{/* {...css([ */}
|
||||
{/* { */}
|
||||
{/* position: "absolute", */}
|
||||
{/* top: 0, */}
|
||||
{/* right: 0, */}
|
||||
{/* bg: (theme) => theme.darkOverlay, */}
|
||||
{/* }, */}
|
||||
{/* "more", */}
|
||||
{/* Platform.OS === "web" && */}
|
||||
{/* moreOpened && { display: important("flex") }, */}
|
||||
{/* ])} */}
|
||||
{/* /> */}
|
||||
</ImageBackground>
|
||||
<P {...css([{ marginY: 0, textAlign: "center" }, "title"])}>
|
||||
{name ?? t("show.episodeNoMetadata")}
|
||||
|
||||
@ -12,7 +12,7 @@ import { HR, IconButton, Menu, tooltip } from "~/primitives";
|
||||
import { useAccount } from "~/providers/account-context";
|
||||
import { useMutation } from "~/query";
|
||||
import { watchListIcon } from "./watchlist-info";
|
||||
// import { useDownloader } from "../../packages/ui/src/downloadses/ui/src/downloads";
|
||||
// import { useDownloader } from "../../packages/ui/src/downloads/ui/src/downloads";
|
||||
|
||||
export const EntryContext = ({
|
||||
slug,
|
||||
@ -27,32 +27,30 @@ export const EntryContext = ({
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Menu
|
||||
Trigger={IconButton}
|
||||
icon={MoreVert}
|
||||
{...tooltip(t("misc.more"))}
|
||||
{...(css([Platform.OS !== "web" && { display: "none" }], props) as any)}
|
||||
>
|
||||
{serieSlug && (
|
||||
<Menu.Item
|
||||
label={t("home.episodeMore.goToShow")}
|
||||
icon={Info}
|
||||
href={`/series/${serieSlug}`}
|
||||
/>
|
||||
)}
|
||||
{/* <Menu.Item */}
|
||||
{/* label={t("home.episodeMore.download")} */}
|
||||
{/* icon={Download} */}
|
||||
{/* onSelect={() => downloader(type, slug)} */}
|
||||
{/* /> */}
|
||||
<Menu
|
||||
Trigger={IconButton}
|
||||
icon={MoreVert}
|
||||
{...tooltip(t("misc.more"))}
|
||||
{...(css([Platform.OS !== "web" && { display: "none" }], props) as any)}
|
||||
>
|
||||
{serieSlug && (
|
||||
<Menu.Item
|
||||
label={t("home.episodeMore.mediainfo")}
|
||||
icon={MovieInfo}
|
||||
href={`/entries/${slug}/info`}
|
||||
label={t("home.episodeMore.goToShow")}
|
||||
icon={Info}
|
||||
href={`/series/${serieSlug}`}
|
||||
/>
|
||||
</Menu>
|
||||
</>
|
||||
)}
|
||||
{/* <Menu.Item */}
|
||||
{/* label={t("home.episodeMore.download")} */}
|
||||
{/* icon={Download} */}
|
||||
{/* onSelect={() => downloader(type, slug)} */}
|
||||
{/* /> */}
|
||||
<Menu.Item
|
||||
label={t("home.episodeMore.mediainfo")}
|
||||
icon={MovieInfo}
|
||||
href={`/entries/${slug}/info`}
|
||||
/>
|
||||
</Menu>
|
||||
);
|
||||
};
|
||||
|
||||
@ -87,60 +85,58 @@ export const ItemContext = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Menu
|
||||
Trigger={IconButton}
|
||||
icon={MoreVert}
|
||||
{...tooltip(t("misc.more"))}
|
||||
{...(css([Platform.OS !== "web" && { display: "none" }], props) as any)}
|
||||
<Menu
|
||||
Trigger={IconButton}
|
||||
icon={MoreVert}
|
||||
{...tooltip(t("misc.more"))}
|
||||
{...(css([Platform.OS !== "web" && { display: "none" }], props) as any)}
|
||||
>
|
||||
<Menu.Sub
|
||||
label={account ? t("show.watchlistEdit") : t("show.watchlistLogin")}
|
||||
disabled={!account}
|
||||
icon={watchListIcon(status)}
|
||||
>
|
||||
<Menu.Sub
|
||||
label={account ? t("show.watchlistEdit") : t("show.watchlistLogin")}
|
||||
disabled={!account}
|
||||
icon={watchListIcon(status)}
|
||||
>
|
||||
{Object.values(WatchStatusV).map((x) => (
|
||||
<Menu.Item
|
||||
key={x}
|
||||
label={t(
|
||||
`show.watchlistMark.${x.toLowerCase() as Lowercase<WatchStatusV>}`,
|
||||
)}
|
||||
onSelect={() => mutation.mutate(x)}
|
||||
selected={x === status}
|
||||
/>
|
||||
))}
|
||||
{status !== null && (
|
||||
<Menu.Item
|
||||
label={t("show.watchlistMark.null")}
|
||||
onSelect={() => mutation.mutate(null)}
|
||||
/>
|
||||
)}
|
||||
</Menu.Sub>
|
||||
{kind === "movie" && (
|
||||
<>
|
||||
{/* <Menu.Item */}
|
||||
{/* label={t("home.episodeMore.download")} */}
|
||||
{/* icon={Download} */}
|
||||
{/* onSelect={() => downloader(type, slug)} */}
|
||||
{/* /> */}
|
||||
<Menu.Item
|
||||
label={t("home.episodeMore.mediainfo")}
|
||||
icon={MovieInfo}
|
||||
href={`/movies/${slug}/info`}
|
||||
/>
|
||||
</>
|
||||
{Object.values(WatchStatusV).map((x) => (
|
||||
<Menu.Item
|
||||
key={x}
|
||||
label={t(
|
||||
`show.watchlistMark.${x.toLowerCase() as Lowercase<WatchStatusV>}`,
|
||||
)}
|
||||
onSelect={() => mutation.mutate(x)}
|
||||
selected={x === status}
|
||||
/>
|
||||
))}
|
||||
{status !== null && (
|
||||
<Menu.Item
|
||||
label={t("show.watchlistMark.null")}
|
||||
onSelect={() => mutation.mutate(null)}
|
||||
/>
|
||||
)}
|
||||
{account?.isAdmin === true && (
|
||||
<>
|
||||
<HR />
|
||||
<Menu.Item
|
||||
label={t("home.refreshMetadata")}
|
||||
icon={Refresh}
|
||||
onSelect={() => metadataRefreshMutation.mutate()}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Menu>
|
||||
</>
|
||||
</Menu.Sub>
|
||||
{kind === "movie" && (
|
||||
<>
|
||||
{/* <Menu.Item */}
|
||||
{/* label={t("home.episodeMore.download")} */}
|
||||
{/* icon={Download} */}
|
||||
{/* onSelect={() => downloader(type, slug)} */}
|
||||
{/* /> */}
|
||||
<Menu.Item
|
||||
label={t("home.episodeMore.mediainfo")}
|
||||
icon={MovieInfo}
|
||||
href={`/movies/${slug}/info`}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{account?.isAdmin === true && (
|
||||
<>
|
||||
<HR />
|
||||
<Menu.Item
|
||||
label={t("home.refreshMetadata")}
|
||||
icon={Refresh}
|
||||
onSelect={() => metadataRefreshMutation.mutate()}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Menu>
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import Done from "@material-symbols/svg-400/rounded/check-fill.svg";
|
||||
import { View } from "react-native";
|
||||
import { max, rem, useYoshiki } from "yoshiki/native";
|
||||
import { WatchStatusV } from "~/models";
|
||||
import type { WatchStatusV } from "~/models";
|
||||
import { Icon, P, ts } from "~/primitives";
|
||||
|
||||
export const ItemWatchStatus = ({
|
||||
@ -14,8 +14,7 @@ export const ItemWatchStatus = ({
|
||||
}) => {
|
||||
const { css } = useYoshiki();
|
||||
|
||||
if (watchStatus !== WatchStatusV.Completed && !unseenEpisodesCount)
|
||||
return null;
|
||||
if (watchStatus !== "completed" && !unseenEpisodesCount) return null;
|
||||
|
||||
return (
|
||||
<View
|
||||
@ -36,7 +35,7 @@ export const ItemWatchStatus = ({
|
||||
props,
|
||||
)}
|
||||
>
|
||||
{watchStatus === WatchStatusV.Completed ? (
|
||||
{watchStatus === "completed" ? (
|
||||
<Icon icon={Done} size={16} />
|
||||
) : (
|
||||
<P
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import { z } from "zod";
|
||||
import { User } from "./user";
|
||||
|
||||
// TODO: actually parse the token
|
||||
const TokenP = z.string();
|
||||
|
||||
export const AccountP = User.and(
|
||||
z.object({
|
||||
token: TokenP,
|
||||
|
||||
@ -4,7 +4,6 @@ import { Genre } from "./utils/genre";
|
||||
import { KImage } from "./utils/images";
|
||||
import { Metadata } from "./utils/metadata";
|
||||
import { zdate } from "./utils/utils";
|
||||
import { EmbeddedVideo } from "./video-embed";
|
||||
|
||||
export const Movie = z
|
||||
.object({
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { forwardRef, type ReactNode, useState } from "react";
|
||||
import { type ReactNode, type Ref, useState } from "react";
|
||||
import {
|
||||
TextInput,
|
||||
type TextInputProps,
|
||||
@ -6,20 +6,22 @@ import {
|
||||
type ViewStyle,
|
||||
} from "react-native";
|
||||
import { px, type Theme, useYoshiki } from "yoshiki/native";
|
||||
import type { YoshikiEnhanced } from "./image/base-image";
|
||||
import type { YoshikiEnhanced } from "./image";
|
||||
import { focusReset, ts } from "./utils";
|
||||
|
||||
export const Input = forwardRef<
|
||||
TextInput,
|
||||
{
|
||||
variant?: "small" | "big";
|
||||
right?: ReactNode;
|
||||
containerStyle?: YoshikiEnhanced<ViewStyle>;
|
||||
} & TextInputProps
|
||||
>(function Input(
|
||||
{ placeholderTextColor, variant = "small", right, containerStyle, ...props },
|
||||
export const Input = ({
|
||||
placeholderTextColor,
|
||||
variant = "small",
|
||||
right,
|
||||
containerStyle,
|
||||
ref,
|
||||
) {
|
||||
...props
|
||||
}: {
|
||||
variant?: "small" | "big";
|
||||
right?: ReactNode;
|
||||
containerStyle?: YoshikiEnhanced<ViewStyle>;
|
||||
ref?: Ref<TextInput>;
|
||||
} & TextInputProps) => {
|
||||
const [focused, setFocused] = useState(false);
|
||||
const { css, theme } = useYoshiki();
|
||||
|
||||
@ -64,4 +66,4 @@ export const Input = forwardRef<
|
||||
{right}
|
||||
</View>
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
@ -69,10 +69,11 @@ export const VolumeSlider = ({ player, ...props }: { player: VideoPlayer }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [volume, setVolume] = useState(player.volume);
|
||||
useEvent(player, "onVolumeChange", setVolume);
|
||||
// TODO: listen to `player.muted` changes (currently hook does not exists
|
||||
// const [muted, setMuted] = useState(player.muted);
|
||||
const muted = player.muted;
|
||||
const [muted, setMuted] = useState(player.muted);
|
||||
useEvent(player, "onVolumeChange", (info) => {
|
||||
setVolume(info.volume);
|
||||
setMuted(info.muted);
|
||||
});
|
||||
|
||||
return (
|
||||
<View
|
||||
|
||||
@ -62,7 +62,7 @@ export const TouchControls = ({
|
||||
}}
|
||||
onDoublePress={(e) => {
|
||||
if (!isTouch) {
|
||||
player.toggleFullscreen();
|
||||
// player.toggleFullscreen();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user