├── .env.example ├── public └── f1.jpg ├── .eslintrc.json ├── src ├── app │ ├── favicon.ico │ ├── fonts │ │ ├── GeistVF.woff │ │ └── GeistMonoVF.woff │ ├── page.tsx │ ├── api │ │ ├── logout │ │ │ └── route.ts │ │ ├── leaderboard │ │ │ └── route.ts │ │ ├── player-profile │ │ │ └── route.ts │ │ ├── profile │ │ │ └── route.ts │ │ ├── orders │ │ │ ├── user │ │ │ │ └── route.ts │ │ │ └── route.ts │ │ ├── webhooks │ │ │ └── razorpay │ │ │ │ └── route.ts │ │ ├── verify-payment │ │ │ └── route.ts │ │ ├── login │ │ │ └── route.ts │ │ ├── signup │ │ │ └── route.ts │ │ └── store-result │ │ │ └── route.ts │ ├── layout.tsx │ ├── (marketing) │ │ ├── contact │ │ │ └── page.tsx │ │ ├── about │ │ │ └── page.tsx │ │ ├── terms │ │ │ └── page.tsx │ │ ├── faq │ │ │ └── page.tsx │ │ └── privacy │ │ │ └── page.tsx │ ├── globals.css │ ├── (auth) │ │ ├── signup │ │ │ └── page.tsx │ │ └── login │ │ │ └── page.tsx │ └── (pages) │ │ ├── leaderboard │ │ └── page.tsx │ │ ├── status │ │ └── page.tsx │ │ ├── leetcode-190 │ │ └── page.tsx │ │ ├── subscription │ │ └── page.tsx │ │ ├── [username] │ │ └── page.tsx │ │ ├── profile │ │ └── page.tsx │ │ ├── playground │ │ └── page.tsx │ │ └── lobby │ │ └── page.tsx ├── lib │ ├── utils.ts │ ├── getDataFromToken.ts │ └── ratelimit.ts ├── components │ ├── custom │ │ ├── Hero.tsx │ │ ├── ModeToggle.tsx │ │ ├── AnimatedTooltip.tsx │ │ ├── Navbar.tsx │ │ ├── Footer.tsx │ │ └── HeroSection.tsx │ ├── ui │ │ ├── skeleton.tsx │ │ ├── label.tsx │ │ ├── textarea.tsx │ │ ├── progress.tsx │ │ ├── input.tsx │ │ ├── checkbox.tsx │ │ ├── badge.tsx │ │ ├── tooltip.tsx │ │ ├── avatar.tsx │ │ ├── Spotlight.tsx │ │ ├── alert.tsx │ │ ├── button.tsx │ │ ├── card.tsx │ │ ├── accordion.tsx │ │ ├── container-scroll-animation.tsx │ │ ├── animated-tooltip.tsx │ │ ├── table.tsx │ │ ├── dialog.tsx │ │ ├── sheet.tsx │ │ ├── select.tsx │ │ └── dropdown-menu.tsx │ └── theme-providers.tsx ├── dbconfig │ └── dbconfig.ts ├── store │ └── useStore.ts ├── models │ ├── order.model.ts │ └── user.model.ts └── data │ └── sampleParagraphs.ts ├── postcss.config.mjs ├── components.json ├── .github ├── workflows │ └── node.js.yml ├── PR_TEMPLATE │ └── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ └── bug_report.yml ├── next.config.mjs ├── .gitignore ├── tsconfig.json ├── package.json ├── tailwind.config.ts └── README.md /.env.example: -------------------------------------------------------------------------------- 1 | MONGODB_URL= 2 | TOKEN_SECRET= -------------------------------------------------------------------------------- /public/f1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzamanjain/TypeArena/HEAD/public/f1.jpg -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next/core-web-vitals", "next/typescript"] 3 | } 4 | -------------------------------------------------------------------------------- /src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzamanjain/TypeArena/HEAD/src/app/favicon.ico -------------------------------------------------------------------------------- /src/app/fonts/GeistVF.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzamanjain/TypeArena/HEAD/src/app/fonts/GeistVF.woff -------------------------------------------------------------------------------- /src/app/fonts/GeistMonoVF.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itzamanjain/TypeArena/HEAD/src/app/fonts/GeistMonoVF.woff -------------------------------------------------------------------------------- /postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /src/components/custom/Hero.tsx: -------------------------------------------------------------------------------- 1 | import TypeArenaLanding from "./HeroSection"; 2 | 3 | export function Hero() { 4 | return ( 5 |
6 | 7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { Hero } from '@/components/custom/Hero' 2 | import { ThemeProvider } from '@/components/theme-providers' 3 | 4 | export default function Home() { 5 | return ( 6 | 7 |
8 | 9 |
10 |
11 | ) 12 | } -------------------------------------------------------------------------------- /src/components/theme-providers.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import { ThemeProvider as NextThemesProvider } from "next-themes" 5 | 6 | export function ThemeProvider({ 7 | children, 8 | ...props 9 | }: React.ComponentProps) { 10 | return {children} 11 | } 12 | -------------------------------------------------------------------------------- /src/lib/getDataFromToken.ts: -------------------------------------------------------------------------------- 1 | import { NextRequest } from "next/server"; 2 | import jwt from 'jsonwebtoken' 3 | 4 | 5 | export const getDataFromToken = (request:NextRequest) => { 6 | try { 7 | const token = request.cookies.get("token")?.value || ""; 8 | const decodeToken:any = jwt.verify(token,process.env.TOKEN_SECRET!); 9 | 10 | return decodeToken.id 11 | 12 | } catch (error:any) { 13 | 14 | console.log(error.message); 15 | } 16 | } -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | } 20 | } -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | name: Next.js Build 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | 16 | - name: Set up Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: 18.x # You can change this to your preferred Node.js version 20 | 21 | - run: npm install 22 | 23 | - run: npm run build 24 | -------------------------------------------------------------------------------- /next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | eslint: { 4 | // Warning: This allows production builds to successfully complete 5 | // even if your project has ESLint errors. 6 | ignoreDuringBuilds: true, 7 | }, 8 | images: { 9 | remotePatterns: [ 10 | { 11 | protocol: 'https', 12 | hostname: 'images.unsplash.com', 13 | }, 14 | ], 15 | }, 16 | }; 17 | 18 | export default nextConfig; 19 | -------------------------------------------------------------------------------- /src/app/api/logout/route.ts: -------------------------------------------------------------------------------- 1 | import { NextRequest,NextResponse } from "next/server"; 2 | 3 | 4 | export async function GET(request:NextRequest,response:NextResponse){ 5 | 6 | try { 7 | const response = NextResponse.json({message:'Logout successful',success:true}) 8 | 9 | response.cookies.set("token","",{ 10 | httpOnly:true, 11 | expires: new Date(0) 12 | }) 13 | 14 | return response 15 | 16 | } catch (error:any) { 17 | return NextResponse.json(error.message, {status: 500}) 18 | } 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 | -------------------------------------------------------------------------------- /.github/PR_TEMPLATE/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | 4 | 5 | ### Related Issue 6 | 7 | 8 | 9 | ### Changes Made 10 | 11 | 12 | 13 | ### Screenshots 14 | 15 | 16 | 17 | ### Checklist 18 | 19 | - [ ] I have tagged the issue in this PR. 20 | - [ ] I have attached necessary screenshots. 21 | - [ ] I have provided a short description of the PR. 22 | - [ ] I ran `yarn build` and build is successful 23 | - [ ] My code follows the style guidelines of this project. 24 | - [ ] I have added necessary documentation (if applicable) -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "target": "es2015", 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 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/(pages)/lobby/page.tsx"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /src/app/api/leaderboard/route.ts: -------------------------------------------------------------------------------- 1 | import { connectDb } from "@/dbconfig/dbconfig"; 2 | import { getDataFromToken } from "@/lib/getDataFromToken"; 3 | import User from "@/models/user.model"; 4 | import { NextRequest, NextResponse } from "next/server"; 5 | 6 | connectDb(); 7 | 8 | //leaderboard api send the top 10 users with thier username , topSpeed and avgSpeed and testAttempted 9 | 10 | export async function GET(request:NextRequest){ 11 | try{ 12 | const users = await User.find().sort({topSpeed:-1}).limit(50).select("fullname username topSpeed testAttempted"); 13 | return NextResponse.json({message:"leaderboard found",users},{status:200}) 14 | }catch(error:any){ 15 | return NextResponse.json({message:"failed to load leaderboard"},{status:500}) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 |