diff options
author | Manurbhav | 2024-05-27 17:02:25 +0530 |
---|---|---|
committer | Manurbhav | 2024-05-27 17:02:25 +0530 |
commit | e44428d6946198dbcf066a5d3f29ee83bdd61db7 (patch) | |
tree | b3c257c56f814d4b9067dce4740089350e0a8eca | |
parent | 133cf9a81b431363354ec016b82b2f6d2905570f (diff) | |
download | IotJS-Astro-e44428d6946198dbcf066a5d3f29ee83bdd61db7.tar.gz IotJS-Astro-e44428d6946198dbcf066a5d3f29ee83bdd61db7.tar.bz2 IotJS-Astro-e44428d6946198dbcf066a5d3f29ee83bdd61db7.zip |
Basic Results page added
location.reload is reloading it infinitely even after adding if condition
-rw-r--r-- | src/components/Login.astro | 15 | ||||
-rw-r--r-- | src/components/Navbar.astro | 1 | ||||
-rw-r--r-- | src/components/ResultsBody.astro | 83 | ||||
-rw-r--r-- | src/pages/results.astro | 22 |
4 files changed, 121 insertions, 0 deletions
diff --git a/src/components/Login.astro b/src/components/Login.astro new file mode 100644 index 0000000..42468cc --- /dev/null +++ b/src/components/Login.astro @@ -0,0 +1,15 @@ +--- +--- + +<div class="bg-white p-10 rounded-lg shadow-lg w-full max-w-sm"> + <h1 class="text-2xl font-bold text-gray-800 mb-6 text-center">Admin Login</h1> + <form> + <div class="mb-4"> + <input type="text" placeholder="Username" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-600"> + </div> + <div class="mb-6"> + <input type="password" placeholder="Password" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-600"> + </div> + <button type="submit" class="w-full bg-purple-600 text-white py-2 rounded-lg hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-600">Login</button> + </form> +</div>
\ No newline at end of file diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index cbc2eb7..bd5434e 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -14,6 +14,7 @@ const routes : Routes[] = [ { path: '/#partners', name: 'Partners' }, { path: '/#contact-us', name: 'Contact Us' }, { path: '/#faq', name: 'FAQ' }, + { path: '/results', name : 'Results' } ] --- diff --git a/src/components/ResultsBody.astro b/src/components/ResultsBody.astro new file mode 100644 index 0000000..dc58ecd --- /dev/null +++ b/src/components/ResultsBody.astro @@ -0,0 +1,83 @@ +--- +import Login from "./Login.astro"; + +--- + +<div class="resultsContainer"> + <div class="pre min-h-screen flex flex-col items-center justify-center"> + <h1 class="mb-10">Results will be announced soon</h1> + <Login /> + </div> + <div class="post min-h-screen hidden"> + <h1>You got 100%</h1> + </div> +</div> + <style> + </style> + + <script> +var resultDate = { + year: 2024, + month: 5, + day: 28, + hours: 11, + minutes: 7, + seconds: 50, +}; + +function checkTime() { + var currentDate = new Date(); + var day = currentDate.getDate(); + var month = currentDate.getMonth() + 1; // getMonth() returns 0-11 + var year = currentDate.getFullYear(); + var hours = currentDate.getHours(); + var minutes = currentDate.getMinutes(); + var seconds = currentDate.getSeconds(); + + console.log( + "Date: " + + day + + "/" + + month + + "/" + + year + + " Time: " + + hours + + ":" + + minutes + + ":" + + seconds + ); + console.log( + "Result Date: " + resultDate.day + + "/" + + resultDate.month + + "/" + + resultDate.year + + " Time: " + + resultDate.hours + + ":" + + resultDate.minutes + + ":" + + resultDate.seconds + ); + + var currentTime = new Date(year, month - 1, day, hours, minutes, seconds); + var targetTime = new Date(resultDate.year, resultDate.month - 1, resultDate.day, resultDate.hours, resultDate.minutes, resultDate.seconds); + + if (currentTime >= targetTime) { + // location.reload(); + document.querySelector(".pre")?.classList.add("hidden"); + document.querySelector(".post")?.classList.remove("hidden"); + document.querySelector(".post")?.classList.add("flex"); + document.querySelector(".post")?.classList.add("items-center"); + document.querySelector(".post")?.classList.add("justify-center"); + } else { + // setTimeout(checkTime, 1000); // Check every second + } +} + +// Initial call to checkTime +checkTime(); + </script> + diff --git a/src/pages/results.astro b/src/pages/results.astro new file mode 100644 index 0000000..e233238 --- /dev/null +++ b/src/pages/results.astro @@ -0,0 +1,22 @@ +--- +import Layout from '../layouts/Layout.astro'; +import TopBar from '../components/TopBar.astro'; +import Navbar from '../components/Navbar.astro'; +import Footer from '../components/Footer.astro'; +import ResultsBody from '../components/ResultsBody.astro'; +import IconBar from '../components/IconBar.astro'; +--- + +<Layout title="Welcome to FOSSEE."> + <main> + <TopBar /> + <Navbar /> + <IconBar/> + <ResultsBody/> + <Footer/> + </main> +</Layout> + +<style> + +</style> |