From 977398c8518c63f459751537a5228629cbe1d5d9 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 7 Jul 2025 23:46:11 +0200 Subject: [PATCH] Fix invalid images url --- front/src/primitives/chip.tsx | 17 +++++++++++------ front/src/primitives/container.tsx | 20 -------------------- front/src/primitives/index.ts | 4 ++-- front/src/providers/account-context.tsx | 2 +- front/src/providers/account-provider.tsx | 2 +- front/src/query/query.tsx | 1 - front/src/ui/details/header.tsx | 10 +--------- front/src/ui/login/logic.tsx | 2 +- 8 files changed, 17 insertions(+), 41 deletions(-) diff --git a/front/src/primitives/chip.tsx b/front/src/primitives/chip.tsx index ba955356..cc797430 100644 --- a/front/src/primitives/chip.tsx +++ b/front/src/primitives/chip.tsx @@ -1,5 +1,5 @@ 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 { Skeleton } from "./skeleton"; import { P } from "./text"; @@ -19,8 +19,8 @@ export const Chip = ({ color?: string; size?: "small" | "medium" | "large"; outline?: boolean; - label?: string; - href?: string; + label: string; + href: string; replace?: boolean; target?: string; textProps?: TextProps; @@ -72,13 +72,14 @@ export const Chip = ({ { marginVertical: 0, fontSize: rem(0.8), - color: (theme: Theme) => (outline ? theme.contrast : theme.alternate.contrast), + color: (theme: Theme) => + outline ? theme.contrast : theme.alternate.contrast, }, ], textProps, )} > - {label ? capitalize(label) : } + {capitalize(label)}

); @@ -89,7 +90,11 @@ Chip.Loader = ({ size = "medium", outline = false, ...props -}: { color?: string; size?: "small" | "medium" | "large"; outline?: boolean }) => { +}: { + color?: string; + size?: "small" | "medium" | "large"; + outline?: boolean; +}) => { const { css } = useYoshiki(); const sizeMult = size === "medium" ? 1 : size === "small" ? 0.5 : 1.5; diff --git a/front/src/primitives/container.tsx b/front/src/primitives/container.tsx index f7602a2f..d1935e0a 100644 --- a/front/src/primitives/container.tsx +++ b/front/src/primitives/container.tsx @@ -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 . - */ - import type { ComponentType } from "react"; import { View, type ViewProps } from "react-native"; import { percent, px, useYoshiki } from "yoshiki/native"; diff --git a/front/src/primitives/index.ts b/front/src/primitives/index.ts index 0c282f64..3fb521b0 100644 --- a/front/src/primitives/index.ts +++ b/front/src/primitives/index.ts @@ -8,7 +8,7 @@ export * from "./image"; export * from "./image-background"; export * from "./skeleton"; export * from "./tooltip"; -// export * from "./container"; +export * from "./container"; export * from "./divider"; // export * from "./progress"; // export * from "./slider"; @@ -19,6 +19,6 @@ export * from "./menu"; // export * from "./select"; export * from "./input"; export * from "./button"; -// export * from "./chip"; +export * from "./chip"; export * from "./utils"; diff --git a/front/src/providers/account-context.tsx b/front/src/providers/account-context.tsx index 2357d44d..b17cf594 100644 --- a/front/src/providers/account-context.tsx +++ b/front/src/providers/account-context.tsx @@ -6,7 +6,7 @@ export const AccountContext = createContext<{ authToken: string | null; selectedAccount: Account | null; accounts: (Account & { select: () => void; remove: () => void })[]; -}>({ apiUrl: "/", authToken: null, selectedAccount: null, accounts: [] }); +}>({ apiUrl: "", authToken: null, selectedAccount: null, accounts: [] }); export const useToken = () => { const { apiUrl, authToken } = useContext(AccountContext); diff --git a/front/src/providers/account-provider.tsx b/front/src/providers/account-provider.tsx index 35fbab84..71971b92 100644 --- a/front/src/providers/account-provider.tsx +++ b/front/src/providers/account-provider.tsx @@ -15,7 +15,7 @@ export const AccountProvider = ({ children }: { children: ReactNode }) => { const ret = useMemo(() => { const acc = accounts.find((x) => x.selected); return { - apiUrl: acc?.apiUrl ?? "/", + apiUrl: acc?.apiUrl ?? "", authToken: acc?.token ?? null, selectedAccount: acc ?? null, accounts: accounts.map((account) => ({ diff --git a/front/src/query/query.tsx b/front/src/query/query.tsx index fc0dc5cf..8167a53c 100644 --- a/front/src/query/query.tsx +++ b/front/src/query/query.tsx @@ -30,7 +30,6 @@ export const queryFn = async (context: { parser: Parser | null; signal?: AbortSignal; }): Promise> => { - console.log(context.url); if ( Platform.OS === "web" && typeof window === "undefined" && diff --git a/front/src/ui/details/header.tsx b/front/src/ui/details/header.tsx index ce29d95e..5382a4da 100644 --- a/front/src/ui/details/header.tsx +++ b/front/src/ui/details/header.tsx @@ -22,15 +22,7 @@ import { } from "yoshiki/native"; import { WatchListInfo } from "~/components/items/watchlist-info"; import { Rating } from "~/components/rating"; -import { - type Genre, - type KImage, - Movie, - Serie, - Show, - type Studio, - type WatchStatusV, -} from "~/models"; +import { type Genre, type KImage, Show, type WatchStatusV } from "~/models"; import { A, Chip, diff --git a/front/src/ui/login/logic.tsx b/front/src/ui/login/logic.tsx index 13a6fa6e..ec7f3ab8 100644 --- a/front/src/ui/login/logic.tsx +++ b/front/src/ui/login/logic.tsx @@ -20,7 +20,7 @@ export const login = async ( apiUrl: string | null; }, ): Promise> => { - apiUrl ??= "/"; + apiUrl ??= ""; try { const controller = new AbortController(); setTimeout(() => controller.abort(), 5_000);