mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-12-05 04:35:11 -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,7 +27,6 @@ export const EntryContext = ({
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Menu
|
||||
Trigger={IconButton}
|
||||
icon={MoreVert}
|
||||
@ -52,7 +51,6 @@ export const EntryContext = ({
|
||||
href={`/entries/${slug}/info`}
|
||||
/>
|
||||
</Menu>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@ -87,7 +85,6 @@ export const ItemContext = ({
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<Menu
|
||||
Trigger={IconButton}
|
||||
icon={MoreVert}
|
||||
@ -141,6 +138,5 @@ export const ItemContext = ({
|
||||
</>
|
||||
)}
|
||||
</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,
|
||||
{
|
||||
export const Input = ({
|
||||
placeholderTextColor,
|
||||
variant = "small",
|
||||
right,
|
||||
containerStyle,
|
||||
ref,
|
||||
...props
|
||||
}: {
|
||||
variant?: "small" | "big";
|
||||
right?: ReactNode;
|
||||
containerStyle?: YoshikiEnhanced<ViewStyle>;
|
||||
} & TextInputProps
|
||||
>(function Input(
|
||||
{ placeholderTextColor, variant = "small", right, containerStyle, ...props },
|
||||
ref,
|
||||
) {
|
||||
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