Fix invalid images url

This commit is contained in:
Zoe Roux 2025-07-07 23:46:11 +02:00
parent a697ffb524
commit 977398c851
No known key found for this signature in database
8 changed files with 17 additions and 41 deletions

View File

@ -1,5 +1,5 @@
import { type TextProps, View } from "react-native"; import { type TextProps, View } from "react-native";
import { type Theme, px, rem, useYoshiki } from "yoshiki/native"; import { px, rem, type Theme, useYoshiki } from "yoshiki/native";
import { Link } from "./links"; import { Link } from "./links";
import { Skeleton } from "./skeleton"; import { Skeleton } from "./skeleton";
import { P } from "./text"; import { P } from "./text";
@ -19,8 +19,8 @@ export const Chip = ({
color?: string; color?: string;
size?: "small" | "medium" | "large"; size?: "small" | "medium" | "large";
outline?: boolean; outline?: boolean;
label?: string; label: string;
href?: string; href: string;
replace?: boolean; replace?: boolean;
target?: string; target?: string;
textProps?: TextProps; textProps?: TextProps;
@ -72,13 +72,14 @@ export const Chip = ({
{ {
marginVertical: 0, marginVertical: 0,
fontSize: rem(0.8), fontSize: rem(0.8),
color: (theme: Theme) => (outline ? theme.contrast : theme.alternate.contrast), color: (theme: Theme) =>
outline ? theme.contrast : theme.alternate.contrast,
}, },
], ],
textProps, textProps,
)} )}
> >
{label ? capitalize(label) : <Skeleton {...css({ width: rem(3) })} />} {capitalize(label)}
</P> </P>
</Link> </Link>
); );
@ -89,7 +90,11 @@ Chip.Loader = ({
size = "medium", size = "medium",
outline = false, outline = false,
...props ...props
}: { color?: string; size?: "small" | "medium" | "large"; outline?: boolean }) => { }: {
color?: string;
size?: "small" | "medium" | "large";
outline?: boolean;
}) => {
const { css } = useYoshiki(); const { css } = useYoshiki();
const sizeMult = size === "medium" ? 1 : size === "small" ? 0.5 : 1.5; const sizeMult = size === "medium" ? 1 : size === "small" ? 0.5 : 1.5;

View File

@ -1,23 +1,3 @@
/*
* Kyoo - A portable and vast media library solution.
* Copyright (c) Kyoo.
*
* See AUTHORS.md and LICENSE file in the project root for full license information.
*
* Kyoo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Kyoo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/
import type { ComponentType } from "react"; import type { ComponentType } from "react";
import { View, type ViewProps } from "react-native"; import { View, type ViewProps } from "react-native";
import { percent, px, useYoshiki } from "yoshiki/native"; import { percent, px, useYoshiki } from "yoshiki/native";

View File

@ -8,7 +8,7 @@ export * from "./image";
export * from "./image-background"; export * from "./image-background";
export * from "./skeleton"; export * from "./skeleton";
export * from "./tooltip"; export * from "./tooltip";
// export * from "./container"; export * from "./container";
export * from "./divider"; export * from "./divider";
// export * from "./progress"; // export * from "./progress";
// export * from "./slider"; // export * from "./slider";
@ -19,6 +19,6 @@ export * from "./menu";
// export * from "./select"; // export * from "./select";
export * from "./input"; export * from "./input";
export * from "./button"; export * from "./button";
// export * from "./chip"; export * from "./chip";
export * from "./utils"; export * from "./utils";

View File

@ -6,7 +6,7 @@ export const AccountContext = createContext<{
authToken: string | null; authToken: string | null;
selectedAccount: Account | null; selectedAccount: Account | null;
accounts: (Account & { select: () => void; remove: () => void })[]; accounts: (Account & { select: () => void; remove: () => void })[];
}>({ apiUrl: "/", authToken: null, selectedAccount: null, accounts: [] }); }>({ apiUrl: "", authToken: null, selectedAccount: null, accounts: [] });
export const useToken = () => { export const useToken = () => {
const { apiUrl, authToken } = useContext(AccountContext); const { apiUrl, authToken } = useContext(AccountContext);

View File

@ -15,7 +15,7 @@ export const AccountProvider = ({ children }: { children: ReactNode }) => {
const ret = useMemo(() => { const ret = useMemo(() => {
const acc = accounts.find((x) => x.selected); const acc = accounts.find((x) => x.selected);
return { return {
apiUrl: acc?.apiUrl ?? "/", apiUrl: acc?.apiUrl ?? "",
authToken: acc?.token ?? null, authToken: acc?.token ?? null,
selectedAccount: acc ?? null, selectedAccount: acc ?? null,
accounts: accounts.map((account) => ({ accounts: accounts.map((account) => ({

View File

@ -30,7 +30,6 @@ export const queryFn = async <Parser extends z.ZodTypeAny>(context: {
parser: Parser | null; parser: Parser | null;
signal?: AbortSignal; signal?: AbortSignal;
}): Promise<z.infer<Parser>> => { }): Promise<z.infer<Parser>> => {
console.log(context.url);
if ( if (
Platform.OS === "web" && Platform.OS === "web" &&
typeof window === "undefined" && typeof window === "undefined" &&

View File

@ -22,15 +22,7 @@ import {
} from "yoshiki/native"; } from "yoshiki/native";
import { WatchListInfo } from "~/components/items/watchlist-info"; import { WatchListInfo } from "~/components/items/watchlist-info";
import { Rating } from "~/components/rating"; import { Rating } from "~/components/rating";
import { import { type Genre, type KImage, Show, type WatchStatusV } from "~/models";
type Genre,
type KImage,
Movie,
Serie,
Show,
type Studio,
type WatchStatusV,
} from "~/models";
import { import {
A, A,
Chip, Chip,

View File

@ -20,7 +20,7 @@ export const login = async (
apiUrl: string | null; apiUrl: string | null;
}, },
): Promise<Result<Account, string>> => { ): Promise<Result<Account, string>> => {
apiUrl ??= "/"; apiUrl ??= "";
try { try {
const controller = new AbortController(); const controller = new AbortController();
setTimeout(() => controller.abort(), 5_000); setTimeout(() => controller.abort(), 5_000);