Skip to content

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

a bunch of ui changes to channel description panel (#148)

PickleNik19cb9287a9fd
diff --git a/src/components/challenge/challenge-layout.tsx b/src/components/challenge/challenge-layout.tsx
index 5dfbb7b4..b604fb50 100644
--- a/src/components/challenge/challenge-layout.tsx
+++ b/src/components/challenge/challenge-layout.tsx
@@ -176,7 +176,7 @@ export function ChallengeLayout({ left, right, skeleton = false }: ChallengeLayo
<div
ref={leftSide}
className={clsx(
- 'min-h-[42px] w-full overflow-y-auto rounded-xl border border-zinc-300 bg-white dark:border-zinc-700 dark:bg-zinc-800 lg:min-w-[500px]',
+ 'min-h-[42px] w-full overflow-hidden rounded-l-2xl rounded-r-xl border border-zinc-300 bg-white dark:border-zinc-700 dark:bg-zinc-800 lg:min-w-[500px]',
skeleton && 'animate-pulse',
)}
>
@@ -202,7 +202,7 @@ export function ChallengeLayout({ left, right, skeleton = false }: ChallengeLayo
ref={rightSide}
style={{ flex: '1 1 0%' }}
className={clsx(
- 'flex flex-col overflow-hidden rounded-xl border border-zinc-300 dark:border-zinc-700 lg:min-w-[500px]',
+ 'flex flex-col overflow-hidden rounded-l-xl rounded-r-2xl border border-zinc-300 dark:border-zinc-700 lg:min-w-[500px]',
skeleton ? 'items-center justify-center pb-3 dark:bg-[#1e1e1e]' : 'min-h-[90px] w-full',
)}
>
diff --git a/src/components/challenge/comments.tsx b/src/components/challenge/comments.tsx
index 717206b4..07bc92b6 100644
--- a/src/components/challenge/comments.tsx
+++ b/src/components/challenge/comments.tsx
@@ -1,15 +1,44 @@
+import clsx from 'clsx';
import { Button } from '~/components/ui/button';
import Comment from '~/components/ui/comment';
import { type Challenge } from '~/app/challenge/[id]/page';
+import { MessageCircle, ChevronDown } from 'lucide-react';
+import { useState } from 'react';
+import { Input } from '../ui/input';
+import NoComments from './nocomments';
interface Props {
challenge: NonNullable<Challenge>;
}
const Comments = ({ challenge }: Props) => {
+ const [showComments, setShowComments] = useState(false);
+ const handleClick = () => {
+ setShowComments(!showComments);
+ };
return (
- <div className="flex h-full w-full flex-col py-4">
- <div className="flex-1 flex-grow">
+ <div className="relative">
+ <button
+ className="flex w-full items-center justify-between gap-2 p-3 font-medium text-neutral-500 duration-300 hover:text-neutral-700 dark:hover:text-zinc-300"
+ onClick={() => handleClick()}
+ >
+ <div className="flex items-center">
+ <MessageCircle className="h-5 w-5"></MessageCircle>
+ &nbsp; Comments
+ </div>
+ <ChevronDown
+ className={clsx('h-4 w-4 duration-300', {
+ '-rotate-180': !showComments,
+ })}
+ ></ChevronDown>
+ </button>
+ <div
+ className={clsx('overscroll-contain duration-300', {
+ 'h-64 overflow-y-auto': showComments,
+ 'h-0 overflow-y-hidden': !showComments,
+ })}
+ >
+ {challenge.comment.length === 0 && <NoComments></NoComments>}
{challenge.comment.map((comment) => (
<Comment
key={comment.id}
@@ -19,7 +48,15 @@ const Comments = ({ challenge }: Props) => {
/>
))}
</div>
- <Button className="sticky bottom-4 right-4 max-w-fit self-end">Comment</Button>
+ <div className="m-2 mt-0 flex items-center justify-between gap-2 rounded-xl bg-background/90 bg-neutral-100 p-1 pr-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-zinc-700/90">
+ <Input
+ className="border-0 focus-visible:ring-0 focus-visible:ring-offset-0"
+ placeholder="Enter your comment here."
+ />
+ <Button className="h-8 rounded-lg bg-emerald-600 px-3 py-2 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300">
+ Comment
+ </Button>
+ </div>
</div>
);
};
diff --git a/src/components/challenge/description/index.tsx b/src/components/challenge/description/index.tsx
index e69de29b..a09a2761 100644
--- a/src/components/challenge/description/index.tsx
+++ b/src/components/challenge/description/index.tsx
@@ -0,0 +1,348 @@
+'use client';
+
+import { clsx } from 'clsx';
+import { debounce } from 'lodash';
+
+import { useSession } from 'next-auth/react';
+import { useRouter } from 'next/navigation';
+import { useRef, useState } from 'react';
+
+import { useForm } from 'react-hook-form';
+
+import { Bookmark as BookmarkIcon, Share, ThumbsUp } from 'lucide-react';
+import { Button } from '~/components/ui/button';
+import {
+ Dialog,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ DialogTrigger,
+} from '~/components/ui/dialog';
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '~/components/ui/tooltip';
+import { TypographyH3 } from '~/components/ui/typography/h3';
+import { DifficultyBadge } from '../../explore/difficulty-badge';
+import { ActionMenu } from '../../ui/action-menu';
+import { Checkbox } from '../../ui/checkbox';
+import { Form, FormField, FormItem } from '../../ui/form';
+import { Markdown } from '../../ui/markdown';
+import { Textarea } from '../../ui/textarea';
+import { TypographyLarge } from '../../ui/typography/large';
+import { ShareForm } from '../share-form';
+
+import { toast } from '../../ui/use-toast';
+import { addOrRemoveBookmark } from '../bookmark.action';
+import { incrementOrDecrementUpvote } from '../increment.action';
+import { addReport } from '../report.action';
+import { type Challenge } from '~/app/challenge/[id]/layout';
+
+interface Props {
+ challenge: NonNullable<Challenge>;
+}
+
+export type FormValues = {
+ comments: string;
+ examples: boolean;
+ derogatory: boolean;
+ other: boolean;
+};
+
+export function Description({ challenge }: Props) {
+ const router = useRouter();
+ const [votes, setVotes] = useState(challenge._count.vote);
+ const [hasVoted, setHasVoted] = useState(challenge.vote.length > 0);
+ const [hasBookmarked, setHasBookmarked] = useState(challenge.bookmark.length > 0);
+ const session = useSession();
+ const debouncedSearch = useRef(
+ debounce(async (challengeId: number, userId: string, shouldIncrement: boolean) => {
+ const votes = await incrementOrDecrementUpvote(challengeId, userId, shouldIncrement);
+ if (votes !== undefined && votes !== null) {
+ setVotes(votes);
+ }
+
+ router.refresh();
+ }, 500),
+ ).current;
+
+ const debouncedBookmark = useRef(
+ debounce(async (challengeId: number, userId: string, shouldBookmark: boolean) => {
+ try {
+ await addOrRemoveBookmark(challengeId, userId, shouldBookmark);
+ setHasBookmarked(shouldBookmark);
+ router.refresh();
+ } catch (e) {
+ console.error(e);
+ // it errored so reverse the intended changes
+ setHasBookmarked(!shouldBookmark);
+ }
+ }, 500),
+ ).current;
+
+ const [dialogOpen, setDialogOpen] = useState(false);
+
+ const form = useForm<FormValues>({
+ defaultValues: {
+ comments: '',
+ other: false,
+ examples: false,
+ derogatory: false,
+ },
+ });
+
+ async function onSubmit(data: FormValues) {
+ const response = await addReport(challenge.id, session?.data?.user?.id as string, data);
+ if (response === 'created') {
+ toast({
+ title: 'Feedback Sent',
+ variant: 'success',
+ description: (
+ <p>
+ Thank you for submitting this feedback. Someone from our moderator team will be
+ reviewing it shortly.
+ </p>
+ ),
+ });
+ } else if (response === 'report_already_made') {
+ toast({
+ title: 'Report already made',
+ description: (
+ <p>
+ You have already made a report about this challenge. We are still reviewing the
+ question.
+ </p>
+ ),
+ });
+ } else if (response === 'not_logged_in') {
+ toast({
+ title: 'You are not loggeed in',
+ description: <p>Please log in to make this report.</p>,
+ });
+ }
+
+ setDialogOpen(false);
+ }
+ return (
+ <>
+ <div className="flex items-baseline justify-between">
+ <TypographyH3 className="mb-2 font-medium">{challenge.name}</TypographyH3>
+
+ <ActionMenu
+ items={[
+ {
+ key: 'feedback',
+ label: 'Feedback',
+ icon: 'Flag',
+ },
+ ]}
+ onChange={() => setDialogOpen(true)}
+ />
+ </div>
+
+ <Dialog open={dialogOpen} onOpenChange={(e) => setDialogOpen(!e)}>
+ <DialogContent>
+ <Form {...form}>
+ {/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}
+ <form onSubmit={form.handleSubmit(onSubmit)}>
+ <DialogHeader>
+ <DialogTitle>Feedback: {challenge.name}</DialogTitle>
+ </DialogHeader>
+
+ <div className="my-4 flex flex-col gap-4">
+ <TypographyLarge>Issues Encountered</TypographyLarge>
+ <FormField
+ name="examples"
+ render={({ field }) => (
+ <FormItem>
+ <div className="flex items-center gap-4">
+ <Checkbox
+ id="examples"
+ checked={field.value as boolean}
+ onChange={field.onChange}
+ onCheckedChange={field.onChange}
+ />
+ <label htmlFor="examples">
+ Description or examples are unclear or incorrect
+ </label>
+ </div>
+ </FormItem>
+ )}
+ />
+ <FormField
+ name="derogatory"
+ render={({ field }) => (
+ <FormItem>
+ <div className="flex items-center gap-4">
+ <Checkbox
+ id="derogatory"
+ checked={field.value as boolean}
+ onCheckedChange={field.onChange}
+ />
+ <label htmlFor="derogatory">Racist or other derogatory statement</label>
+ </div>
+ </FormItem>
+ )}
+ />
+ <FormField
+ name="other"
+ render={({ field }) => (
+ <FormItem>
+ <div className="flex items-center gap-4">
+ <Checkbox
+ id="other"
+ checked={field.value as boolean}
+ onCheckedChange={field.onChange}
+ />
+ <label htmlFor="other">Other</label>
+ </div>
+ </FormItem>
+ )}
+ />
+ <FormField
+ name="comments"
+ render={({ field }) => (
+ <FormItem>
+ <TypographyLarge>Comments</TypographyLarge>
+ <Textarea value={field.value as string} onChange={field.onChange} />
+ </FormItem>
+ )}
+ />
+ </div>
+ <DialogFooter>
+ <Button variant="secondary" type="button" onClick={() => setDialogOpen(false)}>
+ Close
+ </Button>
+ <Button type="submit">Report</Button>
+ </DialogFooter>
+ </form>
+ </Form>
+ </DialogContent>
+ </Dialog>
+
+ <div className="mb-6 flex items-center gap-4">
+ <DifficultyBadge difficulty={challenge.difficulty} />
+
+ <TooltipProvider>
+ <Tooltip delayDuration={0.05} open={session?.data?.user?.id ? false : undefined}>
+ <TooltipTrigger asChild>
+ <span>
+ <Button
+ variant="ghost"
+ className="p-1"
+ disabled={!session?.data?.user?.id}
+ onClick={(): void => {
+ let shouldBookmark = false;
+ if (hasBookmarked) {
+ shouldBookmark = false;
+ setHasBookmarked(false);
+ } else {
+ shouldBookmark = true;
+ setHasBookmarked(true);
+ }
+ debouncedBookmark(
+ challenge.id,
+ session?.data?.user?.id as string,
+ shouldBookmark,
+ )?.catch((e) => {
+ console.error(e);
+ });
+ }}
+ >
+ <BookmarkIcon
+ size={20}
+ className={clsx(
+ {
+ 'fill-blue-500 stroke-blue-500': hasBookmarked,
+ 'stroke-gray-500': !hasBookmarked,
+ },
+ 'hover:stroke-gray-400',
+ )}
+ />
+ </Button>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Login to Bookmark</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <Dialog>
+ <DialogTrigger>
+ <Share size={20} className="stroke-gray-500 hover:stroke-gray-400" />
+ </DialogTrigger>
+ <DialogContent className="w-[200px]">
+ <DialogHeader>
+ <DialogTitle>Share this challenge</DialogTitle>
+ <div className="pt-4">
+ <ShareForm />
+ </div>
+ </DialogHeader>
+ <div className="pt-4">
+ <ShareForm />
+ </div>
+ </DialogContent>
+ </Dialog>
+ <TooltipProvider>
+ <Tooltip delayDuration={0.05} open={session?.data?.user?.id ? false : undefined}>
+ <TooltipTrigger asChild>
+ <span>
+ <Button
+ className="group -ml-1 w-14 gap-2 rounded-lg p-1"
+ variant="ghost"
+ disabled={!session?.data?.user?.id}
+ onClick={(): void => {
+ let shouldIncrement = false;
+ if (hasVoted) {
+ setVotes((v) => v - 1);
+ shouldIncrement = false;
+ setHasVoted(false);
+ } else {
+ setVotes((v) => v + 1);
+ shouldIncrement = true;
+ setHasVoted(true);
+ }
+ debouncedSearch(
+ challenge.id,
+ session?.data?.user?.id as string,
+ shouldIncrement,
+ )?.catch((e) => {
+ console.error(e);
+ });
+ }}
+ >
+ <ThumbsUp
+ size={20}
+ className={clsx(
+ {
+ 'fill-emerald-600 stroke-emerald-600 group-hover:stroke-emerald-500 dark:fill-emerald-400 dark:stroke-emerald-400':
+ hasVoted,
+ 'stroke-zinc-500': !hasVoted,
+ },
+ 'duration-300 group-hover:stroke-zinc-400',
+ )}
+ />
+ <span
+ className={clsx(
+ {
+ 'text-emerald-600 dark:text-emerald-400': hasVoted,
+ 'text-zinc-500 group-hover:text-zinc-400': !hasVoted,
+ },
+ 'self-end text-lg duration-300',
+ )}
+ >
+ {votes}
+ </span>
+ </Button>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Login to Upvote</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ </div>
+ <div className="prose-invert leading-8 prose-h3:text-xl">
+ <Markdown>{challenge.description}</Markdown>
+ </div>
+ </>
+ );
+}
diff --git a/src/components/challenge/editor/index.tsx b/src/components/challenge/editor/index.tsx
index 43fc7a9e..8f37f3fc 100644
--- a/src/components/challenge/editor/index.tsx
+++ b/src/components/challenge/editor/index.tsx
@@ -309,7 +309,7 @@ export const CodePanel = (props: Props) => {
<span>
<Button
size="sm"
- className="cursor-pointer bg-emerald-600 duration-300 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"
+ className="cursor-pointer rounded-lg bg-emerald-600 duration-300 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"
// eslint-disable-next-line @typescript-eslint/no-misused-promises
onClick={handleSubmit}
disabled={!initialTypecheckDone || !session?.user}
diff --git a/src/components/challenge/left-panel-skeleton.tsx b/src/components/challenge/left-panel-skeleton.tsx
index 6f4fb443..7a34af16 100644
--- a/src/components/challenge/left-panel-skeleton.tsx
+++ b/src/components/challenge/left-panel-skeleton.tsx
@@ -4,16 +4,16 @@ export function DescriptionPanelSkeleton() {
return (
<>
<Tabs defaultValue="description" className="w-full">
- <TabsList className="sticky top-0 grid h-auto w-full grid-cols-4 rounded-none border-b border-zinc-300 bg-background dark:border-zinc-700 dark:bg-muted">
+ <TabsList className="sticky top-0 grid h-auto w-full grid-cols-3 rounded-none border-b border-zinc-300 bg-background dark:border-zinc-700 dark:bg-muted">
<TabsTrigger
value="description"
- className="rounded-md rounded-tl-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
+ className="rounded-md rounded-tl-xl duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
>
Description
</TabsTrigger>
<TabsTrigger
value="solutions"
- className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
+ className="rounded-md duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
>
Solutions
</TabsTrigger>
@@ -23,12 +23,6 @@ export function DescriptionPanelSkeleton() {
>
Submissions
</TabsTrigger>
- <TabsTrigger
- value="comments"
- className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
- >
- Comments
- </TabsTrigger>
</TabsList>
<TabsContent value="description" className="mt-0 dark:bg-muted">
<div className="h-full p-5">
@@ -96,25 +90,6 @@ export function DescriptionPanelSkeleton() {
</div>
</div>
</TabsContent>
- <TabsContent className="flex h-full flex-col space-y-2 p-5" value="comments">
- <div className="flex flex-col space-y-10">
- <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl">
- <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- <div className="h-4 w-1/2 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- </div>
- <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl">
- <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- <div className="h-4 w-1/2 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- </div>
- <div className="prose-invert flex flex-col space-y-2 prose-h3:text-xl">
- <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- <div className="h-4 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- <div className="h-4 w-1/2 rounded-lg bg-zinc-300 dark:bg-zinc-700"></div>
- </div>
- </div>
- </TabsContent>
</Tabs>
</>
);
diff --git a/src/components/challenge/left-panel.tsx b/src/components/challenge/left-panel.tsx
index ed28337f..4a81646f 100644
--- a/src/components/challenge/left-panel.tsx
+++ b/src/components/challenge/left-panel.tsx
@@ -1,400 +1,68 @@
'use client';
-import { clsx } from 'clsx';
-import { debounce } from 'lodash';
-import { Bookmark as BookmarkIcon, Share, ThumbsUp } from 'lucide-react';
-import { useSession } from 'next-auth/react';
-import { useRouter } from 'next/navigation';
-import { useRef, useState } from 'react';
-
-import { useForm } from 'react-hook-form';
-import { Button } from '~/components/ui/button';
-import {
- Dialog,
- DialogContent,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from '~/components/ui/dialog';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '~/components/ui/tabs';
-import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '~/components/ui/tooltip';
-import { TypographyH3 } from '~/components/ui/typography/h3';
-import { DifficultyBadge } from '../explore/difficulty-badge';
-import { ActionMenu } from '../ui/action-menu';
-import { Checkbox } from '../ui/checkbox';
-import { Form, FormField, FormItem } from '../ui/form';
-import { Markdown } from '../ui/markdown';
-import { Textarea } from '../ui/textarea';
-import { TypographyLarge } from '../ui/typography/large';
-import { toast } from '../ui/use-toast';
-import { addOrRemoveBookmark } from './bookmark.action';
import Comments from './comments';
-import { incrementOrDecrementUpvote } from './increment.action';
-import { addReport } from './report.action';
-import { ShareForm } from './share-form';
+import { Description } from '~/components/challenge/description';
import { Solutions } from './solutions';
import { Submissions } from './submissions';
-import Link from 'next/link';
import { type Challenge } from '~/app/challenge/[id]/layout';
+import Link from 'next/link';
interface Props {
challenge: NonNullable<Challenge>;
selectedTab: 'description' | 'submissions' | 'solutions' | 'comments';
}
-export type FormValues = {
- comments: string;
- examples: boolean;
- derogatory: boolean;
- other: boolean;
-};
-
export function LeftPanel({ challenge, selectedTab }: Props) {
- const router = useRouter();
- const [votes, setVotes] = useState(challenge._count.vote);
- const [hasVoted, setHasVoted] = useState(challenge.vote.length > 0);
- const [hasBookmarked, setHasBookmarked] = useState(challenge.bookmark.length > 0);
- const session = useSession();
- const debouncedSearch = useRef(
- debounce(async (challengeId: number, userId: string, shouldIncrement: boolean) => {
- const votes = await incrementOrDecrementUpvote(challengeId, userId, shouldIncrement);
- if (votes !== undefined && votes !== null) {
- setVotes(votes);
- }
-
- router.refresh();
- }, 500),
- ).current;
-
- const debouncedBookmark = useRef(
- debounce(async (challengeId: number, userId: string, shouldBookmark: boolean) => {
- try {
- await addOrRemoveBookmark(challengeId, userId, shouldBookmark);
- setHasBookmarked(shouldBookmark);
- router.refresh();
- } catch (e) {
- console.error(e);
- // it errored so reverse the intended changes
- setHasBookmarked(!shouldBookmark);
- }
- }, 500),
- ).current;
-
- const [dialogOpen, setDialogOpen] = useState(false);
-
- const form = useForm<FormValues>({
- defaultValues: {
- comments: '',
- other: false,
- examples: false,
- derogatory: false,
- },
- });
-
- async function onSubmit(data: FormValues) {
- const response = await addReport(challenge.id, session?.data?.user?.id as string, data);
- if (response === 'created') {
- toast({
- title: 'Feedback Sent',
- variant: 'success',
- description: (
- <p>
- Thank you for submitting this feedback. Someone from our moderator team will be
- reviewing it shortly.
- </p>
- ),
- });
- } else if (response === 'report_already_made') {
- toast({
- title: 'Report already made',
- description: (
- <p>
- You have already made a report about this challenge. We are still reviewing the
- question.
- </p>
- ),
- });
- } else if (response === 'not_logged_in') {
- toast({
- title: 'You are not loggeed in',
- description: <p>Please log in to make this report.</p>,
- });
- }
-
- setDialogOpen(false);
- }
-
return (
- <>
- <Tabs defaultValue={selectedTab} className="flex h-full w-full flex-col">
- <TabsList className="sticky top-0 z-10 grid h-auto w-full grid-cols-4 rounded-none border-b border-zinc-300 bg-background/90 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
- <TabsTrigger
- value="description"
- className="rounded-md rounded-tl-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
- >
- <Link href={`/challenge/${challenge.id}`}>Description</Link>
- </TabsTrigger>
- <TabsTrigger
- value="solutions"
- className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
- >
- <Link href={`/challenge/${challenge.id}/solutions`}>Solutions</Link>
- </TabsTrigger>
- <TabsTrigger
- value="submissions"
- className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
- >
- <Link href={`/challenge/${challenge.id}/submissions`}>Submissions</Link>
- </TabsTrigger>
- <TabsTrigger
- value="comments"
- className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
- >
- <Link href={`/challenge/${challenge.id}/comments`}>Comments</Link>
- </TabsTrigger>
- </TabsList>
- <TabsContent value="description" className="mt-0 flex-1 dark:bg-muted">
- <div className="h-full px-4 py-3">
- <div className="flex items-baseline justify-between">
- <TypographyH3 className="mb-2 font-medium">{challenge.name}</TypographyH3>
- <div>
- <ActionMenu
- items={[
- {
- key: 'feedback',
- label: 'Feedback',
- icon: 'Flag',
- },
- ]}
- onChange={() => setDialogOpen(true)}
- />
- </div>
- </div>
-
- <Dialog open={dialogOpen} onOpenChange={(e) => setDialogOpen(!e)}>
- <DialogContent>
- <Form {...form}>
- {/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}
- <form onSubmit={form.handleSubmit(onSubmit)}>
- <DialogHeader>
- <DialogTitle>Feedback: {challenge.name}</DialogTitle>
- </DialogHeader>
-
- <div className="my-4 flex flex-col gap-4">
- <TypographyLarge>Issues Encountered</TypographyLarge>
- <FormField
- name="examples"
- render={({ field }) => (
- <FormItem>
- <div className="flex items-center gap-4">
- <Checkbox
- id="examples"
- checked={field.value as boolean}
- onChange={field.onChange}
- onCheckedChange={field.onChange}
- />
- <label htmlFor="examples">
- Description or examples are unclear or incorrect
- </label>
- </div>
- </FormItem>
- )}
- />
- <FormField
- name="derogatory"
- render={({ field }) => (
- <FormItem>
- <div className="flex items-center gap-4">
- <Checkbox
- id="derogatory"
- checked={field.value as boolean}
- onCheckedChange={field.onChange}
- />
- <label htmlFor="derogatory">
- Racist or other derogatory statement
- </label>
- </div>
- </FormItem>
- )}
- />
- <FormField
- name="other"
- render={({ field }) => (
- <FormItem>
- <div className="flex items-center gap-4">
- <Checkbox
- id="other"
- checked={field.value as boolean}
- onCheckedChange={field.onChange}
- />
- <label htmlFor="other">Other</label>
- </div>
- </FormItem>
- )}
- />
- <FormField
- name="comments"
- render={({ field }) => (
- <FormItem>
- <TypographyLarge>Comments</TypographyLarge>
- <Textarea value={field.value as string} onChange={field.onChange} />
- </FormItem>
- )}
- />
- </div>
- <DialogFooter>
- <Button
- variant="secondary"
- type="button"
- onClick={() => setDialogOpen(false)}
- >
- Close
- </Button>
- <Button type="submit">Report</Button>
- </DialogFooter>
- </form>
- </Form>
- </DialogContent>
- </Dialog>
-
- <div className="mb-6 flex items-center gap-4">
- <DifficultyBadge difficulty={challenge.difficulty} />
+ <Tabs
+ defaultValue={selectedTab}
+ className="flex h-full w-full flex-col overflow-y-auto overflow-x-hidden"
+ >
+ <TabsList className="sticky top-0 z-10 grid h-auto w-full grid-cols-3 rounded-none rounded-tl-2xl rounded-tr-xl border-b border-zinc-300 bg-background/90 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
+ <TabsTrigger
+ value="description"
+ className="rounded-md rounded-tl-xl duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
+ >
+ <Link href={`/challenge/${challenge.id}`}>Description</Link>
+ </TabsTrigger>
+ <TabsTrigger
+ value="solutions"
+ className="rounded-md duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
+ >
+ <Link href={`/challenge/${challenge.id}/solutions`}>Solutions</Link>
+ </TabsTrigger>
+ <TabsTrigger
+ value="submissions"
+ className="rounded-md rounded-tr-lg duration-300 data-[state=active]:bg-neutral-200 dark:data-[state=active]:bg-neutral-700"
+ >
+ <Link href={`/challenge/${challenge.id}/submissions`}>Submissions</Link>
+ </TabsTrigger>
+ </TabsList>
+ <TabsContent value="description" className="mt-0 flex-1">
+ <div className="relative flex h-full flex-col justify-between">
+ <div className="px-4 py-3">
+ <Description challenge={challenge}></Description>
+ </div>
- <TooltipProvider>
- <Tooltip delayDuration={0.05} open={session?.data?.user?.id ? false : undefined}>
- <TooltipTrigger asChild>
- <span>
- <Button
- variant="ghost"
- className="p-1"
- disabled={!session?.data?.user?.id}
- onClick={(): void => {
- let shouldBookmark = false;
- if (hasBookmarked) {
- shouldBookmark = false;
- setHasBookmarked(false);
- } else {
- shouldBookmark = true;
- setHasBookmarked(true);
- }
- debouncedBookmark(
- challenge.id,
- session?.data?.user?.id as string,
- shouldBookmark,
- )?.catch((e) => {
- console.error(e);
- });
- }}
- >
- <BookmarkIcon
- size={20}
- className={clsx(
- {
- 'fill-blue-500 stroke-blue-500': hasBookmarked,
- 'stroke-gray-500': !hasBookmarked,
- },
- 'hover:stroke-gray-400',
- )}
- />
- </Button>
- </span>
- </TooltipTrigger>
- <TooltipContent>
- <p>Login to Bookmark</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <Dialog>
- <DialogTrigger>
- <Share size={20} className="stroke-gray-500 hover:stroke-gray-400" />
- </DialogTrigger>
- <DialogContent className="w-[200px]">
- <DialogHeader>
- <DialogTitle>Share this challenge</DialogTitle>
- <div className="pt-4">
- <ShareForm />
- </div>
- </DialogHeader>
- <div className="pt-4">
- <ShareForm />
- </div>
- </DialogContent>
- </Dialog>
- <TooltipProvider>
- <Tooltip delayDuration={0.05} open={session?.data?.user?.id ? false : undefined}>
- <TooltipTrigger asChild>
- <span>
- <Button
- className="group -ml-1 w-14 gap-2 rounded-lg p-1"
- variant="ghost"
- disabled={!session?.data?.user?.id}
- onClick={(): void => {
- let shouldIncrement = false;
- if (hasVoted) {
- setVotes((v) => v - 1);
- shouldIncrement = false;
- setHasVoted(false);
- } else {
- setVotes((v) => v + 1);
- shouldIncrement = true;
- setHasVoted(true);
- }
- debouncedSearch(
- challenge.id,
- session?.data?.user?.id as string,
- shouldIncrement,
- )?.catch((e) => {
- console.error(e);
- });
- }}
- >
- <ThumbsUp
- size={20}
- className={clsx(
- {
- 'fill-emerald-600 stroke-emerald-600 group-hover:stroke-emerald-500 dark:fill-emerald-400 dark:stroke-emerald-400':
- hasVoted,
- 'stroke-zinc-500': !hasVoted,
- },
- 'duration-300 group-hover:stroke-zinc-400',
- )}
- />
- <span
- className={clsx(
- {
- 'text-emerald-600 dark:text-emerald-400': hasVoted,
- 'text-zinc-500 group-hover:text-zinc-400': !hasVoted,
- },
- 'self-end text-lg duration-300',
- )}
- >
- {votes}
- </span>
- </Button>
- </span>
- </TooltipTrigger>
- <TooltipContent>
- <p>Login to Upvote</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- </div>
- <div className="prose-invert leading-8 prose-h3:text-xl">
- <Markdown>{challenge.description}</Markdown>
- </div>
+ <div
+ className="sticky bottom-0 overflow-hidden rounded-xl border border-zinc-300 border-b-background bg-background/90 backdrop-blur-sm duration-300 dark:border-zinc-700 dark:border-b-muted dark:bg-muted/90"
+ style={{
+ marginLeft: '-1px',
+ marginRight: '-1px',
+ boxShadow: '0px 0px 3rem -0.25rem #0004',
+ }}
+ >
+ <Comments challenge={challenge} />
</div>
- </TabsContent>
- <TabsContent value="solutions" className="mt-0 flex-1 dark:bg-muted">
- <Solutions challenge={challenge} />
- </TabsContent>
- <TabsContent value="submissions" className="mt-0 flex-1 dark:bg-muted">
- <Submissions challenge={challenge} />
- </TabsContent>
- <TabsContent value="comments" className="mt-0 h-full dark:bg-muted">
- <Comments challenge={challenge} />
- </TabsContent>
- </Tabs>
- </>
+ </div>
+ </TabsContent>
+ <TabsContent value="solutions" className="mt-0 flex-1">
+ <Solutions challenge={challenge} />
+ </TabsContent>
+ <TabsContent value="submissions" className="mt-0 flex-1">
+ <Submissions challenge={challenge} />
+ </TabsContent>
+ </Tabs>
);
}
diff --git a/src/components/challenge/nocomments.tsx b/src/components/challenge/nocomments.tsx
new file mode 100644
index 00000000..e8502a2b
--- /dev/null
+++ b/src/components/challenge/nocomments.tsx
@@ -0,0 +1,53 @@
+const NoComments = () => {
+ return (
+ <div className="flex h-full items-center justify-center">
+ <p className="flex flex-col items-center gap-2 text-center text-neutral-500 dark:text-zinc-400">
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ data-name="Layer 1"
+ className="mr-6 h-28 w-28"
+ viewBox="0 0 647.63626 632.17383"
+ >
+ <path
+ d="M687.3279,276.08691H512.81813a15.01828,15.01828,0,0,0-15,15v387.85l-2,.61005-42.81006,13.11a8.00676,8.00676,0,0,1-9.98974-5.31L315.678,271.39691a8.00313,8.00313,0,0,1,5.31006-9.99l65.97022-20.2,191.25-58.54,65.96972-20.2a7.98927,7.98927,0,0,1,9.99024,5.3l32.5498,106.32Z"
+ transform="translate(-276.18187 -133.91309)"
+ fill="#4444"
+ />
+ <path
+ d="M725.408,274.08691l-39.23-128.14a16.99368,16.99368,0,0,0-21.23-11.28l-92.75,28.39L380.95827,221.60693l-92.75,28.4a17.0152,17.0152,0,0,0-11.28028,21.23l134.08008,437.93a17.02661,17.02661,0,0,0,16.26026,12.03,16.78926,16.78926,0,0,0,4.96972-.75l63.58008-19.46,2-.62v-2.09l-2,.61-64.16992,19.65a15.01489,15.01489,0,0,1-18.73-9.95l-134.06983-437.94a14.97935,14.97935,0,0,1,9.94971-18.73l92.75-28.4,191.24024-58.54,92.75-28.4a15.15551,15.15551,0,0,1,4.40966-.66,15.01461,15.01461,0,0,1,14.32032,10.61l39.0498,127.56.62012,2h2.08008Z"
+ transform="translate(-276.18187 -133.91309)"
+ fill="#888a"
+ />
+ <path
+ d="M398.86279,261.73389a9.0157,9.0157,0,0,1-8.61133-6.3667l-12.88037-42.07178a8.99884,8.99884,0,0,1,5.9712-11.24023l175.939-53.86377a9.00867,9.00867,0,0,1,11.24072,5.9707l12.88037,42.07227a9.01029,9.01029,0,0,1-5.9707,11.24072L401.49219,261.33887A8.976,8.976,0,0,1,398.86279,261.73389Z"
+ transform="translate(-276.18187 -133.91309)"
+ fill="#888a"
+ />
+ <circle cx="190.15351" cy="24.95465" r="20" fill="#888a" />
+ <circle cx="190.15351" cy="24.95465" r="12.66462" fill="#444a" />
+ <path
+ d="M878.81836,716.08691h-338a8.50981,8.50981,0,0,1-8.5-8.5v-405a8.50951,8.50951,0,0,1,8.5-8.5h338a8.50982,8.50982,0,0,1,8.5,8.5v405A8.51013,8.51013,0,0,1,878.81836,716.08691Z"
+ transform="translate(-276.18187 -133.91309)"
+ fill="#4444"
+ />
+ <path
+ d="M723.31813,274.08691h-210.5a17.02411,17.02411,0,0,0-17,17v407.8l2-.61v-407.19a15.01828,15.01828,0,0,1,15-15H723.93825Zm183.5,0h-394a17.02411,17.02411,0,0,0-17,17v458a17.0241,17.0241,0,0,0,17,17h394a17.0241,17.0241,0,0,0,17-17v-458A17.02411,17.02411,0,0,0,906.81813,274.08691Zm15,475a15.01828,15.01828,0,0,1-15,15h-394a15.01828,15.01828,0,0,1-15-15v-458a15.01828,15.01828,0,0,1,15-15h394a15.01828,15.01828,0,0,1,15,15Z"
+ transform="translate(-276.18187 -133.91309)"
+ fill="#888a"
+ />
+ <path
+ d="M801.81836,318.08691h-184a9.01015,9.01015,0,0,1-9-9v-44a9.01016,9.01016,0,0,1,9-9h184a9.01016,9.01016,0,0,1,9,9v44A9.01015,9.01015,0,0,1,801.81836,318.08691Z"
+ transform="translate(-276.18187 -133.91309)"
+ fill="#888a"
+ />
+ <circle cx="433.63626" cy="105.17383" r="20" fill="#888a" />
+ <circle cx="433.63626" cy="105.17383" r="12.18187" fill="#444a" />
+ </svg>
+ No comments yet,
+ <br /> be the first to comment!
+ </p>
+ </div>
+ );
+};
+
+export default NoComments;
diff --git a/src/components/challenge/report.action.ts b/src/components/challenge/report.action.ts
index 28211a62..5639e6e6 100644
--- a/src/components/challenge/report.action.ts
+++ b/src/components/challenge/report.action.ts
@@ -1,7 +1,7 @@
'use server';
import { prisma } from '~/server/db';
-import type { FormValues } from './left-panel';
+import type { FormValues } from './description';
export async function doTheThing() {
await Promise.resolve(0);
diff --git a/src/components/challenge/solutions/index.tsx b/src/components/challenge/solutions/index.tsx
index f91de8df..5d24be0e 100644
--- a/src/components/challenge/solutions/index.tsx
+++ b/src/components/challenge/solutions/index.tsx
@@ -27,24 +27,15 @@ export function Solutions({ challenge }: Props) {
<SolutionEditor challenge={challenge} setOpen={setOpenSolutionEditor} />
) : (
<>
- <div className="sticky right-0 top-[41px] z-10 flex items-center justify-between border-b border-zinc-300 bg-background/90 bg-opacity-20 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
- <div className="flex gap-2">
- <div className="flex gap-2 rounded-xl bg-blue-600/10 px-4 py-1 text-blue-600 dark:bg-blue-400/10 dark:text-blue-400">
- All
- </div>
- <div className="flex gap-2 rounded-xl bg-black/5 px-4 py-1 text-neutral-500 dark:bg-white/5 dark:text-neutral-400">
- generics
- </div>
- </div>
+ <div className="sticky right-0 top-[41px] flex justify-end border-b border-zinc-300 bg-background/90 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
<Button
- className="h-8 rounded-xl bg-emerald-600 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"
+ className="h-8 rounded-lg bg-emerald-600 px-3 py-2 hover:bg-emerald-500 dark:bg-emerald-400 dark:hover:bg-emerald-300"
onClick={() => handleClick()}
disabled={!hasSolution}
>
<Plus className="mr-2 h-4 w-4" /> Solution
</Button>
</div>
-
{sharedSolution.map((solution) => (
<SolutionRow key={solution.id} solution={solution} />
))}
@@ -60,21 +51,21 @@ function SolutionRow({
solution: NonNullable<NonNullable<Challenge>['sharedSolution'][0]>;
}) {
return (
- <div className="group flex cursor-pointer flex-col gap-2 p-4 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-neutral-700">
- <h3 className="font-bold">{solution.title}</h3>
- <div className="flex items-center gap-2 text-sm text-neutral-500">
- <div className="rounded-full bg-neutral-200 px-2 py-1 text-xs font-bold text-neutral-600 dark:bg-neutral-700 dark:text-neutral-400">
- {solution.user?.name}
- </div>
- <div>{getRelativeTime(solution.createdAt)}</div>
+ <div className="group flex cursor-pointer flex-col gap-2 p-4 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-zinc-700/50">
+ <div className="flex items-center justify-between">
+ <h3 className="font-bold">{solution.title}</h3>
+ <div className="text-sm text-neutral-500">{getRelativeTime(solution.createdAt)}</div>
</div>
<div className="flex gap-3 text-neutral-600 duration-300 dark:text-neutral-400">
- <button className="flex cursor-pointer items-center gap-2 rounded-full bg-emerald-600/10 px-2 py-1 text-sm text-emerald-600 duration-300 hover:bg-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-400 dark:hover:bg-emerald-400/40">
- <ArrowUp className="h-4 w-4 stroke-1" /> {solution._count.vote}
- </button>
- <button className="flex cursor-pointer items-center gap-2 rounded-full bg-black/5 px-2 py-1 text-sm duration-300 hover:bg-black/20 dark:bg-white/5 dark:hover:bg-white/20">
+ <div className="my-auto mr-auto max-w-fit rounded-full bg-neutral-100 px-2 py-1 text-xs font-bold text-neutral-400 dark:bg-zinc-700 dark:text-neutral-400">
+ @&nbsp;{solution.user?.name}
+ </div>
+ <button className="flex cursor-pointer items-center gap-2 rounded-full bg-neutral-100 px-2 py-1 text-sm duration-300 hover:bg-neutral-200 dark:bg-zinc-700 dark:hover:bg-zinc-600">
<MessageCircle className="h-4 w-4 stroke-1" /> {solution._count.solutionComment}
</button>
+ <button className="flex cursor-pointer items-center gap-2 rounded-full bg-emerald-600/10 px-2 py-1 text-sm text-emerald-600 duration-300 hover:bg-emerald-600/20 dark:bg-emerald-400/20 dark:text-emerald-400 dark:hover:bg-emerald-400/40">
+ <ArrowUp className="h-4 w-4 stroke-1" /> {solution._count.vote}
+ </button>
</div>
</div>
);
diff --git a/src/components/challenge/solutions/solution-editor.tsx b/src/components/challenge/solutions/solution-editor.tsx
index 93cf9ca6..bf447edd 100644
--- a/src/components/challenge/solutions/solution-editor.tsx
+++ b/src/components/challenge/solutions/solution-editor.tsx
@@ -85,7 +85,7 @@ export function SolutionEditor({ setOpen, challenge }: Props) {
<Form {...form}>
{/* eslint-disable-next-line @typescript-eslint/no-misused-promises */}
<form className="flex h-full flex-col" onSubmit={form.handleSubmit(onSubmit)}>
- <div className="sticky right-0 top-[41px] z-10 flex items-center justify-between gap-2 border-b border-zinc-300 bg-background/90 bg-opacity-20 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
+ <div className="sticky right-0 top-[41px] z-10 flex items-center justify-between gap-2 border-b border-zinc-300 bg-background/90 bg-opacity-20 p-1 pr-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
<div className="flex-1">
<FormField
control={form.control}
@@ -105,13 +105,13 @@ export function SolutionEditor({ setOpen, challenge }: Props) {
/>
</div>
<Button
- className="h-9 rounded-xl bg-white text-black hover:bg-zinc-200 focus-visible:bg-zinc-200 focus-visible:ring-offset-0 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:focus-visible:bg-zinc-700"
+ className="h-8 rounded-lg bg-white px-3 py-2 text-black hover:bg-zinc-200 focus-visible:bg-zinc-200 focus-visible:ring-offset-0 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:focus-visible:bg-zinc-700"
type="button"
onClick={() => setOpen(false)}
>
Cancel
</Button>
- <Button className="h-9 rounded-xl" type="submit">
+ <Button className="h-8 rounded-lg px-3 py-2" type="submit">
Post
</Button>
</div>
diff --git a/src/components/challenge/submissions.tsx b/src/components/challenge/submissions.tsx
index 9db4a927..58bbdd53 100644
--- a/src/components/challenge/submissions.tsx
+++ b/src/components/challenge/submissions.tsx
@@ -32,29 +32,33 @@ export function Submissions({ challenge }: Props) {
return submissions.filter(predicate);
}, [selectedStatus, submissions]);
return (
- <div>
- <div className="p-4">
- <Select value={selectedStatus} onValueChange={(e) => setSelectStatus(e as Status)}>
- <SelectTrigger className="w-[180px]">
+ <>
+ <Select value={selectedStatus} onValueChange={(e) => setSelectStatus(e as Status)}>
+ <div className="sticky right-0 top-[41px] flex justify-end border-b border-zinc-300 bg-background/90 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
+ <SelectTrigger className="w-48 rounded-xl border border-zinc-300 bg-neutral-100 focus-visible:border-zinc-50 focus-visible:ring-0 focus-visible:ring-offset-0 dark:border-zinc-700 dark:bg-neutral-900">
<SelectValue placeholder="Select a fruit" />
</SelectTrigger>
- <SelectContent>
- <SelectGroup>
- <SelectItem value="all">All Statuses</SelectItem>
- <SelectItem value="accepted">Accepted</SelectItem>
- <SelectItem value="rejected">Rejected</SelectItem>
- </SelectGroup>
- </SelectContent>
- </Select>
- </div>
- <div>
- <ul className="relative flex flex-col">
- {filteredSubmissions.map((submission) => {
- return <SubmissionRow submission={submission} key={submission.id} />;
- })}
- </ul>
- </div>
- </div>
+ </div>
+ <SelectContent className="rounded-xl">
+ <SelectGroup>
+ <SelectItem className="cursor-pointer rounded-lg" value="all">
+ All Statuses
+ </SelectItem>
+ <SelectItem className="cursor-pointer rounded-lg" value="accepted">
+ Accepted
+ </SelectItem>
+ <SelectItem className="cursor-pointer rounded-lg" value="rejected">
+ Rejected
+ </SelectItem>
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ <ul className="relative flex flex-col">
+ {filteredSubmissions.map((submission) => {
+ return <SubmissionRow submission={submission} key={submission.id} />;
+ })}
+ </ul>
+ </>
);
}
@@ -65,18 +69,18 @@ function SubmissionRow({ submission }: { submission: Solution }) {
};
return (
<li
- className="p-4 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-neutral-700"
+ className="flex cursor-pointer items-center justify-between px-4 py-2 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-zinc-700/50"
onClick={handleClick}
>
<div
className={clsx({
- ' text-emerald-600 dark:text-emerald-400': submission.isSuccessful,
- ' text-rose-600 dark:text-rose-400': !submission.isSuccessful,
+ 'text-emerald-600 dark:text-emerald-400': submission.isSuccessful,
+ 'text-rose-600 dark:text-rose-400': !submission.isSuccessful,
})}
>
{submission.isSuccessful ? 'Accepted' : 'Rejected'}
</div>
- <div>{getRelativeTime(submission.createdAt)}</div>
+ <div className="text-sm text-neutral-500">{getRelativeTime(submission.createdAt)}</div>
</li>
);
}
diff --git a/src/components/ui/action-menu.tsx b/src/components/ui/action-menu.tsx
index f76c8ac4..e3e54d05 100644
--- a/src/components/ui/action-menu.tsx
+++ b/src/components/ui/action-menu.tsx
@@ -27,16 +27,16 @@ export function ActionMenu(props: ActionMenuProps) {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <AllIcons.MoreHorizontal size={16} />
+ <AllIcons.MoreHorizontal className="cursor-pointer" size={16} />
</DropdownMenuTrigger>
- <DropdownMenuContent>
+ <DropdownMenuContent className="rounded-full">
{props.items.map((item) => {
const Icon = (item.icon ? AllIcons[item.icon] : null) as OptionalIcon;
return (
<DropdownMenuItem
onClick={() => props.onChange(item)}
key={item.key}
- className="flex items-center gap-2 p-2"
+ className="flex items-center gap-2 rounded-full"
>
<div>{Icon ? <Icon size={16} /> : null}</div>
<div>{item.label}</div>
diff --git a/src/components/ui/comment.tsx b/src/components/ui/comment.tsx
index f2b52977..d506517f 100644
--- a/src/components/ui/comment.tsx
+++ b/src/components/ui/comment.tsx
@@ -8,14 +8,14 @@ type Props = {
const Comment = ({ userId, text, createdAt }: Props) => {
return (
- <div className="flex cursor-pointer flex-col gap-2 p-4 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-neutral-700">
- <p>{text}</p>
- <div className="space-x-2">
- <span className="max-w-fit rounded-lg bg-neutral-200 pl-1 pr-2 font-bold dark:bg-neutral-700 dark:text-neutral-300">
- @{userId}
+ <div className="flex cursor-pointer flex-col gap-2 p-4 pt-2 duration-300 hover:bg-neutral-100 dark:rounded-none dark:hover:bg-zinc-700/50">
+ <div className="flex items-center gap-2">
+ <span className="my-auto max-w-fit rounded-full bg-neutral-200 p-1 px-2 text-xs font-bold text-neutral-500 dark:bg-zinc-700 dark:text-neutral-400">
+ @&nbsp;{userId}
</span>
- <span>{getRelativeTime(createdAt)}</span>
+ <span className="text-sm text-neutral-500">{getRelativeTime(createdAt)}</span>
</div>
+ <p>{text}</p>
</div>
);
};