diff --git a/front/packages/primitives/src/avatar.tsx b/front/packages/primitives/src/avatar.tsx index 5735b3f9..6f477402 100644 --- a/front/packages/primitives/src/avatar.tsx +++ b/front/packages/primitives/src/avatar.tsx @@ -19,7 +19,7 @@ */ import { View, ViewStyle } from "react-native"; -import { Image } from "./image"; +import { Image, ImageProps } from "./image"; import { useYoshiki, px, Stylable } from "yoshiki/native"; import { Icon } from "./icons"; import { P } from "./text"; @@ -46,7 +46,8 @@ const stringToColor = (string: string) => { export const Avatar = forwardRef< View, { - src?: string | null; + src?: ImageProps["src"]; + quality?: ImageProps["quality"]; alt?: string; size?: YoshikiStyle; placeholder?: string; @@ -56,7 +57,18 @@ export const Avatar = forwardRef< as?: ComponentType<{ style?: ViewStyle } & RefAttributes>; } & Stylable >(function Avatar( - { src, alt, size = px(24), color, placeholder, isLoading = false, fill = false, as, ...props }, + { + src, + quality = "low", + alt, + size = px(24), + color, + placeholder, + isLoading = false, + fill = false, + as, + ...props + }, ref, ) { const { css, theme } = useYoshiki(); @@ -87,7 +99,13 @@ export const Avatar = forwardRef< )} > {src || isLoading ? ( - {alt} + {alt} ) : placeholder ? (

= Style extends any } : never; -type WithLoading = (T & { isLoading?: false }) | (Partial & { isLoading: true }); +type WithLoading = (T & { isLoading?: boolean }) | (Partial & { isLoading: true }); export type Props = WithLoading<{ src?: KyooImage | null; diff --git a/front/packages/primitives/src/image/image.tsx b/front/packages/primitives/src/image/image.tsx index 70bd2e4f..d5e1a061 100644 --- a/front/packages/primitives/src/image/image.tsx +++ b/front/packages/primitives/src/image/image.tsx @@ -59,6 +59,7 @@ export const Image = ({ ); } + quality ??= "high"; return ( {state !== "finished" && ( @@ -69,7 +70,10 @@ export const Image = ({ /> )} setState("finished")} onError={() => setState("errored")} diff --git a/front/packages/primitives/src/image/image.web.tsx b/front/packages/primitives/src/image/image.web.tsx index b2e54f29..7803dd0f 100644 --- a/front/packages/primitives/src/image/image.web.tsx +++ b/front/packages/primitives/src/image/image.web.tsx @@ -73,7 +73,6 @@ export const Image = ({ // To reproduce view's behavior position: "relative", boxSizing: "border-box", - borderStyle: "solid", overflow: "hidden", // Use a blurhash here to nicely fade the NextImage when it is loaded completly @@ -82,17 +81,15 @@ export const Image = ({ backgroundSize: "cover", backgroundRepeat: "no-repeat", backgroundPosition: "50% 50%", - - // Use the layout's size and display the rounded border - width: (layout as any).width, - height: (layout as any).height, - aspectRatio: (layout as any).aspectRatio, }} - // Gather classnames from props (to support parent's hover for example). - {...wCss({ ...border, borderRadius: "6px" }, { className: extractClassNames(props) })} + {...wCss([layout as any, { ...border, borderRadius: "6px" }], { + // Gather classnames from props (to support parent's hover for example). + className: extractClassNames(props), + })} > theme.background, borderWidth: px(4), + borderStyle: "solid", }, }, fover: { diff --git a/front/packages/ui/src/details/header.tsx b/front/packages/ui/src/details/header.tsx index 640d0845..2445fb53 100644 --- a/front/packages/ui/src/details/header.tsx +++ b/front/packages/ui/src/details/header.tsx @@ -18,7 +18,15 @@ * along with Kyoo. If not, see . */ -import { Movie, QueryIdentifier, Show, getDisplayDate, Genre, Studio, KyooImage } from "@kyoo/models"; +import { + Movie, + QueryIdentifier, + Show, + getDisplayDate, + Genre, + Studio, + KyooImage, +} from "@kyoo/models"; import { Container, H1, @@ -108,7 +116,7 @@ const TitleLine = ({ width: { xs: percent(50), md: percent(25) }, }} {...css({ - maxWidth: { xs: px(175), sm: Platform.OS === "web" ? "unset" as any : 99999999 }, + maxWidth: { xs: px(175), sm: Platform.OS === "web" ? ("unset" as any) : 99999999 }, flexShrink: 0, })} /> @@ -121,18 +129,38 @@ const TitleLine = ({ flexGrow: 1, })} > -

({ xs: theme.user.heading, md: theme.heading }), - })}> +

{isLoading || ( <> -

{name}

- {date &&

({date})

} +

({ xs: theme.user.heading, md: theme.heading }), + })} + > + {name} +

+ {date && ( +

({ + xs: theme.user.paragraph, + md: theme.paragraph, + }), + })} + > + {" "} + ({date}) +

+ )} )} @@ -267,25 +295,23 @@ const Description = ({ ))}

- - + + {isLoading || ( -

- {overview ?? t("show.noOverview")} -

+

{overview ?? t("show.noOverview")}

)}
- -

{t("show.tags")}:

+ +

{t("show.tags")}:

{(isLoading ? [...Array(3)] : tags!).map((tag, i) => ( - + ))}