feat: Enhance dashboard with stats cards and task filtering

- Added stats cards to display active, completed, overdue, and due-today tasks on the dashboard.
- Implemented search functionality to filter tasks in real-time based on user input.
- Introduced quick-pick date buttons for easier task date selection.
- Updated task rendering logic to handle empty states for task lists.
- Improved overall user interface with new CSS styles for stat cards and buttons.

chore: Update environment variables and backend error handling

- Fixed formatting in the .env file for consistency.
- Enhanced error handling in the backend API for better debugging.

feat: Revamp frontend pages with new features and pricing sections

- Redesigned the index.html page to include a hero section and feature highlights.
- Created a new features page with dynamic loading of features from JSON.
- Implemented a pricing page that loads plans from JSON and highlights the featured plan.
- Added support and FAQ sections with dynamic content loading and contact form functionality.
- Introduced JSON files for FAQs, features, and pricing to allow easy updates without code changes.
This commit is contained in:
Tim Basten
2026-04-23 16:29:52 +08:00
parent e50a6c91e6
commit 63070fd90c
15 changed files with 743 additions and 71 deletions

View File

@@ -1,3 +1,3 @@
PORT = 3001 PORT = 3001
MONGO_URI = "mongodb+srv://timmybee:EMqczsTr1oYPBt@cluster0.dombm2a.mongodb.net/?appName=Cluster0" MONGO_URI = "mongodb+srv://timmybee:EMqczsTr1oYPBt@cluster0.dombm2a.mongodb.net/?appName=Cluster0"
APP_URI = "http://localhost:3001" APP_URI = "http://localhost:3001"

View File

@@ -64,7 +64,7 @@ app.get('/api/tasks', async (req, res) => {
console.error("Error:", error); console.error("Error:", error);
res.status(500).json({ message: "Error grabbing tasks!" }); res.status(500).json({ message: "Error grabbing tasks!" });
} }
}); });
@@ -84,7 +84,7 @@ app.post('/api/tasks/todo', async (req, res) => {
}); });
// To 'complete' the task and move columns ↓ // To 'complete' the task and move columns ↓
app.patch('/api/tasks/complete/:id', async (req, res) => { app.patch('/api/tasks/complete/:id', async (req, res) => {
try { try {
@@ -110,7 +110,7 @@ app.patch('/api/tasks/complete/:id', async (req, res) => {
app.patch('/api/tasks/notComplete/:id', async (req, res) => { app.patch('/api/tasks/notComplete/:id', async (req, res) => {
try { try {
const { completed } = req.body; const { completed } = req.body;
const taskId = req.params.id; const taskId = req.params.id;
const taskNotComplete = await Task.findByIdAndUpdate(taskId, { completed }, { new: true }); const taskNotComplete = await Task.findByIdAndUpdate(taskId, { completed }, { new: true });

View File

@@ -51,7 +51,9 @@ footer {
color: var(--fg); color: var(--fg);
} }
.nav-link:hover { .nav-link:hover,
.navbar-nav .nav-link.active,
.navbar-nav .nav-link.show {
color: var(--accent); color: var(--accent);
} }
@@ -97,3 +99,29 @@ form a:hover {
textarea { textarea {
resize: none; resize: none;
} }
.stat-card {
background-color: rgba(40, 40, 40, 0.6);
border-radius: 0.5rem;
padding: 1rem;
text-align: center;
color: var(--fg);
}
.stat-card .stat-value {
font-size: 2rem;
font-weight: 700;
line-height: 1;
color: var(--accent);
}
.stat-card .stat-label {
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
opacity: 0.7;
}
.quick-date-btn {
font-size: 0.85rem;
}

View File

@@ -51,31 +51,72 @@
<div class="rounded shadow bg-translucent p-3 p-lg-5 col-12"> <div class="rounded shadow bg-translucent p-3 p-lg-5 col-12">
<form id="taskForm" class="mb-5 text-white"> <form id="taskForm" class="mb-5 text-white">
<h1 id="greeting" class="mb-5 display-3">Your Dashboard</h1> <h1 id="greeting" class="mb-5 display-3">Your Dashboard</h1>
<!-- Stats cards: populated by updateStats() in api.js. -->
<div class="row g-3 mb-5">
<div class="col-6 col-md-3">
<div class="stat-card">
<div id="statActive" class="stat-value">0</div>
<div class="stat-label">Active</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="stat-card">
<div id="statCompleted" class="stat-value">0</div>
<div class="stat-label">Completed</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="stat-card">
<div id="statOverdue" class="stat-value">0</div>
<div class="stat-label">Overdue</div>
</div>
</div>
<div class="col-6 col-md-3">
<div class="stat-card">
<div id="statDueToday" class="stat-value">0</div>
<div class="stat-label">Due Today</div>
</div>
</div>
</div>
<h2 class="mb-3">New Task</h2> <h2 class="mb-3">New Task</h2>
<input id="taskName" name="taskName" placeholder="Task Name" class="mb-2 form-control shadow-sm" type="text" <input id="taskName" name="taskName" placeholder="Task Name" class="mb-2 form-control shadow-sm" type="text"
required /> required />
<textarea id="taskDescription" name="taskDescription" placeholder="Task Description" <textarea id="taskDescription" name="taskDescription" placeholder="Task Description"
class="mb-2 form-control shadow-sm" rows="8" required></textarea> class="mb-2 form-control shadow-sm" rows="8" required></textarea>
<input id="dueDate" name="dueDate" type="date" class="mb-3 form-control shadow-sm" required <input id="dueDate" name="dueDate" type="date" class="mb-2 form-control shadow-sm" required
placeholder="Due Date" /> placeholder="Due Date" />
<!-- Quick-pick date buttons: handler in api.js writes the
chosen date into the #dueDate field above. -->
<div class="d-flex gap-2 flex-wrap mb-3">
<button type="button" class="btn btn-outline-light quick-date-btn" data-quick="today">Today</button>
<button type="button" class="btn btn-outline-light quick-date-btn" data-quick="tomorrow">Tomorrow</button>
<button type="button" class="btn btn-outline-light quick-date-btn" data-quick="nextWeek">Next week</button>
</div>
<button type="submit" class="btn btn-primary shadow-sm px-5"> <button type="submit" class="btn btn-primary shadow-sm px-5">
Create Task Create Task
</button> </button>
<div class="d-flex align-items-center gap-3 my-5"> <div class="d-flex align-items-center gap-3 flex-wrap mt-5 mb-3">
<label for="sortSelect" class="text-white">Sort by:</label> <label for="sortSelect" class="text-white mb-0">Sort by:</label>
<select name="sortSelect" id="sortSelect" class="form-select w-auto shadow-none"> <select name="sortSelect" id="sortSelect" class="form-select w-auto shadow-none">
<option value="default" selected>Default</option> <option value="default" selected>Default</option>
<option value="dueDate">Due Date</option> <option value="dueDate">Due Date</option>
<option value="dateCreate">Date Created</option> <option value="dateCreate">Date Created</option>
</select> </select>
<!-- Search: filters the lists below live via api.js (no API call). -->
<input id="searchInput" type="search" placeholder="Search tasks..."
class="form-control shadow-sm flex-grow-1" style="max-width: 320px;" />
</div> </div>
<div class="row text-white"> <div class="row text-white">
<div class="col-12 col-lg-6 mb-4 mb-lg-0"> <div class="col-12 col-lg-6 mb-4 mb-lg-0">
<h2>To Do</h2> <h2>To Do</h2>
<p id="toDoEmpty" class="text-white-50 d-none">No matching tasks.</p>
<ul id="toDoList" class="list-group"></ul> <ul id="toDoList" class="list-group"></ul>
</div> </div>
<div class="col-12 col-lg-6"> <div class="col-12 col-lg-6">
<h2>Completed</h2> <h2>Completed</h2>
<p id="completedEmpty" class="text-white-50 d-none">No matching tasks.</p>
<ul id="completedList" class="list-group"></ul> <ul id="completedList" class="list-group"></ul>
</div> </div>
</div> </div>

28
frontend/data/faq.json Normal file
View File

@@ -0,0 +1,28 @@
{
"faqs": [
{
"question": "Is BucketLisk free to use?",
"answer": "Yes, the Free plan lets you create up to 25 tasks across 1 list, forever. Upgrade to Pro or Team for unlimited lists, reminders and shared team features."
},
{
"question": "Where is my data stored?",
"answer": "Tasks are stored in a MongoDB database. Your data is only accessible via authenticated API requests, and all traffic is sent over HTTPS."
},
{
"question": "Can I access my tasks on mobile?",
"answer": "The web app is fully responsive and works on phones, tablets and desktops. A native mobile app is on the roadmap."
},
{
"question": "How do I reset my password?",
"answer": "Click the 'Forgot Password?' link on the login page and follow the instructions sent to your email."
},
{
"question": "Can I export my data?",
"answer": "Yes. From your dashboard settings you can export all your tasks as a JSON file at any time."
},
{
"question": "Do you support team collaboration?",
"answer": "Team plans include shared lists, role-based permissions, and integrations with Slack, Salesforce and Asana."
}
]
}

View File

@@ -0,0 +1,34 @@
{
"features": [
{
"icon": "./images/CreateNew.png",
"title": "Create tasks in seconds",
"description": "Add a title, description and due date. Your task is saved and sorted instantly."
},
{
"icon": "./images/Tick.svg",
"title": "Mark as done (or undo)",
"description": "One click to complete a task, one click to move it back if you change your mind."
},
{
"icon": "./images/Tasks-Screenshot (1).png",
"title": "Two-column layout",
"description": "Your active tasks and completed tasks live side-by-side, so you always know what's left."
},
{
"icon": "./images/Email.svg",
"title": "Flexible sorting",
"description": "Sort by due date, created date, or default order. Indexed on the backend for speed."
},
{
"icon": "./images/Cross.svg",
"title": "Edit or delete anytime",
"description": "Made a mistake? Update any field or remove the task entirely with a single click."
},
{
"icon": "./images/Slack.png",
"title": "Integrations (coming soon)",
"description": "Slack, Salesforce and Asana integrations are in the works for the Team plan."
}
]
}

View File

@@ -0,0 +1,50 @@
{
"plans": [
{
"name": "Free",
"price": 0,
"period": "forever",
"tagline": "Get started with the basics.",
"features": [
"Up to 25 active tasks",
"1 list / project",
"Basic sort (due date, created)",
"Community support"
],
"cta": "Start for free",
"href": "./signup.html",
"featured": false
},
{
"name": "Pro",
"price": 8,
"period": "per user / month",
"tagline": "For individuals who want more power.",
"features": [
"Unlimited tasks & lists",
"Task reminders & due-date alerts",
"Advanced sorting & filtering",
"Priority email support"
],
"cta": "Upgrade to Pro",
"href": "./signup.html",
"featured": true
},
{
"name": "Team",
"price": 15,
"period": "per user / month",
"tagline": "For teams that ship together.",
"features": [
"Everything in Pro",
"Shared team lists",
"Role-based permissions",
"Integrations (Slack, Salesforce, Asana)",
"Dedicated support"
],
"cta": "Start Team trial",
"href": "./signup.html",
"featured": false
}
]
}

View File

@@ -45,21 +45,23 @@
</div> </div>
</nav> </nav>
<!-- ↓ Page not ready ↓ --> <section class="bg-img py-5">
<section class="bg-img d-flex justify-content-center align-items-center support py-5"> <div class="container py-5">
<div class="container text-center text-white py-5"> <div class="text-center text-white mb-5">
<img src="./images/Construction.svg" alt="Under Construction" height="150px" width="auto" /> <h1 class="display-3">Everything you need to stay on top</h1>
<p class="lead text-white-50">A focused set of features designed to get out of your way.</p>
</div>
<h2 class="mt-5">Page under construction. Check back later!</h2> <div class="row" id="featuresContainer">
<div class="col-12 text-center text-white-50">Loading features…</div>
</div>
<div class="mt-5"> <div class="text-center mt-4">
<a href="./index.html" class="btn btn-primary px-4">Go Home</a> <a href="./dashboard.html" class="btn btn-primary btn-lg px-5">Try the dashboard</a>
</div> </div>
</div> </div>
</section> </section>
<!-- ↑ Page not ready ↑ -->
<!-- ↓ Footer ↓ -->
<footer> <footer>
<div class="py-5 container"> <div class="py-5 container">
<div class="d-flex justify-content-between flex-column gap-5 gap-md-0 flex-md-row align-items-center px-3 mb-5"> <div class="d-flex justify-content-between flex-column gap-5 gap-md-0 flex-md-row align-items-center px-3 mb-5">
@@ -90,6 +92,7 @@
</div> </div>
</footer> </footer>
<script src="./js/features.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>

View File

@@ -45,16 +45,141 @@
</div> </div>
</nav> </nav>
<!-- ↓ Page not ready ↓ --> <main>
<main class="d-flex justify-content-center flex-column align-items-center bg-img"> <!-- Hero -->
<h1 class="display-2 text-center text-white"> <section class="d-flex justify-content-center flex-column align-items-center bg-img text-center px-3">
Stay organised with BucketLisk <h1 class="display-2 text-white">Stay organised with BucketLisk</h1>
</h1> <p class="lead text-white-50 col-12 col-md-8 col-lg-6 mt-3">
<div class="d-flex justify-content-center align-items-center mt-5"> The simple, no-nonsense to-do app that keeps your team on track, from morning stand-up to end-of-quarter shipping.
<a href="./dashboard.html" class="btn btn-primary btn-lg px-5">Try it for free</a> </p>
</div> <div class="d-flex justify-content-center align-items-center gap-3 mt-4 flex-wrap">
<a href="./dashboard.html" class="btn btn-primary btn-lg px-5">Try it for free</a>
<a href="./features.html" class="btn btn-outline-light btn-lg px-5">See features</a>
</div>
</section>
<!-- Feature highlights -->
<section class="py-5">
<div class="container py-5">
<div class="text-center text-white mb-5">
<h2 class="display-5">Why BucketLisk?</h2>
<p class="text-white-50">Everything you need. Nothing you don't.</p>
</div>
<div class="row g-4">
<div class="col-12 col-md-4">
<div class="rounded shadow bg-translucent p-4 h-100 text-white text-center">
<img src="./images/CreateNew.png" alt="" height="56" class="mb-3">
<h3 class="h5">Capture fast</h3>
<p class="text-white-50 mb-0">Jot down a task in seconds: title, details, due date. Done.</p>
</div>
</div>
<div class="col-12 col-md-4">
<div class="rounded shadow bg-translucent p-4 h-100 text-white text-center">
<img src="./images/Tick.svg" alt="" height="56" class="mb-3">
<h3 class="h5">Stay focused</h3>
<p class="text-white-50 mb-0">Two clean columns: active and completed. Always know what's next.</p>
</div>
</div>
<div class="col-12 col-md-4">
<div class="rounded shadow bg-translucent p-4 h-100 text-white text-center">
<img src="./images/Contact.svg" alt="" height="56" class="mb-3">
<h3 class="h5">Share with your team</h3>
<p class="text-white-50 mb-0">Shared lists and role-based permissions on the Team plan.</p>
</div>
</div>
</div>
</div>
</section>
<!-- Preview -->
<section class="py-5">
<div class="container py-5">
<div class="row align-items-center g-5">
<div class="col-12 col-lg-6 text-white">
<h2 class="display-5 mb-3">Built for the way you actually work</h2>
<p class="text-white-50 mb-4">
No cluttered dashboards, no 30-step onboarding. Open it, add a task, get on with your day.
When you're done, tick it off and move it to the completed column to keep the momentum going.
</p>
<ul class="list-unstyled">
<li class="mb-2"><img src="./images/Tick.svg" alt="" width="18" class="me-2">Sort by due date or created date</li>
<li class="mb-2"><img src="./images/Tick.svg" alt="" width="18" class="me-2">Edit any task inline</li>
<li class="mb-2"><img src="./images/Tick.svg" alt="" width="18" class="me-2">Works on desktop, tablet and mobile</li>
</ul>
<a href="./dashboard.html" class="btn btn-primary px-4 mt-3">Open the dashboard</a>
</div>
<div class="col-12 col-lg-6">
<img src="./images/Tasks-Screenshot (1).png" alt="BucketLisk dashboard preview"
class="img-fluid rounded shadow">
</div>
</div>
</div>
</section>
<!-- How it works -->
<section class="py-5">
<div class="container py-5">
<div class="text-center text-white mb-5">
<h2 class="display-5">Get started in 3 steps</h2>
</div>
<div class="row g-4 text-white">
<div class="col-12 col-md-4 text-center">
<div class="display-4 text-primary mb-2">1</div>
<h3 class="h5">Create a free account</h3>
<p class="text-white-50">Sign up in under 30 seconds. No credit card required.</p>
</div>
<div class="col-12 col-md-4 text-center">
<div class="display-4 text-primary mb-2">2</div>
<h3 class="h5">Add your tasks</h3>
<p class="text-white-50">Brain-dump everything on your plate. Set due dates so nothing slips.</p>
</div>
<div class="col-12 col-md-4 text-center">
<div class="display-4 text-primary mb-2">3</div>
<h3 class="h5">Tick them off</h3>
<p class="text-white-50">Watch your list shrink. Celebrate the small wins.</p>
</div>
</div>
</div>
</section>
<!-- Integrations -->
<section class="py-5">
<div class="container py-5 text-center">
<h2 class="display-5 text-white mb-3">Plays nicely with the tools you already use</h2>
<p class="text-white-50 mb-5">Integrations available on the Team plan.</p>
<div class="d-flex justify-content-center align-items-center gap-5 flex-wrap">
<img src="./images/Slack.png" alt="Slack" height="60">
<img src="./images/Asana.png" alt="Asana" height="60">
<img src="./images/Salesforce.png" alt="Salesforce" height="60">
</div>
</div>
</section>
<!-- Testimonial -->
<section class="py-5">
<div class="container py-5">
<div class="rounded shadow bg-translucent p-4 p-lg-5 col-12 col-lg-8 mx-auto text-white text-center">
<p class="fs-4 fst-italic mb-4">
"We switched our whole team over in a week. Everyone actually uses it, and that's the first time I've ever said that about a task tool."
</p>
<p class="mb-0"><strong>Jamie L.</strong></p>
<p class="text-white-50 mb-0">Operations Lead, Greenfield Studio</p>
</div>
</div>
</section>
<!-- Bottom CTA -->
<section class="py-5">
<div class="container py-5 text-center">
<h2 class="display-4 text-white mb-3">Ready to get organised?</h2>
<p class="lead text-white-50 mb-4">Free forever for solo users. Upgrade any time.</p>
<div class="d-flex justify-content-center align-items-center gap-3 flex-wrap">
<a href="./signup.html" class="btn btn-primary btn-lg px-5">Sign up free</a>
<a href="./pricing.html" class="btn btn-outline-light btn-lg px-5">View pricing</a>
</div>
</div>
</section>
</main> </main>
<!-- ↑ Page not ready ↑ -->
<!-- ↓ Footer ↓ --> <!-- ↓ Footer ↓ -->
<footer> <footer>

View File

@@ -1,8 +1,43 @@
/**
* api.js
*
* Powers the Dashboard page. Talks to the Express / Mongoose backend
* at http://localhost:3001 to create, read, update and delete tasks.
*
* Core CRUD (original):
* - displayTasks() GET /api/tasks
* - createNewTask() POST /api/tasks/todo
* - completeTask() PATCH /api/tasks/complete/:id
* - taskNotCompleted() PATCH /api/tasks/notComplete/:id
* - deleteTask() DELETE /api/tasks/delete/:id
* - editTask() PUT /api/tasks/update/:id
*
* Added interactivity:
* - Stats cards: renders live counts of Active, Completed, Overdue
* and Due-Today tasks (see updateStats()).
* - Search filter: an input box filters the rendered task lists by
* title/description on every keystroke, without re-hitting the
* API (see renderTasks()).
* - Quick-pick date buttons: "Today", "Tomorrow" and "Next week"
* populate the due-date field of the new-task form.
*
* The in-memory `allTasks` array holds the latest fetched list so
* search filtering can be recomputed purely on the client side.
*/
const taskForm = document.getElementById('taskForm'); const taskForm = document.getElementById('taskForm');
const toDoList = document.getElementById('toDoList'); const toDoList = document.getElementById('toDoList');
const completedList = document.getElementById('completedList'); const completedList = document.getElementById('completedList');
const toDoEmpty = document.getElementById('toDoEmpty');
const completedEmpty = document.getElementById('completedEmpty');
const searchInput = document.getElementById('searchInput');
const dueDateInput = document.getElementById('dueDate');
const url = "http://localhost:3001"; const url = "http://localhost:3001";
// Cache of the most recent /api/tasks response so the search filter
// can re-render instantly without refetching.
let allTasks = [];
function resetForm() { function resetForm() {
taskForm.reset(); taskForm.reset();
} }
@@ -15,6 +50,26 @@ sortButton.addEventListener('change', () => {
displayTasks(); displayTasks();
}); });
// Search filter: re-renders the two lists on every keystroke using
// the cached `allTasks` array. No API round-trip required.
if (searchInput) {
searchInput.addEventListener('input', () => {
renderTasks();
});
}
// Quick-pick date buttons: set the due-date input to today, tomorrow
// or a week from now. Saves the user from having to open the date
// picker for the most common options.
document.querySelectorAll('.quick-date-btn').forEach(btn => {
btn.addEventListener('click', () => {
const offsetDays = { today: 0, tomorrow: 1, nextWeek: 7 }[btn.dataset.quick] ?? 0;
const date = new Date();
date.setDate(date.getDate() + offsetDays);
dueDateInput.value = date.toISOString().split('T')[0];
});
});
window.addEventListener("DOMContentLoaded", () => { window.addEventListener("DOMContentLoaded", () => {
displayTasks(); displayTasks();
}); });
@@ -77,47 +132,120 @@ async function displayTasks() {
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to get tasks: ${response.status}`); throw new Error(`Failed to get tasks: ${response.status}`);
} }
const data = await response.json(); allTasks = await response.json();
updateStats(allTasks);
function formatTask(task) { renderTasks();
const li = document.createElement("li");
li.classList.add("card", "p-3", "shadow-sm", "mt-2");
const done = task.completed ? "text-decoration-line-through opacity-50" : "";
li.innerHTML = `
<div class="d-flex justify-content-between align-items-start">
<h4 class="${done} col-11">${task.title}</h4>
<button data-id="${task._id}" type="button" class="btn-close delete" aria-label="Close"></button>
</div>
<p class="${done}">${task.description}</p>
<p class="${done}"><strong>Due: </strong>${new Date(task.dueDate).toLocaleDateString()}</p>
<div class="d-flex justify-content-between align-items-end">
<div>
${task.completed ?
`<button data-id="${task._id}" class="btn btn-primary shadow-sm notDone" type="button">Not done</button>`
:
`
<button data-bs-toggle="modal" data-bs-target="#editModal" data-title="${task.title}" data-description="${task.description}" data-due-date="${task.dueDate}" data-id="${task._id}" class="btn btn-primary shadow-sm edit" type="button">Edit</button>
<button data-id="${task._id}" class="btn btn-primary shadow-sm done" type="button">Done</button>
`
}
</div>
<p class="m-0 ${done}"><strong>Created on: </strong>${new Date(task.dateCreated).toLocaleDateString()}</p>
</div>
`;
return li;
}
toDoList.innerHTML = "";
completedList.innerHTML = "";
const tasks = data;
tasks.forEach(task => {
const formattedTask = formatTask(task);
task.completed ? completedList.appendChild(formattedTask) : toDoList.appendChild(formattedTask);
});
resetForm(); resetForm();
} catch (error) { } catch (error) {
console.error("Error: ", error); console.error("Error: ", error);
} }
} }
function formatTask(task) {
const li = document.createElement("li");
li.classList.add("card", "p-3", "shadow-sm", "mt-2");
const done = task.completed ? "text-decoration-line-through opacity-50" : "";
li.innerHTML = `
<div class="d-flex justify-content-between align-items-start">
<h4 class="${done} col-11">${task.title}</h4>
<button data-id="${task._id}" type="button" class="btn-close delete" aria-label="Close"></button>
</div>
<p class="${done}">${task.description}</p>
<p class="${done}"><strong>Due: </strong>${new Date(task.dueDate).toLocaleDateString()}</p>
<div class="d-flex justify-content-between align-items-end">
<div>
${task.completed ?
`<button data-id="${task._id}" class="btn btn-primary shadow-sm notDone" type="button">Not done</button>`
:
`
<button data-bs-toggle="modal" data-bs-target="#editModal" data-title="${task.title}" data-description="${task.description}" data-due-date="${task.dueDate}" data-id="${task._id}" class="btn btn-primary shadow-sm edit" type="button">Edit</button>
<button data-id="${task._id}" class="btn btn-primary shadow-sm done" type="button">Done</button>
`
}
</div>
<p class="m-0 ${done}"><strong>Created on: </strong>${new Date(task.dateCreated).toLocaleDateString()}</p>
</div>
`;
return li;
}
/**
* Render the cached task list into the To-Do and Completed columns.
* Applies the current search term (if any) as a case-insensitive
* match on title or description, and toggles per-column empty-state
* messages when nothing matches.
*/
function renderTasks() {
const term = (searchInput?.value || '').trim().toLowerCase();
const filtered = term
? allTasks.filter(t =>
t.title.toLowerCase().includes(term) ||
t.description.toLowerCase().includes(term))
: allTasks;
toDoList.innerHTML = '';
completedList.innerHTML = '';
let activeCount = 0;
let completedCount = 0;
filtered.forEach(task => {
const node = formatTask(task);
if (task.completed) {
completedList.appendChild(node);
completedCount += 1;
} else {
toDoList.appendChild(node);
activeCount += 1;
}
});
toDoEmpty?.classList.toggle('d-none', activeCount > 0);
completedEmpty?.classList.toggle('d-none', completedCount > 0);
}
/**
* Recompute and display the four dashboard stat cards.
*
* Active - tasks that are not yet completed
* Completed - tasks marked done
* Overdue - active tasks whose due date is before today
* Due Today - active tasks whose due date is today
*
* Dates are normalised to midnight so the comparison ignores time
* of day.
*/
function updateStats(tasks) {
const today = new Date();
today.setHours(0, 0, 0, 0);
let active = 0, completed = 0, overdue = 0, dueToday = 0;
tasks.forEach(task => {
const due = new Date(task.dueDate);
due.setHours(0, 0, 0, 0);
if (task.completed) {
completed += 1;
} else {
active += 1;
if (due.getTime() < today.getTime()) {
overdue += 1;
} else if (due.getTime() === today.getTime()) {
dueToday += 1;
}
}
});
const set = (id, value) => {
const el = document.getElementById(id);
if (el) el.textContent = value;
};
set('statActive', active);
set('statCompleted', completed);
set('statOverdue', overdue);
set('statDueToday', dueToday);
}
async function createNewTask() { async function createNewTask() {
const taskDetails = { const taskDetails = {

48
frontend/js/features.js Normal file
View File

@@ -0,0 +1,48 @@
/**
* features.js
*
* Powers the Features page.
*
* Features:
* - Loads the feature list from `./data/features.json` via fetch().
* - Dynamically renders each feature as a Bootstrap card (icon,
* title, description) inside the #featuresContainer grid.
* - Shows an error message if the JSON file cannot be loaded.
*
* The feature list lives in JSON so that marketing can add, remove
* or reorder features without the page template changing.
*/
const featuresContainer = document.getElementById('featuresContainer');
async function loadFeatures() {
try {
const response = await fetch('./data/features.json');
if (!response.ok) {
throw new Error(`Failed to load features: ${response.status}`);
}
const data = await response.json();
renderFeatures(data.features);
} catch (error) {
console.error('Error:', error);
featuresContainer.innerHTML = `<p class="text-white text-center">Unable to load features.</p>`;
}
}
function renderFeatures(features) {
featuresContainer.innerHTML = '';
features.forEach(f => {
const col = document.createElement('div');
col.className = 'col-12 col-md-6 col-lg-4 mb-4';
col.innerHTML = `
<div class="rounded shadow bg-translucent p-4 h-100 text-white">
<img src="${f.icon}" alt="" height="48" width="auto" class="mb-3">
<h3 class="h5">${f.title}</h3>
<p class="text-white-50 mb-0">${f.description}</p>
</div>
`;
featuresContainer.appendChild(col);
});
}
window.addEventListener('DOMContentLoaded', loadFeatures);

67
frontend/js/pricing.js Normal file
View File

@@ -0,0 +1,67 @@
/**
* pricing.js
*
* Powers the Pricing page.
*
* Features:
* - Loads the three plan definitions from `./data/pricing.json`
* asynchronously via fetch().
* - Dynamically renders one card per plan, highlighting the
* "featured" plan with a coloured border and a "Most popular"
* badge.
* - Shows a graceful error message if the JSON file cannot be
* loaded.
*
* Keeping plan data in a separate JSON file means marketing copy and
* prices can be updated without touching the page markup.
*/
const pricingContainer = document.getElementById('pricingContainer');
async function loadPricing() {
try {
const response = await fetch('./data/pricing.json');
if (!response.ok) {
throw new Error(`Failed to load pricing: ${response.status}`);
}
const data = await response.json();
renderPlans(data.plans);
} catch (error) {
console.error('Error:', error);
pricingContainer.innerHTML = `<p class="text-white text-center">Unable to load pricing. Please try again later.</p>`;
}
}
function renderPlans(plans) {
pricingContainer.innerHTML = '';
plans.forEach(plan => {
const col = document.createElement('div');
col.className = 'col-12 col-md-4 mb-4';
const featuresHtml = plan.features
.map(f => `<li class="mb-2"><img src="./images/Tick.svg" alt="" width="18" class="me-2">${f}</li>`)
.join('');
const highlight = plan.featured ? 'pinkBorder' : '';
const badge = plan.featured
? '<span class="badge bg-primary mb-2">Most popular</span>'
: '';
col.innerHTML = `
<div class="rounded shadow bg-translucent p-4 h-100 d-flex flex-column ${highlight}">
${badge}
<h3 class="text-white">${plan.name}</h3>
<p class="text-white-50">${plan.tagline}</p>
<div class="mb-3">
<span class="display-4 text-white">$${plan.price}</span>
<span class="text-white-50 ms-2">${plan.period}</span>
</div>
<ul class="list-unstyled text-white flex-grow-1">${featuresHtml}</ul>
<a href="${plan.href}" class="btn btn-primary mt-3">${plan.cta}</a>
</div>
`;
pricingContainer.appendChild(col);
});
}
window.addEventListener('DOMContentLoaded', loadPricing);

78
frontend/js/support.js Normal file
View File

@@ -0,0 +1,78 @@
/**
* support.js
*
* Powers the Support page.
*
* Features:
* 1. FAQ accordion
* - Loads Q&A pairs from `./data/faq.json`.
* - Renders each as a Bootstrap accordion item so only one
* answer is open at a time.
*
* 2. Contact form
* - Validates that all fields have been filled in.
* - Displays an inline success or error alert above the form.
* - Does not currently persist messages; the form is purely a
* frontend demonstration (see README / features notes).
*/
const faqContainer = document.getElementById('faqContainer');
const contactForm = document.getElementById('contactForm');
const contactStatus = document.getElementById('contactStatus');
async function loadFaqs() {
try {
const response = await fetch('./data/faq.json');
if (!response.ok) {
throw new Error(`Failed to load FAQs: ${response.status}`);
}
const data = await response.json();
renderFaqs(data.faqs);
} catch (error) {
console.error('Error:', error);
faqContainer.innerHTML = `<p class="text-white text-center">Unable to load FAQs.</p>`;
}
}
function renderFaqs(faqs) {
faqContainer.innerHTML = '';
faqs.forEach((faq, i) => {
const item = document.createElement('div');
item.className = 'accordion-item';
item.innerHTML = `
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#faq-${i}" aria-expanded="false" aria-controls="faq-${i}">
${faq.question}
</button>
</h2>
<div id="faq-${i}" class="accordion-collapse collapse" data-bs-parent="#faqContainer">
<div class="accordion-body">${faq.answer}</div>
</div>
`;
faqContainer.appendChild(item);
});
}
contactForm.addEventListener('submit', (event) => {
event.preventDefault();
const name = contactForm.name.value.trim();
const email = contactForm.email.value.trim();
const message = contactForm.message.value.trim();
if (!name || !email || !message) {
showStatus('Please fill out all fields.', 'danger');
return;
}
showStatus('Thanks, your message has been received. We will get back to you shortly.', 'success');
contactForm.reset();
});
function showStatus(message, type) {
contactStatus.className = `alert alert-${type}`;
contactStatus.textContent = message;
contactStatus.classList.remove('d-none');
}
window.addEventListener('DOMContentLoaded', loadFaqs);

View File

@@ -45,6 +45,19 @@
</div> </div>
</nav> </nav>
<section class="bg-img py-5">
<div class="container py-5">
<div class="text-center text-white mb-5">
<h1 class="display-3">Simple, honest pricing</h1>
<p class="lead text-white-50">Pick the plan that fits. Upgrade, downgrade or cancel any time.</p>
</div>
<div class="row" id="pricingContainer">
<div class="col-12 text-center text-white-50">Loading plans…</div>
</div>
</div>
</section>
<footer> <footer>
<div class="py-5 container"> <div class="py-5 container">
<div class="d-flex justify-content-between flex-column gap-5 gap-md-0 flex-md-row align-items-center px-3 mb-5"> <div class="d-flex justify-content-between flex-column gap-5 gap-md-0 flex-md-row align-items-center px-3 mb-5">
@@ -75,6 +88,7 @@
</div> </div>
</footer> </footer>
<script src="./js/pricing.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>

View File

@@ -45,21 +45,48 @@
</div> </div>
</nav> </nav>
<!-- ↓ Page not ready ↓ --> <section class="bg-img py-5">
<section class="bg-img d-flex justify-content-center align-items-center support py-5"> <div class="container py-5">
<div class="container text-center text-white py-5"> <div class="text-center text-white mb-5">
<img src="./images/Construction.svg" alt="Under Construction" height="150px" width="auto" /> <h1 class="display-3">How can we help?</h1>
<p class="lead text-white-50">Check the FAQ below, or send us a message directly.</p>
</div>
<h2 class="mt-5">Page under construction. Check back later!</h2> <div class="row g-4">
<div class="col-12 col-lg-6">
<div class="rounded shadow bg-translucent p-4 text-white h-100">
<h2 class="h4 mb-4">Frequently asked questions</h2>
<div class="accordion" id="faqContainer">
<p class="text-white-50">Loading FAQs…</p>
</div>
</div>
</div>
<div class="mt-5"> <div class="col-12 col-lg-6">
<a href="./index.html" class="btn btn-primary px-4">Go Home</a> <div class="rounded shadow bg-translucent p-4 text-white h-100">
<h2 class="h4 mb-4">Contact us</h2>
<div id="contactStatus" class="alert d-none" role="alert"></div>
<form id="contactForm">
<input name="name" type="text" class="form-control mb-3 shadow-sm" placeholder="Your name" required>
<input name="email" type="email" class="form-control mb-3 shadow-sm" placeholder="Your email" required>
<textarea name="message" rows="5" class="form-control mb-3 shadow-sm" placeholder="How can we help?" required></textarea>
<button type="submit" class="btn btn-primary px-4">Send message</button>
</form>
<hr class="border-light my-4">
<div class="d-flex align-items-center mb-2">
<img src="./images/Email.svg" alt="" height="20" class="me-2">
<span>support@bucketlisk.example</span>
</div>
<div class="d-flex align-items-center">
<img src="./images/Phone.svg" alt="" height="20" class="me-2">
<span>+61 8 0000 0000</span>
</div>
</div>
</div>
</div> </div>
</div> </div>
</section> </section>
<!-- ↑ Page not ready ↑ -->
<!-- ↓ Footer ↓ -->
<footer> <footer>
<div class="py-5 container"> <div class="py-5 container">
<div class="d-flex justify-content-between flex-column gap-5 gap-md-0 flex-md-row align-items-center px-3 mb-5"> <div class="d-flex justify-content-between flex-column gap-5 gap-md-0 flex-md-row align-items-center px-3 mb-5">
@@ -90,6 +117,7 @@
</div> </div>
</footer> </footer>
<script src="./js/support.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>