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
193 changes: 192 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,86 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title>CodeClip</title>

<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Bitcount:[email protected]&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Bitcount:[email protected]&family=Oooh+Baby&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"
integrity="sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>

<!-- Material Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

<!-- Styles -->
<link rel="stylesheet" href="styles.css" />

<!-- Sentry Script -->

<script
src="https://js.sentry-cdn.com/8994bf86fecf7733832520db1565ab1f.min.js"
crossorigin="anonymous"
></script>

<script src="https://js.sentry-cdn.com/8994bf86fecf7733832520db1565ab1f.min.js" crossorigin="anonymous"></script>

</head>
<body>
<!-- Header Component -->
<header class="header">
<div class="container header__container">
<div class="header__logo">
<span class="logo-text">CodeClip</span>
</div>
<nav class="header__nav" id="navMenu">
<ul class="nav__list">
<li><a href="#" class="nav__link">Home</a></li>

<li><a href="#" class="nav__link">Challenges</a></li>
<li><a href="#" class="nav__link">Editor</a></li>
<li><a href="#" class="nav__link">Profile</a></li>
<li>
<i class="fa-solid fa-moon" id="theme-toggle"></i>
<!-- <div class="theme-toggle-container">
<button id="theme-toggle" class="theme-toggle-btn">
Toggle Theme
</button>
</div> -->
</li>
</ul>
</nav>
<button
class="header__toggle"
id="navToggle"
aria-label="Open navigation menu"
>

<li><a href="./pages/challenges.html" class="nav__link">Challenges</a></li>
<li><a href="/editor.html" class="nav__link">Editor</a></li>
<li><a href="#" class="nav__link">Profile</a></li>
</ul>
</nav>
<button class="header__toggle" id="navToggle" aria-label="Open navigation menu">

<span class="hamburger"></span>
<span class="hamburger"></span>
<span class="hamburger"></span>
</button>

<title>Challenges - CodeClip</title>

<!-- Google Fonts -->
Expand Down Expand Up @@ -55,6 +135,7 @@ <h1 class="challenges-hero__title">
Test your skills with our curated collection of coding challenges. From beginner-friendly problems to advanced algorithms, there's something for every developer.
</p>
</div>

</div>
</section>

Expand Down Expand Up @@ -88,6 +169,88 @@ <h1 class="challenges-hero__title">
<input type="text" id="search-challenges" placeholder="Search challenges..." class="search-input">
</div>
</div>

<div class="container">
<div class="hero__content">
<div class="hero__text">
<p class="hero__subtitle">🚀 An Interactive Coding Platform</p>
<h1 class="hero__title">

<span id="element"></span>
</h1>
<p class="hero__description">
Discover CodeClip, an exhilarating, lightweight web app that
empowers developers to master coding challenges right in their
browser! Whether you're tackling algorithms, debugging scripts,
or showcasing your solutions to the open-source community,
CodeClip offers a seamless, interactive experience with a sleek
interface, real-time feedback, and effortless sharing via unique
URLs or GitHub Gists.
</p>
<div class="hero__cta">
<a href="/coding" class="btn btn-primary">🎯 Start Coding</a>
<a href="/challenges" class="btn btn-secondary"
>📚 View Challenges</a
>

Code. <span class="highlight">Challenge.</span><br />
Conquer.
</h1>
<p class="hero__description">
Discover CodeClip, an exhilarating, lightweight web app that empowers developers to master coding challenges right in their browser! Whether you're tackling algorithms, debugging scripts, or showcasing your solutions to the open-source community, CodeClip offers a seamless, interactive experience with a sleek interface, real-time feedback, and effortless sharing via unique URLs or GitHub Gists.
</p>
<div class="hero__cta">
<a href="/coding" class="btn btn-primary">🎯 Start Coding</a>
<a href="/challenges" class="btn btn-secondary">📚 View Challenges</a>

</div>
</div>
<div class="hero__visual">
<div class="code-window">
<div class="code-window__header">
<span class="circle red"></span>
<span class="circle yellow"></span>
<span class="circle green"></span>
</div>
<div class="code-content">

<div class="code-line">
<span class="comment">// Welcome to CodeClip</span>
</div>
<div class="code-line">
<span class="keyword">function</span>
<span class="string">solveProblem</span>() {
</div>
<div class="code-line">
<span class="keyword">return</span>
<span class="string">'Success!'</span>;
</div>

<div class="code-line"><span class="comment">// Welcome to CodeClip</span></div>
<div class="code-line"><span class="keyword">function</span> <span class="string">solveProblem</span>() {</div>
<div class="code-line"> <span class="keyword">return</span> <span class="string">'Success!'</span>;</div>

<div class="code-line">}</div>
</div>
</div>
</div>
</div>
</div>
</section>

</main>

<!-- Theme Toggle -->

<!-- Feature Cards -->
<div class="content">
<div class="card">
<a href="#" target="_blank">
<div class="icon"><i class="material-icons md-36" alt="Challenge vault icon">security</i></div>
<p class="title">Challenge Vault</p>
<p class="text">All your challenges in one place — track, review, repeat.</p>
</a>

</div>
</section>

Expand Down Expand Up @@ -167,6 +330,7 @@ <h3 class="challenge-card__title">Valid Parentheses</h3>
<div id="no-results" class="no-results-message" style="display: none;">
<h2>🤔 No challenges found...</h2>
<p>Try adjusting your search or filter criteria.</p>

</div>
</div>
</section>
Expand Down Expand Up @@ -393,6 +557,32 @@ <h4>Community</h4>
margin-left: 0;
}



<!-- Footer -->
<div id="footer"></div>

<!-- Scripts -->


<script src="https://unpkg.com/[email protected]/dist/typed.umd.js"></script>

<!-- Setup and start animation! -->
<script>
var typed = new Typed("#element", {
strings: ["Code", "Challenge", "Conquer"],
typeSpeed: 50,
loop: true,
});
</script>

<script type="module" src="scripts/data.js"></script>
<script type="module" src="scripts/app.js"></script>
<script type="module" src="./scripts/theme.js"></script>
</body>
</html>


.search-input {
width: 100%;
}
Expand All @@ -403,4 +593,5 @@ <h4>Community</h4>
}
</style>
</body>
</html>
</html>

77 changes: 44 additions & 33 deletions scripts/theme.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,53 @@
import { saveUserSettings, loadUserSettings } from './data.js';
import { saveUserSettings, loadUserSettings } from "./data.js";

document.addEventListener("DOMContentLoaded", () => {
const toggleBtn = document.getElementById("theme-toggle");
const toggleBtn = document.getElementById("theme-toggle");

const setTheme = (theme) => {
document.documentElement.setAttribute("data-theme", theme);
const success = saveUserSettings({ ...loadUserSettings(), theme });
if (!success) {
alert('Failed to save theme preference.');
}
};
const setTheme = (theme) => {
document.documentElement.setAttribute("data-theme", theme);

// Toggle icon based on theme
if (theme === "dark") {
toggleBtn.classList.remove("fa-sun");
toggleBtn.classList.add("fa-moon");
} else {
toggleBtn.classList.remove("fa-moon");
toggleBtn.classList.add("fa-sun");
}

const success = saveUserSettings({ ...loadUserSettings(), theme });
if (!success) {
alert("Failed to save theme preference.");
}
};

// Apply saved theme on load
const savedSettings = loadUserSettings();
const savedTheme = savedSettings.theme;
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
const initialTheme = savedTheme || (prefersDark ? "dark" : "light");
setTheme(initialTheme);
// Apply saved theme on load
const savedSettings = loadUserSettings();
const savedTheme = savedSettings.theme;
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
const initialTheme = savedTheme || (prefersDark ? "dark" : "light");
setTheme(initialTheme);

// Toggle button click
toggleBtn.addEventListener("click", () => {
const current = document.documentElement.getAttribute("data-theme");
const newTheme = current === "light" ? "dark" : "light";
setTheme(newTheme);
});
// Toggle button click
toggleBtn.addEventListener("click", () => {
const current = document.documentElement.getAttribute("data-theme");
const newTheme = current === "light" ? "dark" : "light";
setTheme(newTheme);
});

// Real-time sync: The theme changed in one tab is linked and synced with the theme change in other tabs.
window.addEventListener("storage", (event) => {
if (event.key === "codeclip_user_settings") {
try {
const newSettings = JSON.parse(event.newValue);
if (newSettings && newSettings.theme) {
document.documentElement.setAttribute("data-theme", newSettings.theme);
}
} catch (e) {
// Ignore parse errors
// Real-time sync: The theme changed in one tab is linked and synced with the theme change in other tabs.
window.addEventListener("storage", (event) => {
if (event.key === "codeclip_user_settings") {
try {
const newSettings = JSON.parse(event.newValue);
if (newSettings && newSettings.theme) {
document.documentElement.setAttribute(
"data-theme",
newSettings.theme
);
}
} catch (e) {
}
});
}
});
});

22 changes: 22 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,10 @@ body {
left: 30%;
animation-delay: 4s;
}
#theme-toggle:hover{
cursor: pointer;

}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
Expand Down Expand Up @@ -386,6 +389,19 @@ body {
background: #475569;
}


/* Responsive Styles */
@media (max-width: 1024px) {
.hero__content {
grid-template-columns: 1fr;
text-align: center;
}
.hero__cta {
justify-content: center;
}
.hero__visual {
margin: 0 auto;

/* Content Section - Fixed for proper centering */
.content {
max-width: 1024px;
Expand Down Expand Up @@ -588,10 +604,12 @@ a {
justify-content: center;
align-items: center;
width: 100%;

max-width: 400px;
}
}


.content {
padding-top: 50px;
flex-direction: column;
Expand All @@ -604,6 +622,7 @@ a {
}



@media (max-width: 768px) {
.header__container {
height: 60px;
Expand Down Expand Up @@ -639,10 +658,12 @@ a {
.hero__title {
font-size: 2.5rem;
}


.content {
padding-top: 300px;
}

}

@media (max-width: 480px) {
Expand All @@ -655,6 +676,7 @@ a {
.hero__title {
font-size: 2rem;
}


/* Ensure hero still uses full width on mobile and centers content */
.hero .container {
Expand Down