diff --git a/login.css b/login.css index a358a98e..27183d8f 100644 --- a/login.css +++ b/login.css @@ -643,4 +643,33 @@ input::-webkit-reveal { .forgot-password { margin-bottom: 15px; } +} +/* Lamp Toggle */ +.lamp-container { + text-align: center; + margin-bottom: 20px; +} + +#lampToggle { + padding: 10px 18px; + border: none; + border-radius: 10px; + cursor: pointer; + background: #ffd54f; + font-size: 16px; + font-weight: bold; +} + +/* Dark Overlay */ +#darkOverlay { + position: absolute; + inset: 0; + background: rgba(0, 0, 0, 0.6); + border-radius: 20px; + z-index: 5; + transition: opacity 0.4s ease; +} + +.hidden { + display: none; } \ No newline at end of file diff --git a/login.html b/login.html index 607f3847..37d825da 100644 --- a/login.html +++ b/login.html @@ -50,7 +50,11 @@ +
+ +
+
diff --git a/login.js b/login.js index adbf78e8..dbdc4494 100644 --- a/login.js +++ b/login.js @@ -108,3 +108,37 @@ function togglePassword() { eyeIcon.className = "fas fa-eye"; } } +// Lamp Toggle Feature +document.addEventListener("DOMContentLoaded", () => { + const lampToggle = document.getElementById("lampToggle"); + const darkOverlay = document.getElementById("darkOverlay"); + + if (!lampToggle || !darkOverlay) return; + + const inputs = document.querySelectorAll( + 'input, button[type="submit"]' + ); + + let lampOn = true; + + lampToggle.addEventListener("click", () => { + lampOn = !lampOn; + + if (lampOn) { + lampToggle.textContent = "💡 ON"; + darkOverlay.classList.add("hidden"); + + inputs.forEach(input => { + input.disabled = false; + }); + + } else { + lampToggle.textContent = "💡 OFF"; + darkOverlay.classList.remove("hidden"); + + inputs.forEach(input => { + input.disabled = true; + }); + } + }); +}); \ No newline at end of file diff --git a/register.css b/register.css index ff9aaa0f..57215415 100644 --- a/register.css +++ b/register.css @@ -547,3 +547,32 @@ input::-webkit-reveal { .form-container a:hover { color: #0f3d1e; } +/* Lamp Toggle */ +.lamp-container { + text-align: center; + margin-bottom: 20px; +} + +#lampToggle { + padding: 10px 18px; + border: none; + border-radius: 10px; + cursor: pointer; + background: #ffd54f; + font-size: 16px; + font-weight: bold; +} + +/* Dark Overlay */ +#darkOverlay { + position: absolute; + inset: 0; + background: rgba(0, 0, 0, 0.6); + border-radius: 20px; + z-index: 5; + transition: opacity 0.4s ease; +} + +.hidden { + display: none; +} \ No newline at end of file diff --git a/register.js b/register.js index df82de8e..79773753 100644 --- a/register.js +++ b/register.js @@ -262,3 +262,37 @@ document.addEventListener("keydown", function (e) { document.addEventListener("DOMContentLoaded", updateProgress); document.getElementById("password").addEventListener("input", checkPasswordStrength); +// Lamp Toggle Feature +document.addEventListener("DOMContentLoaded", () => { + const lampToggle = document.getElementById("lampToggle"); + const darkOverlay = document.getElementById("darkOverlay"); + + if (!lampToggle || !darkOverlay) return; + + const formInputs = document.querySelectorAll( + "#role, #fullname, #email, #password, #confirmPassword, #register-btn" + ); + + let lampOn = true; + + lampToggle.addEventListener("click", () => { + lampOn = !lampOn; + + if (lampOn) { + lampToggle.textContent = "💡 ON"; + darkOverlay.classList.add("hidden"); + + formInputs.forEach(input => { + input.disabled = false; + }); + + } else { + lampToggle.textContent = "💡 OFF"; + darkOverlay.classList.remove("hidden"); + + formInputs.forEach(input => { + input.disabled = true; + }); + } + }); +}); \ No newline at end of file diff --git a/src/frontend/components/RecentPredictions.js b/src/frontend/components/RecentPredictions.js index c84d6f2f..fb8b28dc 100644 --- a/src/frontend/components/RecentPredictions.js +++ b/src/frontend/components/RecentPredictions.js @@ -1,4 +1,8 @@ -import { getPredictions, clearPredictions } from "../js/predictionStorage.js"; +import { + getPredictions, + clearPredictions, + comparePredictions +} from "../js/predictionStorage.js"; export default function RecentPredictions() { const history = getPredictions(); @@ -11,16 +15,35 @@ export default function RecentPredictions() { container.appendChild(title); history.forEach((item, i) => { - const div = document.createElement("div"); - div.className = "prediction-item"; - div.innerHTML = ` -

${item.timestamp}

-

Input: ${item.input}

-

Output: ${item.output}

- `; - container.appendChild(div); - }); + const div = document.createElement("div"); + div.className = "prediction-item"; + div.innerHTML = ` +

${item.timestamp}

+

Input: ${item.input}

+

Output: ${item.output}

+ `; + + const compareBtn = document.createElement("button"); + compareBtn.textContent = "Compare"; + + compareBtn.onclick = () => { + if (i + 1 < history.length) { + const result = comparePredictions(i + 1, i); + + alert( + `Previous Output: ${result.previous.output} + Latest Output: ${result.latest.output}` + ); + } else { + alert("No previous prediction available"); + } + }; + + div.appendChild(compareBtn); + + container.appendChild(div); +}); if (history.length > 0) { const clearBtn = document.createElement("button"); clearBtn.textContent = "Clear History"; diff --git a/src/frontend/js/predictionStorage.js b/src/frontend/js/predictionStorage.js index 53dd7ccc..487cda1c 100644 --- a/src/frontend/js/predictionStorage.js +++ b/src/frontend/js/predictionStorage.js @@ -12,3 +12,11 @@ export function getPredictions() { export function clearPredictions() { localStorage.removeItem("predictions"); } +export function comparePredictions(index1, index2) { + const history = getPredictions(); + + return { + previous: history[index1], + latest: history[index2] + }; +}