mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Movie cleanup
This commit is contained in:
parent
4347df0b9b
commit
de06c7f81f
@ -23,6 +23,7 @@ import { Image } from "./image";
|
||||
import { useYoshiki, px, Stylable } from "yoshiki/native";
|
||||
import { Icon } from "./icons";
|
||||
import AccountCircle from "@material-symbols/svg-400/rounded/account_circle-fill.svg";
|
||||
import { YoshikiStyle } from "yoshiki/dist/type";
|
||||
|
||||
export const Avatar = ({
|
||||
src,
|
||||
@ -30,25 +31,36 @@ export const Avatar = ({
|
||||
size = px(24),
|
||||
color,
|
||||
isLoading = false,
|
||||
fill = false,
|
||||
...props
|
||||
}: {
|
||||
src?: string | null;
|
||||
alt?: string;
|
||||
size?: number;
|
||||
size?: YoshikiStyle<number | string>;
|
||||
color?: string;
|
||||
isLoading?: boolean;
|
||||
fill?: boolean;
|
||||
} & Stylable) => {
|
||||
const { css, theme } = useYoshiki();
|
||||
const col = color ?? theme.overlay0;
|
||||
|
||||
console.log(color)
|
||||
// TODO: Support dark themes when fill === true
|
||||
return (
|
||||
<View
|
||||
{...css({ borderRadius: size / 2, width: size, height: size, overflow: "hidden" }, props)}
|
||||
{...css(
|
||||
[
|
||||
{ borderRadius: 999999, width: size, height: size, overflow: "hidden" },
|
||||
fill && {
|
||||
bg: col,
|
||||
},
|
||||
],
|
||||
props,
|
||||
)}
|
||||
>
|
||||
{src || isLoading ? (
|
||||
<Image src={src} alt={alt} layout={{ width: size, height: size }} />
|
||||
) : (
|
||||
<Icon icon={AccountCircle} size={size} color={color ?? theme.overlay0} />
|
||||
<Icon icon={AccountCircle} size={size} color={fill ? col : theme.colors.white} />
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentProps, ComponentType } from "react";
|
||||
import { PressableProps, ViewStyle } from "react-native";
|
||||
import { Platform, PressableProps, ViewStyle } from "react-native";
|
||||
import { SvgProps } from "react-native-svg";
|
||||
import { YoshikiStyle } from "yoshiki/dist/type";
|
||||
import { Pressable, px, useYoshiki } from "yoshiki/native";
|
||||
@ -28,12 +28,24 @@ import { ts } from "./utils";
|
||||
type IconProps = {
|
||||
icon: ComponentType<SvgProps>;
|
||||
color: YoshikiStyle<string>;
|
||||
size?: number | string;
|
||||
size?: YoshikiStyle<number | string>;
|
||||
};
|
||||
|
||||
export const Icon = ({ icon: Icon, color, size = 24, ...props }: IconProps) => {
|
||||
const { css } = useYoshiki();
|
||||
return <Icon width={size} height={size} {...css({ fill: color } as ViewStyle, props)} />;
|
||||
const computed = css({ width: size, height: size, fill: color } as ViewStyle, props);
|
||||
return (
|
||||
<Icon
|
||||
{...Platform.select<SvgProps>({
|
||||
web: computed,
|
||||
default: {
|
||||
height: computed.style?.height,
|
||||
width: computed.style?.width,
|
||||
...computed,
|
||||
},
|
||||
})}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const IconButton = <AsProps = PressableProps,>({
|
||||
|
@ -18,35 +18,4 @@
|
||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Movie, MovieP, QueryIdentifier, QueryPage } from "@kyoo/models";
|
||||
import { Platform, ScrollView } from "react-native";
|
||||
import { useYoshiki } from "yoshiki/native";
|
||||
import { TransparentLayout } from "../layout";
|
||||
import { Header } from "./header";
|
||||
import { Staff } from "./staff";
|
||||
|
||||
const query = (slug: string): QueryIdentifier<Movie> => ({
|
||||
parser: MovieP,
|
||||
path: ["shows", slug],
|
||||
params: {
|
||||
fields: ["genres", "studio"],
|
||||
},
|
||||
});
|
||||
|
||||
export const MovieDetails: QueryPage<{ slug: string }> = ({ slug }) => {
|
||||
const { css } = useYoshiki();
|
||||
|
||||
return (
|
||||
<ScrollView {...css(Platform.OS === "web" && { overflow: "overlay" as any })}>
|
||||
<Header slug={slug} query={query(slug)} />
|
||||
<Staff slug={slug} />
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
MovieDetails.getFetchUrls = ({ slug }) => [
|
||||
query(slug),
|
||||
// ShowStaff.query(slug),
|
||||
];
|
||||
|
||||
MovieDetails.getLayout = TransparentLayout;
|
||||
export { MovieDetails } from "./movie";
|
||||
|
51
front/packages/ui/src/details/movie.tsx
Normal file
51
front/packages/ui/src/details/movie.tsx
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 { Movie, MovieP, QueryIdentifier, QueryPage } from "@kyoo/models";
|
||||
import { Platform, ScrollView } from "react-native";
|
||||
import { useYoshiki } from "yoshiki/native";
|
||||
import { TransparentLayout } from "../layout";
|
||||
import { Header } from "./header";
|
||||
|
||||
const query = (slug: string): QueryIdentifier<Movie> => ({
|
||||
parser: MovieP,
|
||||
path: ["shows", slug],
|
||||
params: {
|
||||
fields: ["genres", "studio"],
|
||||
},
|
||||
});
|
||||
|
||||
export const MovieDetails: QueryPage<{ slug: string }> = ({ slug }) => {
|
||||
const { css } = useYoshiki();
|
||||
|
||||
return (
|
||||
<ScrollView {...css(Platform.OS === "web" && { overflow: "overlay" as any })}>
|
||||
<Header slug={slug} query={query(slug)} />
|
||||
{/* <Staff slug={slug} /> */}
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
MovieDetails.getFetchUrls = ({ slug }) => [
|
||||
query(slug),
|
||||
// ShowStaff.query(slug),
|
||||
];
|
||||
|
||||
MovieDetails.getLayout = TransparentLayout;
|
@ -39,7 +39,7 @@ export const PersonAvatar = ({
|
||||
|
||||
return (
|
||||
<Link href={slug ? `/person/${slug}` : ""} {...props}>
|
||||
<Avatar src={poster} alt={name} size={PersonAvatar.width} />
|
||||
<Avatar src={poster} alt={name} size={PersonAvatar.width} fill />
|
||||
<Skeleton>{isLoading || <P {...css({ textAlign: "center" })}>{name}</P>}</Skeleton>
|
||||
{(isLoading || role) && (
|
||||
<Skeleton>{isLoading || <SubP {...css({ textAlign: "center" })}>{role}</SubP>}</Skeleton>
|
||||
|
Loading…
x
Reference in New Issue
Block a user