chore: Apply linting rules and add git hok (#611)

Co-authored-by: Fredrik Burmester <fredrik.burmester@gmail.com>
This commit is contained in:
lostb1t
2025-03-16 18:01:12 +01:00
committed by GitHub
parent 2688e1b981
commit 92513e234f
268 changed files with 9197 additions and 8394 deletions

View File

@@ -1,11 +1,11 @@
import { View } from "react-native";
import { Text } from "../common/Text";
import Animated, {
useAnimatedStyle,
useAnimatedReaction,
useSharedValue,
withTiming,
} from "react-native-reanimated";
import { Text } from "../common/Text";
interface Props {
isLoading: boolean;
@@ -28,29 +28,29 @@ export const LoadingSkeleton: React.FC<Props> = ({ isLoading }) => {
} else {
opacity.value = withTiming(0, { duration: 200 });
}
}
},
);
return (
<Animated.View style={animatedStyle} className="mt-2 absolute w-full">
<Animated.View style={animatedStyle} className='mt-2 absolute w-full'>
{[1, 2, 3].map((s) => (
<View className="px-4 mb-4" key={s}>
<View className="w-1/2 bg-neutral-900 h-6 mb-2 rounded-lg"></View>
<View className="flex flex-row gap-2">
<View className='px-4 mb-4' key={s}>
<View className='w-1/2 bg-neutral-900 h-6 mb-2 rounded-lg'></View>
<View className='flex flex-row gap-2'>
{[1, 2, 3].map((i) => (
<View className="w-28" key={i}>
<View className="bg-neutral-900 h-40 w-full rounded-md mb-1"></View>
<View className="rounded-md overflow-hidden mb-1 self-start">
<View className='w-28' key={i}>
<View className='bg-neutral-900 h-40 w-full rounded-md mb-1'></View>
<View className='rounded-md overflow-hidden mb-1 self-start'>
<Text
className="text-neutral-900 bg-neutral-900 rounded-md"
className='text-neutral-900 bg-neutral-900 rounded-md'
numberOfLines={1}
>
Nisi mollit voluptate amet.
</Text>
</View>
<View className="rounded-md overflow-hidden self-start mb-1">
<View className='rounded-md overflow-hidden self-start mb-1'>
<Text
className="text-neutral-900 bg-neutral-900 text-xs rounded-md"
className='text-neutral-900 bg-neutral-900 text-xs rounded-md'
numberOfLines={1}
>
Lorem ipsum

View File

@@ -1,11 +1,12 @@
import { apiAtom, userAtom } from "@/providers/JellyfinProvider";
import { getUserItemData } from "@/utils/jellyfin/user-library/getUserItemData";
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { FlashList } from "@shopify/flash-list";
import { useQuery } from "@tanstack/react-query";
import { useAtom } from "jotai";
import React, { PropsWithChildren } from "react";
import type React from "react";
import type { PropsWithChildren } from "react";
import { Text } from "../common/Text";
import {FlashList} from "@shopify/flash-list";
type SearchItemWrapperProps<T> = {
ids?: string[] | null;
@@ -15,12 +16,12 @@ type SearchItemWrapperProps<T> = {
onEndReached?: (() => void) | null | undefined;
};
export const SearchItemWrapper = <T extends unknown>({
export const SearchItemWrapper = <T,>({
ids,
items,
renderItem,
header,
onEndReached
onEndReached,
}: PropsWithChildren<SearchItemWrapperProps<T>>) => {
const [api] = useAtom(apiAtom);
const [user] = useAtom(userAtom);
@@ -37,25 +38,25 @@ export const SearchItemWrapper = <T extends unknown>({
api,
userId: user.Id,
itemId: id,
})
}),
);
const results = await Promise.all(itemPromises);
// Filter out null items
return results.filter(
(item) => item !== null
(item) => item !== null,
) as unknown as BaseItemDto[];
},
enabled: !!ids && ids.length > 0 && !!api && !!user?.Id,
staleTime: Infinity,
staleTime: Number.POSITIVE_INFINITY,
});
if (!data && (!items || items.length === 0)) return null;
return (
<>
<Text className="font-bold text-lg px-4 mb-2">{header}</Text>
<Text className='font-bold text-lg px-4 mb-2'>{header}</Text>
<FlashList
horizontal
contentContainerStyle={{
@@ -70,7 +71,7 @@ export const SearchItemWrapper = <T extends unknown>({
onEndReachedThreshold={1}
onEndReached={onEndReached}
//@ts-ignore
renderItem={({item, index}) => item ? renderItem(item) : <></>}
renderItem={({ item, index }) => (item ? renderItem(item) : <></>)}
/>
</>
);