Skip to content

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

chore: clean up typo + types

bautistaaaf816235d3261
diff --git a/apps/web/src/components/explore/explore-slug.tsx b/apps/web/src/components/explore/explore-slug.tsx
index 6a520d74..40909e05 100644
--- a/apps/web/src/components/explore/explore-slug.tsx
+++ b/apps/web/src/components/explore/explore-slug.tsx
@@ -1,7 +1,7 @@
import Link from 'next/link';
import { TypographyH3 } from '@repo/ui';
import { ExploreCard } from './explore-card';
-import { getChallangesByTagOrDifficulty } from './explore.action';
+import { getChallengesByTagOrDifficulty } from './explore.action';
interface ExploreSlugProps {
slug: string;
@@ -11,7 +11,7 @@ interface ExploreSlugProps {
* todo: paginate the challenges. also make em look nice.
*/
export async function ExploreSlug({ slug }: ExploreSlugProps) {
- const challenges = await getChallangesByTagOrDifficulty(slug);
+ const challenges = await getChallengesByTagOrDifficulty(slug);
return (
<div className="container flex flex-col items-center gap-8 py-5 md:gap-20 md:pb-20">
diff --git a/apps/web/src/components/explore/explore.action.ts b/apps/web/src/components/explore/explore.action.ts
index dbf391d3..b1faa0f8 100644
--- a/apps/web/src/components/explore/explore.action.ts
+++ b/apps/web/src/components/explore/explore.action.ts
@@ -3,13 +3,13 @@
import { prisma } from '@repo/db';
import { Tags, type Difficulty } from '@repo/db/types';
-export type ExploreChallengeData = ReturnType<typeof getChallangesByTagOrDifficulty>;
+export type ExploreChallengeData = ReturnType<typeof getChallengesByTagOrDifficulty>;
const allTags: Tags[] = Object.values(Tags);
/**
* Fetches challenges either by tag or difficulty.
*/
-export async function getChallangesByTagOrDifficulty(str: string, take?: number) {
+export async function getChallengesByTagOrDifficulty(str: string, take?: number) {
const formattedStr = str.trim().toUpperCase();
return prisma.challenge.findMany({
diff --git a/apps/web/src/components/explore/index.tsx b/apps/web/src/components/explore/index.tsx
index ac414a60..77df2b6e 100644
--- a/apps/web/src/components/explore/index.tsx
+++ b/apps/web/src/components/explore/index.tsx
@@ -1,5 +1,5 @@
import { Suspense } from 'react';
-import { getChallangesByTagOrDifficulty } from './explore.action';
+import { getChallengesByTagOrDifficulty } from './explore.action';
import { ExploreSection } from './section';
import { ExploreSectionSkeleton } from './section-skeleton';
@@ -17,37 +17,37 @@ export async function Explore() {
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection
title="Most Popular"
- fetcher={getChallangesByTagOrDifficulty}
- moreRoute="popular"
+ fetcher={getChallengesByTagOrDifficulty}
+ moreRoute="POPULAR"
/>
</Suspense>
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection
title="Newest"
- fetcher={getChallangesByTagOrDifficulty}
- moreRoute="newest"
+ fetcher={getChallengesByTagOrDifficulty}
+ moreRoute="NEWEST"
/>
</Suspense>
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection
title="Great for Beginners"
- fetcher={getChallangesByTagOrDifficulty}
- moreRoute="easy"
+ fetcher={getChallengesByTagOrDifficulty}
+ moreRoute="EASY"
/>
</Suspense>
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection
title="Great for Enthusiasts"
- fetcher={getChallangesByTagOrDifficulty}
- moreRoute="medium"
+ fetcher={getChallengesByTagOrDifficulty}
+ moreRoute="MEDIUM"
/>
</Suspense>
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection
title="For the Experts"
- fetcher={getChallangesByTagOrDifficulty}
- moreRoute="hard"
+ fetcher={getChallengesByTagOrDifficulty}
+ moreRoute="HARD"
/>
</Suspense>
</div>
diff --git a/apps/web/src/components/explore/section.tsx b/apps/web/src/components/explore/section.tsx
index 7cb5baa1..5de81a18 100644
--- a/apps/web/src/components/explore/section.tsx
+++ b/apps/web/src/components/explore/section.tsx
@@ -1,4 +1,5 @@
import { Diamond } from '@repo/ui/icons';
+import type { Difficulty, Tags } from '@repo/db/types';
import type { ExploreChallengeData } from './explore.action';
import { ExploreCarousel } from './section-carousel';
import { ViewMoreButton } from './view-more-button';
@@ -11,7 +12,7 @@ interface Props {
* - Make sure it's either a `DIFFICULTY` or `TAGS`. Anything else will return in not found.
* - Case doesn't matter since we trim & uppercase before querying db.
*/
- moreRoute: string;
+ moreRoute: Difficulty | Tags;
}
const COLORS_BY_DIFFICULTY = {