Connect, collaborate, and grow with a community of TypeScript developers
chore: remove aot from typehero (#1608)
bautistaaa90cae3deaf30
diff --git a/apps/web/src/app/aot-2023/_components/about.tsx b/apps/web/src/app/aot-2023/_components/about.tsxdeleted file mode 100644index 1017d9e8..00000000--- a/apps/web/src/app/aot-2023/_components/about.tsx+++ /dev/null@@ -1,152 +0,0 @@-'use client';--import { cn } from '@repo/ui/cn';-import { Button } from '@repo/ui/components/button';-import {- Sheet,- SheetContent,- SheetHeader,- SheetTitle,- SheetTrigger,-} from '@repo/ui/components/sheet';-import { BadgeInfo } from '@repo/ui/icons';-import {- HolidayBronzeBadge,- HolidaySilverBadge,- HolidayGoldBadge,- HolidayPlatinumBadge,-} from '~/app/(profile)/[username]/_components/aot-badges/aot-2023-badge';--export function About({ className }: { className?: string }) {- return (- <Sheet>- <SheetTrigger asChild>- <Button- asChild- className={cn(- className,- 'flex cursor-pointer items-center gap-2 rounded-xl border-2 px-4 py-2 dark:text-white',- )}- variant="outline"- >- <span>- <BadgeInfo className="h-4 w-4" />- About- </span>- </Button>- </SheetTrigger>- <SheetContent- className="flex w-full flex-col gap-8 overflow-y-scroll sm:max-w-[400px] md:max-w-[700px]"- side="right"- >- <SheetHeader>- <SheetTitle>- <h2 className="text-4xl font-semibold tracking-tighter">About</h2>- </SheetTitle>- </SheetHeader>- <div className="flex flex-col gap-5 text-lg tracking-tight">- <p>- The TypeHero team wants to thank you for taking part in our first Advent of TypeScript.- We hope you find the challenges interesting and pick up something new as you go! If you- like what you see, consider sharing the event with your friends. And if you have any- questions, feel free to reach out to us on Discord or GitHub.- </p>- <h3 className="text-2xl font-semibold tracking-tighter">Tips</h3>- <p>- <span className="font-bold text-red-600">1.</span> You might find using the{' '}- <a- href="https://www.typescriptlang.org/play"- className="font-bold underline"- target="_blank"- rel="noreferrer noopener"- >- TypeScript Playground- </a>{' '}- preferred over our editor(at least for now 🤐). Just copy the code from the test- section, start coding, and when you nail it, pop your code (except the tests) back into- our editor.- </p>- <p>- <span className="font-bold text-red-600">2.</span> The test cases are your friends!- They’ll guide you through what we’re asking for. When things get trickier, these cases- will be your trusty helpers.- </p>- <p>- <span className="font-bold text-red-600">3.</span> There’s a channel in our{' '}- <a- target="_blank"- rel="noreferrer"- href="https://discord.com/invite/KPNUNQRB"- className="font-bold text-[#5865F2] underline"- >- discord- </a>{' '}- just for chewing over these challenges. Jump in, chat, and share your thoughts on- solutions. We highly recommend it!- </p>- <p>- <span className="font-bold text-red-600">4.</span> Remember, it’s all about having fun!- These challenges are meant to tease your brain. They’ll ramp up real quick 🙈. Don’t- sweat it if a challenge feels tough. We’ll drop the solutions on our{' '}- <a- target="_blank"- rel="noreferrer"- href="https://github.com/typehero/typehero"- className="font-bold underline"- >- Github- </a>{' '}- after the event, so be sure to give it a star!- </p>- <h3 className="text-2xl font-semibold tracking-tighter">Rewards</h3>- <p>- Earn and collect Advent of TypeScript badges on your journey! Once earned, these badges- will be proudly displayed as achievements on your public profile. Happy coding! ☃️- </p>- <div className="grid grid-cols-[6rem_1fr] grid-rows-4 gap-4">- <div className="flex w-full items-center justify-center">- <HolidayBronzeBadge className="h-24 w-24" />- </div>- <div className="my-2">- <h4 className="font-bold">Advent of TypeScript 2023 Bronze</h4>- <p>- Submit at least <span className="font-bold">1</span> attempt for an Advent of- TypeScript 2023 challenge.- </p>- </div>- <div className="flex w-full items-center justify-center">- <HolidaySilverBadge className="h-24 w-24" />- </div>- <div className="my-2">- <h4 className="font-bold">Advent of TypeScript 2023 Silver</h4>- <p>- Successfully complete <span className="font-bold">5</span> Advent of TypeScript 2023- challenges.- </p>- </div>- <div className="flex w-full items-center justify-center">- <HolidayGoldBadge className="h-24 w-24" />- </div>- <div className="my-2">- <h4 className="font-bold">Advent of TypeScript 2023 Gold</h4>- <p>- Successfully complete <span className="font-bold">15</span> Advent of TypeScript- 2023 challenges.- </p>- </div>- <div className="flex w-full items-center justify-center">- <HolidayPlatinumBadge className="h-24 w-24" />- </div>- <div className="my-2">- <h4 className="font-bold">Advent of TypeScript 2023 Platinum</h4>- <p>- Successfully complete all <span className="font-bold">25</span> Advent of TypeScript- 2023 challenges.- </p>- </div>- </div>- </div>- </SheetContent>- </Sheet>- );-}diff --git a/apps/web/src/app/aot-2023/_components/aot-card-skeleton.tsx b/apps/web/src/app/aot-2023/_components/aot-card-skeleton.tsxdeleted file mode 100644index a29e4842..00000000--- a/apps/web/src/app/aot-2023/_components/aot-card-skeleton.tsx+++ /dev/null@@ -1,20 +0,0 @@-import { Skeleton } from '@repo/ui/components/skeleton';--export function AOTCardSkeleton() {- return (- <div className="container flex flex-col items-center gap-5 pb-8 md:gap-10 md:py-5">- {/*Title */}- <Skeleton className="mb-10 h-24 w-4/5 animate-pulse rounded-xl bg-zinc-300 text-center dark:bg-zinc-700" />-- {/*Cards */}- <div className="w-[calc(100% + 8rem)] grid grid-cols-[repeat(1,240px)] justify-center gap-4 sm:px-8 md:-mx-16 md:grid-cols-[repeat(3,240px)] md:px-0 lg:mx-0 lg:w-full xl:grid-cols-[repeat(4,240px)] 2xl:gap-8">- {Array.from({ length: 8 }, (_, idx) => (- <Skeleton- className="h-[320px] animate-pulse rounded-lg bg-zinc-300 dark:bg-zinc-700"- key={idx}- />- ))}- </div>- </div>- );-}diff --git a/apps/web/src/app/aot-2023/_components/card-grid.tsx b/apps/web/src/app/aot-2023/_components/card-grid.tsxdeleted file mode 100644index cea0c2e4..00000000--- a/apps/web/src/app/aot-2023/_components/card-grid.tsx+++ /dev/null@@ -1,73 +0,0 @@-import { prisma } from '@repo/db';-import { TiltableCard } from './tiltable-card';-import { type Session } from '@repo/auth/server';-import { daysAfterDecemberFirst } from '~/utils/aot';-import { auth } from '~/server/auth';--export async function CardGrid() {- const session = await auth();- const challenges = await getTrackChallenges(session);- const challengesToReveal = revealItems(challenges);-- return (- <div className="container">- <section className="w-[calc(100% + 8rem)] grid grid-cols-[repeat(1,240px)] justify-center gap-4 sm:px-8 md:-mx-16 md:grid-cols-[repeat(3,240px)] md:px-0 lg:mx-0 lg:w-full xl:grid-cols-[repeat(4,240px)] 2xl:gap-8">- {challengesToReveal?.map((challenge, i) => {- return <TiltableCard key={challenge.id} index={i} challenge={challenge} />;- })}- </section>- </div>- );-}--export type Challenges = NonNullable<Awaited<ReturnType<typeof getTrackChallenges>>>;-async function getTrackChallenges(session: Session | null) {- const track = await prisma.track.findFirstOrThrow({- where: {- slug: 'advent-of-typescript-2023',- },- include: {- trackChallenges: {- include: {- challenge: {- select: {- submission: {- where: {- userId: session?.user?.id || '',- isSuccessful: true,- },- select: {- isSuccessful: true,- },- take: 1,- },- id: true,- name: true,- slug: true,- },- },- },- orderBy: {- orderId: 'asc',- },- },- },- });-- return track?.trackChallenges.map((trackChallenge) => {- const { submission, ...challenge } = trackChallenge.challenge;- return {- ...challenge,- hasSolved: trackChallenge.challenge.submission.length > 0,- };- });-}--function revealItems(items: Challenges) {- const daysPassed = daysAfterDecemberFirst();-- return items.map((item, index) => {- const isPastOrCurrentDay = index <= daysPassed;- return { ...item, isRevealed: isPastOrCurrentDay };- });-}diff --git a/apps/web/src/app/aot-2023/_components/index.tsx b/apps/web/src/app/aot-2023/_components/index.tsxindex 1ee5aff1..32cf382c 100644--- a/apps/web/src/app/aot-2023/_components/index.tsx+++ b/apps/web/src/app/aot-2023/_components/index.tsx@@ -1,76 +1,5 @@-import { Button } from '@repo/ui/components/button';-import { Github } from '@repo/ui/icons';-import Link from 'next/link';-import { notFound } from 'next/navigation';-import { getAllFlags } from '~/utils/feature-flags';-import { CountdownTimer } from '../../_components/countdown-timer';-import { About } from './about';-import { CardGrid } from './card-grid';-import { Suspense } from 'react';-import { AOTCardSkeleton } from './aot-card-skeleton';+import { permanentRedirect } from 'next/navigation';export async function AotLandingPage() {- const featureFlags = await getAllFlags();- if (!featureFlags.enableHolidayEvent) return notFound();-- return (- <Suspense fallback={<AOTCardSkeleton />}>- <div className="flex flex-col gap-5 pb-8 md:gap-10 md:py-5">- <div className="container">- <div className="relative mx-auto w-fit text-center">- <div className="absolute left-0 top-0 -z-10 hidden h-full w-full transform-gpu bg-gradient-to-r from-red-500 via-red-600 to-green-500 opacity-70 blur-3xl sm:opacity-40 dark:block" />- <h1 className="mb-10 mt-16 text-4xl font-bold tracking-tighter text-black sm:text-8xl dark:text-white">- <span>Advent</span> of <span className="text-red-600">TypeScript</span>- </h1>- </div>- <div className="flex flex-col items-center justify-center gap-5">- <CountdownTimer />- <div className="flex w-full flex-col items-center justify-center gap-2 md:w-auto md:flex-row md:gap-5">- <Link- href="/aot-2023/wrapped"- className="group flex w-full items-center justify-center gap-2 rounded-xl bg-red-600 px-3 py-2 text-sm font-bold text-white duration-300 md:mx-auto md:w-auto"- >- See the results!- </Link>- <a- target="_blank"- rel="noreferrer"- href="https://chat.typehero.dev"- className="group flex w-full items-center justify-center gap-2 rounded-xl bg-[#5865F2] px-3 py-2 text-sm font-bold text-white duration-300 md:mx-auto md:w-auto dark:bg-[#5865F2]"- >- <svg- className="h-4 w-4 fill-current group-hover:rotate-[360deg]"- role="img"- style={{ transition: 'color 0s, transform 0.3s' }}- viewBox="0 0 24 24"- xmlns="http://www.w3.org/2000/svg"- >- <title>Discord</title>- <path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />- </svg>- Join the Discord- </a>- <About className="w-full md:w-auto" />- <Button- asChild- className="flex w-full items-center justify-center gap-2 rounded-xl border-2 px-4 py-2 md:w-auto dark:text-white"- variant="outline"- >- <a- target="_blank"- rel="noreferrer"- className="gap-1 md:inline-flex"- href="https://github.com/typehero/typehero"- >- <Github className="h-4 w-4" />- Star us on GitHub- </a>- </Button>- </div>- </div>- </div>- <CardGrid />- </div>- </Suspense>- );+ return permanentRedirect('https://adventofts.com/');}diff --git a/apps/web/src/app/aot-2023/_components/tiltable-card.tsx b/apps/web/src/app/aot-2023/_components/tiltable-card.tsxdeleted file mode 100644index 044f5edb..00000000--- a/apps/web/src/app/aot-2023/_components/tiltable-card.tsx+++ /dev/null@@ -1,285 +0,0 @@-'use client';--import { motion } from 'framer-motion';-import Image from 'next/image';-import { useRouter } from 'next/navigation';-import { useRef, useState, type MouseEvent, useEffect } from 'react';-import type { Challenges } from './card-grid';-import clsx from 'clsx';--interface Props {- challenge: Challenges[0] & { isRevealed: boolean };- index: number;-}-const spring = {- type: 'spring',- stiffness: 300,- damping: 40,-};--const IMAGES = [- 'gingerbreadman2',- 'bell',- 'candle',- 'candycane',- 'santatree',- 'gift2',- 'chimney',- 'christmas_tree',- 'firework',- 'gift',- 'gingerbreadman',- 'leaf',- 'lollypop',- 'ornament',- 'santasnowball',- 'singingcandles',- 'sled',- 'snowflake',- 'snowman',- 'sock',- 'star',- 'sunglasses',- 'twohands',- 'wreath',- '25',-];-export function TiltableCard({ index, challenge }: Props) {- const router = useRouter();- // if a day has been solved it should just be flipped- const [isFlipped, setIsFlipped] = useState(challenge.hasSolved);-- const [rotations, setRotations] = useState({ x: 0, y: 0, z: 0 });- const [isAnimating, setAnimating] = useState(false);- const isAnimatingReference = useRef(isAnimating);- const [glare, setGlare] = useState({ x: 0, y: 0, opacity: 0 });-- const handleClick = () => {- if (!challenge.isRevealed || challenge.hasSolved) return;- setIsFlipped((prevState) => !prevState);- };-- const animate = (event: MouseEvent) => {- if (!challenge.isRevealed || challenge.hasSolved) return;- setAnimating(true);-- const rect = event.currentTarget.getBoundingClientRect();-- const absolute = {- x: event.clientX - rect.left,- y: event.clientY - rect.top,- };-- const percent = {- x: round((100 / rect.width) * absolute.x),- y: round((100 / rect.height) * absolute.y),- };-- const center = {- x: percent.x - 50,- y: percent.y - 50,- };-- setRotations({- x: round(((center.x > 50 ? 1 : -1) * center.x) / 12),- y: round(center.y / 16),- z: round(distance(percent.x, percent.y, 50, 50) / 20),- });-- setGlare({- x: percent.x,- y: percent.y,- opacity: 0.25,- });- };-- const stopAnimating = () => {- if (!challenge.isRevealed) return;- setAnimating(false);-- setTimeout(() => {- if (isAnimatingReference.current) return;-- setRotations({ x: 0, y: 0, z: 2 });- setGlare({ x: 50, y: 50, opacity: 0 });- }, 100);- };-- useEffect(() => {- if (!challenge.isRevealed) {- return;- }- router.prefetch(`/challenge/${challenge.slug}`);- }, [challenge, router]);-- return (- <motion.div- onClick={handleClick}- transition={spring}- style={{- height: '320px',- perspective: '1200px',- transformStyle: 'preserve-3d',- position: 'relative',- cursor: 'pointer',- }}- >- <motion.div- animate={{ rotateY: isFlipped ? -180 : 0 }}- transition={spring}- style={{- width: '100%',- height: '100%',- zIndex: isFlipped ? 0 : 1,- backfaceVisibility: 'hidden',- position: 'absolute',- }}- >- <motion.div- onMouseMove={animate}- onMouseLeave={stopAnimating}- animate={{- rotateY: rotations.x,- rotateX: rotations.y,- transformPerspective: rotations.z * 100,- }}- style={{- height: '320px',- backgroundColor: challenge.hasSolved ? '#175f2c' : '#761111',- ...(!challenge.isRevealed ? { filter: 'grayscale(100%)' } : {}),- borderRadius: '0.5rem',- boxShadow:- '0 0 0 1px rgba(0, 0, 0, 0.105), 0 9px 20px 0 rgba(0, 0, 0, 0.02), 0 1px 2px 0 rgba(0, 0, 0, 0.106)',- display: 'flex',- alignItems: 'center',- position: 'relative',- justifyContent: 'center',- transformStyle: 'preserve-3d',- transformOrigin: 'center',- perspective: '320px',- }}- >- <motion.div- style={{- zIndex: 2,- mixBlendMode: 'overlay',- position: 'absolute',- transform: 'translateZ(1px)',- width: '100%',- height: '100%',- borderRadius: '0.5rem',- transformStyle: 'preserve-3d',- }}- animate={{- background: `radial-gradient(- farthest-corner circle at ${glare.x}% ${glare.y}%,- rgba(255, 255, 255, 0.7) 10%,- rgba(255, 255, 255, 0.5) 24%,- rgba(0, 0, 0, 0.8) 82%- )`,- opacity: glare.opacity,- }}- />- <Image- src={`/aot/${IMAGES[index]}.png`}- width={100}- height={100}- alt=""- className={clsx(!challenge.isRevealed && 'opacity-50')}- />- <p- className={clsx(- 'absolute bottom-4 right-4 text-xl font-bold text-white',- !challenge.isRevealed && 'opacity-50',- )}- >- {index + 1}- </p>- </motion.div>- </motion.div>- <motion.a- href={`/challenge/${challenge.slug}`}- onClick={(e) => {- e.stopPropagation();- e.preventDefault();- router.push(`/challenge/${challenge.slug}`);- return false;- }}- initial={{ rotateY: 180 }}- animate={{ rotateY: isFlipped ? 0 : 180 }}- transition={spring}- style={{- width: '100%',- height: '100%',- zIndex: isFlipped ? 1 : 0,- backfaceVisibility: 'hidden',- position: 'absolute',- cursor: 'pointer',- }}- >- <motion.div- className="aot-card"- onMouseMove={animate}- onMouseLeave={stopAnimating}- animate={{- rotateY: rotations.x,- rotateX: rotations.y,- transformPerspective: rotations.z * 100,- }}- style={{- height: '320px',- backgroundColor: challenge.hasSolved ? '#175f2c' : '#761111',- borderRadius: '0.5rem',- boxShadow:- '0 0 0 1px rgba(0, 0, 0, 0.105), 0 9px 20px 0 rgba(0, 0, 0, 0.02), 0 1px 2px 0 rgba(0, 0, 0, 0.106)',- display: 'flex',- flexDirection: 'column',- alignItems: 'center',- position: 'relative',- justifyContent: 'center',- transformStyle: 'preserve-3d',- transformOrigin: 'center',- perspective: '320px',- overflow: 'hidden',- }}- >- <motion.div- style={{- zIndex: 2,- mixBlendMode: 'overlay',- position: 'absolute',- transform: 'translateZ(1px)',- width: '100%',- height: '100%',- borderRadius: '0.5rem',- transformStyle: 'preserve-3d',- }}- animate={{- background: `radial-gradient(- farthest-corner circle at ${glare.x}% ${glare.y}%,- rgba(255, 255, 255, 0.7) 10%,- rgba(255, 255, 255, 0.5) 24%,- rgba(0, 0, 0, 0.8) 82%- )`,- opacity: glare.opacity,- }}- />- {Boolean(challenge.hasSolved) && (- <div className="absolute left-[-46px] top-[12px] w-[170px] -rotate-45 transform bg-gradient-to-r from-yellow-400 to-yellow-100 py-1 font-semibold text-black drop-shadow-md">- <span className="ml-12">Solved</span>- </div>- )}- <p className="text-xl font-bold text-white">{challenge.name}</p>- </motion.div>- </motion.a>- </motion.div>- );-}--export function round(num: number, fix = 2) {- return parseFloat(num.toFixed(fix));-}--export function distance(x1: number, y1: number, x2: number, y2: number) {- return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));-}diff --git a/apps/web/src/app/aot-2023/page.tsx b/apps/web/src/app/aot-2023/page.tsxindex edeae03a..b154d409 100644--- a/apps/web/src/app/aot-2023/page.tsx+++ b/apps/web/src/app/aot-2023/page.tsx@@ -1,11 +1,5 @@-import type { Metadata } from 'next';-import { buildMetaForEventPage } from '~/app/metadata';+import { permanentRedirect } from 'next/navigation';-export async function generateMetadata(): Promise<Metadata> {- return buildMetaForEventPage({- title: 'Advent of Typescript 2023 | TypeHero',- description: 'Advent of Typescript 2023',- });+export default function AotLandingPage() {+ return permanentRedirect('https://adventofts.com/');}--export { AotLandingPage as default } from './_components';diff --git a/apps/web/src/app/aot-2023/wrapped/_components/hero.tsx b/apps/web/src/app/aot-2023/wrapped/_components/hero.tsxdeleted file mode 100644index bd4d0b9f..00000000--- a/apps/web/src/app/aot-2023/wrapped/_components/hero.tsx+++ /dev/null@@ -1,30 +0,0 @@-import Image from 'next/image';--export function Hero() {- return (- <div className="relative flex h-screen w-full flex-col items-center justify-center">- <Image- src="/aot/hero-background.svg"- layout="fill"- objectFit="cover"- alt="background with shapes"- className="z-0 opacity-40"- />- <h1 className="z-10 text-center text-4xl font-bold tracking-tighter md:mb-5 md:text-8xl">- Advent of <span className="text-red-600">Typescript</span>- </h1>- <div className="relative flex">- <Image- src="/aot/wrapped.png"- width={150}- height={150}- alt=""- className="absolute -left-[150px] -scale-x-100 transform"- />- <p className="z-10 text-4xl font-bold tracking-tighter text-green-600 md:text-8xl">- Wrapped- </p>- </div>- </div>- );-}diff --git a/apps/web/src/app/aot-2023/wrapped/_components/least-solved.tsx b/apps/web/src/app/aot-2023/wrapped/_components/least-solved.tsxdeleted file mode 100644index 462d71b3..00000000--- a/apps/web/src/app/aot-2023/wrapped/_components/least-solved.tsx+++ /dev/null@@ -1,80 +0,0 @@-'use client';--import { CheckCheck } from '@repo/ui/icons';-import { motion, type Variants } from 'framer-motion';-import Link from 'next/link';-import type { AotChallengeData } from '../page';-import Image from 'next/image';--interface Props {- leastSolved: AotChallengeData[];-}-export function LeastSolved({ leastSolved }: Props) {- const variants: Variants = {- offscreen: {- opacity: 0,- y: -100,- },- onscreen: (delay: number) => ({- opacity: 1,- y: 0,- transition: {- delay,- duration: 0.5,- },- }),- };-- return (- <div className="flex h-screen w-full justify-center gap-2 bg-gradient-to-l from-red-100 to-30% dark:from-red-950">- <div className="flex flex-col items-center justify-center gap-4 pt-20">- <div className="relative">- <p className="mb-10 text-5xl font-bold tracking-tighter text-red-950 sm:mx-[-130px] sm:text-8xl dark:text-red-50">- LEAST SOLVED- </p>- <Image- src="/aot/santa_dead.png"- width={200}- height={200}- alt=""- className="absolute hidden -scale-x-100 sm:-bottom-7 sm:-left-44 sm:block"- />- <Image- src="/aot/santa_dead.png"- width={100}- height={100}- alt=""- className="absolute -left-10 bottom-1 -scale-x-100 sm:hidden"- />- </div>- <div className="flex flex-col gap-10">- {leastSolved.map((s, i) => {- return (- <Link key={s.slug} href={`/challenge/${s.slug}`} target="_blank">- <motion.div- initial="offscreen"- variants={variants}- whileInView="onscreen"- viewport={{ once: false }}- custom={0}- className="flex items-center gap-4"- >- <div className="flex h-20 w-20 items-center justify-center rounded-full bg-red-500 text-3xl font-semibold text-white">- {i + 1}- </div>- <div className="flex flex-col items-start justify-start gap-1 text-left">- <p className="text-xl font-semibold">{s.name}</p>- <p className="flex items-center gap-1 text-sm text-neutral-500">- <CheckCheck className="h-4 w-4" />- {s.userCount} Successful Submissions- </p>- </div>- </motion.div>- </Link>- );- })}- </div>- </div>- </div>- );-}diff --git a/apps/web/src/app/aot-2023/wrapped/_components/most-solved.tsx b/apps/web/src/app/aot-2023/wrapped/_components/most-solved.tsxdeleted file mode 100644index 4c52528e..00000000--- a/apps/web/src/app/aot-2023/wrapped/_components/most-solved.tsx+++ /dev/null@@ -1,80 +0,0 @@-'use client';--import { CheckCheck } from '@repo/ui/icons';-import { motion, type Variants } from 'framer-motion';-import Link from 'next/link';-import type { AotChallengeData } from '../page';-import Image from 'next/image';--interface Props {- mostSolved: AotChallengeData[];-}-export function MostSolved({ mostSolved }: Props) {- const variants: Variants = {- offscreen: {- opacity: 0,- y: -100,- },- onscreen: (delay: number) => ({- opacity: 1,- y: 0,- transition: {- delay,- duration: 0.5,- },- }),- };-- return (- <div className="flex h-screen w-full justify-center gap-2 bg-gradient-to-l from-green-100 to-30% dark:from-green-950">- <div className="flex flex-col items-center justify-center gap-4 pt-20">- <div className="relative">- <p className="mb-10 text-5xl font-bold tracking-tighter text-green-950 sm:mx-[-130px] sm:text-8xl dark:text-green-50">- MOST SOLVED- </p>- <Image- src="/aot/sunglasses2.png"- width={150}- height={150}- alt=""- className="absolute hidden -scale-x-100 sm:-bottom-24 sm:-left-36 sm:block"- />- <Image- src="/aot/sunglasses2.png"- width={100}- height={100}- alt=""- className="absolute -bottom-10 -left-14 -scale-x-100 sm:hidden"- />- </div>- <div className="flex flex-col gap-10">- {mostSolved.map((s, i) => {- return (- <Link key={s.slug} href={`/challenge/${s.slug}`} target="_blank">- <motion.div- initial="offscreen"- variants={variants}- whileInView="onscreen"- viewport={{ once: false }}- custom={0}- className="flex items-center gap-4"- >- <div className="flex h-20 w-20 items-center justify-center rounded-full bg-green-500 text-3xl font-semibold text-white">- {i + 1}- </div>- <div className="flex flex-col items-start justify-start gap-1 text-left">- <p className="text-xl font-semibold">{s.name}</p>- <p className="flex items-center gap-1 text-sm text-neutral-500">- <CheckCheck className="h-4 w-4" />- {s.userCount} Successful Submissions- </p>- </div>- </motion.div>- </Link>- );- })}- </div>- </div>- </div>- );-}diff --git a/apps/web/src/app/aot-2023/wrapped/_components/user-summary.tsx b/apps/web/src/app/aot-2023/wrapped/_components/user-summary.tsxdeleted file mode 100644index 6f64e85f..00000000--- a/apps/web/src/app/aot-2023/wrapped/_components/user-summary.tsx+++ /dev/null@@ -1,109 +0,0 @@-import { prisma } from '@repo/db';-import Image from 'next/image';-import { AOT_CHALLENGES } from '~/app/challenge/[slug]/aot-slugs';-import { MotionDiv } from '~/components/motion';--export async function UserSummary() {- const totalNumberOfAccountsDuringAot = await prisma.user.count({- where: {- createdAt: {- gte: new Date('2023-12-01T00:00:00.000Z'),- lte: new Date('2023-12-25T23:59:59.999Z'),- },- },- });- const totalAotSubmissions = await prisma.submission.count({- where: {- challenge: {- slug: {- in: AOT_CHALLENGES,- },- },- },- });- const incorrectAotSubmissions = await prisma.submission.count({- where: {- challenge: {- slug: {- in: AOT_CHALLENGES,- },- },- isSuccessful: false,- },- });- const correctAotSubmissions = await prisma.submission.count({- where: {- challenge: {- slug: {- in: AOT_CHALLENGES,- },- },- isSuccessful: true,- },- });-- return (- <div className="h-screen w-full bg-red-800 text-white">- <div className="flex h-full">- <div className="hidden h-full w-full items-center justify-center border-r border-r-white/50 md:flex">- <MotionDiv animate={{ y: [0, 10, 0] }} transition={{ repeat: Infinity, duration: 2 }}>- <Image src="/aot/santa_flying.png" width={200} height={200} alt="" />- </MotionDiv>- </div>- <div className="relative h-full w-full p-6">- <div className="absolute left-6 top-6 text-4xl font-semibold tracking-tighter md:text-5xl">- General Metrics- </div>- <div className="flex h-full flex-col gap-7 pt-36 md:justify-center md:pt-0">- <Image- src="/aot/santa_flying.png"- width={100}- height={100}- alt=""- className="md:hidden"- />- <div className="flex items-end gap-5">- <div className="text-2xl font-bold md:w-44 md:text-6xl">- {formatThousandsWithK(totalNumberOfAccountsDuringAot)}- </div>- <div className="text-md md:text-2xl">Accounts Created</div>- </div>- <div className="flex items-end gap-5">- <div className="text-2xl font-bold md:w-44 md:text-6xl">150K</div>- <div className="text-md md:text-2xl">AOT Page Visits</div>- </div>- <div className="flex items-end gap-5">- <div className="text-2xl font-bold md:w-44 md:text-6xl">- {formatThousandsWithK(totalAotSubmissions)}- </div>- <div className="text-md md:text-2xl">Total Submissions</div>- </div>- <div className="flex items-end gap-5">- <div className="text-2xl font-bold md:w-44 md:text-6xl">- {formatThousandsWithK(incorrectAotSubmissions)}- </div>- <div className="text-md md:text-2xl">Total Incorrect Submissions</div>- </div>- <div className="flex items-end gap-5">- <div className="text-2xl font-bold md:w-44 md:text-6xl">- {formatThousandsWithK(correctAotSubmissions)}- </div>- <div className="text-md md:text-2xl">Total Correct Submissions</div>- </div>- </div>- </div>- </div>- </div>- );-}--const formatter = Intl.NumberFormat('en-US', {- notation: 'compact',- maximumFractionDigits: 1,-});--function formatThousandsWithK(num: number) {- if (num < 1000) return num;-- return formatter.format(num);-}diff --git a/apps/web/src/app/aot-2023/wrapped/page.tsx b/apps/web/src/app/aot-2023/wrapped/page.tsxindex c38946c8..f9192b39 100644--- a/apps/web/src/app/aot-2023/wrapped/page.tsx+++ b/apps/web/src/app/aot-2023/wrapped/page.tsx@@ -1,64 +1,5 @@-import { prisma } from '@repo/db';-import { Prisma } from '@repo/db/types';-import { AOT_CHALLENGES } from '../../challenge/[slug]/aot-slugs';-import { Hero } from './_components/hero';-import { LeastSolved } from './_components/least-solved';-import { MostSolved } from './_components/most-solved';-import { UserSummary } from './_components/user-summary';+import { permanentRedirect } from 'next/navigation';-export const dynamic = 'force-static';-export const dynamicParams = false;-export interface AotChallengeData {- challengeId: string;- name: string;- slug: string;- userCount: number;-}-export default async function Index() {- const topThreeSolved = await prisma.$queryRaw<AotChallengeData[]>`- select name, slug, challengeId, count(T.userId) as userCount- from(- select DISTINCT challengeId, userId- from Submission- where isSuccessful = true- ) as T- LEFT JOIN Challenge ON Challenge.id = T.challengeId- WHERE slug in (${Prisma.join(AOT_CHALLENGES.slice(0, -1))})- group by challengeId, slug- order by userCount desc- limit 3- `;-- const bottomThreeSolved = await prisma.$queryRaw<AotChallengeData[]>`- select name, slug, challengeId, count(T.userId) as userCount- from(- select DISTINCT challengeId, userId- from Submission- where isSuccessful = true- ) as T- LEFT JOIN Challenge ON Challenge.id = T.challengeId- WHERE slug in (${Prisma.join(AOT_CHALLENGES.slice(0, -1))})- group by challengeId, slug- order by userCount asc- limit 3- `;-- const top3 = topThreeSolved.map((r) => ({- ...r,- userCount: Number(r.userCount),- }));-- const bottom3 = bottomThreeSolved.map((r) => ({- ...r,- userCount: Number(r.userCount),- }));-- return (- <div>- <Hero />- <UserSummary />- <MostSolved mostSolved={top3} />- <LeastSolved leastSolved={bottom3} />- </div>- );+export default function Index() {+ return permanentRedirect('https://adventofts.com/');}diff --git a/apps/web/src/app/challenge/[slug]/aot-slugs.ts b/apps/web/src/app/challenge/[slug]/aot-slugs.tsindex 5af0c85c..7ed82d29 100644--- a/apps/web/src/app/challenge/[slug]/aot-slugs.ts+++ b/apps/web/src/app/challenge/[slug]/aot-slugs.ts@@ -1,3 +1,6 @@+// i dont feel like dealing with a db query right now to grab aot challenges+// AOT and TypeHero share the same db so a user can technically change the slug in the url and+// load the aot challenge in typeheroexport const AOT_CHALLENGES = ['2023-1','2023-2',@@ -24,4 +27,29 @@ export const AOT_CHALLENGES = ['2023-23','2023-24','2023-25',+ '2024-1',+ '2024-2',+ '2024-3',+ '2024-4',+ '2024-5',+ '2024-6',+ '2024-7',+ '2024-8',+ '2024-9',+ '2024-10',+ '2024-11',+ '2024-12',+ '2024-13',+ '2024-14',+ '2024-15',+ '2024-16',+ '2024-17',+ '2024-18',+ '2024-19',+ '2024-20',+ '2024-21',+ '2024-22',+ '2024-23',+ '2024-24',+ '2024-25',];diff --git a/apps/web/src/app/challenge/[slug]/layout.tsx b/apps/web/src/app/challenge/[slug]/layout.tsxindex 6bea3489..2c4d4b9e 100644--- a/apps/web/src/app/challenge/[slug]/layout.tsx+++ b/apps/web/src/app/challenge/[slug]/layout.tsx@@ -6,6 +6,8 @@ import { ForceRenderUntilClient } from '@repo/ui/components/force-render-until-cimport { getChallengeRouteData } from './getChallengeRouteData';import { TrackVisibiltyProvider } from './use-track-visibility.hook';import { ContextProviders } from './context-providers';+import { AOT_CHALLENGES } from './aot-slugs';+import { permanentRedirect } from 'next/navigation';export default async function LayoutData({children,@@ -14,6 +16,9 @@ export default async function LayoutData({children: React.ReactNode;params: { slug: string };}) {+ if (AOT_CHALLENGES.includes(slug)) {+ return permanentRedirect('https://adventofts.com/');+ }const session = await auth();const { challenge, track } = await getChallengeRouteData(slug, session);diff --git a/apps/web/src/app/challenge/[slug]/left-wrapper.tsx b/apps/web/src/app/challenge/[slug]/left-wrapper.tsxindex c3d2dc0b..44140f16 100644--- a/apps/web/src/app/challenge/[slug]/left-wrapper.tsx+++ b/apps/web/src/app/challenge/[slug]/left-wrapper.tsx@@ -10,7 +10,6 @@ import { cn } from '@repo/ui/cn';import { Tabs, TabsContent, TabsList, TabsTrigger } from '@repo/ui/components/tabs';import { FlaskConical, History, Text } from '@repo/ui/icons';-import { AOT_CHALLENGES } from './aot-slugs';import type { ChallengeRouteData } from './getChallengeRouteData';import { useTrackNavigationVisiblity } from './use-track-visibility.hook';import { ProblemExplorerTrackNav } from '~/components/Navigation/problem-explorer-track-nav';@@ -31,7 +30,6 @@ export function LeftWrapper({ children, challenge, track, expandPanel, isDesktopconst featureFlags = useContext(FeatureFlagContext);- const isAotChallenge = useMemo(() => AOT_CHALLENGES.includes(challenge.slug), [challenge.slug]);const isCollapsedRef = useRef(isCollapsed);const isDesktopRef = useRef(isDesktop);isDesktopRef.current = isDesktop;@@ -98,7 +96,7 @@ export function LeftWrapper({ children, challenge, track, expandPanel, isDesktop// Hide the enrolled track when in collapsed mobile view.const isTrackFeatureEnabled = featureFlags?.enableInChallengeTrack;const hasEnrolledTrackForChallenge = track !== null;- const isTrackVisible = isTrackFeatureEnabled && (!isCollapsed || isDesktop) && !isAotChallenge;+ const isTrackVisible = isTrackFeatureEnabled && (!isCollapsed || isDesktop);const isIconOnly = isCollapsed && isDesktop;const { setIsTrackTitleVisible } = useTrackNavigationVisiblity();diff --git a/apps/web/src/app/challenge/[slug]/page.tsx b/apps/web/src/app/challenge/[slug]/page.tsxindex 629a6d70..d93ce13c 100644--- a/apps/web/src/app/challenge/[slug]/page.tsx+++ b/apps/web/src/app/challenge/[slug]/page.tsx@@ -1,11 +1,10 @@import { type Session } from '@repo/auth/server';-import { buildMetaForChallenge, buildMetaForEventPage } from '~/app/metadata';+import { buildMetaForChallenge } from '~/app/metadata';+import { auth } from '~/server/auth';import { getRelativeTimeStrict } from '~/utils/relativeTime';import { Comments } from '../_components/comments';import { Description } from '../_components/description';-import { AOT_CHALLENGES } from './aot-slugs';import { getChallengeRouteData } from './getChallengeRouteData';-import { auth } from '~/server/auth';interface Props {params: {@@ -14,13 +13,6 @@ interface Props {}export async function generateMetadata({ params: { slug } }: Props) {- if (AOT_CHALLENGES.includes(slug)) {- return buildMetaForEventPage({- title: 'Advent of Typescript 2023 | TypeHero',- description: 'Advent of Typescript 2023',- });- }-const { challenge } = await getChallengeRouteData(slug, null);const description = `Unlock your TypeScript potential by solving the ${challenge.name} challenge on TypeHero.`;diff --git a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsxindex 452d02fe..3a657172 100644--- a/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx+++ b/apps/web/src/app/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx@@ -5,7 +5,6 @@ import { useQuery } from '@tanstack/react-query';import Link from 'next/link';import { useParams, useSearchParams } from 'next/navigation';import { getRelativeTimeStrict } from '~/utils/relativeTime';-import { AOT_CHALLENGES } from '../../../aot-slugs';import { getChallengeSubmissionById } from '../getChallengeSubmissions';import { Suggestions } from './suggestions';import {@@ -30,8 +29,6 @@ export function SubmissionOverview({ submissionId }: Props) {const { slug } = useParams();const searchParams = useSearchParams();- const isAotChallenge = AOT_CHALLENGES.includes(slug as string);-const showSuggestions = searchParams.get('success') === 'true';const { data: submission } = useQuery({queryKey: [`submission`, submissionId],@@ -42,13 +39,9 @@ export function SubmissionOverview({ submissionId }: Props) {const track = searchParams.get('slug');- const tweet = isAotChallenge- ? `https://twitter.com/intent/tweet?text=${encodeURIComponent(- `I've completed ${submission?.challenge.name} - Advent of TypeScript 2023`,- )}&url=https://typehero.dev/challenge/${slug}&hashtags=AdventOfTypescript`- : `https://twitter.com/intent/tweet?text=${encodeURIComponent(- `I've completed ${submission?.challenge.name} on TypeHero!`,- )}&url=https://typehero.dev/challenge/${slug}`;+ const tweet = `https://twitter.com/intent/tweet?text=${encodeURIComponent(+ `I've completed ${submission?.challenge.name} on TypeHero!`,+ )}&url=https://typehero.dev/challenge/${slug}`;if (!submission) return null;@@ -80,18 +73,16 @@ export function SubmissionOverview({ submissionId }: Props) {Submitted {getRelativeTimeStrict(submission.createdAt)}</div></div>- {!isAotChallenge && (- <div>- <Link- className="bg-primary flex h-8 items-center gap-1 rounded-lg py-2 pl-2 pr-3 text-sm text-white"- href={`/challenge/${slug}/solutions`}- >- <Plus size={16} /> Share your Solution- </Link>- </div>- )}+ <div>+ <Link+ className="bg-primary flex h-8 items-center gap-1 rounded-lg py-2 pl-2 pr-3 text-sm text-white"+ href={`/challenge/${slug}/solutions`}+ >+ <Plus size={16} /> Share your Solution+ </Link>+ </div></div>- {showSuggestions && !isAotChallenge ? (+ {showSuggestions ? (<div className="flex w-full items-start"><Suggestions track={track} challengeId={submission.challengeId} /></div>@@ -140,15 +131,6 @@ export function SubmissionOverview({ submissionId }: Props) {Share on Twitter</a></Button>- {isAotChallenge ? (- <Button- asChild- variant="outline"- className="fancy-border-gradient relative border-none"- >- <Link href="/aot-2023">Back to Advent of TypeScript</Link>- </Button>- ) : null}</div></div></>diff --git a/apps/web/src/app/challenge/_components/description/index.tsx b/apps/web/src/app/challenge/_components/description/index.tsxindex 53da04f2..a50db216 100644--- a/apps/web/src/app/challenge/_components/description/index.tsx+++ b/apps/web/src/app/challenge/_components/description/index.tsx@@ -18,16 +18,15 @@ import { TypographyH3 } from '@repo/ui/components/typography/h3';import { Bookmark as BookmarkIcon, Calendar, CheckCircle, Flag, Share } from '@repo/ui/icons';import clsx from 'clsx';import { debounce } from 'lodash';-import { useMemo, useRef, useState } from 'react';+import { useRef, useState } from 'react';import { type ChallengeRouteData } from '~/app/challenge/[slug]/getChallengeRouteData';import { ReportDialog } from '~/components/ReportDialog';+import { ShareUrl } from '~/components/share-url';import { getRelativeTimeStrict } from '~/utils/relativeTime';import { addOrRemoveBookmark } from '../bookmark.action';+import { UserBadge } from '../comments/enhanced-user-badge';import { Vote } from '../vote';-import { AOT_CHALLENGES } from '../../[slug]/aot-slugs';import { Suggestions } from './suggestions';-import { UserBadge } from '../comments/enhanced-user-badge';-import { ShareUrl } from '~/components/share-url';interface Props {challenge: ChallengeRouteData['challenge'];@@ -44,8 +43,6 @@ export function Description({ challenge }: Props) {const [hasBookmarked, setHasBookmarked] = useState(challenge.bookmark.length > 0);const session = useSession();- const isAotChallenge = useMemo(() => AOT_CHALLENGES.includes(challenge.slug), [challenge.slug]);-const debouncedBookmark = useRef(debounce(async (challengeId: number, userId: string, shouldBookmark: boolean) => {try {@@ -101,7 +98,7 @@ export function Description({ challenge }: Props) {</div>{/* Difficulty & Action Buttons */}<div className="mt-3 flex items-center gap-3">- {!isAotChallenge ? <DifficultyBadge difficulty={challenge.difficulty} /> : null}+ <DifficultyBadge difficulty={challenge.difficulty} />{challenge.hasSolved ? (<Tooltip><TooltipTrigger asChild>@@ -190,7 +187,7 @@ export function Description({ challenge }: Props) {<Markdown>{challenge.description}</Markdown></div>{/* More Challenges Suggestions */}- {!isAotChallenge && <Suggestions challengeId={challenge.id} />}+ <Suggestions challengeId={challenge.id} /></div>);}diff --git a/apps/web/src/app/explore/_components/explore.action.ts b/apps/web/src/app/explore/_components/explore.action.tsindex f7ff814c..94bab01c 100644--- a/apps/web/src/app/explore/_components/explore.action.ts+++ b/apps/web/src/app/explore/_components/explore.action.ts@@ -3,7 +3,6 @@import { auth } from '~/server/auth';import { prisma } from '@repo/db';import { Tags, type Difficulty } from '@repo/db/types';-import { AOT_CHALLENGES } from '../../challenge/[slug]/aot-slugs';import { cache } from 'react';export type ExploreChallengeData = ReturnType<typeof getChallengesByTagOrDifficulty>;@@ -24,9 +23,6 @@ export async function getChallengesByTagOrDifficulty(str: string, take?: number)status: 'BANNED',},},- slug: {- notIn: AOT_CHALLENGES,- },// OR didn't work. so this workaround is fine because IT WORKS :3...(allTags.includes(formattedStr as keyof typeof Tags)? {diff --git a/apps/web/src/components/Navigation/index.tsx b/apps/web/src/components/Navigation/index.tsxindex 8f22fea2..ef3d29a8 100644--- a/apps/web/src/components/Navigation/index.tsx+++ b/apps/web/src/components/Navigation/index.tsx@@ -49,7 +49,7 @@ export async function Navigation() {<NavLink title="Tracks" href="/tracks" />{featureFlags?.enableHolidayEvent ? (<div className="flex items-center gap-1">- <NavLink title="Advent of TS" href="/aot-2023" />+ <NavLink title="Advent of TS" href="https://www.adventofts.com" /></div>) : null}</>