├── public ├── movie.png ├── tired.png ├── screenshot.png ├── todo-list.png ├── body-building.png ├── loading-time.png ├── screenshot2.png ├── vercel.svg └── next.svg ├── postcss.config.js ├── app ├── _trpc │ └── client.ts ├── auth-callback │ ├── layout.tsx │ └── page.tsx ├── (help) │ ├── about │ │ ├── page.tsx │ │ └── _components │ │ │ └── about-component.tsx │ ├── contact │ │ ├── page.tsx │ │ └── _components │ │ │ └── contact-component.tsx │ ├── terms │ │ ├── page.tsx │ │ └── _components │ │ │ └── terms-component.tsx │ └── privacy │ │ ├── page.tsx │ │ └── _components │ │ └── privacy-component.tsx ├── api │ └── trpc │ │ └── [trpc] │ │ └── route.ts ├── (root) │ ├── (new) │ │ ├── page.tsx │ │ └── _components │ │ │ └── new-anime.tsx │ ├── favorites │ │ ├── page.tsx │ │ └── _components │ │ │ ├── favorite-item.tsx │ │ │ ├── unauthorized.tsx │ │ │ └── favorite-grid.tsx │ ├── top-airing │ │ ├── page.tsx │ │ └── _components │ │ │ └── top-airing-grid.tsx │ ├── info │ │ ├── page.tsx │ │ └── _components │ │ │ ├── anime-not-found.tsx │ │ │ └── anime-info.tsx │ └── video │ │ ├── page.tsx │ │ └── _components │ │ ├── video-player.jsx │ │ └── video-container.tsx ├── icon.svg ├── layout.tsx └── globals.css ├── components ├── ui │ ├── aspect-ratio.tsx │ ├── skeleton.tsx │ ├── label.tsx │ ├── textarea.tsx │ ├── separator.tsx │ ├── input.tsx │ ├── badge.tsx │ ├── button.tsx │ ├── card.tsx │ ├── accordion.tsx │ ├── dialog.tsx │ ├── form.tsx │ ├── sheet.tsx │ ├── select.tsx │ └── dropdown-menu.tsx ├── logo.tsx ├── shell.tsx ├── navbar │ ├── nav-items.tsx │ ├── user.tsx │ ├── navbar.tsx │ ├── side-nav.tsx │ └── nav-search.tsx ├── spinner.tsx ├── mode-toggle.tsx ├── no-items.tsx ├── error.tsx ├── pagination.tsx ├── add-favorite.tsx ├── footer.tsx ├── comments.tsx └── episodes.tsx ├── next.config.js ├── middleware.ts ├── .env.example ├── trpc ├── get-user.tsx ├── user-favorite.ts ├── index.ts ├── comments.ts ├── trpc.ts ├── auth-callback.ts ├── add-comment.ts └── add-user-favorite.ts ├── components.json ├── providers ├── theme-provider.tsx ├── index.tsx └── trpc-provider.tsx ├── context ├── use-episode.tsx ├── use-info.tsx ├── use-search.tsx └── use-anime.tsx ├── .env ├── db └── index.ts ├── .gitignore ├── lib └── utils.ts ├── tsconfig.json ├── prisma └── schema.prisma ├── package.json ├── README.md ├── constants └── site.ts ├── tailwind.config.ts └── types └── index.ts /public/movie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/movie.png -------------------------------------------------------------------------------- /public/tired.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/tired.png -------------------------------------------------------------------------------- /public/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/screenshot.png -------------------------------------------------------------------------------- /public/todo-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/todo-list.png -------------------------------------------------------------------------------- /public/body-building.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/body-building.png -------------------------------------------------------------------------------- /public/loading-time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/loading-time.png -------------------------------------------------------------------------------- /public/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/azkriven16/animinji/HEAD/public/screenshot2.png -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /app/_trpc/client.ts: -------------------------------------------------------------------------------- 1 | import { AppRouter } from "@/trpc"; 2 | import { createTRPCReact } from "@trpc/react-query"; 3 | 4 | export const trpc = createTRPCReact({}); 5 | -------------------------------------------------------------------------------- /components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" 4 | 5 | const AspectRatio = AspectRatioPrimitive.Root 6 | 7 | export { AspectRatio } 8 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | images: { 4 | domains: ["s4.anilist.co", "gogocdn.net", "img.clerk.com"], 5 | }, 6 | }; 7 | 8 | module.exports = nextConfig; 9 | -------------------------------------------------------------------------------- /middleware.ts: -------------------------------------------------------------------------------- 1 | import { authMiddleware } from "@clerk/nextjs"; 2 | 3 | export default authMiddleware({ 4 | publicRoutes: ["/", "/:locale/sign-in"], 5 | }); 6 | 7 | export const config = { 8 | matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], 9 | }; 10 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_TRPC="" 2 | 3 | DATABASE_URL="" 4 | 5 | NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="" 6 | CLERK_SECRET_KEY="" 7 | NEXT_PUBLIC_CLERK_SIGN_IN_URL="" 8 | NEXT_PUBLIC_CLERK_SIGN_UP_URL="" 9 | NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL="" 10 | NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL="" 11 | -------------------------------------------------------------------------------- /app/auth-callback/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { ReactNode } from "react"; 3 | 4 | export const metadata: Metadata = { 5 | title: "Setting up account", 6 | }; 7 | export default function Layout({ children }: { children: ReactNode }) { 8 | return <>{children}; 9 | } 10 | -------------------------------------------------------------------------------- /trpc/get-user.tsx: -------------------------------------------------------------------------------- 1 | import { TRPCError } from "@trpc/server"; 2 | import { protectedProcedure } from "./trpc"; 3 | 4 | export const getUser = protectedProcedure.query(async ({ ctx }) => { 5 | if (!ctx.user) { 6 | throw new TRPCError({ code: "UNAUTHORIZED", message: "Please login" }); 7 | } 8 | 9 | return ctx.user; 10 | }); 11 | -------------------------------------------------------------------------------- /components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils" 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ) 13 | } 14 | 15 | export { Skeleton } 16 | -------------------------------------------------------------------------------- /app/(help)/about/page.tsx: -------------------------------------------------------------------------------- 1 | import { siteConfig } from "@/constants/site"; 2 | import { Metadata } from "next"; 3 | import AboutComponent from "./_components/about-component"; 4 | 5 | export const metadata: Metadata = { 6 | title: `About - ${siteConfig.name}`, 7 | }; 8 | export default function AboutPage() { 9 | return ; 10 | } 11 | -------------------------------------------------------------------------------- /app/(help)/contact/page.tsx: -------------------------------------------------------------------------------- 1 | import { siteConfig } from "@/constants/site"; 2 | import { Metadata } from "next"; 3 | import ContactComponent from "./_components/contact-component"; 4 | 5 | export const metadata: Metadata = { 6 | title: `Contact - ${siteConfig.name}`, 7 | }; 8 | export default function ContactPage() { 9 | return ; 10 | } 11 | -------------------------------------------------------------------------------- /app/(help)/terms/page.tsx: -------------------------------------------------------------------------------- 1 | import { siteConfig } from "@/constants/site"; 2 | import { Metadata } from "next"; 3 | import TermsComponent from "./_components/terms-component"; 4 | 5 | export const metadata: Metadata = { 6 | title: `Terms & Conditions - ${siteConfig.name}`, 7 | }; 8 | export default function TermsPage() { 9 | return ; 10 | } 11 | -------------------------------------------------------------------------------- /app/(help)/privacy/page.tsx: -------------------------------------------------------------------------------- 1 | import { siteConfig } from "@/constants/site"; 2 | import { Metadata } from "next"; 3 | import PrivacyComponent from "./_components/privacy-component"; 4 | 5 | export const metadata: Metadata = { 6 | title: `Privacy Policy - ${siteConfig.name}`, 7 | }; 8 | export default function PrivacyPage() { 9 | return ; 10 | } 11 | -------------------------------------------------------------------------------- /app/api/trpc/[trpc]/route.ts: -------------------------------------------------------------------------------- 1 | import { appRouter } from "@/trpc"; 2 | import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; 3 | 4 | const handler = (req: Request) => 5 | fetchRequestHandler({ 6 | endpoint: "/api/trpc", 7 | req, 8 | router: appRouter, 9 | createContext: () => ({}), 10 | }); 11 | 12 | export { handler as GET, handler as POST }; 13 | -------------------------------------------------------------------------------- /app/(root)/(new)/page.tsx: -------------------------------------------------------------------------------- 1 | import NewAnime from "./_components/new-anime"; 2 | import { Metadata } from "next"; 3 | import { siteConfig } from "@/constants/site"; 4 | 5 | export const metadata: Metadata = { 6 | title: `New - ${siteConfig.name}`, 7 | }; 8 | 9 | export default function NewPage() { 10 | return ( 11 |
12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true 11 | }, 12 | "aliases": { 13 | "components": "@/components", 14 | "utils": "@/lib/utils" 15 | } 16 | } -------------------------------------------------------------------------------- /components/logo.tsx: -------------------------------------------------------------------------------- 1 | import { siteConfig } from "@/constants/site"; 2 | import Link from "next/link"; 3 | import { MdAnimation } from "react-icons/md"; 4 | export default function Logo() { 5 | return ( 6 | 7 | {siteConfig.name} 8 | 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /providers/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { ThemeProvider as NextThemesProvider } from "next-themes"; 5 | import { type ThemeProviderProps } from "next-themes/dist/types"; 6 | 7 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 8 | return {children}; 9 | } 10 | -------------------------------------------------------------------------------- /context/use-episode.tsx: -------------------------------------------------------------------------------- 1 | import { animeBaseURL } from "@/constants/site"; 2 | import { useQuery } from "@tanstack/react-query"; 3 | 4 | export const useEpisode = (episodeId: string) => { 5 | return useQuery(["watch", episodeId], async () => { 6 | const res = await fetch( 7 | `${animeBaseURL}/anime/gogoanime/watch/${episodeId}` 8 | ); 9 | return res.json(); 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /context/use-info.tsx: -------------------------------------------------------------------------------- 1 | import { animeBaseURL } from "@/constants/site"; 2 | import { IAnimeResult } from "@/types"; 3 | import { useQuery } from "@tanstack/react-query"; 4 | 5 | export const useInfo = (id: string) => { 6 | return useQuery(["info", id], async () => { 7 | const res = await fetch(`${animeBaseURL}/anime/gogoanime/info/${id}`); 8 | return res.json(); 9 | }); 10 | }; 11 | -------------------------------------------------------------------------------- /components/shell.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils"; 2 | import { ReactNode } from "react"; 3 | 4 | interface ShellProps { 5 | className?: string; 6 | children: ReactNode; 7 | } 8 | 9 | export default function Shell({ className, children }: ShellProps) { 10 | return ( 11 |
12 | {children} 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /app/(root)/favorites/page.tsx: -------------------------------------------------------------------------------- 1 | import { Metadata } from "next"; 2 | import FavoritesGrid from "./_components/favorite-grid"; 3 | import { siteConfig } from "@/constants/site"; 4 | 5 | export const metadata: Metadata = { 6 | title: `Favorites - ${siteConfig.name}`, 7 | }; 8 | 9 | export default function FavoritesPage() { 10 | return ( 11 |
12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /app/(root)/top-airing/page.tsx: -------------------------------------------------------------------------------- 1 | import TopAiringGrid from "./_components/top-airing-grid"; 2 | import { Metadata } from "next"; 3 | import { siteConfig } from "@/constants/site"; 4 | 5 | export const metadata: Metadata = { 6 | title: `Top Airing - ${siteConfig.name}`, 7 | }; 8 | 9 | export default function TopAiringPage() { 10 | return ( 11 |
12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /trpc/user-favorite.ts: -------------------------------------------------------------------------------- 1 | import { TRPCError } from "@trpc/server"; 2 | import { protectedProcedure } from "./trpc"; 3 | import { db } from "@/db"; 4 | 5 | export const getUserFavorite = protectedProcedure.query(async ({ ctx }) => { 6 | if (!ctx.userId) 7 | throw new TRPCError({ code: "UNAUTHORIZED", message: "Please login" }); 8 | 9 | return await db.favorite.findMany({ 10 | where: { 11 | userId: ctx.userId, 12 | }, 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | NEXT_PUBLIC_TRPC=https://animinji.vercel.app/api/trpc 2 | 3 | DATABASE_URL="postgresql://postgres:eVuU5qZtb2RiEv9t@db.wmusuzolzskelwzbrxxs.supabase.co:5432/postgres" 4 | 5 | NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_ZWFnZXItbW91c2UtNjAuY2xlcmsuYWNjb3VudHMuZGV2JA 6 | CLERK_SECRET_KEY=sk_test_hHNHqgAh5kOghygy7zHnyf7WPdyGt6PANnkPjOuHj6 7 | NEXT_PUBLIC_CLERK_SIGN_IN_URL=/ 8 | NEXT_PUBLIC_CLERK_SIGN_UP_URL=/ 9 | NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/ 10 | NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/ 11 | -------------------------------------------------------------------------------- /db/index.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from "@prisma/client"; 2 | 3 | declare global { 4 | // eslint-disable-next-line no-var 5 | var cachedPrisma: PrismaClient; 6 | } 7 | 8 | let prisma: PrismaClient; 9 | if (process.env.NODE_ENV === "production") { 10 | prisma = new PrismaClient(); 11 | } else { 12 | if (!global.cachedPrisma) { 13 | global.cachedPrisma = new PrismaClient(); 14 | } 15 | prisma = global.cachedPrisma; 16 | } 17 | 18 | export const db = prisma; 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | .env 31 | 32 | # vercel 33 | .vercel 34 | 35 | # typescript 36 | *.tsbuildinfo 37 | next-env.d.ts 38 | -------------------------------------------------------------------------------- /context/use-search.tsx: -------------------------------------------------------------------------------- 1 | import { animeBaseURL } from "@/constants/site"; 2 | import { useQuery } from "@tanstack/react-query"; 3 | 4 | export const useSearch = ({ 5 | episodeId, 6 | page, 7 | }: { 8 | episodeId: string; 9 | page?: number; 10 | }) => { 11 | return useQuery( 12 | ["watch", episodeId], // Include page and pageSize in the query key 13 | async () => { 14 | const res = await fetch( 15 | `${animeBaseURL}/anime/gogoanime/${episodeId}?page=${page}` 16 | ); 17 | return res.json(); 18 | } 19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | 8 | export const cleanHtmlTags = (text: string | any) => { 9 | if (typeof text === "string") { 10 | return text.replace(/<[^>]*>/g, ""); 11 | } else { 12 | return ( 13 | text.userPreferred.replace(/<[^>]*>/g, "") || 14 | text.romaji.replace(/<[^>]*>/g, "") || 15 | "" 16 | ); 17 | } 18 | }; 19 | 20 | export const skeletonArray = new Array(20).fill(null); 21 | -------------------------------------------------------------------------------- /trpc/index.ts: -------------------------------------------------------------------------------- 1 | import { router } from "./trpc"; 2 | import { getUserFavorite } from "./user-favorite"; 3 | import { addUserFavorite } from "./add-user-favorite"; 4 | import { authCallback } from "./auth-callback"; 5 | import { getAllComments } from "./comments"; 6 | import { addComment } from "./add-comment"; 7 | import { getUser } from "./get-user"; 8 | 9 | export const appRouter = router({ 10 | authCallback, 11 | getUserFavorite, 12 | getAllComments, 13 | addComment, 14 | addUserFavorite, 15 | getUser, 16 | }); 17 | 18 | export type AppRouter = typeof appRouter; 19 | -------------------------------------------------------------------------------- /components/navbar/nav-items.tsx: -------------------------------------------------------------------------------- 1 | import { siteConfig } from "@/constants/site"; 2 | import Link from "next/link"; 3 | import { buttonVariants } from "../ui/button"; 4 | 5 | export default function NavItems() { 6 | return ( 7 |
    8 | {siteConfig.navItems.map((link) => ( 9 |
  • 10 | 14 | {link.text} 15 | 16 |
  • 17 | ))} 18 |
19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /trpc/comments.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | import { protectedProcedure } from "./trpc"; 3 | import { TRPCError } from "@trpc/server"; 4 | import { db } from "@/db"; 5 | export const getAllComments = protectedProcedure 6 | .input( 7 | z.object({ 8 | animeId: z.string(), 9 | }) 10 | ) 11 | .query(async ({ ctx, input }) => { 12 | if (!ctx.userId) 13 | throw new TRPCError({ code: "UNAUTHORIZED", message: "Please login" }); 14 | 15 | return await db.comment.findMany({ 16 | where: { 17 | animeId: input.animeId, 18 | }, 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /context/use-anime.tsx: -------------------------------------------------------------------------------- 1 | import { animeBaseURL } from "@/constants/site"; 2 | import { useQuery } from "@tanstack/react-query"; 3 | 4 | interface useGetGogoProps { 5 | page?: number; 6 | type: animeType; 7 | } 8 | 9 | export enum animeType { 10 | RecentEpisodes = "recent-episodes", 11 | TopAiring = "top-airing", 12 | } 13 | export const useAnime = ({ 14 | page = 1, 15 | type = animeType.RecentEpisodes, 16 | }: useGetGogoProps) => { 17 | return useQuery([type, page], async () => { 18 | const res = await fetch( 19 | `${animeBaseURL}/anime/gogoanime/${type}?page=${page}` 20 | ); 21 | return res.json(); 22 | }); 23 | }; 24 | -------------------------------------------------------------------------------- /trpc/trpc.ts: -------------------------------------------------------------------------------- 1 | import { auth } from "@clerk/nextjs"; 2 | import { TRPCError, initTRPC } from "@trpc/server"; 3 | 4 | const t = initTRPC.create(); 5 | 6 | const isAuthed = t.middleware(async ({ next }) => { 7 | const { userId, user } = auth(); 8 | 9 | if (!userId && !user) { 10 | throw new TRPCError({ 11 | code: "UNAUTHORIZED", 12 | message: "Please login", 13 | }); 14 | } 15 | 16 | return next({ 17 | ctx: { 18 | userId, 19 | user, 20 | }, 21 | }); 22 | }); 23 | 24 | export const router = t.router; 25 | 26 | export const publicProcedure = t.procedure; 27 | export const protectedProcedure = t.procedure.use(isAuthed); 28 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /trpc/auth-callback.ts: -------------------------------------------------------------------------------- 1 | import { TRPCError } from "@trpc/server"; 2 | import { protectedProcedure } from "./trpc"; 3 | import { db } from "@/db"; 4 | 5 | export const authCallback = protectedProcedure.query(async ({ ctx }) => { 6 | const { userId } = ctx; 7 | if (!userId) { 8 | throw new TRPCError({ code: "UNAUTHORIZED", message: "Please login" }); 9 | } 10 | 11 | // check if user is in db 12 | const dbUser = await db.user.findFirst({ 13 | where: { 14 | id: userId, 15 | }, 16 | }); 17 | 18 | if (!dbUser) { 19 | // create user in db 20 | await db.user.create({ 21 | data: { 22 | id: userId, 23 | }, 24 | }); 25 | } 26 | 27 | return { success: true }; 28 | }); 29 | -------------------------------------------------------------------------------- /app/(root)/info/page.tsx: -------------------------------------------------------------------------------- 1 | import AnimeInfo from "./_components/anime-info"; 2 | import { Metadata } from "next"; 3 | import { animeBaseURL, siteConfig } from "@/constants/site"; 4 | import { cleanHtmlTags } from "@/lib/utils"; 5 | 6 | type Props = { 7 | searchParams: { [key: string]: string | string[] | undefined }; 8 | }; 9 | 10 | export async function generateMetadata({ 11 | searchParams, 12 | }: Props): Promise { 13 | const res = await fetch( 14 | `${animeBaseURL}/anime/gogoanime/info/${searchParams.anime}` 15 | ).then((res) => res.json()); 16 | 17 | return { 18 | title: `${cleanHtmlTags(res.title)} - ${siteConfig.name}`, 19 | }; 20 | } 21 | 22 | export default function Info() { 23 | return ; 24 | } 25 | -------------------------------------------------------------------------------- /components/spinner.tsx: -------------------------------------------------------------------------------- 1 | import { Loader, Loader2 } from "lucide-react"; 2 | 3 | import { cva, type VariantProps } from "class-variance-authority"; 4 | 5 | import { cn } from "@/lib/utils"; 6 | 7 | const spinnerVariants = cva("text-muted-foreground animate-spin", { 8 | variants: { 9 | size: { 10 | default: "h-4 w-4", 11 | sm: "h-2 w-2", 12 | lg: "h-6 w-6", 13 | icon: "h-10 w-10", 14 | }, 15 | }, 16 | defaultVariants: { 17 | size: "default", 18 | }, 19 | }); 20 | 21 | interface SpinnerProps extends VariantProps {} 22 | 23 | export const Spinner = ({ size }: SpinnerProps) => { 24 | return ( 25 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /providers/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode } from "react"; 2 | import { ThemeProvider } from "./theme-provider"; 3 | import TRPCProvider from "./trpc-provider"; 4 | import { ClerkProvider } from "@clerk/nextjs"; 5 | 6 | interface Props { 7 | children: ReactNode; 8 | } 9 | 10 | export default function Providers({ children }: Props) { 11 | return ( 12 | 19 | 25 | {children} 26 | 27 | 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as LabelPrimitive from "@radix-ui/react-label" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 11 | ) 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )) 24 | Label.displayName = LabelPrimitive.Root.displayName 25 | 26 | export { Label } 27 | -------------------------------------------------------------------------------- /components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes {} 7 | 8 | const Textarea = React.forwardRef( 9 | ({ className, ...props }, ref) => { 10 | return ( 11 |