Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Tracks things (resolves #753) (#942)

PickleNikc0670e084448
diff --git a/apps/web/src/app/[locale]/explore/_components/index.tsx b/apps/web/src/app/[locale]/explore/_components/index.tsx
index 39b463e0..b4e9d417 100644
--- a/apps/web/src/app/[locale]/explore/_components/index.tsx
+++ b/apps/web/src/app/[locale]/explore/_components/index.tsx
@@ -19,47 +19,53 @@ export async function Explore() {
}
return (
- <div className="flex flex-col gap-8 py-8 md:gap-10 md:py-10">
- <div className="container">
- <h1 className="mb-8 text-4xl font-bold tracking-tight text-neutral-900 dark:text-white">
- Explore
- </h1>
- <p className=" max-w-[69ch] text-lg leading-10 text-neutral-600 dark:text-white/50">
- Explore the challenges. Embrace the opportunity to grow, learn, and showcase your
- programming abilities. We hope you find the{' '}
- <span className="font-semibold dark:text-neutral-200">perfect</span> challenge!
- </p>
+ <>
+ <div className="flex flex-col gap-8 py-8 md:gap-10 md:py-8">
+ <div className="container">
+ <h1 className="mb-8 text-4xl font-bold tracking-tight text-neutral-900 dark:text-white">
+ Explore
+ </h1>
+ <p className=" max-w-[69ch] text-lg leading-10 text-neutral-600 dark:text-white/50">
+ Explore the challenges. Embrace the opportunity to grow, learn, and showcase your
+ programming abilities. We hope you find the{' '}
+ <span className="font-semibold dark:text-neutral-200">perfect</span> challenge!
+ </p>
+ </div>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection title="πŸ’• Most Popular" tag="POPULAR" redirectRoute="/explore/popular" />
+ </Suspense>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection title="πŸ”₯ Newest" tag="NEWEST" redirectRoute="/explore/newest" />
+ </Suspense>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection
+ title="Great for Beginners"
+ tag="BEGINNER"
+ redirectRoute="/explore/beginner"
+ />
+ </Suspense>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection title="Great for Learners" tag="EASY" redirectRoute="/explore/easy" />
+ </Suspense>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection
+ title="Great for Enthusiasts"
+ tag="MEDIUM"
+ redirectRoute="/explore/medium"
+ />
+ </Suspense>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection title="Great for Experts" tag="HARD" redirectRoute="/explore/hard" />
+ </Suspense>
+ <Suspense fallback={<ExploreSectionSkeleton />}>
+ <ExploreSection
+ title="Great for Masters"
+ tag="EXTREME"
+ redirectRoute="/explore/extreme"
+ />
+ </Suspense>
</div>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection title="πŸ’• Most Popular" tag="POPULAR" redirectRoute="/explore/popular" />
- </Suspense>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection title="πŸ”₯ Newest" tag="NEWEST" redirectRoute="/explore/newest" />
- </Suspense>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection
- title="Great for Beginners"
- tag="BEGINNER"
- redirectRoute="/explore/beginner"
- />
- </Suspense>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection title="Great for Learners" tag="EASY" redirectRoute="/explore/easy" />
- </Suspense>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection
- title="Great for Enthusiasts"
- tag="MEDIUM"
- redirectRoute="/explore/medium"
- />
- </Suspense>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection title="Great for Experts" tag="HARD" redirectRoute="/explore/hard" />
- </Suspense>
- <Suspense fallback={<ExploreSectionSkeleton />}>
- <ExploreSection title="Great for Masters" tag="EXTREME" redirectRoute="/explore/extreme" />
- </Suspense>
<Footsies />
- </div>
+ </>
);
}
diff --git a/apps/web/src/app/[locale]/tracks/_components/enroll-button.tsx b/apps/web/src/app/[locale]/tracks/_components/enroll-button.tsx
index c394132f..0c5573b7 100644
--- a/apps/web/src/app/[locale]/tracks/_components/enroll-button.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/enroll-button.tsx
@@ -3,6 +3,9 @@
import { Button } from '@repo/ui/components/button';
import { toast } from '@repo/ui/components/use-toast';
import type { enrollUserInTrack, unenrollUserFromTrack } from './track.action';
+import { useState } from 'react';
+import { Loader2 } from '@repo/ui/icons';
+import { Play } from 'next/font/google';
interface EnrollButtonProps {
action: typeof enrollUserInTrack | typeof unenrollUserFromTrack;
@@ -11,9 +14,13 @@ interface EnrollButtonProps {
}
export function ActionButton({ action, text, trackId }: EnrollButtonProps) {
+ const [isLoading, setIsLoading] = useState(false);
return (
<Button
+ className="shadcnoverridetransition select-none rounded-3xl bg-black text-white shadow-[0px_16px_6px_-16px_#ff4,4px_2px_4px_-2px_#f4f,-4px_2px_4px_-2px_#4f4] hover:-translate-y-1 hover:bg-neutral-800 hover:shadow-[0px_16px_6px_-12px_#ff4,4px_6px_6px_-2px_#f4f,-4px_6px_6px_-2px_#4f4] active:translate-y-1 active:scale-95 active:shadow-[0px_10px_3px_-16px_#ff4,8px_0px_2px_-2px_#f4f,-8px_0px_2px_-2px_#4f4] dark:bg-white dark:text-black dark:hover:bg-white dark:hover:brightness-125 dark:hover:saturate-150"
+ disabled={isLoading}
onClick={async () => {
+ setIsLoading(true);
try {
await action(trackId);
toast({
@@ -21,6 +28,7 @@ export function ActionButton({ action, text, trackId }: EnrollButtonProps) {
variant: 'success',
description: <p>You're now successfully {text.toLowerCase()}ed the track.</p>,
});
+ setIsLoading(false);
} catch (error) {
error instanceof Error && error.message === 'User is not logged in'
? toast({
@@ -42,10 +50,26 @@ export function ActionButton({ action, text, trackId }: EnrollButtonProps) {
<p>There was an error trying to {text.toLowerCase()} you from the track.</p>
),
});
+ setIsLoading(false);
}
}}
>
- {text}
+ {isLoading ? (
+ <Loader2 className="mx-[1.125rem] h-5 w-5 animate-spin" />
+ ) : text == 'Enroll' ? (
+ <>
+ <svg
+ className="-ml-2 mr-1.5 h-5 w-5 fill-current"
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 -960 960 960"
+ >
+ <path d="M320-273v-414q0-17 12-28.5t28-11.5q5 0 10.5 1.5T381-721l326 207q9 6 13.5 15t4.5 19q0 10-4.5 19T707-446L381-239q-5 3-10.5 4.5T360-233q-16 0-28-11.5T320-273Z" />
+ </svg>
+ {text}
+ </>
+ ) : (
+ text
+ )}
</Button>
);
}
diff --git a/apps/web/src/app/[locale]/tracks/_components/index.tsx b/apps/web/src/app/[locale]/tracks/_components/index.tsx
index 91e92575..51984770 100644
--- a/apps/web/src/app/[locale]/tracks/_components/index.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/index.tsx
@@ -3,6 +3,7 @@ import { redirect } from 'next/navigation';
import { isBetaUser } from '~/utils/server/is-beta-user';
import { EnrolledTrackSection } from './track-enrolled-section';
import { TrackGrid } from './track-grid';
+import { Footsies } from '~/components/footsies';
export async function Tracks() {
// early acces you must be authorized
@@ -14,18 +15,22 @@ export async function Tracks() {
}
return (
- <div className="flex flex-col gap-5 py-8 md:gap-10 md:py-10">
- <div className="container">
- <h1 className="mb-8 text-4xl font-bold tracking-tight text-neutral-900 dark:text-white">
- Tracks
- </h1>
- <p className=" max-w-[69ch] text-lg leading-10 text-neutral-600 dark:text-white/50">
- TypeHero provides a curated collection of diverse coding challenges grouped into different
- tracks, offering a dynamic learning path for developers to enhance their skills.
- </p>
+ <>
+ <div className="flex flex-col gap-5 pb-8 md:gap-10 md:py-5">
+ <EnrolledTrackSection />
+ <div className="container">
+ <h1 className="mb-8 text-4xl font-bold tracking-tight text-neutral-900 dark:text-white sm:px-8 md:px-0">
+ Tracks
+ </h1>
+ <p className="max-w-[69ch] text-lg leading-10 text-neutral-600 dark:text-white/50 sm:px-8 md:px-0">
+ TypeHero provides a curated collection of diverse coding challenges grouped into
+ different tracks, offering a dynamic learning path for developers to enhance their
+ skills.
+ </p>
+ </div>
+ <TrackGrid />
</div>
- <EnrolledTrackSection />
- <TrackGrid />
- </div>
+ <Footsies />
+ </>
);
}
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-card-soon.tsx b/apps/web/src/app/[locale]/tracks/_components/track-card-soon.tsx
new file mode 100644
index 00000000..568b985a
--- /dev/null
+++ b/apps/web/src/app/[locale]/tracks/_components/track-card-soon.tsx
@@ -0,0 +1,78 @@
+'use client';
+
+import { Badge } from '@repo/ui/components/badge';
+import { Card, CardContent } from '@repo/ui/components/card';
+import { Swords } from '@repo/ui/icons';
+import { clsx } from 'clsx';
+import Link from 'next/link';
+import type { Tracks } from './track-grid';
+
+interface TrackProps {
+ track: Tracks[number];
+}
+
+// The color for track.
+export const BGS_BY_TRACK: Record<number, string> = {
+ 0: 'to-difficulty-beginner/30 dark:to-difficulty-beginner-dark/20',
+ 1: 'to-difficulty-easy/30 dark:to-difficulty-easy-dark/20',
+ 2: 'to-difficulty-medium/30 dark:to-difficulty-medium-dark/20',
+ 3: 'to-difficulty-hard/30 dark:to-difficulty-hard-dark/20',
+ 4: 'to-difficulty-extreme/30 dark:to-difficulty-extreme-dark/20',
+} as const;
+export const bgsArray = Object.values(BGS_BY_TRACK);
+
+const EnrolledBadge = ({ text = 'Enrolled' }: { text?: string }) => (
+ <div className="text-background absolute left-0 top-0 z-10 rounded-br-xl bg-blue-400 px-5 py-1.5 text-sm font-bold">
+ {text}
+ </div>
+);
+
+export function TrackCardSoon({ track }: TrackProps) {
+ const isEnrolled = Boolean(track.enrolledUsers?.length);
+
+ return (
+ <Link href={`/tracks/${track.slug}`} className="group">
+ <Card
+ className={clsx(
+ 'relative overflow-hidden border-dashed duration-300',
+ isEnrolled
+ ? 'border-blue-400'
+ : 'group-hover:border-neutral-400/50 group-focus:border-neutral-500 dark:group-hover:border-neutral-400/50',
+ )}
+ >
+ <div className="absolute -bottom-12 -left-4 w-full -translate-x-1/4 translate-y-1/4 rotate-[30deg]">
+ <div className="-ml-4 h-12 w-full border-t border-neutral-500/50 bg-gradient-to-r from-neutral-100 to-transparent duration-500 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150" />
+ <div className="-ml-8 h-12 w-full border-t border-neutral-500/50 bg-gradient-to-r from-neutral-100 to-transparent duration-500 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150" />
+ <div className="-ml-12 h-12 w-full border-t border-neutral-500/50 bg-gradient-to-r from-neutral-100 to-transparent duration-500 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150" />
+ <div className="-ml-16 h-12 w-full border-t border-neutral-500/50 bg-gradient-to-r from-neutral-100 to-transparent duration-500 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150" />
+ </div>
+ {isEnrolled ? <EnrolledBadge /> : null}
+ <CardContent className="relative z-10 flex flex-col items-center gap-6 p-9">
+ <div
+ className={clsx(
+ `relative bg-gradient-to-r from-neutral-500/10 from-10% to-neutral-500/50 to-100% dark:from-neutral-900 dark:to-neutral-500/50`,
+ 'flex h-24 w-24 flex-none items-center justify-center rounded-2xl',
+ )}
+ >
+ <Swords
+ size={50}
+ className={clsx(
+ 'transition-opacity duration-300',
+ !isEnrolled && 'opacity-50 group-hover:opacity-100 group-focus:opacity-100',
+ )}
+ />
+ </div>
+ <div className="text-center font-semibold capitalize tracking-wide">{track.name}</div>
+ <div className="text-muted-foreground line-clamp-3 text-center text-sm tracking-wide">
+ This track is still in development. <br /> Check back soon!
+ <br />
+ </div>
+
+ <div className="text-center">
+ <Badge className="flex-none bg-neutral-600">coming soon</Badge>
+ </div>
+ </CardContent>
+ </Card>
+ </Link>
+ );
+}
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-card.tsx b/apps/web/src/app/[locale]/tracks/_components/track-card.tsx
index 065b9a40..4429dda3 100644
--- a/apps/web/src/app/[locale]/tracks/_components/track-card.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/track-card.tsx
@@ -22,12 +22,7 @@ export const BGS_BY_TRACK: Record<number, string> = {
export const bgsArray = Object.values(BGS_BY_TRACK);
const EnrolledBadge = ({ text = 'Enrolled' }: { text?: string }) => (
- <div
- className={clsx(
- 'absolute -right-[1px] -top-[27px] z-[-1] rounded rounded-tl-lg rounded-tr-xl px-5 pb-10 pt-[3px] text-sm',
- 'border border-blue-400 bg-blue-400 text-white',
- )}
- >
+ <div className="text-background absolute left-0 top-0 z-10 rounded-br-3xl bg-[#3078c5] px-5 py-1.5 text-sm font-bold dark:bg-blue-400">
{text}
</div>
);
@@ -39,19 +34,53 @@ export function TrackCard({ track }: TrackProps) {
<Link href={`/tracks/${track.slug}`} className="group">
<Card
className={clsx(
- 'relative transition-colors duration-300',
+ 'relative overflow-hidden duration-300',
isEnrolled
- ? 'border-blue-400'
- : 'group-hover:border-blue-400 group-focus:border-blue-400',
+ ? 'border-[#3078c5] dark:border-blue-400'
+ : 'dark:group-hover:border-border group-hover:border-neutral-400 group-hover:shadow-xl group-focus:border-neutral-500 dark:group-hover:shadow dark:group-hover:shadow-neutral-400/70',
)}
>
+ <div className="absolute -bottom-12 -left-4 w-full -translate-x-1/4 translate-y-1/4 rotate-[30deg]">
+ <div
+ className={clsx(
+ '-ml-4 h-12 w-full border-t bg-gradient-to-r to-white duration-500 group-hover:-translate-y-1 dark:to-[#09090b]',
+ isEnrolled
+ ? 'border-blue-500/50 from-blue-100 dark:border-blue-400/50 dark:from-[#2b4567]'
+ : 'border-neutral-500/50 from-neutral-100 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150',
+ )}
+ />
+ <div
+ className={clsx(
+ '-ml-8 h-12 w-full border-t bg-gradient-to-r to-white duration-500 group-hover:-translate-y-5 dark:to-[#09090b]',
+ isEnrolled
+ ? 'border-blue-500/50 from-blue-100 dark:border-blue-400/50 dark:from-[#2b4567]'
+ : 'border-neutral-500/50 from-neutral-100 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150',
+ )}
+ />
+ <div
+ className={clsx(
+ '-ml-12 h-12 w-full border-t bg-gradient-to-r to-white duration-500 group-hover:-translate-y-8 dark:to-[#09090b]',
+ isEnrolled
+ ? 'border-blue-500/50 from-blue-100 dark:border-blue-400/50 dark:from-[#2b4567]'
+ : 'border-neutral-500/50 from-neutral-100 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150',
+ )}
+ />
+ <div
+ className={clsx(
+ '-ml-16 h-12 w-full border-t bg-gradient-to-r to-white duration-500 group-hover:-translate-y-12 dark:to-[#09090b]',
+ isEnrolled
+ ? 'border-blue-500/50 from-blue-100 dark:border-blue-400/50 dark:from-[#2b4567]'
+ : 'border-neutral-500/50 from-neutral-100 dark:border-neutral-700/50 dark:from-neutral-900 dark:group-hover:brightness-150',
+ )}
+ />
+ </div>
{isEnrolled ? <EnrolledBadge /> : null}
- <CardContent className="flex flex-col items-center gap-5 p-8">
+ <CardContent className="relative z-10 flex flex-col items-center gap-5 p-8">
<div
className={clsx(
`bg-gradient-to-r from-neutral-500/10 from-10% ${
BGS_BY_TRACK[track.id % bgsArray.length]
- } relative to-100% dark:from-neutral-500/20`,
+ } relative to-100% dark:from-neutral-900`,
'flex h-24 w-24 flex-none items-center justify-center rounded-2xl',
)}
>
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-challenge-card.tsx b/apps/web/src/app/[locale]/tracks/_components/track-challenge-card.tsx
index d5e1d4e4..71ad4bde 100644
--- a/apps/web/src/app/[locale]/tracks/_components/track-challenge-card.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/track-challenge-card.tsx
@@ -1,6 +1,6 @@
'use client';
-import { Check, PieChart } from '@repo/ui/icons';
+import { Check, PieChart, Loader2 } from '@repo/ui/icons';
import { useIsMobile } from '~/utils/useIsMobile';
import type { Challenge, Submission } from '@repo/db/types';
@@ -46,26 +46,29 @@ export function TrackChallenge({
<div
className={cn(
BGS_BY_DIFFICULTY[challenge.difficulty],
- 'flex w-full items-center justify-between gap-3 rounded-lg',
- 'bg-gradient-to-r from-neutral-500/10 from-70% to-100% dark:from-neutral-500/20',
- 'p-4 py-2 text-black/90 duration-300 group-active/challenge:bg-neutral-500/40 group-active/challenge:duration-75 dark:text-white/90 sm:py-4',
+ 'flex w-full items-center justify-between gap-3 rounded-3xl lg:rounded-lg',
+ 'bg-gradient-to-r from-neutral-500/10 from-70% to-100% dark:from-neutral-900/70',
+ 'p-4 text-black/90 duration-300 group-active/challenge:bg-neutral-500/40 group-active/challenge:duration-75 dark:text-white/90',
{
- 'group-hover/challenge:scale-105 group-hover/challenge:rounded-xl group-hover/challenge:bg-neutral-500/20':
+ 'from-blue-600/30 from-10% dark:from-neutral-500/30': isSelected,
+ },
+ {
+ 'group-hover/challenge:scale-[1.025] group-hover/challenge:bg-neutral-500/20 lg:group-hover/challenge:rounded-xl':
!isMobile,
},
)}
>
- <div className="w-full flex-col space-y-2">
- <div className="flex flex-row justify-between">
- <div className="flex flex-row gap-3">
+ <div className="w-full space-y-2">
+ <div className="flex w-full flex-row justify-between">
+ <div className="flex w-full flex-row gap-3">
<Tooltip>
<TooltipTrigger asChild>
- <div className="relative hidden items-center gap-3 md:flex md:flex-row ">
+ <div className="relative hidden gap-3 pr-1.5 pt-2 md:flex md:flex-row lg:items-center lg:pr-0 lg:pt-0">
<input
className="peer hidden appearance-none"
type="checkbox"
id={challenge.id.toString()}
- checked={isCompleted || isInProgress}
+ checked={isCompleted || isInProgress || isSelected}
readOnly
/>
<div
@@ -76,11 +79,16 @@ export function TrackChallenge({
isCompleted,
'peer-checked:bg-orange-600/80 peer-checked:dark:bg-orange-300/80':
isInProgress,
+ 'peer-checked:bg-blue-600/80 peer-checked:dark:bg-blue-300/80':
+ isSelected,
},
)}
/>
+ {isSelected ? (
+ <Loader2 className="absolute left-1 my-auto h-3 w-3 scale-0 stroke-[4] text-white duration-300 peer-checked:scale-100 dark:text-black" />
+ ) : null}
{isCompleted ? (
- <Check className="absolute left-1 my-auto h-3 w-3 scale-0 stroke-[4] text-white duration-300 peer-checked:scale-100 dark:text-black" />
+ <Check className="absolute left-1.5 my-auto h-4 w-4 scale-0 stroke-[4] text-white duration-300 peer-checked:scale-100 dark:text-black" />
) : null}
{isInProgress ? (
<PieChart className="absolute left-1 my-auto h-3 w-3 scale-0 stroke-[4] text-white duration-300 peer-checked:scale-100 dark:text-black" />
@@ -91,10 +99,10 @@ export function TrackChallenge({
<p>{isCompleted ? 'Completed' : isInProgress ? 'Attempted' : 'Todo'}</p>
</TooltipContent>
</Tooltip>
- <div className="flex flex-col items-start gap-3 md:flex-row">
- <div className="flex flex-col gap-2">
- <span className={cn({ 'text-primary': isSelected })}>{challenge.name}</span>
- <div className="flex flex-row gap-3 md:hidden">
+ <div className="flex w-full flex-col items-start gap-3 lg:flex-row">
+ <div className="flex w-full justify-between gap-2 text-lg font-bold lg:w-auto lg:text-base lg:font-normal">
+ <span className={cn({ 'font-bold': isSelected })}>{challenge.name}</span>
+ <div className="flex flex-row items-start gap-3 lg:hidden">
<DifficultyBadge difficulty={challenge.difficulty} />
{isCompleted && isMobile ? <Badge variant="outline">Completed</Badge> : null}
</div>
@@ -106,7 +114,7 @@ export function TrackChallenge({
)}
</div>
</div>
- <div className="hidden md:block">
+ <div className="hidden items-center lg:flex">
<DifficultyBadge difficulty={challenge.difficulty} />
</div>
</div>
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-details.tsx b/apps/web/src/app/[locale]/tracks/_components/track-details.tsx
index 6c2b8253..15c0457c 100644
--- a/apps/web/src/app/[locale]/tracks/_components/track-details.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/track-details.tsx
@@ -6,6 +6,7 @@ import { ActionButton } from './enroll-button';
import { TrackChallenge } from './track-challenge-card';
import { TrackProgress } from './track-progress';
import { enrollUserInTrack, getTrackDetails, unenrollUserFromTrack } from './track.action';
+import { Footsies } from '~/components/footsies';
interface TrackDetailProps {
slug: string;
@@ -45,64 +46,65 @@ export async function TrackDetail({ slug }: TrackDetailProps) {
.map((trackChallenge) => trackChallenge.id);
return (
- <div className="container flex min-h-screen flex-col items-center gap-4 py-5 md:gap-8 md:pb-20">
- <div className="flex flex-col items-center space-y-4">
- <div
- className={clsx(
- `bg-gradient-to-r from-neutral-500/10 from-10% ${
- BGS_BY_TRACK[track.id % bgsArray.length]
- } relative to-100% dark:from-neutral-500/20`,
- 'flex h-24 w-24 flex-none items-center justify-center rounded-2xl',
+ <>
+ <div className="container flex flex-col items-center gap-8 pb-8 pt-5 sm:pb-12 md:pb-0">
+ <div className="flex w-full flex-col justify-between gap-8 sm:flex-row sm:items-center sm:gap-8">
+ <div className="flex gap-6">
+ <div
+ className={clsx(
+ `bg-gradient-to-r from-neutral-500/10 from-10% ${
+ BGS_BY_TRACK[track.id % bgsArray.length]
+ } relative to-100% dark:from-neutral-500/20`,
+ 'hidden h-24 w-24 flex-none items-center justify-center rounded-2xl sm:flex',
+ )}
+ >
+ <Swords
+ size={50}
+ className={clsx(
+ 'transition-opacity duration-300',
+ !isEnrolled && 'opacity-50 group-hover:opacity-100 group-focus:opacity-100',
+ )}
+ />
+ </div>
+ <div className="flex flex-col gap-2">
+ <h1 className="text-3xl font-bold tracking-tight text-neutral-900 dark:text-white">
+ {track.name}
+ </h1>
+ <p className="text-md max-w-[69ch] text-neutral-600 dark:text-white/50">
+ {track.description}
+ </p>
+ </div>
+ </div>
+ {isEnrolled ? (
+ <ActionButton action={unenrollUserFromTrack} trackId={track.id} text="Unenroll" />
+ ) : (
+ <ActionButton action={enrollUserInTrack} trackId={track.id} text="Enroll" />
)}
- >
- <Swords
- size={50}
- className={clsx(
- 'transition-opacity duration-300',
- !isEnrolled && 'opacity-50 group-hover:opacity-100 group-focus:opacity-100',
- )}
- />
- </div>
- <div className="flex flex-col items-center space-y-2">
- <h1 className="text-center text-3xl font-bold tracking-tight text-neutral-900 dark:text-white">
- {track.name}
- </h1>
- <p className="text-md max-w-[69ch] text-center text-neutral-600 dark:text-white/50">
- {track.description}
- </p>
</div>
- {isEnrolled ? (
- <ActionButton action={unenrollUserFromTrack} trackId={track.id} text="Unenroll" />
- ) : (
- <ActionButton action={enrollUserInTrack} trackId={track.id} text="Enroll" />
- )}
- </div>
- {isEnrolled ? (
- <div className="w-full md:w-3/4 ">
- <TrackProgress
- completedChallenges={completedTrackChallenges.length}
- totalChallenges={trackChallenges.length}
- />
- </div>
- ) : null}
- <div className="flex w-full flex-row justify-around gap-8">
- <div className="flex flex-col space-y-2 md:w-3/4">
- <div className="grid-col grid grid-cols-1 gap-2 self-stretch">
- {trackChallenges.map((trackChallenge) => (
- <Link
- key={trackChallenge.challenge.id}
- href={`/challenge/${trackChallenge.challenge.slug}`}
- >
- <TrackChallenge
- challenge={trackChallenge.challenge}
- isCompleted={completedTrackChallenges.includes(trackChallenge.id)}
- isInProgress={inProgressTrackChallenges.includes(trackChallenge.id)}
- />
- </Link>
- ))}
- </div>
+ <div className="flex w-full flex-col">
+ {isEnrolled ? (
+ <div className="mb-2 w-full px-1 sm:px-8 lg:px-0">
+ <TrackProgress
+ completedChallenges={completedTrackChallenges.length}
+ totalChallenges={trackChallenges.length}
+ />
+ </div>
+ ) : null}
+ {trackChallenges.map((trackChallenge) => (
+ <Link
+ key={trackChallenge.challenge.id}
+ href={`/challenge/${trackChallenge.challenge.slug}`}
+ >
+ <TrackChallenge
+ challenge={trackChallenge.challenge}
+ isCompleted={completedTrackChallenges.includes(trackChallenge.id)}
+ isInProgress={inProgressTrackChallenges.includes(trackChallenge.id)}
+ />
+ </Link>
+ ))}
</div>
</div>
- </div>
+ <Footsies />
+ </>
);
}
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-enrolled-section.tsx b/apps/web/src/app/[locale]/tracks/_components/track-enrolled-section.tsx
index 6936fdf1..e2abd065 100644
--- a/apps/web/src/app/[locale]/tracks/_components/track-enrolled-section.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/track-enrolled-section.tsx
@@ -41,10 +41,10 @@ export async function EnrolledTrackSection() {
});
return (
- <div>
+ <div className="sm:px-8 md:px-0">
{tracks.length > 0 ? (
<>
- <div className="container flex items-center justify-between gap-3 px-4 pt-5">
+ <div className="container p-4">
<h2 className="relative text-3xl font-bold tracking-tight">
<div className="absolute -left-8 -z-10 h-12 w-32 rounded-full bg-blue-300/50 blur-3xl" />
Your Tracks
@@ -66,25 +66,30 @@ export async function EnrolledTrackSection() {
</section>
</>
) : (
- <div
- className="relative grid min-h-[246px] w-full items-center gap-2 px-5 md:grid-cols-2 md:gap-10"
- key="helper-track"
- >
- <div className="text-center md:text-right">
- <h1 className="text-lg font-bold">No Tracks Yet.</h1>
- <p className="text-muted-foreground mt-2 text-sm">
- Start your journey by enrolling in a track.
- </p>
+ <>
+ <div className="container p-4">
+ <h2 className="relative text-3xl font-bold tracking-tight">Your Tracks</h2>
</div>
+ <div
+ className="relative grid min-h-[246px] w-full items-center gap-2 px-5 md:grid-cols-2 md:gap-10"
+ key="helper-track"
+ >
+ <div className="text-center md:text-right">
+ <h1 className="text-lg font-bold">You're not enrolled in any tracks yet.</h1>
+ <p className="text-muted-foreground mt-2 text-sm">
+ Start your journey by enrolling in a track below.
+ </p>
+ </div>
- <div className="absolute left-2/4 hidden h-full w-[1px] -translate-x-2/4 transform bg-white bg-opacity-5 md:block" />
+ <div className="absolute left-2/4 hidden h-full w-[1px] -translate-x-2/4 transform bg-white bg-opacity-5 md:block" />
- <div className="row-start-1 md:row-auto">
- <SkeletonTrack />
- <SkeletonTrack className="bg-opacity-[.01 -translate-y-4 translate-x-10" />
- <div className="absolute top-1/3 -z-10 h-12 w-32 rounded-full bg-blue-300/50 blur-3xl" />
+ <div className="row-start-1 md:row-auto">
+ <SkeletonTrack />
+ <SkeletonTrack className="bg-opacity-[.01 -translate-y-4 translate-x-10" />
+ <div className="absolute top-1/3 -z-10 h-12 w-32 rounded-full bg-blue-300/50 blur-3xl" />
+ </div>
</div>
- </div>
+ </>
)}
</div>
);
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-grid.tsx b/apps/web/src/app/[locale]/tracks/_components/track-grid.tsx
index 265a4260..b1f2fb85 100644
--- a/apps/web/src/app/[locale]/tracks/_components/track-grid.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/track-grid.tsx
@@ -2,6 +2,7 @@ import { getServerAuthSession, type Session } from '@repo/auth/server';
import { prisma } from '@repo/db';
import { withUnstableCache } from '~/utils/withUnstableCache';
import { TrackCard } from './track-card';
+import { TrackCardSoon } from './track-card-soon';
export const createTrackGridCacheKey = (userId: string) => `user-${userId}-tracks`;
export async function TrackGrid() {
@@ -14,9 +15,13 @@ export async function TrackGrid() {
tags: [createTrackGridCacheKey(session?.user.id ?? '')],
});
return (
- <div className="container flex items-center justify-between gap-3">
- <section className="grid w-full grid-flow-row grid-cols-1 gap-10 lg:grid-cols-2 xl:grid-cols-3">
+ <div className="container">
+ <section className="w-[calc(100% + 8rem)] grid grid-cols-1 gap-4 sm:px-8 md:-mx-16 md:grid-cols-2 md:px-0 lg:mx-0 lg:w-full xl:grid-cols-3 2xl:gap-8">
{tracks?.map((track) => <TrackCard key={`track-${track.id}`} track={track} />)}
+ {/* Coming Soon:tm: cards */}
+ {tracks
+ ?.splice(0, 1)
+ .map((track) => <TrackCardSoon key={`track-${track.id}`} track={track} />)}
</section>
</div>
);
diff --git a/apps/web/src/app/[locale]/tracks/_components/track-progress.tsx b/apps/web/src/app/[locale]/tracks/_components/track-progress.tsx
index 720c6360..bdf64c1b 100644
--- a/apps/web/src/app/[locale]/tracks/_components/track-progress.tsx
+++ b/apps/web/src/app/[locale]/tracks/_components/track-progress.tsx
@@ -14,7 +14,10 @@ export function TrackProgress({ completedChallenges, totalChallenges }: TrackPro
{completedChallenges}/{totalChallenges}
</span>
</div>
- <Progress className="h-[8px]" value={(completedChallenges / totalChallenges) * 100} />
+ <Progress
+ className="h-[8px] bg-neutral-300 dark:bg-neutral-800"
+ value={(completedChallenges / totalChallenges) * 100}
+ />
</div>
);
}
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index 17785e45..9762d1e7 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -602,3 +602,12 @@ a {
.ReactQueryDevtools > button {
margin-bottom: 5rem !important;
}
+
+/* overrides silly annoying shadcn default */
+/* it doesn't transition shadows by default */
+.shadcnoverridetransition {
+ transition: all 0.3s ease !important;
+}
+.shadcnoverridetransition:active {
+ transition: all 0.075s ease !important;
+}