Skip to content

Commit bf76c25

Browse files
authored
Fixes & updates
Updates : 1. Added updates to queue : enqueue & dequeue 2. added Updated to queue : peek front 3. added sitemaps
2 parents f6d5ec0 + a7391ee commit bf76c25

File tree

18 files changed

+908
-858
lines changed

18 files changed

+908
-858
lines changed

app/api/auth/route.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ export async function POST(req) {
3535

3636
if (action === 'signup') {
3737
// Create Supabase user with metadata
38-
const { user, error } = await supabase.auth.signUp(
39-
{ email, password },
40-
{ data: { display_name: name } }
41-
)
38+
const { data, error } = await supabase.auth.signUp({
39+
email,
40+
password,
41+
options: {
42+
data: { display_name: name },
43+
},
44+
})
4245
if (error) {
4346
return new Response(JSON.stringify({ success: false, message: error.message }), { status: 400 })
4447
}
45-
return new Response(JSON.stringify({ success: true, message: 'Signup successful! Check your email.' }), { status: 200 })
48+
return new Response(JSON.stringify({ success: true, message: 'Signup successful. Verification email sent.', trigger: true }), { status: 200 })
4649
}
4750

4851
else if (action === 'login') {

app/visualizer/queue/operations/enqueue-dequeue/animation.jsx

Lines changed: 163 additions & 232 deletions
Large diffs are not rendered by default.

app/visualizer/queue/operations/enqueue-dequeue/codeBlock.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,14 @@ int main() {
323323
initial={{ opacity: 0, y: 20 }}
324324
animate={{ opacity: 1, y: 0 }}
325325
transition={{ duration: 0.3 }}
326-
className="bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 transition-colors duration-300"
326+
className="bg-white dark:bg-neutral-950 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 transition-colors duration-300"
327327
>
328328
{/* Header */}
329-
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center p-4 bg-gray-50 dark:bg-gray-700/50 border-b border-gray-200 dark:border-gray-700">
329+
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center p-4 bg-gray-50 dark:bg-neutral-950 border-b border-gray-200 dark:border-gray-700">
330330
<div className="flex items-center mb-2 sm:mb-0">
331331
<FaCode className="text-blue-500 mr-2 text-lg" />
332332
<h3 className="text-lg font-semibold text-gray-800 dark:text-white">
333-
Queue Implementation (Enqueue & Dequeue)
333+
Queue (Enqueue & Dequeue)
334334
</h3>
335335
</div>
336336

app/visualizer/queue/operations/enqueue-dequeue/content.jsx

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1+
"use client";
2+
import ComplexityGraph from "@/app/components/ui/graph";
3+
import { useEffect, useState } from "react";
4+
15
const content = () => {
6+
const [theme, setTheme] = useState('light');
7+
const [mounted, setMounted] = useState(false);
8+
9+
useEffect(() => {
10+
const updateTheme = () => {
11+
const savedTheme = localStorage.getItem('theme') || 'light';
12+
setTheme(savedTheme);
13+
};
14+
15+
updateTheme();
16+
setMounted(true);
17+
18+
window.addEventListener('storage', updateTheme);
19+
window.addEventListener('themeChange', updateTheme);
20+
21+
return () => {
22+
window.removeEventListener('storage', updateTheme);
23+
window.removeEventListener('themeChange', updateTheme);
24+
};
25+
}, []);
26+
227
const paragraph = [
328
`A Queue is a linear data structure that follows the First-In-First-Out (FIFO) principle. Elements are added at the rear (enqueue) and removed from the front (dequeue). It operates much like a real-world queue (line) where the first person to arrive is the first to be served.`,
429
`The space complexity is O(n) where n is the number of elements in the queue, as it needs to store all elements.`,
@@ -35,12 +60,40 @@ const content = () => {
3560
const complexity = [
3661
{ points : "Enqueue Operation: O(1) - Constant time to add to the end" },
3762
{ points : "Dequeue Operation: O(1) - Constant time to remove from the front" },
38-
{ points : "Peek Operation: O(1) - Constant time to examine the front element" },
3963
];
4064

4165
return (
42-
<main className="max-w-4xl mx-auto">
43-
<article className="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden mb-8">
66+
<main className="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-5 md:gap-4">
67+
<div className="col-span-1">
68+
<div className="hidden md:block">
69+
{mounted && (
70+
<iframe
71+
key={theme}
72+
src={
73+
theme === "dark"
74+
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
75+
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
76+
}
77+
width="100%"
78+
height="400"
79+
title="Daily DSA Challenge"
80+
></iframe>
81+
)}
82+
</div>
83+
<div className="flex justify-center">
84+
<span className="text-xs hidden md:block">
85+
Daily DSA Challenge by{" "}
86+
<a
87+
href="https://hw.glich.co/resources/daily"
88+
target="_blank"
89+
className="underline hover:text-blue-500 duration-300"
90+
>
91+
Hello World
92+
</a>
93+
</span>
94+
</div>
95+
</div>
96+
<article className="col-span-4 max-w-4xl bg-white dark:bg-neutral-950 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden mb-8">
4497
{/* What is a Queue? */}
4598
<section className="p-6 border-b border-gray-100 dark:border-gray-700">
4699
<h1 className="text-2xl font-bold text-gray-900 dark:text-white mb-4 flex items-center">
@@ -158,6 +211,15 @@ const content = () => {
158211
</li>
159212
))}
160213
</ul>
214+
215+
<div className="mt-8">
216+
<ComplexityGraph
217+
bestCase={(n) => 1}
218+
averageCase={(n) => 1}
219+
worstCase={(n) => 1}
220+
maxN={25}
221+
/>
222+
</div>
161223
</div>
162224
</section>
163225

@@ -177,14 +239,43 @@ const content = () => {
177239
{/* Additional Info */}
178240
<section className="p-6">
179241
<div className="prose dark:prose-invert max-w-none">
180-
<div className="p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800">
242+
<div className="px-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-200 dark:border-blue-800">
181243
<p className="text-gray-700 dark:text-gray-300 leading-relaxed">
182244
{paragraph[2]}
183245
</p>
184246
</div>
185247
</div>
186248
</section>
187249
</article>
250+
251+
{/* Mobile iframe at bottom */}
252+
<div className="block md:hidden w-full">
253+
{mounted && (
254+
<iframe
255+
key={theme}
256+
src={
257+
theme === "dark"
258+
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
259+
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
260+
}
261+
width="100%"
262+
height="320"
263+
title="Daily DSA Challenge"
264+
></iframe>
265+
)}
266+
<div className="flex justify-center pb-8">
267+
<span className="text-xs">
268+
Daily DSA Challenge by{" "}
269+
<a
270+
href="https://hw.glich.co/resources/daily"
271+
target="_blank"
272+
className="underline hover:text-blue-500 duration-300"
273+
>
274+
Hello World
275+
</a>
276+
</span>
277+
</div>
278+
</div>
188279
</main>
189280
);
190281
};
Lines changed: 107 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,121 @@
11
import Animation from "@/app/visualizer/queue/operations/enqueue-dequeue/animation";
22
import Navbar from "@/app/components/navbarinner";
3+
import Breadcrumbs from "@/app/components/ui/Breadcrumbs";
4+
import ArticleActions from "@/app/components/ui/ArticleActions";
5+
import Content from "@/app/visualizer/queue/operations/enqueue-dequeue/content";
6+
import Quiz from "@/app/visualizer/queue/operations/enqueue-dequeue/quiz";
7+
import Code from "@/app/visualizer/queue/operations/enqueue-dequeue/codeBlock";
8+
import ModuleCard from "@/app/components/ui/ModuleCard";
9+
import { MODULE_MAPS } from "@/lib/modulesMap";
10+
import ExploreOther from "@/app/components/ui/exploreOther";
11+
import Footer from "@/app/components/footer";
12+
import BackToTop from "@/app/components/ui/backtotop";
313

414
export const metadata = {
5-
title: 'Enqueue and Dequeue Operations in Queue | Learn Queue with JS, C, Python, Java Code',
6-
description: 'Visualize and understand the Enqueue and Dequeue operations in a Queue with real-time animations and code examples in JavaScript, C, Python, and Java. Perfect for DSA beginners and interview preparation.',
15+
title:
16+
"Enqueue and Dequeue Operations in Queue | Learn Queue with JS, C, Python, Java Code",
17+
description:
18+
"Visualize and understand the Enqueue and Dequeue operations in a Queue with real-time animations and code examples in JavaScript, C, Python, and Java. Perfect for DSA beginners and interview preparation.",
719
keywords: [
8-
'Enqueue Operation',
9-
'Dequeue Operation',
10-
'Queue Operations',
11-
'Queue DSA',
12-
'Queue Enqueue Dequeue',
13-
'Learn Queue',
14-
'Queue Visualization',
15-
'Interactive DSA Tools',
16-
'Queue Data Structure',
17-
'Queue Code Examples',
18-
'Enqueue Dequeue in JavaScript',
19-
'Enqueue Dequeue in C',
20-
'Enqueue Dequeue in Python',
21-
'Enqueue Dequeue in Java',
20+
"Enqueue Operation",
21+
"Dequeue Operation",
22+
"Queue Operations",
23+
"Queue DSA",
24+
"Queue Enqueue Dequeue",
25+
"Learn Queue",
26+
"Queue Visualization",
27+
"Interactive DSA Tools",
28+
"Queue Data Structure",
29+
"Queue Code Examples",
30+
"Enqueue Dequeue in JavaScript",
31+
"Enqueue Dequeue in C",
32+
"Enqueue Dequeue in Python",
33+
"Enqueue Dequeue in Java",
2234
],
2335
robots: "index, follow",
36+
openGraph: {
37+
images: [
38+
{
39+
url: "/og/queue/enqueueDequeue.png",
40+
width: 1200,
41+
height: 630,
42+
alt: "Enqueue Dequeue Algorithm Visualization",
43+
},
44+
],
45+
},
2446
};
2547

2648
export default function Page() {
49+
const paths = [
50+
{ name: "Home", href: "/" },
51+
{ name: "Visualizer", href: "/visualizer" },
52+
{ name: "Enqueue-Dequeue", href: "" },
53+
];
54+
2755
return (
2856
<>
29-
<Navbar/>
30-
<Animation />
57+
<div>
58+
<Navbar />
59+
</div>
60+
61+
<div className="py-20 bg-gray-100 dark:bg-neutral-900 text-gray-800 dark:text-gray-200">
62+
<section className="px-6 md:px-12">
63+
<div className="mt-10 sm:mt-10 mb-4">
64+
<Breadcrumbs paths={paths} />
65+
</div>
66+
<div className="flex items-center flex-col">
67+
<div className="flex">
68+
<p className="uppercase tracking-wide bg-green-500 dark:text-black px-4 py-1 mb-2 rounded-full">
69+
Queue
70+
</p>
71+
</div>
72+
<h1 className="text-4xl md:text-4xl font-bold text-center text-gray-900 dark:text-white mb-0">
73+
Enqueue & Dequeue
74+
</h1>
75+
<ArticleActions />
76+
</div>
77+
<div className="bg-black border border-none dark:bg-gray-600 w-100 h-[2px] rounded-xl my-10"></div>
78+
<Content />
79+
</section>
80+
81+
<section className="px-6">
82+
<Animation />
83+
</section>
84+
85+
<section className="px-6">
86+
<p className="text-lg text-center text-gray-600 dark:text-gray-400 mb-8">
87+
Test Your Knowledge before moving forward!
88+
</p>
89+
<Quiz />
90+
</section>
91+
92+
<section className="px-6">
93+
<Code />
94+
</section>
95+
96+
<section className="px-6 md:px-12 my-12">
97+
<ModuleCard
98+
moduleId={MODULE_MAPS.enqueueDequeue}
99+
title="Enqueue Dequeue"
100+
description="Mark queue : enqueue & dequeue as done and view it on your dashboard"
101+
initialDone={false}
102+
/>
103+
</section>
104+
105+
<section className="px-6">
106+
<ExploreOther
107+
title="Explore Other Operations"
108+
links={[
109+
{ text: "Peek Front", url: "./peek-front" },
110+
{ text: "Is Empty", url: "./isempty" },
111+
{ text: "Is Full", url: "./isfull" },
112+
]}
113+
/>
114+
</section>
115+
</div>
116+
117+
<BackToTop />
118+
<Footer />
31119
</>
32120
);
33-
};
121+
}

0 commit comments

Comments
 (0)