refactoring: upgrade nextjs; api => server actions

This commit is contained in:
ner committed 2024-01-06 12:55:11 +02:00
1 parent 447be7d021
commit 03cfacf91c
45 files changed
+1034 -923

No files matched your search

+1 -1
View File
@@ -25,7 +25,7 @@ const Card: FC<Props> = ({ movie, className, children, onClick }) => {
<div className='absolute left-0 top-0 w-full h-20 bg-gradient-to-t from-transparent to-black opacity-80'>
<div className='max-w-[300px] w-full mx-auto pt-1 px-3 text-white'>
<div className='grid items-center grid-cols-[1fr_50px]'>
<Title hideGradient title={movie.title} />
<Title title={movie.title} />
{movie.release_date && (
<span className='flex justify-end text-lg font-semibold'>
{new Date(movie.release_date).getFullYear()}
+2
View File
@@ -1,3 +1,5 @@
'use client';
import { FC } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
@@ -1,5 +1,7 @@
import { FC, useEffect, useRef } from 'react';
import { motion, useAnimation, useInView } from 'framer-motion';
'use client';
import { FC } from 'react';
import { motion } from 'framer-motion';
import { User2 } from 'lucide-react';
import Image from 'next/image';
import { useRouter } from 'next/navigation';
+1 -1
View File
@@ -20,7 +20,7 @@ const Poster: FC<Props> = ({ title, poster, width, height, size = 250, className
>
{poster ? (
<Image
className='rounded-lg mx-auto'
className='rounded-lg mx-auto w-auto'
unoptimized
height={height}
width={width}
+3 -7
View File
@@ -1,23 +1,19 @@
'use client';
import { FC, useState } from 'react';
import Marquee from 'react-fast-marquee';
import { useTheme } from '@/hooks/useTheme';
interface Props {
title: string;
hideGradient?: boolean;
className?: string;
}
const Title: FC<Props> = ({ title, hideGradient, className }) => {
const Title: FC<Props> = ({ title, className }) => {
const [isScrollableTitle, setIsScrollableTitle] = useState(false);
const [theme] = useTheme();
return (
<Marquee
play={isScrollableTitle}
gradient={!hideGradient && isScrollableTitle}
gradientWidth={10}
gradientColor={theme === 'light' ? [255, 255, 255] : [2, 8, 23]}
className={`movie-title overflow-hidden h-[30px] text-lg font-semibold ${className}`}
>
<div
@@ -6,10 +6,10 @@ import { atomWithStorage } from 'jotai/utils';
import { Cast, Loader, Magnet } from 'lucide-react';
import useTorrents from '@/app/(site)/useTorrents';
import { ORDER } from '@/app/api/torrents/parsers/pirate-bay';
import { Modal } from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
import { ORDER } from '@/lib/api/parsers/pirate-bay';
interface Props extends InstanceProps<void> {
title: string;
@@ -102,7 +102,7 @@ const Torrents: FC<Props> = ({ title, isOpen, onResolve }) => {
<div className='flex gap-2 m-auto justify-center'>
{host ? (
<a
onClick={handleCast(torrent.magnet)}
onClick={handleCast(torrent.magnet!)}
className='flex items-center justify-center h-8 w-8 border rounded-lg'
>
<Cast size={20} />