Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions app/components/ui/DailyDSAEmbed.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use client";
import { useEffect, useState } from "react";

const DailyDSAEmbed = ({ mobile = false, theme = "light" }) => {
const src = `https://scaleengineer.com/embed/daily/dsa?theme=${theme}`;
const wrapperClasses = mobile
? "block md:hidden w-full"
: "max-w-full hidden md:block";
const height = mobile ? 200 : 280;

return (
<div className={wrapperClasses}>
<div className="max-w-full mb-4">
<a
href="https://scaleengineer.com/daily"
target="_blank"
rel="noopener noreferrer"
className="mb-2 inline-block text-[#737373] no-underline"
style={{
font: "500 12px/1.4 -apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif",
}}
>
Daily DSA Challenge by{" "}
<span className="text-[#0a0a0a] underline underline-offset-[3px]">
Scale Engineer
</span>
</a>
<iframe
src={src}
width="100%"
height={height}
className="border border-black border-dashed rounded-none overflow-hidden"
title="Daily DSA Challenge"
loading="lazy"
></iframe>
</div>
</div>
);
};

export default DailyDSAEmbed;
63 changes: 4 additions & 59 deletions app/visualizer/queue/implementation/array/content.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
"use client";
import { useEffect, useState } from "react";
import DailyDSAEmbed from "@/app/components/ui/DailyDSAEmbed";

const content = () => {
const [theme, setTheme] = useState("light");
const [mounted, setMounted] = useState(false);

useEffect(() => {
const updateTheme = () => {
const savedTheme = localStorage.getItem("theme") || "light";
setTheme(savedTheme);
};

updateTheme();
setMounted(true);

window.addEventListener("storage", updateTheme);
window.addEventListener("themeChange", updateTheme);
Expand Down Expand Up @@ -96,35 +94,8 @@ const content = () => {

return (
<main className="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-5 md:gap-4">
<div className="col-span-1">
<div className="hidden md:block">
{mounted && (
<iframe
key={theme}
src={
theme === "dark"
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
}
width="100%"
height="400"
title="Daily DSA Challenge"
></iframe>
)}
</div>
<div className="flex justify-center">
<span className="text-xs hidden md:block">
Daily DSA Challenge by{" "}
<a
href="https://hw.glich.co/resources/daily"
target="_blank"
className="underline hover:text-blue-500 duration-300"
>
Hello World
</a>
</span>
</div>
</div>

<DailyDSAEmbed mobile={false} theme={theme} />
<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">
{/* Queue Array Implementation Overview */}
<section className="p-6 border-b border-gray-100 dark:border-gray-700">
Expand Down Expand Up @@ -261,33 +232,7 @@ const content = () => {
</article>

{/* Mobile iframe at bottom */}
<div className="block md:hidden w-full">
{mounted && (
<iframe
key={theme}
src={
theme === "dark"
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
}
width="100%"
height="320"
title="Daily DSA Challenge"
></iframe>
)}
<div className="flex justify-center pb-8">
<span className="text-xs">
Daily DSA Challenge by{" "}
<a
href="https://hw.glich.co/resources/daily"
target="_blank"
className="underline hover:text-blue-500 duration-300"
>
Hello World
</a>
</span>
</div>
</div>
<DailyDSAEmbed mobile theme={theme} />
</main>
);
};
Expand Down
60 changes: 3 additions & 57 deletions app/visualizer/queue/implementation/linkedList/content.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
"use client";
import { useEffect, useState } from "react";
import DailyDSAEmbed from "@/app/components/ui/DailyDSAEmbed";

const content = () => {
const [theme, setTheme] = useState("light");
const [mounted, setMounted] = useState(false);

useEffect(() => {
const updateTheme = () => {
const savedTheme = localStorage.getItem("theme") || "light";
setTheme(savedTheme);
};

updateTheme();
setMounted(true);

window.addEventListener("storage", updateTheme);
window.addEventListener("themeChange", updateTheme);
Expand Down Expand Up @@ -71,33 +69,7 @@ const content = () => {
return (
<main className="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-5 md:gap-4">
<div className="col-span-1">
<div className="hidden md:block">
{mounted && (
<iframe
key={theme}
src={
theme === "dark"
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
}
width="100%"
height="400"
title="Daily DSA Challenge"
></iframe>
)}
</div>
<div className="flex justify-center">
<span className="text-xs hidden md:block">
Daily DSA Challenge by{" "}
<a
href="https://hw.glich.co/resources/daily"
target="_blank"
className="underline hover:text-blue-500 duration-300"
>
Hello World
</a>
</span>
</div>
<DailyDSAEmbed mobile={false} theme={theme} />
</div>
<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">
{/* Queue Linked List Implementation Overview */}
Expand Down Expand Up @@ -220,33 +192,7 @@ const content = () => {
</article>

{/* Mobile iframe at bottom */}
<div className="block md:hidden w-full">
{mounted && (
<iframe
key={theme}
src={
theme === "dark"
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
}
width="100%"
height="320"
title="Daily DSA Challenge"
></iframe>
)}
<div className="flex justify-center pb-8">
<span className="text-xs">
Daily DSA Challenge by{" "}
<a
href="https://hw.glich.co/resources/daily"
target="_blank"
className="underline hover:text-blue-500 duration-300"
>
Hello World
</a>
</span>
</div>
</div>
<DailyDSAEmbed mobile theme={theme} />
</main>
);
};
Expand Down
60 changes: 3 additions & 57 deletions app/visualizer/queue/operations/enqueue-dequeue/content.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
"use client";
import ComplexityGraph from "@/app/components/ui/graph";
import { useEffect, useState } from "react";
import DailyDSAEmbed from "@/app/components/ui/DailyDSAEmbed";

const content = () => {
const [theme, setTheme] = useState('light');
const [mounted, setMounted] = useState(false);

useEffect(() => {
const updateTheme = () => {
const savedTheme = localStorage.getItem('theme') || 'light';
setTheme(savedTheme);
};

updateTheme();
setMounted(true);

window.addEventListener('storage', updateTheme);
window.addEventListener('themeChange', updateTheme);
Expand Down Expand Up @@ -65,33 +63,7 @@ const content = () => {
return (
<main className="max-w-7xl mx-auto grid grid-cols-1 md:grid-cols-5 md:gap-4">
<div className="col-span-1">
<div className="hidden md:block">
{mounted && (
<iframe
key={theme}
src={
theme === "dark"
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
}
width="100%"
height="400"
title="Daily DSA Challenge"
></iframe>
)}
</div>
<div className="flex justify-center">
<span className="text-xs hidden md:block">
Daily DSA Challenge by{" "}
<a
href="https://hw.glich.co/resources/daily"
target="_blank"
className="underline hover:text-blue-500 duration-300"
>
Hello World
</a>
</span>
</div>
<DailyDSAEmbed mobile={false} theme={theme} />
</div>
<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">
{/* What is a Queue? */}
Expand Down Expand Up @@ -249,33 +221,7 @@ const content = () => {
</article>

{/* Mobile iframe at bottom */}
<div className="block md:hidden w-full">
{mounted && (
<iframe
key={theme}
src={
theme === "dark"
? "https://hw.glich.co/resources/embed/daily/dsa?theme=dark"
: "https://hw.glich.co/resources/embed/daily/dsa?theme=light"
}
width="100%"
height="320"
title="Daily DSA Challenge"
></iframe>
)}
<div className="flex justify-center pb-8">
<span className="text-xs">
Daily DSA Challenge by{" "}
<a
href="https://hw.glich.co/resources/daily"
target="_blank"
className="underline hover:text-blue-500 duration-300"
>
Hello World
</a>
</span>
</div>
</div>
<DailyDSAEmbed mobile theme={theme} />
</main>
);
};
Expand Down
Loading
Loading