Skip to content

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

resolves #244 (#255)

PickleNikae00b3f1f066
diff --git a/src/app/challenge/[id]/left-wrapper.tsx b/src/app/challenge/[id]/left-wrapper.tsx
index 78e5324f..dcdbaf71 100644
--- a/src/app/challenge/[id]/left-wrapper.tsx
+++ b/src/app/challenge/[id]/left-wrapper.tsx
@@ -30,7 +30,7 @@ export function LeftWrapper({ challengeId, children }: Props) {
return (
<Tabs
defaultValue={selectedTab}
- className="custom-scrollable-element flex h-full w-full flex-col overflow-x-hidden overflow-y-scroll"
+ className="flex h-full w-full flex-col overflow-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
@@ -55,7 +55,7 @@ export function LeftWrapper({ challengeId, children }: Props) {
Submissions
</TabsTrigger>
</TabsList>
- <TabsContent value={selectedTab} className="mt-0 flex-1">
+ <TabsContent value={selectedTab} className="mt-0 h-[calc(100%_-_41px)]">
{children}
</TabsContent>
</Tabs>
diff --git a/src/app/challenge/[id]/page.tsx b/src/app/challenge/[id]/page.tsx
index 47707185..7ed549b9 100644
--- a/src/app/challenge/[id]/page.tsx
+++ b/src/app/challenge/[id]/page.tsx
@@ -19,7 +19,7 @@ export default async function Challenges({ params: { id } }: Props) {
}
return (
- <div className="relative flex h-full flex-col justify-between">
+ <div className="relative h-full">
<Description challenge={challenge}></Description>
<Comments challengeId={challenge.id} commentCount={challenge.comment.length} />
</div>
diff --git a/src/components/challenge/challenge-layout.tsx b/src/components/challenge/challenge-layout.tsx
index b604fb50..db3f3122 100644
--- a/src/components/challenge/challenge-layout.tsx
+++ b/src/components/challenge/challenge-layout.tsx
@@ -200,9 +200,8 @@ export function ChallengeLayout({ left, right, skeleton = false }: ChallengeLayo
</div>
<div
ref={rightSide}
- style={{ flex: '1 1 0%' }}
className={clsx(
- 'flex flex-col overflow-hidden rounded-l-xl rounded-r-2xl border border-zinc-300 dark:border-zinc-700 lg:min-w-[500px]',
+ 'flex flex-1 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/index.tsx b/src/components/challenge/comments/index.tsx
index ec725822..34282a1d 100644
--- a/src/components/challenge/comments/index.tsx
+++ b/src/components/challenge/comments/index.tsx
@@ -22,8 +22,6 @@ interface Props {
commentCount: number;
}
-
-
const Comments = ({ challengeId, commentCount }: Props) => {
const [showComments, setShowComments] = useState(false);
const [text, setText] = useState('');
@@ -87,7 +85,7 @@ const Comments = ({ challengeId, commentCount }: Props) => {
return (
<div
className={clsx(
- 'sticky bottom-0 overflow-hidden border-zinc-300 bg-background/90 shadow-[0_0_3rem_-0.25rem_#0004] backdrop-blur-sm duration-300 dark:border-zinc-700 dark:border-b-muted dark:bg-muted/90 dark:shadow-[0_0_3rem_-0.25rem_#0008]',
+ 'sticky bottom-0 overflow-hidden border-zinc-300 bg-background/90 shadow-[0_0_3rem_-0.25rem_#0004] backdrop-blur-sm duration-300 dark:border-zinc-700 dark:border-b-muted dark:bg-muted/90 dark:shadow-[0_0_3rem_-0.25rem_#0008]',
{
'border-t': !showComments,
},
@@ -109,7 +107,7 @@ const Comments = ({ challengeId, commentCount }: Props) => {
></ChevronDown>
</button>
<div
- className={clsx('flex flex-col-reverse overscroll-contain duration-300', {
+ className={clsx('custom-scrollable-element flex flex-col-reverse overscroll-contain duration-300', {
'h-[64] pb-2 md:h-[calc(100vh_-_247px)]': showComments,
'h-0 overflow-y-hidden': !showComments,
'overflow-y-auto': showComments && data?.pages[0]?.data.length !== 0,
diff --git a/src/components/challenge/description/index.tsx b/src/components/challenge/description/index.tsx
index e0900ac8..cba309d3 100644
--- a/src/components/challenge/description/index.tsx
+++ b/src/components/challenge/description/index.tsx
@@ -133,7 +133,7 @@ export function Description({ challenge }: Props) {
}
}
return (
- <div className="px-4 py-3">
+ <div className="custom-scrollable-element overflow-y-auto h-full px-4 pt-3 pb-36">
{/* NOTE: collapse this element */}
<div className="flex items-center gap-4">
<TypographyH3 className="mb-2 mr-auto max-w-[75%] items-center truncate text-2xl font-bold">
diff --git a/src/components/challenge/solutions/index.tsx b/src/components/challenge/solutions/index.tsx
index 85f47162..8725efcf 100644
--- a/src/components/challenge/solutions/index.tsx
+++ b/src/components/challenge/solutions/index.tsx
@@ -31,19 +31,21 @@ export function Solutions({ challenge }: Props) {
{challenge.sharedSolution.length !== 0 ? (
<>
{(loggedInUserHasSolution || !session?.data?.user) && (
- <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">
+ <div className="absolute right-0 top-0 w-full flex justify-end border-b border-zinc-300 bg-background/70 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/70">
<SubmitSolution setView={setView} />
</div>
)}
- {challenge?.sharedSolution.map((solution) => (
- <SolutionRow
+ <div className="h-full pt-12 overflow-y-auto custom-scrollable-element">
+ {challenge?.sharedSolution.map((solution) => (
+ <SolutionRow
key={solution.id}
solution={solution}
handleClick={() => {
setView('details');
}}
- />
- ))}
+ />
+ ))}
+ </div>
</>
) : (
<NoSolutions
@@ -71,7 +73,7 @@ function SolutionRow({
className="group flex cursor-pointer flex-col gap-2 p-4 duration-300 hover:bg-neutral-100 dark:hover:bg-zinc-700/50"
href={`/challenge/${solution.challengeId}/solutions/${solution.id}`}
>
- <h3 className="font-bold">{solution.title}</h3>
+ <h3 className="font-bold truncate">{solution.title}</h3>
<div className="flex items-center gap-1 text-neutral-600 dark:text-neutral-400">
<UserBadge username={solution.user?.name ?? ''} />
<div className="mr-auto text-sm text-neutral-500">
diff --git a/src/components/challenge/solutions/solution-detail.tsx b/src/components/challenge/solutions/solution-detail.tsx
index 821e185a..a057b9e1 100644
--- a/src/components/challenge/solutions/solution-detail.tsx
+++ b/src/components/challenge/solutions/solution-detail.tsx
@@ -31,12 +31,12 @@ export function SolutionDetails({ solution }: Props) {
return (
<div className="relative flex h-full flex-col">
- <div className="sticky right-0 top-[41px] flex border-b border-zinc-300 bg-background/90 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
+ <div className="sticky right-0 top-0 w-full flex border-b border-zinc-300 bg-background/90 p-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
<Link href={`/challenge/${solution.challengeId}/solutions`}>
<X size={20} className="stroke-gray-500 hover:stroke-gray-400" />
</Link>
</div>
- <div className="flex-1 px-4 py-3">
+ <div className="flex-1 overflow-y-auto custom-scrollable-element px-4 py-3">
<div className="mb-5 flex flex-col gap-3">
<div className="flex items-center gap-2">
<Avatar>
diff --git a/src/components/challenge/solutions/solution-editor.tsx b/src/components/challenge/solutions/solution-editor.tsx
index 151ac0a9..aa54932f 100644
--- a/src/components/challenge/solutions/solution-editor.tsx
+++ b/src/components/challenge/solutions/solution-editor.tsx
@@ -84,8 +84,8 @@ export function SolutionEditor({ dismiss, challenge }: Props) {
return (
<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-1 pr-2 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
+ <form className="flex h-full relative flex-col" onSubmit={form.handleSubmit(onSubmit)}>
+ <div className="sticky right-0 top-0 w-full 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}
diff --git a/src/components/challenge/submissions/index.tsx b/src/components/challenge/submissions/index.tsx
index 4af410d1..0c3ac190 100644
--- a/src/components/challenge/submissions/index.tsx
+++ b/src/components/challenge/submissions/index.tsx
@@ -26,9 +26,9 @@ export function Submissions({ submissions }: Props) {
return submissions.filter(predicate);
}, [selectedStatus, submissions]);
return (
- <>
+ <div className="h-full relative">
{submissions.length !== 0 ? (
- <div className="sticky right-0 top-[41px] flex gap-2 border-b border-zinc-300 bg-background/90 p-2 px-4 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/90">
+ <div className="absolute w-full right-0 top-0 z-10 flex gap-2 border-b border-zinc-300 bg-background/70 p-2 px-4 backdrop-blur-sm dark:border-zinc-700 dark:bg-muted/70">
<div
className={`flex cursor-pointer gap-2 rounded-lg px-4 py-1 duration-300 ${
selectedStatus === 'all'
@@ -65,7 +65,7 @@ export function Submissions({ submissions }: Props) {
<NoSubmissions />
)}
- <ul className="relative flex flex-col">
+ <ul className="overflow-y-auto pt-12 h-full custom-scrollable-element flex flex-col">
{filteredSubmissions.map((submission) => {
return (
<SubmissionRow
@@ -76,7 +76,7 @@ export function Submissions({ submissions }: Props) {
);
})}
</ul>
- </>
+ </div>
);
}
diff --git a/src/styles/globals.css b/src/styles/globals.css
index a2bbd857..9e6c3e11 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -139,12 +139,18 @@ main {
@apply bg-muted;
}
-.custom-scrollable-element {
- scrollbar-width: none;
+.custom-scrollable-element::-webkit-scrollbar {
+ width: 0.6rem;
+}
+.custom-scrollable-element::-webkit-scrollbar-track {
+ background-color: transparent;
+}
+.custom-scrollable-element::-webkit-scrollbar-thumb {
+ @apply bg-neutral-300/50 dark:bg-zinc-700/50 rounded-l-xl;
}
-.custom-scrollable-element::-webkit-scrollbar {
- width: 0;
+.custom-scrollable-element::-webkit-scrollbar-thumb:hover {
+ @apply bg-neutral-300 dark:bg-zinc-600;
}
.movingbackground {