Skip to content

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

chore: cleanup suggestions

bautistaaa810af22c31fa
diff --git a/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx b/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx
index 76cc6f99..d576275e 100644
--- a/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx
+++ b/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/overview.tsx
@@ -2,12 +2,12 @@ import { Button } from '@repo/ui/components/button';
import { Markdown } from '@repo/ui/components/markdown';
import { Tooltip, TooltipContent, TooltipTrigger } from '@repo/ui/components/tooltip';
import { toast } from '@repo/ui/components/use-toast';
-import { CheckCircle2, Copy, X, XCircle } from '@repo/ui/icons';
+import { CheckCircle2, Copy, Plus, X, XCircle } from '@repo/ui/icons';
import { useQuery } from '@tanstack/react-query';
import Link from 'next/link';
+import { useParams, useSearchParams } from 'next/navigation';
import { getRelativeTime } from '~/utils/relativeTime';
import { getChallengeSubmissionById } from '../getChallengeSubmissions';
-import { useParams, useSearchParams } from 'next/navigation';
import { Suggestions } from './suggestions';
interface Props {
@@ -62,31 +62,43 @@ export function SubmissionOverview({ submissionId }: Props) {
</Tooltip>
</div>
<div className="custom-scrollable-element h-fit overflow-y-scroll p-2">
- <div className="mb-5">
- <div
- className={`flex items-center gap-1 py-1 ${
- submission.isSuccessful
- ? ' text-emerald-600 dark:text-emerald-400 '
- : ' text-rose-600 dark:text-rose-400 '
- }`}
- >
- {submission.isSuccessful ? (
- <CheckCircle2 size={17} className="mb-0.5" />
- ) : (
- <XCircle size={17} className="mb-0.5" />
- )}
- {submission.isSuccessful ? 'Accepted' : 'Rejected'}
+ <div className="mb-2 flex items-center justify-between">
+ <div>
+ <div
+ className={`flex items-center gap-1 px-3 py-1 text-xl ${
+ submission.isSuccessful
+ ? ' text-emerald-600 dark:text-emerald-400 '
+ : ' text-rose-600 dark:text-rose-400 '
+ }`}
+ >
+ {submission.isSuccessful ? (
+ <CheckCircle2 size={22} className="mb-0.5" />
+ ) : (
+ <XCircle size={22} className="mb-0.5" />
+ )}
+ {submission.isSuccessful ? 'Accepted' : 'Rejected'}
+ </div>
+ <div className="px-3 text-sm text-neutral-500">
+ Submitted {getRelativeTime(submission.createdAt)}
+ </div>
</div>
- <div className="text-sm text-neutral-500">
- Submitted {getRelativeTime(submission.createdAt)}
+ <div>
+ <Link
+ className="bg-primary flex h-8 items-center gap-1 rounded-lg px-3 py-2 text-sm"
+ href={`/challenge/${slug}/solutions`}
+ >
+ <Plus size={16} /> Solution
+ </Link>
</div>
</div>
{showSuggestions ? (
- <div className="flex w-full items-start justify-center">
+ <div className="flex w-full items-start">
<Suggestions track={track} challengeId={submission.challengeId} />
</div>
) : null}
- <Markdown>{code}</Markdown>
+ <div className="mb-3 px-3">
+ <Markdown>{code}</Markdown>
+ </div>
</div>
</>
);
diff --git a/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/suggestions.tsx b/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/suggestions.tsx
index e67f86e1..3490a812 100644
--- a/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/suggestions.tsx
+++ b/apps/web/src/app/[locale]/challenge/[slug]/submissions/[[...catchAll]]/_components/suggestions.tsx
@@ -1,13 +1,12 @@
'use client';
import { Button } from '@repo/ui/components/button';
-import type { ChallengeRouteData } from '../../../getChallengeRouteData';
import { ChevronRight, Swords } from '@repo/ui/icons';
import { useQuery } from '@tanstack/react-query';
+import Link from 'next/link';
import { useMemo } from 'react';
-import { getTrackDetails } from '~/app/[locale]/tracks/_components/track.action';
import { TrackChallenge } from '~/app/[locale]/tracks/_components/track-challenge-card';
+import { getTrackDetails } from '~/app/[locale]/tracks/_components/track.action';
import { getSimilarChallenges } from '~/utils/server/get-similar-challenges';
-import Link from 'next/link';
interface SuggestionsProps {
track: string | null;
@@ -50,21 +49,21 @@ export function Suggestions({ track, challengeId }: SuggestionsProps) {
}, [currentIndex, trackDetails]);
return (
- <div className="w-full max-w-[1000px] md:p-4 md:pb-8">
+ <div className="w-full max-w-[1000px] md:py-4 md:pb-8">
{trackDetails && next ? (
<>
<div className="flex items-center justify-between p-3">
- <h2 className="text-foreground/70 flex items-center gap-2 text-xl font-bold md:text-2xl">
- <Swords className="h-8 w-8" />
+ <h3 className="text-foreground/70 flex items-center gap-2 text-lg font-semibold md:text-xl">
+ <Swords size={26} />
{`Next Up in ${trackDetails?.name}`}
- </h2>
+ </h3>
<Link href={`/tracks/${track}`}>
<Button size="sm" className="gap-1 rounded-full" variant="outline">
More <ChevronRight size={13} />
</Button>
</Link>
</div>
- <div className="px-6">
+ <div className="px-3">
<Link href={`/challenge/${next.challenge.slug}`}>
<TrackChallenge
challenge={next.challenge}
@@ -79,15 +78,15 @@ export function Suggestions({ track, challengeId }: SuggestionsProps) {
{similarChallenges ? (
<>
- <div className="mt-2 flex items-center justify-between p-3">
- <h2 className="text-foreground/70 text-xl font-bold md:text-2xl">More Challenges</h2>
+ <div className="flex items-center justify-between p-3">
+ <h3 className="text-foreground/70 text-lg font-semibold md:text-xl">More Challenges</h3>
<Link href="/explore">
<Button size="sm" className="gap-1 rounded-full" variant="outline">
Explore <ChevronRight size={13} />
</Button>
</Link>
</div>
- <div className="px-6">
+ <div className="px-3">
{similarChallenges?.map((challenge, idx) => {
return (
<Link href={`/challenge/${challenge.slug}`} key={idx}>