Skip to content

Commit 873db80

Browse files
committed
feat(questions): new explore question page created
1 parent f1c31e6 commit 873db80

File tree

11 files changed

+168
-91
lines changed

11 files changed

+168
-91
lines changed

src/app/(app)/(default_layout)/(questions)/questions/explore/page.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ export async function generateMetadata() {
1010
title: 'Explore Questions | TechBlitz',
1111
description:
1212
'Explore a diverse set of questions across multiple topics to enhance your knowledge.',
13+
keywords: [
14+
'javascript coding questions',
15+
'react coding questions',
16+
'web development coding questions',
17+
'coding challenges',
18+
'coding tutorials',
19+
'coding practice',
20+
'coding practice questions',
21+
],
1322
image: {
1423
text: 'Explore Questions | TechBlitz',
1524
bgColor: '#000',
@@ -22,9 +31,8 @@ export async function generateMetadata() {
2231
const heroDescription = (
2332
<div className="flex flex-col gap-y-4 z-20 relative font-inter max-w-3xl">
2433
<p className="text-sm md:text-base text-gray-400">
25-
Curated lists of hot topics to help you level up your programming skills.
26-
Browse through our carefully selected collection of coding challenges and
27-
tutorials.
34+
Curated lists of coding questions, ranging from Javascript, React, Node,
35+
Web Development, and more to help you level up your programming skills.
2836
</p>
2937
<div className="flex flex-col gap-y-2">
3038
<p className="text-gray-400">Can't find what you're looking for?</p>

src/app/(app)/(default_layout)/(questions)/questions/previous/page.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { validateSearchParams } from '@/utils/search-params';
1212
import { parseSearchParams } from '@/utils/search-params';
1313
import { getTags } from '@/utils/data/questions/tags/get-tags';
1414
import { createMetadata } from '@/utils';
15+
import { Button } from '@/components/ui/button';
1516

1617
export async function generateMetadata() {
1718
return createMetadata({
@@ -26,6 +27,20 @@ export async function generateMetadata() {
2627
});
2728
}
2829

30+
const heroDescription = (
31+
<div className="flex flex-col gap-y-4 z-20 relative font-inter max-w-3xl">
32+
<p className="text-sm md:text-base text-gray-400">
33+
All daily questions that have been asked in the past.
34+
</p>
35+
<div className="flex flex-col gap-y-2">
36+
<p className="text-gray-400">Want to see more questions?</p>
37+
<Button href="/questions" variant="secondary">
38+
View all questions
39+
</Button>
40+
</div>
41+
</div>
42+
);
43+
2944
export default async function PreviousQuestionsPage({
3045
searchParams,
3146
}: {
@@ -38,10 +53,7 @@ export default async function PreviousQuestionsPage({
3853

3954
return (
4055
<>
41-
<Hero
42-
heading="Previous Daily Questions"
43-
subheading="All daily questions that have been asked in the past."
44-
/>
56+
<Hero heading="Previous Daily Questions" subheading={heroDescription} />
4557
<div className="flex flex-col h-full justify-between container mt-5">
4658
<div className="flex flex-col lg:flex-row w-full gap-16">
4759
<div className="w-full lg:min-w-[65%] space-y-6">

src/app/(app)/providers.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ export default function RootProvider({
1313
return (
1414
<main
1515
className={cn(
16-
'!w-full lg:w-auto transition-[width] duration-200 ease-in-out py-6 lg:pt-4 lg:pb-3'
16+
'w-full transition-[width] duration-200 ease-in-out py-6',
17+
'lg:py-4 lg:pb-3',
18+
{
19+
'lg:w-[calc(100%-15rem)]': state === 'expanded',
20+
'lg:w-[calc(100%-3rem)]': state === 'collapsed',
21+
}
1722
)}
18-
style={{
19-
width:
20-
state === 'expanded' ? 'calc(100% - 15rem)' : 'calc(100% - 3rem)',
21-
}}
2223
>
2324
{children}
2425
</main>

src/components/app/questions/layout/carousel/question-carousel-card.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@ export default function QuestionCarouselCard(opts: {
99
const { questionData } = opts;
1010

1111
return (
12-
<Link
13-
href={`/question/${questionData.uid}`}
14-
className="h-full bg-black-100"
15-
>
12+
<Link href={`/question/${questionData.uid}`} className="h-full bg-black-75">
1613
<div className="flex flex-col justify-between space-y-5 items-start border border-black-50 hover:border-accent duration-300 p-6 rounded-lg group w-full h-full relative overflow-hidden">
17-
<h6 className="text-xl text-wrap text-start line-clamp-2">
14+
<h6 className="text-wrap text-start line-clamp-2">
1815
{questionData?.question}
1916
</h6>
2017
<div className="w-full flex justify-between items-end">

src/components/app/questions/layout/carousel/question-carousel-list.tsx

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,40 @@ import { QuestionWithTags } from '@/types/Questions';
55
export default async function QuestionsCarouselList() {
66
const questionsCarousels = [
77
{
8-
tag: 'javascript',
8+
tag: ['javascript', 'JavaScript', 'javaScript', 'generators'],
99
title: 'Javascript Questions',
1010
description:
11-
'Explore a diverse set of Javascript questions to enhance your knowledge.',
11+
'Learn how to use JavaScript to build more efficient and scalable applications.',
1212
image: '/images/javascript.png',
1313
questions: [],
1414
},
1515
{
16-
tag: 'react',
16+
tag: ['react'],
1717
title: 'React Questions',
18-
description:
19-
'Explore a diverse set of React questions to enhance your knowledge.',
18+
description: 'Explore the most popular JavaScript framework, React.',
2019
image: '/images/react.png',
2120
questions: [],
2221
},
2322
{
24-
tag: 'async',
25-
title: 'Async Questions',
26-
description:
27-
'Explore a diverse set of questions relating to asynchronous programming.',
28-
image: '/images/async.png',
29-
questions: [],
30-
},
31-
{
32-
tag: 'promises',
33-
title: 'Web Development Questions',
23+
tag: ['react-hooks'],
24+
title: 'React Hooks',
3425
description:
35-
'Explore a diverse set of questions relating to web development.',
36-
image: '/images/web-dev.png',
26+
'Learn how to use React Hooks to build more efficient and scalable applications.',
27+
image: '/images/react.png',
3728
questions: [],
3829
},
3930
{
40-
tag: 'promises',
41-
title: 'Web Development Questions',
42-
description:
43-
'Explore a diverse set of questions relating to web development.',
44-
image: '/images/web-dev.png',
31+
tag: ['arrays', 'Array', 'array-methods'],
32+
title: 'Arrays',
33+
description: 'Learn all the key concepts of arrays in JavaScript.',
34+
image: '/images/arrays.png',
4535
questions: [],
4636
},
4737
{
48-
tag: 'promises',
49-
title: 'Web Development Questions',
50-
description:
51-
'Explore a diverse set of questions relating to web development.',
52-
image: '/images/web-dev.png',
38+
tag: ['async', 'promises'],
39+
title: 'Asynchronous Programming',
40+
description: 'Learn how to handle asynchronous operations in JavaScript.',
41+
image: '/images/async.png',
5342
questions: [],
5443
},
5544
];
@@ -66,12 +55,16 @@ export default async function QuestionsCarouselList() {
6655
<div className="flex flex-col gap-y-16 md:gap-y-28 pt-10">
6756
{questionsByTag.map((carousel) => (
6857
<QuestionCarousel
69-
key={carousel.tag}
58+
key={carousel.title}
7059
heading={carousel.title}
7160
description={carousel.description}
7261
image={carousel.image}
73-
questions={carousel.questions as unknown as QuestionWithTags[]}
74-
tag={carousel.tag as 'javascript' | 'react' | 'async' | 'web-dev'}
62+
questions={
63+
(carousel.questions[0]?.questions.map(
64+
(q) => q.question
65+
) as unknown as QuestionWithTags[]) || []
66+
}
67+
tag={carousel.tag}
7568
/>
7669
))}
7770
</div>

src/components/app/questions/layout/carousel/question-carousel.tsx

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import {
22
Carousel,
33
CarouselItem,
44
CarouselContent,
5+
CarouselNext,
6+
CarouselPrevious,
57
} from '@/components/ui/carousel';
68
import { QuestionWithTags } from '@/types/Questions';
79

810
import QuestionCarouselCard from './question-carousel-card';
11+
import { Button } from '@/components/ui/button';
12+
import { ChevronRight } from 'lucide-react';
913

1014
/**
1115
* A carousel that will showcase a set of questions.
@@ -18,7 +22,7 @@ export default function QuestionCarousel(opts: {
1822
description: string | React.ReactNode;
1923
image: string;
2024
questions: QuestionWithTags[];
21-
tag: 'javascript' | 'react' | 'web-dev' | 'async';
25+
tag: string | string[];
2226
}) {
2327
const { heading, description, image, questions, tag } = opts;
2428

@@ -31,33 +35,59 @@ export default function QuestionCarousel(opts: {
3135
});
3236

3337
return (
34-
<div className="flex flex-col gap-y-8">
35-
<div className="flex flex-col gap-y-2">
36-
<h6 className="text-xl lg:text-3xl text-wrap text-start text-gradient from-white to-white/55">
37-
{heading}
38-
</h6>
39-
<p className="text-sm text-wrap text-start">{description}</p>
40-
</div>
41-
<div className="relative w-full">
42-
<div className="hidden md:block absolute left-0 top-0 h-full w-12 bg-gradient-to-r from-[#000] to-transparent z-10" />
43-
<div className="hidden md:block absolute right-0 top-0 h-full w-12 bg-gradient-to-l from-[#000000] to-transparent z-10" />
44-
<Carousel
45-
opts={{
46-
loop: false,
47-
dragFree: true,
48-
align: 'start',
49-
}}
50-
className="w-full"
51-
>
38+
<Carousel
39+
opts={{
40+
loop: false,
41+
dragFree: true,
42+
align: 'start',
43+
}}
44+
className="w-full"
45+
>
46+
<div className="flex flex-col gap-y-8">
47+
<div className="flex flex-col md:flex-row gap-4 w-full md:justify-between md:items-end">
48+
<div className="flex flex-col gap-y-2">
49+
<h6 className="text-xl lg:text-3xl text-wrap text-start text-gradient from-white to-white/55">
50+
{heading}
51+
</h6>
52+
<p className="text-sm text-wrap text-start">{description}</p>
53+
</div>
54+
<div className="flex items-center gap-2 justify-between">
55+
<Button href={`/questions?tag=${tag}`} variant="default">
56+
View more
57+
<ChevronRight className="size-4 ml-2" />
58+
</Button>
59+
<div className="flex items-center gap-2">
60+
<CarouselPrevious
61+
className="md:hidden border-none text-white top-0 left-0 right-0 relative translate-y-0"
62+
variant="default"
63+
/>
64+
<CarouselNext
65+
className="md:hidden border-none text-white top-0 left-0 right-0 relative translate-y-0"
66+
variant="default"
67+
/>
68+
</div>
69+
</div>
70+
</div>
71+
<div className="relative w-full">
72+
<div className="hidden md:block absolute left-0 top-0 h-full w-12 bg-gradient-to-r from-[#000] to-transparent z-10" />
73+
<div className="hidden md:block absolute right-0 top-0 h-full w-12 bg-gradient-to-l from-[#000000] to-transparent z-10" />
5274
<CarouselContent className="grid grid-flow-col auto-cols-[calc(100%-8px)] md:auto-cols-[calc(50%-8px)] lg:auto-cols-[calc(33.33%-8px)] gap-4">
5375
{questions.map((q) => (
5476
<CarouselItem key={q.uid} className="flex">
5577
<QuestionCarouselCard key={q.uid} questionData={q} />
5678
</CarouselItem>
5779
))}
5880
</CarouselContent>
59-
</Carousel>
81+
<CarouselPrevious
82+
className="hidden md:block border-none text-white -top-12 left-0 z-10"
83+
variant="ghost"
84+
/>
85+
<CarouselNext
86+
className="hidden md:block border-none text-white -top-12"
87+
variant="ghost"
88+
/>
89+
</div>
6090
</div>
61-
</div>
91+
</Carousel>
6292
);
6393
}

src/components/app/questions/layout/question-page-sidebar.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import { QuestionMarkCircledIcon } from '@radix-ui/react-icons';
1111
import { UserRecord } from '@/types/User';
1212
import { getUserDailyStats } from '@/utils/data/user/authed/get-daily-streak';
1313
import { Button } from '@/components/ui/button';
14+
import { Separator } from '@/components/ui/separator';
15+
import CurrentStreak, {
16+
SolarFlameBoldDuotone,
17+
} from '@/components/ui/current-streak';
1418

1519
export default async function QuestionPageSidebar(opts: {
1620
user: UserRecord | null;
@@ -34,14 +38,32 @@ export default async function QuestionPageSidebar(opts: {
3438
<h6 className="text-xl">Your current streak</h6>
3539
<div className="relative">
3640
{user ? (
37-
<DatePicker
38-
className="z-30 text-white bg-black-100 border border-black-50 p-2 rounded-md hover:cursor-default"
39-
color="white"
40-
type="range"
41-
value={dateArray}
42-
c="gray"
43-
inputMode="none"
44-
/>
41+
<div className="flex flex-col gap-y-4 text-white bg-black-75 border border-black-50 p-4 rounded-lg hover:cursor-default">
42+
<DatePicker
43+
className="z-30"
44+
color="white"
45+
type="range"
46+
value={dateArray}
47+
c="gray"
48+
inputMode="none"
49+
/>
50+
<Separator className="w-full bg-black-50" />
51+
<div className="grid grid-cols-2 gap-4 pt-2">
52+
<div className="flex flex-col gap-y-2 items-center">
53+
<p className="text-sm text-gray-400">Longest streak</p>
54+
<div className="flex items-center gap-x-1">
55+
<p className="font-onest font-bold">
56+
{userStreak?.streakData?.longestStreak}
57+
</p>
58+
<SolarFlameBoldDuotone className="size-6" />
59+
</div>
60+
</div>
61+
<div className="flex flex-col gap-y-2 items-center">
62+
<p className="text-sm text-gray-400">Current streak</p>
63+
<CurrentStreak />
64+
</div>
65+
</div>
66+
</div>
4567
) : (
4668
<div className="relative">
4769
<div className="absolute inset-0 backdrop-blur-[2px] z-10 flex items-center justify-center rounded-md">

src/components/global/navigation/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ export function AppSidebar(opts: {
384384
};
385385

386386
return (
387-
<Sidebar collapsible="icon">
387+
<Sidebar collapsible="icon" className="z-50">
388388
<SidebarContent className="py-6 bg-[#000000]">
389389
<SidebarGroup>
390390
<SidebarGroupLabel className="w-full flex items-center justify-between">

src/components/ui/carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ const CarouselPrevious = React.forwardRef<
204204
variant={variant}
205205
size={size}
206206
className={cn(
207-
'absolute h-8 w-8 rounded-full',
207+
'absolute h-8 w-8 rounded-full',
208208
orientation === 'horizontal'
209209
? '-left-8 top-1/2 -translate-y-full'
210210
: '-top-8 left-1/2 -translate-x-1/2 rotate-90',

src/components/ui/current-streak.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export default async function CurrentStreak() {
3232

3333
return (
3434
<div className="flex items-center gap-x-1">
35-
<SolarFlameBoldDuotone className="size-6" />
36-
<p className="font-ubuntu font-bold">
35+
<p className="font-onest font-bold">
3736
{userStreak?.streakData?.currentstreakCount}{' '}
3837
</p>
38+
<SolarFlameBoldDuotone className="size-6" />
3939
</div>
4040
);
4141
}

0 commit comments

Comments
 (0)