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
const humanFileSize = (size: number): string => {
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];
};

View File

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

View File

@ -27,4 +27,4 @@ export const tooltip = (tooltip: string, up?: boolean) => ({
});
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
icon={SkipPrevious}
as={Link}
href={previousSlug}
href={previousSlug!}
replace
size={ts(4)}
{...css([!previousSlug && { opacity: 0, pointerEvents: "none" }], common)}
@ -141,7 +141,7 @@ export const TouchControls = ({
<IconButton
icon={SkipNext}
as={Link}
href={nextSlug}
href={nextSlug!}
replace
size={ts(4)}
{...css([!nextSlug && { opacity: 0, pointerEvents: "none" }], common)}

View File

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