feat: actor page

This commit is contained in:
Fredrik Burmester
2024-08-23 07:51:36 +02:00
parent ec50a90a32
commit 20739e6e2c
9 changed files with 215 additions and 25 deletions

View File

@@ -5,26 +5,32 @@ import { useState } from "react";
interface Props extends ViewProps {
text?: string | null;
characterLimit?: number;
}
const LIMIT = 140;
export const OverviewText: React.FC<Props> = ({ text, ...props }) => {
const [limit, setLimit] = useState(LIMIT);
export const OverviewText: React.FC<Props> = ({
text,
characterLimit = 140,
...props
}) => {
const [limit, setLimit] = useState(characterLimit);
if (!text) return null;
if (text.length > LIMIT)
if (text.length > characterLimit)
return (
<TouchableOpacity
onPress={() =>
setLimit((prev) => (prev === LIMIT ? text.length : LIMIT))
setLimit((prev) =>
prev === characterLimit ? text.length : characterLimit
)
}
{...props}
>
<View {...props} className="">
<Text>{tc(text, limit)}</Text>
<Text className="text-purple-600 mt-1">
{limit === LIMIT ? "Show more" : "Show less"}
{limit === characterLimit ? "Show more" : "Show less"}
</Text>
</View>
</TouchableOpacity>

View File

@@ -17,7 +17,7 @@ import { Loader } from "../Loader";
import { Text } from "./Text";
interface HorizontalScrollProps
extends Omit<FlashListProps<BaseItemDto>, "renderItem" | "data"> {
extends Omit<FlashListProps<BaseItemDto>, "renderItem" | "data" | "style"> {
queryFn: ({
pageParam,
}: {

View File

@@ -45,6 +45,10 @@ export const TouchableItemRouter: React.FC<PropsWithChildren<Props>> = ({
router.push(`/artists/${item.Id}/page`);
return;
}
if (item.Type === "Person") {
router.push(`/actors/${item.Id}`);
return;
}
if (item.Type === "BoxSet") {
router.push(`/collections/${item.Id}`);

View File

@@ -10,12 +10,8 @@ interface Props extends ViewProps {
export const MoviesTitleHeader: React.FC<Props> = ({ item, ...props }) => {
const router = useRouter();
return (
<>
<View className="flex flex-row items-center self-center px-4">
<Text className="text-center font-bold text-2xl mr-2">
{item?.Name}
</Text>
</View>
</>
<View className="flex flex-row items-center self-center px-4" {...props}>
<Text className="text-center font-bold text-2xl mr-2">{item?.Name}</Text>
</View>
);
};

View File

@@ -28,10 +28,7 @@ export const CastAndCrew = ({ item }: { item: BaseItemDto }) => {
renderItem={(item, index) => (
<TouchableOpacity
onPress={() => {
if (settings?.searchEngine === "Marlin")
router.push(`/search?q=${item.Name}&prev=${pathname}`);
else
Linking.openURL(`https://www.google.com/search?q=${item.Name}`);
router.push(`/actors/${item.Id}`);
}}
key={item.Id}
className="flex flex-col w-32"