mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -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 { useYoshiki, px, Stylable } from "yoshiki/native";
|
||||||
import { Icon } from "./icons";
|
import { Icon } from "./icons";
|
||||||
import AccountCircle from "@material-symbols/svg-400/rounded/account_circle-fill.svg";
|
import AccountCircle from "@material-symbols/svg-400/rounded/account_circle-fill.svg";
|
||||||
|
import { YoshikiStyle } from "yoshiki/dist/type";
|
||||||
|
|
||||||
export const Avatar = ({
|
export const Avatar = ({
|
||||||
src,
|
src,
|
||||||
@ -30,25 +31,36 @@ export const Avatar = ({
|
|||||||
size = px(24),
|
size = px(24),
|
||||||
color,
|
color,
|
||||||
isLoading = false,
|
isLoading = false,
|
||||||
|
fill = false,
|
||||||
...props
|
...props
|
||||||
}: {
|
}: {
|
||||||
src?: string | null;
|
src?: string | null;
|
||||||
alt?: string;
|
alt?: string;
|
||||||
size?: number;
|
size?: YoshikiStyle<number | string>;
|
||||||
color?: string;
|
color?: string;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
|
fill?: boolean;
|
||||||
} & Stylable) => {
|
} & Stylable) => {
|
||||||
const { css, theme } = useYoshiki();
|
const { css, theme } = useYoshiki();
|
||||||
|
const col = color ?? theme.overlay0;
|
||||||
|
|
||||||
console.log(color)
|
// TODO: Support dark themes when fill === true
|
||||||
return (
|
return (
|
||||||
<View
|
<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 ? (
|
{src || isLoading ? (
|
||||||
<Image src={src} alt={alt} layout={{ width: size, height: size }} />
|
<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>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ComponentProps, ComponentType } from "react";
|
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 { SvgProps } from "react-native-svg";
|
||||||
import { YoshikiStyle } from "yoshiki/dist/type";
|
import { YoshikiStyle } from "yoshiki/dist/type";
|
||||||
import { Pressable, px, useYoshiki } from "yoshiki/native";
|
import { Pressable, px, useYoshiki } from "yoshiki/native";
|
||||||
@ -28,12 +28,24 @@ import { ts } from "./utils";
|
|||||||
type IconProps = {
|
type IconProps = {
|
||||||
icon: ComponentType<SvgProps>;
|
icon: ComponentType<SvgProps>;
|
||||||
color: YoshikiStyle<string>;
|
color: YoshikiStyle<string>;
|
||||||
size?: number | string;
|
size?: YoshikiStyle<number | string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Icon = ({ icon: Icon, color, size = 24, ...props }: IconProps) => {
|
export const Icon = ({ icon: Icon, color, size = 24, ...props }: IconProps) => {
|
||||||
const { css } = useYoshiki();
|
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,>({
|
export const IconButton = <AsProps = PressableProps,>({
|
||||||
|
@ -18,35 +18,4 @@
|
|||||||
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Movie, MovieP, QueryIdentifier, QueryPage } from "@kyoo/models";
|
export { MovieDetails } from "./movie";
|
||||||
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;
|
|
||||||
|
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 (
|
return (
|
||||||
<Link href={slug ? `/person/${slug}` : ""} {...props}>
|
<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>
|
<Skeleton>{isLoading || <P {...css({ textAlign: "center" })}>{name}</P>}</Skeleton>
|
||||||
{(isLoading || role) && (
|
{(isLoading || role) && (
|
||||||
<Skeleton>{isLoading || <SubP {...css({ textAlign: "center" })}>{role}</SubP>}</Skeleton>
|
<Skeleton>{isLoading || <SubP {...css({ textAlign: "center" })}>{role}</SubP>}</Skeleton>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user