diff --git a/apps/web/components/CustomPagination.tsx b/apps/web/components/CustomPagination.tsx
index 88bbde35..382143bd 100644
--- a/apps/web/components/CustomPagination.tsx
+++ b/apps/web/components/CustomPagination.tsx
@@ -2,7 +2,8 @@ import { Track, Problem } from "@prisma/client";
import { PageToggle } from "./PageToggle";
import Link from "next/link";
import { Button } from "@repo/ui";
-import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons";
+import { ArrowUp, ChevronLeft, ChevronRight, HomeIcon } from "lucide-react";
+import { motion } from "framer-motion";
const CustomPagination = ({
isAtHeader = false,
@@ -14,8 +15,18 @@ const CustomPagination = ({
problemIndex: number;
track: Track & { problems: Problem[] };
}) => {
+ const scrollToTop = () => {
+ window.scrollTo({ top: 0, behavior: "smooth" });
+ };
+
return (
-
+
+
+
+
@@ -55,23 +68,29 @@ const CustomPagination = ({
+
);
};
diff --git a/apps/web/components/TrackTools.tsx b/apps/web/components/TrackTools.tsx
index 078271bb..b532c039 100644
--- a/apps/web/components/TrackTools.tsx
+++ b/apps/web/components/TrackTools.tsx
@@ -2,7 +2,7 @@ import { Track, Problem } from "@prisma/client";
import { PageToggle } from "./PageToggle";
import Link from "next/link";
import { Button } from "@repo/ui";
-import { ArrowUp, ChevronLeft, ChevronRight } from "lucide-react";
+import { ArrowUp, ChevronLeft, ChevronRight, HomeIcon } from "lucide-react";
import { motion } from "framer-motion";
const TrackTools = ({
@@ -25,9 +25,10 @@ const TrackTools = ({
className="flex w-full items-center justify-between gap-2 p-6"
>
-
+
@@ -42,7 +43,7 @@ const TrackTools = ({
size={"lg"}
>
-
Prev
+
Prev
-
Next
+
Next
{/* To Top */}
diff --git a/apps/web/components/Tracks.tsx b/apps/web/components/Tracks.tsx
index 3eebb117..1d834031 100644
--- a/apps/web/components/Tracks.tsx
+++ b/apps/web/components/Tracks.tsx
@@ -61,7 +61,9 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {
const filterTracks = () => {
setLoading(true);
- let newFilteredTracks = tracks;
+ let newFilteredTracks = [...tracks].sort(
+ (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
+ );
if (selectedCohort) {
newFilteredTracks = newFilteredTracks.filter((t) => t.cohort === selectedCohort);
}
@@ -95,6 +97,15 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {
setSelectedCohort((prevCohort) => (prevCohort === cohort ? null : cohort));
};
+ const handleAllTracks = () => {
+ setLoading(true);
+ setFilteredTracks(tracks);
+ setSelectedCategory("");
+ setSelectedCohort(null);
+ setCurrentPage(1);
+ setLoading(false);
+ };
+
useEffect(() => {
filterTracks();
}, [selectedCategory, selectedCohort, tracks]);
@@ -131,8 +142,17 @@ export const Tracks = ({ tracks, categories }: TracksWithCategoriesProps) => {
className="flex max-w-5xl flex-col gap-4 w-full mx-auto p-4"
id="tracks"
>
-
+
+
+
-
+
{/* Filter by Categories */}