Fix typesd

This commit is contained in:
Zoe Roux 2024-01-25 16:40:30 +01:00
parent a56c06ca33
commit 085d337fb7
5 changed files with 12 additions and 14 deletions

View File

@ -197,6 +197,7 @@ export const WatchInfoP = z
// from https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string // from https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string
const humanFileSize = (size: number): string => { const humanFileSize = (size: number): string => {
var i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024)); var i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
// @ts-ignore I'm not gonna fix stackoverflow's working code.
return (size / Math.pow(1024, i)).toFixed(2) * 1 + " " + ["B", "kB", "MB", "GB", "TB"][i]; return (size / Math.pow(1024, i)).toFixed(2) * 1 + " " + ["B", "kB", "MB", "GB", "TB"][i];
}; };

View File

@ -18,7 +18,6 @@
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>. * along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { ComponentProps } from "react";
import { View } from "react-native"; import { View } from "react-native";
import FImage from "react-native-fast-image"; import FImage from "react-native-fast-image";
@ -36,8 +35,8 @@ export const FastImage = ({
}: { }: {
src: string; src: string;
alt: string; alt: string;
width: number | string; width: number;
height: number | string; height: number;
x: number; x: number;
y: number; y: number;
rows: number; rows: number;

View File

@ -27,4 +27,4 @@ export const tooltip = (tooltip: string, up?: boolean) => ({
}); });
import type { Tooltip as RTooltip } from "react-tooltip"; import type { Tooltip as RTooltip } from "react-tooltip";
export declare const Tooltip: RTooltip; export const Tooltip: typeof RTooltip = (() => null) as any;

View File

@ -127,7 +127,7 @@ export const TouchControls = ({
<IconButton <IconButton
icon={SkipPrevious} icon={SkipPrevious}
as={Link} as={Link}
href={previousSlug} href={previousSlug!}
replace replace
size={ts(4)} size={ts(4)}
{...css([!previousSlug && { opacity: 0, pointerEvents: "none" }], common)} {...css([!previousSlug && { opacity: 0, pointerEvents: "none" }], common)}
@ -141,7 +141,7 @@ export const TouchControls = ({
<IconButton <IconButton
icon={SkipNext} icon={SkipNext}
as={Link} as={Link}
href={nextSlug} href={nextSlug!}
replace replace
size={ts(4)} size={ts(4)}
{...css([!nextSlug && { opacity: 0, pointerEvents: "none" }], common)} {...css([!nextSlug && { opacity: 0, pointerEvents: "none" }], common)}

View File

@ -19,16 +19,14 @@
*/ */
import { useFetch, QueryIdentifier, imageFn, Chapter } from "@kyoo/models"; import { useFetch, QueryIdentifier, imageFn, Chapter } from "@kyoo/models";
import { FastImage, P, Tooltip, imageBorderRadius, tooltip, ts } from "@kyoo/primitives"; import { FastImage, P, imageBorderRadius, ts } from "@kyoo/primitives";
import { Platform, View } from "react-native"; import { View } from "react-native";
import { percent, useYoshiki, px, vh, Theme } from "yoshiki/native"; import { percent, useYoshiki, px, Theme } from "yoshiki/native";
import { ErrorView } from "../../fetch"; import { ErrorView } from "../../fetch";
import { ComponentProps, useEffect, useMemo } from "react"; import { useMemo } from "react";
import { CssObject } from "yoshiki/src/web/generator";
import { useAtomValue } from "jotai"; import { useAtomValue } from "jotai";
import { durationAtom, playAtom, progressAtom } from "../state"; import { durationAtom, progressAtom } from "../state";
import { toTimerString } from "./left-buttons"; import { toTimerString } from "./left-buttons";
import { useSetAtom } from "jotai";
type Thumb = { type Thumb = {
from: number; from: number;
@ -89,7 +87,7 @@ export const useScrubber = (url: string) => {
columns: Math.max(...info.map((x) => x.x)) / last.width + 1, columns: Math.max(...info.map((x) => x.x)) / last.width + 1,
width: last.width, width: last.width,
height: last.height, height: last.height,
} }
: null, : null,
} as const; } as const;
}; };