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 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) : <Skeleton {...css({ width: rem(3) })} />}
{capitalize(label)}
</P>
</Link>
);
@ -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;

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 { View, type ViewProps } from "react-native";
import { percent, px, useYoshiki } from "yoshiki/native";

View File

@ -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";

View File

@ -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);

View File

@ -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) => ({

View File

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

View File

@ -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,

View File

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