summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManurbhav Arya2024-06-19 23:07:58 +0530
committerManurbhav Arya2024-06-19 23:07:58 +0530
commit895fc782d1ba2a47d4cb6f0d83700cd2e206a916 (patch)
tree145f5dfb0c7f0ca1819fe67def7b6dba7bafe197
parent8c495febd09303742cca2ff703f9fab6257a5a4f (diff)
downloadIotJS-Astro-895fc782d1ba2a47d4cb6f0d83700cd2e206a916.tar.gz
IotJS-Astro-895fc782d1ba2a47d4cb6f0d83700cd2e206a916.tar.bz2
IotJS-Astro-895fc782d1ba2a47d4cb6f0d83700cd2e206a916.zip
added comments, renamed md folders, updated readme, added active link feature, modularised results timer
-rw-r--r--.gitignore4
-rw-r--r--README.md74
-rw-r--r--config.json10
-rw-r--r--public/results.json50
-rw-r--r--src/components/Dummy.astro2
-rw-r--r--src/components/Navbar.astro328
-rw-r--r--src/components/ResultsBody.astro88
-rw-r--r--src/content/homePage/coreTeam/core1.md (renamed from src/content/home/core/core1.md)0
-rw-r--r--src/content/homePage/coreTeam/core2.md (renamed from src/content/home/core/core2.md)0
-rw-r--r--src/content/homePage/coreTeam/core3.md (renamed from src/content/home/core/core3.md)0
-rw-r--r--src/content/homePage/coreTeam/core4.md (renamed from src/content/home/core/core4.md)0
-rw-r--r--src/content/homePage/coreTeam/core5.md (renamed from src/content/home/core/core5.md)0
-rw-r--r--src/content/homePage/coreTeam/core6.md (renamed from src/content/home/core/core6.md)0
-rw-r--r--src/content/homePage/coreTeam/core7.md (renamed from src/content/home/core/core7.md)0
-rw-r--r--src/content/homePage/coreTeam/core8.md (renamed from src/content/home/core/core8.md)0
-rw-r--r--src/content/homePage/coreTeam/core9.md (renamed from src/content/home/core/core9.md)0
-rw-r--r--src/content/homePage/partner/partner1.md (renamed from src/content/home/partner/partner1.md)0
-rw-r--r--src/content/homePage/partner/partner2.md (renamed from src/content/home/partner/partner2.md)0
-rw-r--r--src/content/homePage/partner/partner3.md (renamed from src/content/home/partner/partner3.md)0
-rw-r--r--src/content/homePage/partner/partner4.md (renamed from src/content/home/partner/partner4.md)0
-rw-r--r--src/content/homePage/purpose/purp1.md (renamed from src/content/home/purpose/purp1.md)0
-rw-r--r--src/content/homePage/purpose/purp2.md (renamed from src/content/home/purpose/purp2.md)0
-rw-r--r--src/content/homePage/significance/sig1.md (renamed from src/content/home/significance/sig1.md)5
-rw-r--r--src/content/navbarRoute/nav1.md (renamed from src/content/navbar/nav1.md)0
-rw-r--r--src/content/navbarRoute/nav2.md (renamed from src/content/navbar/nav2.md)0
-rw-r--r--src/content/navbarRoute/nav3.md (renamed from src/content/navbar/nav3.md)0
-rw-r--r--src/content/navbarRoute/nav4.md (renamed from src/content/navbar/nav4.md)0
-rw-r--r--src/content/navbarRoute/nav5.md (renamed from src/content/navbar/nav5.md)0
-rw-r--r--src/content/navbarRoute/nav6.md (renamed from src/content/navbar/nav6.md)0
-rw-r--r--src/content/navbarRoute/nav7.md (renamed from src/content/navbar/nav7.md)0
-rw-r--r--src/content/navbarRoute/nav8.md (renamed from src/content/navbar/nav8.md)0
-rw-r--r--src/content/navbarRoute/nav9.md (renamed from src/content/navbar/nav9.md)0
-rw-r--r--src/content/partnersCarouselLogo/c1.md (renamed from src/content/carousel/c1.md)0
-rw-r--r--src/content/partnersCarouselLogo/c2.md (renamed from src/content/carousel/c2.md)0
-rw-r--r--src/content/partnersCarouselLogo/c3.md (renamed from src/content/carousel/c3.md)0
-rw-r--r--src/content/partnersCarouselLogo/c4.md (renamed from src/content/carousel/c4.md)0
-rw-r--r--src/content/partnersCarouselLogo/c5.md (renamed from src/content/carousel/c5.md)0
-rw-r--r--src/content/partnersCarouselLogo/c6.md (renamed from src/content/carousel/c6.md)0
-rw-r--r--src/content/partnersCarouselLogo/c7.md (renamed from src/content/carousel/c7.md)0
-rw-r--r--src/content/partnersCarouselLogo/c8.md (renamed from src/content/carousel/c8.md)0
-rw-r--r--src/content/resourcesPage/a1.md (renamed from src/content/accordion/a1.md)0
-rw-r--r--src/content/resourcesPage/a2.md (renamed from src/content/accordion/a2.md)0
-rw-r--r--src/content/resourcesPage/a3.md (renamed from src/content/accordion/a3.md)0
-rw-r--r--src/content/resourcesPage/a4.md (renamed from src/content/accordion/a4.md)0
-rw-r--r--src/content/resourcesPage/a5.md (renamed from src/content/accordion/a5.md)0
-rw-r--r--src/content/resourcesPage/a6.md (renamed from src/content/accordion/a6.md)0
-rw-r--r--src/content/resourcesPage/a7.md (renamed from src/content/accordion/a7.md)0
-rw-r--r--src/content/resourcesPage/a8.md (renamed from src/content/accordion/a8.md)0
-rw-r--r--src/content/scheduleEvent/s1.md (renamed from src/content/schedule/s1.md)0
-rw-r--r--src/content/scheduleEvent/s2.md (renamed from src/content/schedule/s2.md)0
-rw-r--r--src/content/scheduleEvent/s3.md (renamed from src/content/schedule/s3.md)0
-rw-r--r--src/content/scheduleEvent/s4.md (renamed from src/content/schedule/s4.md)0
-rw-r--r--src/content/scheduleEvent/s5.md (renamed from src/content/schedule/s5.md)0
-rw-r--r--src/content/topbarLogo/top1.md (renamed from src/content/topbar/top1.md)0
-rw-r--r--src/content/topbarLogo/top2.md (renamed from src/content/topbar/top2.md)0
-rw-r--r--src/content/topbarLogo/top3.md (renamed from src/content/topbar/top3.md)0
-rw-r--r--src/content/topbarLogo/top4.md (renamed from src/content/topbar/top4.md)0
-rw-r--r--src/content/topbarLogo/top5.md (renamed from src/content/topbar/top5.md)0
-rw-r--r--src/content/topbarLogo/top6.md (renamed from src/content/topbar/top6.md)0
-rw-r--r--src/content/topbarLogo/top7.md (renamed from src/content/topbar/top7.md)0
-rw-r--r--src/content/topbarLogo/top8.md (renamed from src/content/topbar/top8.md)0
-rw-r--r--src/content/topbarLogo/top9.md (renamed from src/content/topbar/top9.md)0
-rw-r--r--src/lib/databaseUpdates.js2
-rw-r--r--src/lib/db.ts2
-rw-r--r--src/pages/admin.astro81
-rw-r--r--src/pages/login.astro7
-rw-r--r--src/pages/results.astro48
67 files changed, 404 insertions, 297 deletions
diff --git a/.gitignore b/.gitignore
index bf35e9d..466d7b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,9 @@ node_modules/
#database
mydatabase.db
+#sample md
+fruits/
+
# logs
npm-debug.log*
yarn-debug.log*
@@ -25,3 +28,4 @@ pnpm-debug.log*
# jetbrains setting folder
.idea/
+
diff --git a/README.md b/README.md
index fc995fe..688c96a 100644
--- a/README.md
+++ b/README.md
@@ -13,31 +13,68 @@ Inside of project, you'll see the following folders and files:
```text
/
├── public/
-│ └── favicon.svg
├── src/
│ ├── components/
-│ │ └── Accordion.astro
-│ │ └── Carousel.astro
-│ │ └── Footer.astro
-│ │ └── Header.astro
-│ │ └── HomeBody.astro
-│ │ └── IconBar.astro
-│ │ └── Navbar.astro
-│ │ └── ResourcesBody.astro
-│ │ └── ScheduleBody.astro
-│ │ └── TopBar.astro
+│ ├── content/
│ ├── layouts/
-│ │ └── Layout.astro
+│ ├── lib/
│ └── pages/
-│ └── index.astro
-│ └── resources.astro
-│ └── schedule.astro
└── .gitignore
└── astro.config.mjs
└── package.json
└── README.md
```
+The project directory includes the following folders for managing content:
+
+- **FAQ**: Located in `src/content/faq`.
+
+ - Add new FAQs by creating Markdown files with `Number`, `question`, and `answer`.
+
+- **Footer**: Contains `about` and `resources` subfolders.
+
+ - **About**: Located in `src/content/footer/about`.
+ - Add new about links using Markdown files with `Number`, `name`, and `link`.
+ - **Resources**: Located in `src/content/footer/resources`.
+ - Add new resource links using Markdown files with `Number`, `name`, and `link`.
+
+- **Homepage**: Contains `coreTeam`, `partner`, `purpose`, and `significance` subfolders.
+
+ - **Core Team**: Located in `src/content/homepage/coreTeam`.
+ - Add new team members using Markdown files with `Number`, `name`, `position`, and `institute`.
+ - **Partner**: Located in `src/content/homepage/partner`.
+ - Add new partners using Markdown files with `Number` and `description`.
+ -Remember that position is an `array` as the person can have multiple positions in the company, so you have to enclose the whole position content in square brackets `[]`, text in double quotes `""`, and separate each text with a comma `,`.
+ - **Purpose**: Located in `src/content/homepage/purpose`.
+ - Add new purposes using Markdown files with `Number` and `description`.
+ - **Significance**: Located in `src/content/homepage/significance`.
+ - Add new significance content using Markdown files with `Number`, `intro`, `point` (array), and `end`.
+ - Remember that point is an `array` so you have to enclose the whole point content in square brackets `[]`, text in double quotes `""`, and separate each text with a comma `,`.
+
+- **Navbar Routes**: Located in `src/content/navbarRoutes`.
+
+ - Add new routes using Markdown files with `Number`, `path`, and `name`.
+ - For same page links, use `#` followed by the section id and for external links, use the full URL.
+
+- **Partners Carousel Logos**: Located in `src/content/partnersCarouselLogos`.
+
+ - Add new partner logos to the carousel using Markdown files with `Number`, `img`, `alt`, and `link`.
+ - link is optional, keep it blank `""` if not available.
+
+- **Resources Page**: Located in `src/content/resourcesPage`.
+
+ - Add new resources using Markdown files with `Number`, `heading`, and `points` (list).
+ - Add hyphen and for `text` and `link`, keep the `title` encloded in square brackets `[]` and then the `link` in round brackets `()`.
+
+- **Schedule Events**: Located in `src/content/scheduleEvents`.
+
+ - Add new schedule events using Markdown files with `Number`, `heading`, and `events` (list).
+ - Add hyphen and then the event name.
+
+- **Top Bar Logo**: Located in `src/content/topBarLogo`.
+ - Add new top bar logos using Markdown files with `Number`, `link`, `img`, `alt`, `classname`, and `id`.
+ - Just keep the `classname` as `img-fluid logos` and `id` blank `""`.
+
## Setup Instructions
To run the project locally, follow these steps:
@@ -72,6 +109,13 @@ npm run start
The converted website has been deployed using Netlify and is accessible via the following URL:
+## Package Use
+
+- **Tailwind CSS**: Employed for comprehensive styling and design consistency.
+- **Astro**: Utilized for efficient static site generation and improved performance.
+- **Lucia**: Integrated for streamlined authentication and user management functionalities.
+- **Better SQLite 3**: Implemented for robust and scalable database operations.
+
## License
This project is licensed under the MIT License.
diff --git a/config.json b/config.json
new file mode 100644
index 0000000..b06c36f
--- /dev/null
+++ b/config.json
@@ -0,0 +1,10 @@
+{
+ "resultDate": {
+ "year": 2024,
+ "month": 7,
+ "day": 18,
+ "hours": 16,
+ "minutes": 1,
+ "seconds": 0
+ }
+}
diff --git a/public/results.json b/public/results.json
new file mode 100644
index 0000000..19b42a4
--- /dev/null
+++ b/public/results.json
@@ -0,0 +1,50 @@
+[
+ {
+ "name": "Alice Johnson",
+ "college": "ABC University",
+ "projectIdea": "AI-based Image Recognition",
+ "shortlisted": true
+ },
+ {
+ "name": "Bob Smith",
+ "college": "XYZ College",
+ "projectIdea": "Blockchain for Supply Chain",
+ "shortlisted": false
+ },
+ {
+ "name": "Charlie Brown",
+ "college": "DEF Institute of Technology",
+ "projectIdea": "Smart Home Automation",
+ "shortlisted": true
+ },
+ {
+ "name": "Diana Prince",
+ "college": "GHI University",
+ "projectIdea": "Healthcare Chatbot",
+ "shortlisted": false
+ },
+ {
+ "name": "Edward Norton",
+ "college": "JKL College",
+ "projectIdea": "Augmented Reality Education",
+ "shortlisted": true
+ },
+ {
+ "name": "Fiona Gallagher",
+ "college": "MNO Institute",
+ "projectIdea": "Renewable Energy Solutions",
+ "shortlisted": true
+ },
+ {
+ "name": "George Harrison",
+ "college": "PQR University",
+ "projectIdea": "Automated Financial Advisor",
+ "shortlisted": false
+ },
+ {
+ "name": "Hannah Lee",
+ "college": "STU College",
+ "projectIdea": "Virtual Reality Therapy",
+ "shortlisted": true
+ }
+]
diff --git a/src/components/Dummy.astro b/src/components/Dummy.astro
index 99ab06f..ec3b8ed 100644
--- a/src/components/Dummy.astro
+++ b/src/components/Dummy.astro
@@ -1,5 +1,5 @@
---
-var test = await Astro.glob("../content/accordion/*.md");
+var test = await Astro.glob("../content/resourcesPage/*.md");
---
<section>
diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro
index a4073b7..6d5239d 100644
--- a/src/components/Navbar.astro
+++ b/src/components/Navbar.astro
@@ -35,177 +35,182 @@ const navbarData : Routes[] = navbarJson;
}
</div>
<style>
+ .hamburger-navbar{
+ position: fixed;
+ right: 0;
+ display: none;
+ z-index: 1001;
+ }
+ .off-screen-menu{
+ background-color: orange;
+ height: 100%;
+ display: none;
+ width: 100%;
+ top: 20%;
+ position: sticky;
+ right: -450px;
+ flex-direction: column;
+ justify-content: center;
+ font-size: 3rem;
+ z-index: 1001;
+ }
- .hamburger-navbar{
- position: fixed;
- right: 0;
- display: none;
- z-index: 1001;
- }
- .off-screen-menu{
- background-color: orange;
- height: 100%;
- display: none;
- width: 100%;
- top: 20%;
- position: sticky;
- right: -450px;
- flex-direction: column;
- justify-content: center;
- font-size: 3rem;
- z-index: 1001;
- }
+ .off-screen-menu a{
+ font-size: 2.9vh;
+ text-decoration: none;
+ color: black;
+ /* color: blue; */
+ font-weight: 500;
+ padding: 1vh 4vh;
+ }
+ .off-screen-menu a:hover{
+ background-color: rgb(5, 5, 95);
+ color: white;
+ }
- .off-screen-menu a{
- font-size: 2.9vh;
- text-decoration: none;
- color: black;
- /* color: blue; */
- font-weight: 500;
- padding: 1vh 4vh;
- }
- .off-screen-menu a:hover{
- background-color: rgb(5, 5, 95);
- color: white;
- }
+ .off-screen-menu:active{
+ right: 0;
+ }
+ .active{
+ display: flex;
+ }
- .off-screen-menu:active{
- right: 0;
- }
- .active{
- display: flex;
- }
+ nav{
+ display: block;
+ background-color: orange;
+ padding: 1rem;
+ width: 100vw;
+ z-index: 1000;
+ }
+ .ham-menu{
+ height: 40px;
+ width: 40px;
+ margin-left: auto;
+ position: sticky;
+ top: 0;
+ cursor: pointer;
+ }
- nav{
- display: block;
- background-color: orange;
- padding: 1rem;
- width: 100vw;
- z-index: 1000;
- }
- .ham-menu{
- height: 40px;
- width: 40px;
- margin-left: auto;
- position: sticky;
- top: 0;
- cursor: pointer;
- }
+ .ham-menu span{
+ height: 5px;
+ width: 100%;
+ background-color: #6f86ff;
+ border-radius: 25px;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ /* transition: .3s ease; */
+ transform: translate(-50%, -50%);
+ }
- .ham-menu span{
- height: 5px;
- width: 100%;
- background-color: #6f86ff;
- border-radius: 25px;
- position: absolute;
- top: 50%;
- left: 50%;
- /* transition: .3s ease; */
- transform: translate(-50%, -50%);
- }
+ .ham-menu span:nth-child(1){
+ top: 25%;
+ }
+ .ham-menu span:nth-child(3){
+ top: 75%;
+ }
- .ham-menu span:nth-child(1){
- top: 25%;
- }
- .ham-menu span:nth-child(3){
- top: 75%;
- }
+ .ham-menu.active span:nth-child(1){
+ top: 50%;
+ transform: translate(-50%, -50%) rotate(45deg);
+ }
- .ham-menu.active span:nth-child(1){
- top: 50%;
- transform: translate(-50%, -50%) rotate(45deg);
- }
+ .ham-menu.active span:nth-child(2){
+ opacity: 0;
+ }
- .ham-menu.active span:nth-child(2){
- opacity: 0;
- }
+ .ham-menu.active span:nth-child(3){
+ top: 50%;
+ transform: translate(-50%, -50%) rotate(-45deg);
+ }
- .ham-menu.active span:nth-child(3){
- top: 50%;
- transform: translate(-50%, -50%) rotate(-45deg);
+ .navbar {
+ /* font-family: 'Roboto Slab', serif !important; */
+ display: flex;
+ justify-content: center;
+ padding: 0;
+ background-color: rgb(252, 230, 188);
+ position: sticky;
+ top: 0%; /* Add this line */
+ z-index: 1000;
+ }
+ .navbar a {
+ font-size: 2.5vh;
+ color: blue;
+ font-weight:600;
+ text-decoration: none;
+ padding: 1.7vh 1.5vw;
+ }
+ .navbar a:hover{
+ background-color: rgb(1, 1, 131);
+ color: white;
+ }
+ .navbar a.active-link {
+ color: rgba(223, 78, 78, 0.801);
+ font-size: 3.5vh;
+ }
+
+ @media screen and (max-width: 535px){
+ nav{
+ width: 100vh;
}
+
+ }
- .navbar {
- /* font-family: 'Roboto Slab', serif !important; */
- display: flex;
- justify-content: center;
- padding: 0;
- background-color: rgb(252, 230, 188);
- position: sticky;
- top: 0%; /* Add this line */
- z-index: 1000;
- }
- .navbar a {
- font-size: 2.5vh;
- color: blue;
- font-weight:600;
- text-decoration: none;
- padding: 1.7vh 1.5vw;
+ @media screen and (max-width: 613px) {
+ .container {
+ width: 100%; /* Adjust as needed */
}
- .navbar a:hover{
- background-color: rgb(1, 1, 131);
- color: white;
+ .navbar{
+ padding: 0 10vw;
}
+ }
- @media screen and (max-width: 535px){
- nav{
- width: 100vh;
- }
-
+ @media screen and (max-width: 627px){
+ .off-screen-menu{
+ /* top: 17.5vh; */
+ top: 14vh;
}
-
- @media screen and (max-width: 613px) {
- .container {
- width: 100%; /* Adjust as needed */
- }
- .navbar{
- padding: 0 10vw;
- }
+ }
+ @media screen and (min-width: 628px) and (max-width: 792px){
+ .off-screen-menu{
+ top: 17vw;
}
-
- @media screen and (max-width: 627px){
- .off-screen-menu{
- /* top: 17.5vh; */
- top: 14vh;
- }
+ }
+ @media screen and (min-width: 792px) and (max-width: 880px){
+ .active{
+ top: 16vw;
}
- @media screen and (min-width: 628px) and (max-width: 792px){
- .off-screen-menu{
- top: 17vw;
- }
+ }
+ @media screen and (min-width: 880px) and (max-width: 982px){
+ nav{
+ padding: 1rem;
+ width: 100vw;
}
- @media screen and (min-width: 792px) and (max-width: 880px){
- .active{
- top: 16vw;
- }
+ .active{
+ top: 19vh;
}
- @media screen and (min-width: 880px) and (max-width: 982px){
- nav{
- padding: 1rem;
- width: 100vw;
- }
- .active{
- top: 19vh;
- }
+ }
+ @media screen and (max-width: 982px){
+ .navbar{
+ display: none;
}
- @media screen and (max-width: 982px){
- .navbar{
- display: none;
- }
- .hamburger-navbar{
- display: block;
- }
+ .hamburger-navbar{
+ display: block;
}
- @media screen and (min-width: 982px){
- .off-screen-menu{
- display: none;
- }
+ }
+ @media screen and (min-width: 982px){
+ .off-screen-menu{
+ display: none;
}
+ }
- </style>
+</style>
<script>
+
+ // for hamburger menu
const hamMenu = document.querySelector('.ham-menu');
const offScreenMenu : Element | null = document.querySelector('.off-screen-menu');
@@ -217,4 +222,37 @@ const navbarData : Routes[] = navbarJson;
offScreenMenu?.classList.remove('active');
}
})
+
+
+
+
+ // for active links
+
+ function handleActiveLinks() {
+ const navbarLinks = document.querySelectorAll('.navbar a');
+ // console.log(navbarLinks);
+ var currentPathWithHash = window.location.pathname + window.location.hash;
+ // console.log(currentPathWithHash);
+
+ navbarLinks.forEach(link=>{
+ const linkPath = link.getAttribute('href');
+ // console.log(linkPath);
+
+ if(currentPathWithHash===linkPath){
+ link.classList.add('active-link');
+ }
+ else{
+ link.classList.remove('active-link');
+ }
+ })
+ }
+
+ document.addEventListener('DOMContentLoaded', () => {
+ handleActiveLinks();
+ });
+
+ window.addEventListener('hashchange', () => {
+ handleActiveLinks();
+ });
+
</script>
diff --git a/src/components/ResultsBody.astro b/src/components/ResultsBody.astro
index 8dbc21c..15b8f31 100644
--- a/src/components/ResultsBody.astro
+++ b/src/components/ResultsBody.astro
@@ -1,12 +1,15 @@
---
-// import Login from "./Login.astro";
+
+// Can be used in other pages to check if the user is logged in or not
const user = Astro.locals.user;
+
if(!user) {
Astro.redirect('/login');
}
else{
Astro.redirect('/admin');
}
+
---
<div class="resultsContainer">
@@ -15,87 +18,6 @@ else{
<!-- <Login /> -->
<a href = "/login" type="submit" class="w-40 bg-purple-600 no-underline text-center text-white py-2 rounded-lg hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-600" id="Adminbtn">Admin Login<a/>
</div>
- <div class="post min-h-screen hidden">
- <h1>You got 100%</h1>
- <a href="/admin" class="w-40 bg-purple-600 no-underline text-center text-white py-2 rounded-lg hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-600">Check your Results</a>
- </div>
-</div>
- <style>
- </style>
-
- <script>
-
-// Redirect not working
-
-// document.getElementById("Adminbtn")?.addEventListener("click", function() {
-// console.log("Admin Login");
-// Astro.redirect('/login');
-// });
-
-var resultDate = {
- year: 2024,
- month: 6,
- day: 30,
- hours: 11,
- minutes: 57,
- seconds: 0,
-};
-
-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);
- var check = false;
- if (currentTime >= targetTime && !check) {
- // 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("flex-col");
- 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>
+</div>
diff --git a/src/content/home/core/core1.md b/src/content/homePage/coreTeam/core1.md
index f90d9dc..f90d9dc 100644
--- a/src/content/home/core/core1.md
+++ b/src/content/homePage/coreTeam/core1.md
diff --git a/src/content/home/core/core2.md b/src/content/homePage/coreTeam/core2.md
index a5a4a22..a5a4a22 100644
--- a/src/content/home/core/core2.md
+++ b/src/content/homePage/coreTeam/core2.md
diff --git a/src/content/home/core/core3.md b/src/content/homePage/coreTeam/core3.md
index 205b3ec..205b3ec 100644
--- a/src/content/home/core/core3.md
+++ b/src/content/homePage/coreTeam/core3.md
diff --git a/src/content/home/core/core4.md b/src/content/homePage/coreTeam/core4.md
index 5965961..5965961 100644
--- a/src/content/home/core/core4.md
+++ b/src/content/homePage/coreTeam/core4.md
diff --git a/src/content/home/core/core5.md b/src/content/homePage/coreTeam/core5.md
index a2df3fe..a2df3fe 100644
--- a/src/content/home/core/core5.md
+++ b/src/content/homePage/coreTeam/core5.md
diff --git a/src/content/home/core/core6.md b/src/content/homePage/coreTeam/core6.md
index 2d31a5a..2d31a5a 100644
--- a/src/content/home/core/core6.md
+++ b/src/content/homePage/coreTeam/core6.md
diff --git a/src/content/home/core/core7.md b/src/content/homePage/coreTeam/core7.md
index 327b00c..327b00c 100644
--- a/src/content/home/core/core7.md
+++ b/src/content/homePage/coreTeam/core7.md
diff --git a/src/content/home/core/core8.md b/src/content/homePage/coreTeam/core8.md
index 8eadfaa..8eadfaa 100644
--- a/src/content/home/core/core8.md
+++ b/src/content/homePage/coreTeam/core8.md
diff --git a/src/content/home/core/core9.md b/src/content/homePage/coreTeam/core9.md
index 06207ed..06207ed 100644
--- a/src/content/home/core/core9.md
+++ b/src/content/homePage/coreTeam/core9.md
diff --git a/src/content/home/partner/partner1.md b/src/content/homePage/partner/partner1.md
index fb074a0..fb074a0 100644
--- a/src/content/home/partner/partner1.md
+++ b/src/content/homePage/partner/partner1.md
diff --git a/src/content/home/partner/partner2.md b/src/content/homePage/partner/partner2.md
index 493cdb5..493cdb5 100644
--- a/src/content/home/partner/partner2.md
+++ b/src/content/homePage/partner/partner2.md
diff --git a/src/content/home/partner/partner3.md b/src/content/homePage/partner/partner3.md
index 93eff18..93eff18 100644
--- a/src/content/home/partner/partner3.md
+++ b/src/content/homePage/partner/partner3.md
diff --git a/src/content/home/partner/partner4.md b/src/content/homePage/partner/partner4.md
index 46dea29..46dea29 100644
--- a/src/content/home/partner/partner4.md
+++ b/src/content/homePage/partner/partner4.md
diff --git a/src/content/home/purpose/purp1.md b/src/content/homePage/purpose/purp1.md
index b5afe43..b5afe43 100644
--- a/src/content/home/purpose/purp1.md
+++ b/src/content/homePage/purpose/purp1.md
diff --git a/src/content/home/purpose/purp2.md b/src/content/homePage/purpose/purp2.md
index a2e7974..a2e7974 100644
--- a/src/content/home/purpose/purp2.md
+++ b/src/content/homePage/purpose/purp2.md
diff --git a/src/content/home/significance/sig1.md b/src/content/homePage/significance/sig1.md
index b0d8427..44db8a6 100644
--- a/src/content/home/significance/sig1.md
+++ b/src/content/homePage/significance/sig1.md
@@ -10,8 +10,3 @@ point:
]
end: "Join us on this extraordinary journey, where innovation knows no bounds. Together, let's turn ideas into actions and make a lasting impact on society and the environment. The Open Source Hardware IoT GIS Hackathon is your stage to shine, and the world is waiting to witness your brilliance."
---
-
-- "Solve Real-World Problems: Tackle critical issues such as environmental sustainability, disaster management, precision agriculture, and more. Your solutions can change lives and protect our planet."
-- "Foster Innovation: Innovation thrives when knowledge is shared openly. By promoting open source hardware and IoT, we empower you to push the boundaries of creativity and discovery."
-- "Create Collaborative Communities: Through this hackathon, we build communities of like-minded individuals passionate about making a difference. Together, we can achieve more than any one of us can alone."
-- "Empower Future Leaders: Whether you're a student, a professional, or an enthusiast, this hackathon is a launchpad for your ideas. It's a chance to develop your skills, showcase your talents, and make your mark on the world."
diff --git a/src/content/navbar/nav1.md b/src/content/navbarRoute/nav1.md
index 7199b5d..7199b5d 100644
--- a/src/content/navbar/nav1.md
+++ b/src/content/navbarRoute/nav1.md
diff --git a/src/content/navbar/nav2.md b/src/content/navbarRoute/nav2.md
index 46d2ece..46d2ece 100644
--- a/src/content/navbar/nav2.md
+++ b/src/content/navbarRoute/nav2.md
diff --git a/src/content/navbar/nav3.md b/src/content/navbarRoute/nav3.md
index aca7e20..aca7e20 100644
--- a/src/content/navbar/nav3.md
+++ b/src/content/navbarRoute/nav3.md
diff --git a/src/content/navbar/nav4.md b/src/content/navbarRoute/nav4.md
index d9377ee..d9377ee 100644
--- a/src/content/navbar/nav4.md
+++ b/src/content/navbarRoute/nav4.md
diff --git a/src/content/navbar/nav5.md b/src/content/navbarRoute/nav5.md
index 4189027..4189027 100644
--- a/src/content/navbar/nav5.md
+++ b/src/content/navbarRoute/nav5.md
diff --git a/src/content/navbar/nav6.md b/src/content/navbarRoute/nav6.md
index bc4c362..bc4c362 100644
--- a/src/content/navbar/nav6.md
+++ b/src/content/navbarRoute/nav6.md
diff --git a/src/content/navbar/nav7.md b/src/content/navbarRoute/nav7.md
index dc381f7..dc381f7 100644
--- a/src/content/navbar/nav7.md
+++ b/src/content/navbarRoute/nav7.md
diff --git a/src/content/navbar/nav8.md b/src/content/navbarRoute/nav8.md
index 5107d3e..5107d3e 100644
--- a/src/content/navbar/nav8.md
+++ b/src/content/navbarRoute/nav8.md
diff --git a/src/content/navbar/nav9.md b/src/content/navbarRoute/nav9.md
index 6011217..6011217 100644
--- a/src/content/navbar/nav9.md
+++ b/src/content/navbarRoute/nav9.md
diff --git a/src/content/carousel/c1.md b/src/content/partnersCarouselLogo/c1.md
index c41d559..c41d559 100644
--- a/src/content/carousel/c1.md
+++ b/src/content/partnersCarouselLogo/c1.md
diff --git a/src/content/carousel/c2.md b/src/content/partnersCarouselLogo/c2.md
index d112c14..d112c14 100644
--- a/src/content/carousel/c2.md
+++ b/src/content/partnersCarouselLogo/c2.md
diff --git a/src/content/carousel/c3.md b/src/content/partnersCarouselLogo/c3.md
index 63bee1c..63bee1c 100644
--- a/src/content/carousel/c3.md
+++ b/src/content/partnersCarouselLogo/c3.md
diff --git a/src/content/carousel/c4.md b/src/content/partnersCarouselLogo/c4.md
index 8d841cb..8d841cb 100644
--- a/src/content/carousel/c4.md
+++ b/src/content/partnersCarouselLogo/c4.md
diff --git a/src/content/carousel/c5.md b/src/content/partnersCarouselLogo/c5.md
index 50941da..50941da 100644
--- a/src/content/carousel/c5.md
+++ b/src/content/partnersCarouselLogo/c5.md
diff --git a/src/content/carousel/c6.md b/src/content/partnersCarouselLogo/c6.md
index f5a2f4a..f5a2f4a 100644
--- a/src/content/carousel/c6.md
+++ b/src/content/partnersCarouselLogo/c6.md
diff --git a/src/content/carousel/c7.md b/src/content/partnersCarouselLogo/c7.md
index 1d686ac..1d686ac 100644
--- a/src/content/carousel/c7.md
+++ b/src/content/partnersCarouselLogo/c7.md
diff --git a/src/content/carousel/c8.md b/src/content/partnersCarouselLogo/c8.md
index b642ed7..b642ed7 100644
--- a/src/content/carousel/c8.md
+++ b/src/content/partnersCarouselLogo/c8.md
diff --git a/src/content/accordion/a1.md b/src/content/resourcesPage/a1.md
index b8d9a1d..b8d9a1d 100644
--- a/src/content/accordion/a1.md
+++ b/src/content/resourcesPage/a1.md
diff --git a/src/content/accordion/a2.md b/src/content/resourcesPage/a2.md
index 99bb55a..99bb55a 100644
--- a/src/content/accordion/a2.md
+++ b/src/content/resourcesPage/a2.md
diff --git a/src/content/accordion/a3.md b/src/content/resourcesPage/a3.md
index c94c930..c94c930 100644
--- a/src/content/accordion/a3.md
+++ b/src/content/resourcesPage/a3.md
diff --git a/src/content/accordion/a4.md b/src/content/resourcesPage/a4.md
index 70bc5fc..70bc5fc 100644
--- a/src/content/accordion/a4.md
+++ b/src/content/resourcesPage/a4.md
diff --git a/src/content/accordion/a5.md b/src/content/resourcesPage/a5.md
index 13d7277..13d7277 100644
--- a/src/content/accordion/a5.md
+++ b/src/content/resourcesPage/a5.md
diff --git a/src/content/accordion/a6.md b/src/content/resourcesPage/a6.md
index 43d2e47..43d2e47 100644
--- a/src/content/accordion/a6.md
+++ b/src/content/resourcesPage/a6.md
diff --git a/src/content/accordion/a7.md b/src/content/resourcesPage/a7.md
index fbead12..fbead12 100644
--- a/src/content/accordion/a7.md
+++ b/src/content/resourcesPage/a7.md
diff --git a/src/content/accordion/a8.md b/src/content/resourcesPage/a8.md
index 9d60b84..9d60b84 100644
--- a/src/content/accordion/a8.md
+++ b/src/content/resourcesPage/a8.md
diff --git a/src/content/schedule/s1.md b/src/content/scheduleEvent/s1.md
index b8ccbe1..b8ccbe1 100644
--- a/src/content/schedule/s1.md
+++ b/src/content/scheduleEvent/s1.md
diff --git a/src/content/schedule/s2.md b/src/content/scheduleEvent/s2.md
index c9d3359..c9d3359 100644
--- a/src/content/schedule/s2.md
+++ b/src/content/scheduleEvent/s2.md
diff --git a/src/content/schedule/s3.md b/src/content/scheduleEvent/s3.md
index e2deb0f..e2deb0f 100644
--- a/src/content/schedule/s3.md
+++ b/src/content/scheduleEvent/s3.md
diff --git a/src/content/schedule/s4.md b/src/content/scheduleEvent/s4.md
index bd6d2f3..bd6d2f3 100644
--- a/src/content/schedule/s4.md
+++ b/src/content/scheduleEvent/s4.md
diff --git a/src/content/schedule/s5.md b/src/content/scheduleEvent/s5.md
index f4418c5..f4418c5 100644
--- a/src/content/schedule/s5.md
+++ b/src/content/scheduleEvent/s5.md
diff --git a/src/content/topbar/top1.md b/src/content/topbarLogo/top1.md
index 0902ba0..0902ba0 100644
--- a/src/content/topbar/top1.md
+++ b/src/content/topbarLogo/top1.md
diff --git a/src/content/topbar/top2.md b/src/content/topbarLogo/top2.md
index 2192cf1..2192cf1 100644
--- a/src/content/topbar/top2.md
+++ b/src/content/topbarLogo/top2.md
diff --git a/src/content/topbar/top3.md b/src/content/topbarLogo/top3.md
index b4f0087..b4f0087 100644
--- a/src/content/topbar/top3.md
+++ b/src/content/topbarLogo/top3.md
diff --git a/src/content/topbar/top4.md b/src/content/topbarLogo/top4.md
index 46dd551..46dd551 100644
--- a/src/content/topbar/top4.md
+++ b/src/content/topbarLogo/top4.md
diff --git a/src/content/topbar/top5.md b/src/content/topbarLogo/top5.md
index 566f120..566f120 100644
--- a/src/content/topbar/top5.md
+++ b/src/content/topbarLogo/top5.md
diff --git a/src/content/topbar/top6.md b/src/content/topbarLogo/top6.md
index 8ff1e48..8ff1e48 100644
--- a/src/content/topbar/top6.md
+++ b/src/content/topbarLogo/top6.md
diff --git a/src/content/topbar/top7.md b/src/content/topbarLogo/top7.md
index cb6856c..cb6856c 100644
--- a/src/content/topbar/top7.md
+++ b/src/content/topbarLogo/top7.md
diff --git a/src/content/topbar/top8.md b/src/content/topbarLogo/top8.md
index f52976a..f52976a 100644
--- a/src/content/topbar/top8.md
+++ b/src/content/topbarLogo/top8.md
diff --git a/src/content/topbar/top9.md b/src/content/topbarLogo/top9.md
index 5eb9467..5eb9467 100644
--- a/src/content/topbar/top9.md
+++ b/src/content/topbarLogo/top9.md
diff --git a/src/lib/databaseUpdates.js b/src/lib/databaseUpdates.js
index 1c8bf79..e27b8d8 100644
--- a/src/lib/databaseUpdates.js
+++ b/src/lib/databaseUpdates.js
@@ -10,6 +10,8 @@ const userId = "p1pczcq94xsbdcj";
// Function to print all entries from the user table
function printAllUsers() {
+ //check for empty database
+
const users = db.prepare("SELECT * FROM user").all();
console.log("All Users:");
console.table(users);
diff --git a/src/lib/db.ts b/src/lib/db.ts
index 002c215..d1b870f 100644
--- a/src/lib/db.ts
+++ b/src/lib/db.ts
@@ -1,7 +1,7 @@
import sqlite from "better-sqlite3";
// import path from "path";
-const dbPath = "./mydatabase.db";
+const dbPath = "mydatabase.db";
export const db = sqlite(dbPath);
diff --git a/src/pages/admin.astro b/src/pages/admin.astro
index c3c5cee..eed0c75 100644
--- a/src/pages/admin.astro
+++ b/src/pages/admin.astro
@@ -4,35 +4,80 @@ import TopBar from '../components/TopBar.astro';
import Navbar from '../components/Navbar.astro';
import Footer from '../components/Footer.astro';
import IconBar from '../components/IconBar.astro';
-const user = Astro.locals.user;
-// console.log(user);
-if (!user) {
- // console.log("redirecting to login");
- return Astro.redirect("/login");
+import results from '../../public/results.json';
+import configFile from '../../config.json';
+
+// Check if sign out button should be shown
+var signOut = false;
+
+// Import your configuration file
+const config = configFile
+const resultDate = config.resultDate;
+
+// Calculate current time
+const currentDate = new Date();
+
+// Create target time
+const targetTime = new Date(resultDate.year, resultDate.month - 1, resultDate.day, resultDate.hours, resultDate.minutes, resultDate.seconds);
+
+console.log("Result date: ", targetTime);
+console.log("Current date: ", currentDate);
+
+// Check if current time is past target time
+if (currentDate < targetTime) {
+ signOut = true; // Show sign out button
+ const user = Astro.locals.user; // Check if user is logged in
+ if (!user) {
+ return Astro.redirect("/login"); // Redirect to login page if user is not logged in
+ }
}
-const username = user.username;
+const renderStatus = (status:boolean) => status ? "Shortlisted" : "Not Shortlisted";
+interface IResult {
+ name: string;
+ college: string;
+ projectIdea: string;
+ shortlisted: boolean;
+}
+
+// console.log(signOut);
+
---
<Layout title="Welcome to FOSSEE.">
- <main>
- <TopBar />
- <Navbar />
- <IconBar/>
- <div>
- <h1>Hi, {user.username}!</h1>
- <p>Your user ID is {user.id}.</p>
- <form method="post" action="/api/logout">
- <button>Sign out</button>
- </form>
+ <TopBar />
+ <Navbar />
+ <IconBar/>
+ <main class="pt-20 lg:pt-0">
+ <div class="container mx-auto p-6 min-h-screen">
+ <div class="flex justify-between mb-6">
+ <h1 class="text-3xl font-bold">Result Declarations</h1>
+ {signOut &&
+ <form method="post" action="/api/logout">
+ <button class="bg-red-600 text-white px-4 py-2 rounded hover:bg-red-700">Sign Out</button>
+ </form>
+ }
+ </div>
+ <div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
+ {results.map((result : IResult) => (
+ <div class="bg-white rounded-lg shadow-md p-6 grid gap-4">
+ <h2 class="text-2xl font-semibold">{result.name}</h2>
+ <div class="grid grid-cols-1 gap-2">
+ <p class="text-gray-700"><strong>College:</strong> {result.college}</p>
+ <p class="text-gray-700"><strong>Project Idea:</strong> {result.projectIdea}</p>
+ <p class={result.shortlisted ? "text-green-600 font-bold" : "text-red-600 font-bold"}>
+ <strong>Status:</strong> {renderStatus(result.shortlisted)}
+ </p>
+ </div>
+ </div>
+ ))}
+ </div>
</div>
<Footer/>
-
</main>
</Layout>
<style>
-
</style>
<script>
diff --git a/src/pages/login.astro b/src/pages/login.astro
index efe31a3..f57d6ca 100644
--- a/src/pages/login.astro
+++ b/src/pages/login.astro
@@ -2,8 +2,7 @@
const user = Astro.locals.user; // Fetch the user from session or locals
-if (user) {
-// console.log(user);
+if (user) { // If user is already logged in, redirect to admin page
return Astro.redirect("/admin");
}
import Layout from '../layouts/Layout.astro';
@@ -23,7 +22,3 @@ import LoginBody from '../components/LoginBody.astro';
<Footer/>
</main>
</Layout>
-
-<style>
-
-</style>
diff --git a/src/pages/results.astro b/src/pages/results.astro
index ed2b0d7..15b6c49 100644
--- a/src/pages/results.astro
+++ b/src/pages/results.astro
@@ -5,32 +5,34 @@ import Navbar from '../components/Navbar.astro';
import Footer from '../components/Footer.astro';
import ResultsBody from '../components/ResultsBody.astro';
import IconBar from '../components/IconBar.astro';
+import configFile from '../../config.json';
-const fruits = await Astro.glob('../content/fruits/*.md');
----
+// Import your configuration file
+const config = configFile
+const resultDate = config.resultDate;
-<Layout title="Welcome to FOSSEE.">
- <main>
- <TopBar />
- <Navbar />
- <IconBar/>
+// Calculate current time
+const currentDate = new Date();
- <!-- {fruits.map((fruit)=>{
- const Content = fruit.Content;
- const heading = fruit.frontmatter.heading;
- return (
- <div>
- <h1>{heading}</h1>
- <Content />
- </div>
- )
- })} -->
- <ResultsBody/>
- <Footer/>
+// Create target time
+const targetTime = new Date(resultDate.year, resultDate.month - 1, resultDate.day, resultDate.hours, resultDate.minutes, resultDate.seconds);
- </main>
-</Layout>
+console.log("Result date: ", targetTime);
+console.log("Current date: ", currentDate);
-<style>
+// Check if current time is past target time
+if (currentDate >= targetTime) {
+ // Redirect if condition met
+ return Astro.redirect('/admin');
+}
+---
-</style>
+<Layout title="Welcome to FOSSEE.">
+ <main>
+ <TopBar />
+ <Navbar />
+ <IconBar />
+ <ResultsBody />
+ <Footer />
+ </main>
+</Layout> \ No newline at end of file