diff --git a/README.md b/README.md
index 4390707..261e612 100644
--- a/README.md
+++ b/README.md
@@ -4,5 +4,10 @@ This template is used in the [Building An Activity](https://discord.com/develope
Read more about building Discord Activities with the Embedded App SDK at [https://discord.com/developers/docs/activities/overview](https://discord.com/developers/docs/activities/overview).
-# web-app
-# web-app
+# installation
+WIP
+
+run
+npm run dev in ./server and ./client
+cloudflared tunnel --url http://localhost:5173
+then fix the discord app and vite.config.js
diff --git a/Task.jsx b/Task.jsx
new file mode 100644
index 0000000..3fbcfea
--- /dev/null
+++ b/Task.jsx
@@ -0,0 +1,131 @@
+// Task.js (React Component)
+import React, { useState } from 'react';
+import TaskLabel from './client/components/TaskLabel';
+import Member from './client/components/Member';
+import '/styles/popup.css';
+import '/styles/task.css';
+
+const TaskPopup = ({
+ isVisible,
+ onClose,
+ onSave,
+ members,
+}) => {
+ const [taskName, setTaskName] = useState('');
+ const [taskDetails, setTaskDetails] = useState('');
+ const [startDate, setStartDate] = useState('');
+ const [dueDate, setDueDate] = useState('');
+ const [assignedMember, setAssignedMember] = useState(null);
+ const [selectedLabel, setSelectedLabel] = useState(null);
+
+ const handleSave = () => {
+ if (!taskName) {
+ alert('Task name is required.');
+ return;
+ }
+ const taskData = {
+ name: taskName,
+ details: taskDetails,
+ startDate,
+ dueDate,
+ assignedMember,
+ label: selectedLabel,
+ };
+ onSave(taskData);
+ handleClose();
+ };
+
+ const handleClose = () => {
+ setTaskName('');
+ setTaskDetails('');
+ setStartDate('');
+ setDueDate('');
+ setAssignedMember(null);
+ setSelectedLabel(null);
+ onClose();
+ };
+
+ if (!isVisible) return null;
+
+ return (
+
-
-
-
-
-
-
-
-
-
-

-
-
-
-
-
-
-
-
-
- `;
-}
-
diff --git a/client/components/list.js b/client/components/list.js
deleted file mode 100644
index 2c5df9d..0000000
--- a/client/components/list.js
+++ /dev/null
@@ -1,212 +0,0 @@
-export function List() {
- const listContainer = document.getElementById("list-container");
- const addListButton = document.getElementById("add-list-button");
- const taskPopupOverlay = document.getElementById("task-popup-overlay");
- const taskListIdInput = document.getElementById("task-list-id"); // Hidden input to store target list ID
-
- let listCount = 0;
- const initialPosition = 27; // Initial position of add-list-button in vw
- const offset = 302; // Offset for positioning lists (in px)
-
- // Function to update the position of the add-list-button
- function updateAddListButtonPosition() {
- addListButton.style.left = `calc(${initialPosition}vw + ${listCount * offset}px)`;
- }
-
- // Function to create a new list input box
- function createNewListInputBox() {
- addListButton.style.display = "none";
-
- const createNewListBox = document.createElement("div");
- createNewListBox.classList.add("create-new-list");
-
- const listInput = document.createElement("input");
- listInput.type = "text";
- listInput.placeholder = "Enter list name...";
- listInput.classList.add("add-list-input");
-
- const buttonRow = document.createElement("div");
- buttonRow.classList.add("button-row");
-
- const cancelButton = document.createElement("button");
- cancelButton.textContent = "cancel";
- cancelButton.classList.add("cancel-list-button");
- cancelButton.addEventListener("click", () => {
- createNewListBox.remove();
- addListButton.style.display = "block";
- });
-
- const confirmButton = document.createElement("button");
- confirmButton.textContent = "confirm";
- confirmButton.classList.add("confirm-list-button");
- confirmButton.addEventListener("click", () => {
- const listName = listInput.value.trim();
- if (listName) {
- const listData = { id: Date.now(), title: listName };
- renderList(listData, listContainer);
- listCount++;
- updateAddListButtonPosition();
- createNewListBox.remove();
- addListButton.style.display = "block";
- } else {
- alert("List name cannot be empty.");
- }
- });
-
- buttonRow.appendChild(cancelButton);
- buttonRow.appendChild(confirmButton);
- createNewListBox.appendChild(listInput);
- createNewListBox.appendChild(buttonRow);
- listContainer.appendChild(createNewListBox);
- }
-
- // Function to render a list
- function renderList(listData, container, existingList = null) {
- const list = document.createElement("div");
- list.classList.add("list");
- list.setAttribute("data-list-id", listData.id);
-
- // Container for title and settings
- const titleContainer = document.createElement("div");
- titleContainer.classList.add("list-title-container");
-
- // List title
- const title = document.createElement("span");
- title.classList.add("list-title");
- title.textContent = listData.title;
-
- // Settings icon
- const listSettingsIcon = document.createElement("img");
- listSettingsIcon.src = "../assets/setting.svg"; // Replace with the actual path to your settings.svg
- listSettingsIcon.alt = "Settings";
- listSettingsIcon.classList.add("list-settings-icon");
-
- // List settings popup
- const settingsPopup = document.createElement("div");
- settingsPopup.classList.add("list-settings-popup", "hidden");
-
- // Rename List button
- const renameButton = document.createElement("p");
- renameButton.textContent = "rename list";
- renameButton.addEventListener("click", () => {
- console.log("Rename list clicked.");
-
- // Replace list content with the rename input box
- list.innerHTML = ""; // Clear the current list content
-
- const renameContainer = document.createElement("div");
- renameContainer.classList.add("rename-list");
-
- const renameInput = document.createElement("input");
- renameInput.type = "text";
- renameInput.value = listData.title; // Pre-fill with the current title
- renameInput.classList.add("add-list-input");
- renameInput.placeholder = "Enter new name...";
-
- const buttonRow = document.createElement("div");
- buttonRow.classList.add("button-row");
-
- const cancelRenameButton = document.createElement("button");
- cancelRenameButton.textContent = "cancel";
- cancelRenameButton.classList.add("cancel-rename-button");
- cancelRenameButton.addEventListener("click", () => {
- console.log("Rename canceled.");
- renderList(listData, container, list); // Re-render the original list in place
- });
-
- const confirmRenameButton = document.createElement("button");
- confirmRenameButton.textContent = "confirm";
- confirmRenameButton.classList.add("confirm-rename-button");
- confirmRenameButton.addEventListener("click", () => {
- const newTitle = renameInput.value.trim();
- if (newTitle) {
- console.log("List renamed to:", newTitle);
- listData.title = newTitle; // Update the list title in the data
- renderList(listData, container, list); // Re-render the updated list in place
- } else {
- alert("List name cannot be empty.");
- }
- });
-
- buttonRow.appendChild(cancelRenameButton);
- buttonRow.appendChild(confirmRenameButton);
- renameContainer.appendChild(renameInput);
- renameContainer.appendChild(buttonRow);
- list.appendChild(renameContainer);
- renameInput.focus();
- });
-
- // Add Task button
- const addTaskButton = document.createElement("p");
- addTaskButton.textContent = "add a task";
- addTaskButton.addEventListener("click", () => {
- console.log("Add task clicked.");
- taskPopupOverlay.classList.remove("hidden");
- settingsPopup.classList.add("hidden");
- });
-
- // Delete List button
- const deleteButton = document.createElement("p");
- deleteButton.textContent = "delete list";
- deleteButton.classList.add("delete");
- deleteButton.addEventListener("click", () => {
- console.log("Delete list clicked.");
- list.remove();
- listCount--;
- updateAddListButtonPosition();
- });
-
- settingsPopup.appendChild(renameButton);
- settingsPopup.appendChild(addTaskButton);
- settingsPopup.appendChild(deleteButton);
-
- // Add event listener to settings icon
- listSettingsIcon.addEventListener("click", (event) => {
- event.stopPropagation(); // Prevent click propagation
- const isHidden = settingsPopup.classList.contains("hidden");
- document.querySelectorAll(".list-settings-popup").forEach((popup) =>
- popup.classList.add("hidden")
- );
-
- if (isHidden) {
- const rect = listSettingsIcon.getBoundingClientRect();
- settingsPopup.style.top = `${rect.top + window.scrollY}px`; // Adjust for upward offset
- settingsPopup.style.left = `${rect.left + window.scrollX + 55}px`; // Adjust for rightward offset
- settingsPopup.classList.remove("hidden");
- }
- });
-
- document.addEventListener("click", () => {
- settingsPopup.classList.add("hidden");
- });
-
- titleContainer.appendChild(title);
- titleContainer.appendChild(listSettingsIcon);
- list.appendChild(titleContainer);
-
- // Add Task button inside the list
- const addTaskButtonInList = document.createElement("button");
- addTaskButtonInList.textContent = "+ add a task";
- addTaskButtonInList.classList.add("add-task-button");
- addTaskButtonInList.addEventListener("click", () => {
- console.log("Add task clicked (from list).");
- taskPopupOverlay.classList.remove("hidden");
- });
-
- list.appendChild(addTaskButtonInList);
-
- // Replace the existing list if provided
- if (existingList) {
- container.replaceChild(list, existingList);
- } else {
- container.appendChild(list);
- }
-
- // Append the settings popup to the body for absolute positioning
- document.body.appendChild(settingsPopup);
- }
-
-
- addListButton.addEventListener("click", createNewListInputBox);
- updateAddListButtonPosition();
-}
diff --git a/client/components/member.js b/client/components/member.js
deleted file mode 100644
index b90f751..0000000
--- a/client/components/member.js
+++ /dev/null
@@ -1,97 +0,0 @@
-export function Member(members) {
- const memberPopup = document.getElementById("member-popup");
- const doneMemberButton = document.getElementById("done-member-button");
- const addMemberButton = document.getElementById("add-member-button");
- const memberOptionsContainer = document.querySelector(".member-options");
-
- let selectedMemberButton = null;
-
- // Populate Members
- function populateMembers(memberList) {
- console.log("Populating members:", memberList);
-
- if (!memberOptionsContainer) {
- console.error("Member options container not found.");
- return;
- }
-
- memberOptionsContainer.innerHTML = ""; // Clear existing options
-
- memberList.forEach((member, index) => {
- if (!member || !member.profilePicture || !member.name) {
- console.error(`Invalid member at index ${index}:`, member);
- return; // Skip invalid member
- }
-
- console.log(`Adding member ${index + 1}:`, member);
-
- const memberOption = document.createElement("div");
- memberOption.className = "member-option";
- memberOption.setAttribute("data-member-id", member.id);
-
- const profilePicture = document.createElement("img");
- profilePicture.src = member.profilePicture;
- profilePicture.alt = member.name;
- profilePicture.className = "member-profile-picture";
-
- const username = document.createElement("span");
- username.textContent = member.name;
- username.className = "member-username";
-
- memberOption.appendChild(profilePicture);
- memberOption.appendChild(username);
- memberOptionsContainer.appendChild(memberOption);
- });
-
- console.log("Members successfully added to member-options.");
- }
-
- // Show Member Popup
- function showMemberPopup() {
- if (memberPopup) {
- console.log("Showing member popup.");
- memberPopup.classList.remove("hidden");
- } else {
- console.error("Member popup element not found.");
- }
- }
-
- // Hide Member Popup
- function hideMemberPopup() {
- if (memberPopup) {
- console.log("Hiding member popup.");
- memberPopup.classList.add("hidden");
- }
- }
-
- // Done Button Logic
- doneMemberButton.addEventListener("click", () => {
- if (selectedMemberButton) {
- const selectedMemberName = selectedMemberButton.querySelector(".member-username").textContent;
- addMemberButton.textContent = selectedMemberName;
- addMemberButton.style.backgroundColor = "#53D1F0";
- addMemberButton.style.color = "#fff";
- hideMemberPopup();
- } else {
- alert("Please select a member before clicking 'Done'.");
- }
- });
-
- // Close Popup on Outside Click
- document.addEventListener("click", (event) => {
- if (
- memberPopup &&
- !memberPopup.contains(event.target) &&
- event.target.id !== "add-member-button"
- ) {
- hideMemberPopup();
- }
- });
-
- // Populate members during initialization
- populateMembers(members);
-
- return {
- showMemberPopup,
- };
-}
diff --git a/client/components/pages/Project.jsx b/client/components/pages/Project.jsx
new file mode 100644
index 0000000..50dc736
--- /dev/null
+++ b/client/components/pages/Project.jsx
@@ -0,0 +1,132 @@
+import React, { useState, useEffect } from 'react';
+import { DiscordSDK } from '@discord/embedded-app-sdk';
+import Interface from '../Interface.jsx';
+import Calendar from '../Calendar.jsx';
+import Task from '../../../Task.jsx';
+import Board from '../BoardSection.jsx';
+import SettingsPopup from '../Settings.jsx';
+import ProjectSection from '../ProjectSection.jsx';
+import ConfirmationPopup from '../ConfirmationPopup.jsx';
+import TaskLabel from '../TaskLabel.jsx';
+import BoardProject from '../BoardProject.jsx';
+import List from '../List.jsx';
+import Member from '../Member.jsx';
+import ErrorBoundary from '/ErrorBoundary.jsx';
+import '/styles/sidebar.css';
+
+
+const Project = () => {
+ const [discordSdk, setDiscordSdk] = useState(null);
+ const [user, setUser] = useState(null);
+ const [isConfirmationVisible, setIsConfirmationVisible] = useState(false);
+ const [labelPopupVisible, setLabelPopupVisible] = useState(false);
+
+ useEffect(() => {
+ const setupDiscordSdk = async () => {
+ try {
+ const discordClientId = import.meta.env.VITE_DISCORD_CLIENT_ID;
+
+ if (!discordClientId) {
+ throw new Error('Discord Client ID is missing');
+ }
+
+ console.log('Setting up Discord SDK...');
+
+ // Initialize Discord SDK
+ const sdk = new DiscordSDK(discordClientId);
+ await sdk.ready();
+
+ console.log('Discord SDK Ready...');
+
+ // Authorize with Discord OAuth
+ const { code } = await sdk.commands.authorize({
+ client_id: discordClientId,
+ response_type: 'code',
+ state: '',
+ prompt: 'none',
+ scope: ['identify', 'guilds', 'applications.commands'],
+ });
+
+ console.log('Authorization code received...');
+
+ // Exchange authorization code for access token
+ const response = await fetch('/.proxy/api/v1/token', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ code }),
+ });
+
+ if (!response.ok) {
+ throw new Error('Failed to fetch access token');
+ }
+
+ const { access_token } = await response.json();
+ console.log('Access Token received...');
+
+ // Authenticate with Discord SDK using the access token
+ await sdk.commands.authenticate({ access_token });
+
+ console.log('Authentication successful...');
+
+ // Fetch the user profile
+ const userProfile = await fetchUserProfile(access_token);
+ console.log('User Profile:', userProfile);
+
+ setUser({
+ username: userProfile.username,
+ avatarUrl: `https://cdn.discordapp.com/avatars/${userProfile.id}/${userProfile.avatar}.png`,
+ });
+
+ setDiscordSdk(sdk);
+ } catch (error) {
+ console.error('Error setting up Discord SDK:', error);
+ }
+ };
+
+ const fetchUserProfile = async (token) => {
+ const response = await fetch('https://discord.com/api/users/@me', {
+ headers: { Authorization: `Bearer ${token}` },
+ });
+ if (!response.ok) {
+ throw new Error('Failed to fetch user profile');
+ }
+ return await response.json();
+ };
+
+ setupDiscordSdk();
+ }, []);
+
+ const handleConfirmation = () => {
+ setIsConfirmationVisible(false);
+ };
+
+ if (!user) {
+ console.log('User data is still loading...');
+ return
Loading...
;
+ }
+
+ return (
+
+
+
+
+ setIsConfirmationVisible(false)}
+ />
+ console.log('Selected label:', label)}
+ onClose={() => setLabelPopupVisible(false)}
+ />
+
+
+
+
+
+
+ );
+};
+
+export default Project;
diff --git a/client/components/projectPopup.js b/client/components/projectPopup.js
deleted file mode 100644
index 49073a2..0000000
--- a/client/components/projectPopup.js
+++ /dev/null
@@ -1,129 +0,0 @@
-import { ConfirmationPopup } from './confirmationPopup.js';
-
-export function ProjectPopup() {
- const projectListContainer = document.getElementById("project-list-container");
- const createProjectButton = document.getElementById("create-project-button");
- const createProjectButtonForm = document.getElementById("create-project-button-form");
- const projectPopupOverlay = document.getElementById("project-popup-overlay");
- const closeProjectPopupButton = document.getElementById("close-project-popup-button");
- const cancelProjectButton = document.getElementById("cancel-project-button");
- const projectNameInput = document.getElementById("project-name");
- const projectDescriptionInput = document.getElementById("project-description");
- const projectNameDisplay = document.getElementById("projectname"); // Display area for project name
- const projectDescriptionDisplay = document.getElementById("projectdescription"); // Display area for project description
- const { showConfirmationPopup, hideConfirmationPopup } = ConfirmationPopup();
-
- // Function to reset and hide the project popup overlay
- function resetProjectPopupOverlay() {
- projectPopupOverlay.classList.add("hidden");
- projectNameInput.value = ""; // Clear the input field
- projectDescriptionInput.value = ""; // Clear the description field
- }
-
- // Function to handle the confirmation logic
- function handleConfirmation(action) {
- if (action === "discard") {
- resetProjectPopupOverlay();
- }
- hideConfirmationPopup();
- }
-
- // Attach event listeners to confirmation popup buttons
- document.getElementById("cancel-discard-button").addEventListener("click", () => {
- hideConfirmationPopup();
- });
-
- document.getElementById("discard-button").addEventListener("click", () => {
- handleConfirmation("discard");
- });
-
- // Show the project popup
- function showProjectPopup() {
- projectPopupOverlay.classList.remove("hidden");
- }
-
- // Function to dynamically position the line
- function createOrUpdateDynamicLine() {
- const projectSection = document.getElementById("project-section");
- let dynamicLine = document.querySelector(".dynamic-line");
-
- if (!dynamicLine) {
- dynamicLine = document.createElement("div");
- dynamicLine.className = "dynamic-line";
- projectSection.appendChild(dynamicLine);
- }
-
- const lastProjectButton = projectListContainer.querySelector(".project-button:last-child");
- if (lastProjectButton) {
- const lastButtonRect = lastProjectButton.getBoundingClientRect();
- const projectSectionRect = projectSection.getBoundingClientRect();
- const offsetVh = ((lastButtonRect.bottom - projectSectionRect.top) / window.innerHeight) * 100;
- dynamicLine.style.top = `calc(${offsetVh}vh + 2.5vh)`; // Adjust for spacing
- dynamicLine.style.left = "0";
- dynamicLine.style.width = "100%";
- dynamicLine.style.display = "block";
- } else {
- dynamicLine.style.display = "none"; // Hide if no projects
- }
- }
-
- // Handle creating a new project button
- function handleCreateProject(event) {
- event.preventDefault();
-
- const projectName = projectNameInput.value.trim();
- const projectDescription = projectDescriptionInput.value.trim();
- if (projectName) {
- const newProjectButton = document.createElement("button");
- newProjectButton.className = "project-button";
- newProjectButton.innerHTML = `
-
✓
-
${projectName}
- `;
-
- // Store the project description as a data attribute (hidden)
- newProjectButton.dataset.description = projectDescription;
-
- // Add event listener to select the project and update projectbox
- newProjectButton.addEventListener("click", () => {
- document.querySelectorAll(".project-button").forEach((btn) => {
- btn.classList.remove("active");
- btn.querySelector(".checkmark").classList.add("hidden");
- });
- newProjectButton.classList.add("active");
- newProjectButton.querySelector(".checkmark").classList.remove("hidden");
-
- // Update the projectbox with the selected project's name and description
- projectNameDisplay.textContent = projectName;
- projectDescriptionDisplay.textContent = projectDescription || "No description.";
- });
-
- projectListContainer.appendChild(newProjectButton);
- resetProjectPopupOverlay();
- createOrUpdateDynamicLine();
- } else {
- alert("Please enter a project name.");
- }
- }
-
- // Show confirmation popup for specific actions
- function showConfirmationOnAction(event) {
- event.stopPropagation();
- showConfirmationPopup();
- }
-
- // Add event listeners
- createProjectButton.addEventListener("click", showProjectPopup);
- createProjectButtonForm.addEventListener("click", handleCreateProject);
- closeProjectPopupButton.addEventListener("click", showConfirmationOnAction);
- cancelProjectButton.addEventListener("click", showConfirmationOnAction);
-
- projectPopupOverlay.addEventListener("click", (event) => {
- if (event.target === projectPopupOverlay) {
- showConfirmationPopup();
- }
- });
-
- // Optional: Handle dynamic line updates on window resize
- window.addEventListener("resize", createOrUpdateDynamicLine);
-}
diff --git a/client/components/settings.js b/client/components/settings.js
deleted file mode 100644
index 82b45c4..0000000
--- a/client/components/settings.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export function SettingsPopup() {
- const settingsIcon = document.getElementById("settings-icon");
- const settingsPopup = document.getElementById("settings-popup");
-
- settingsIcon.addEventListener("click", (event) => {
- event.stopPropagation();
- settingsPopup.style.display =
- settingsPopup.style.display === "none" || settingsPopup.style.display === "" ? "flex" : "none";
- });
-
- document.addEventListener("click", (event) => {
- if (!settingsIcon.contains(event.target) && !settingsPopup.contains(event.target)) {
- settingsPopup.style.display = "none";
- }
- });
-}
\ No newline at end of file
diff --git a/client/components/task.js b/client/components/task.js
deleted file mode 100644
index 52c7e89..0000000
--- a/client/components/task.js
+++ /dev/null
@@ -1,178 +0,0 @@
-import { TaskLabel } from "./taskLabel.js";
-import { Member } from "./member.js";
-import { ConfirmationPopup } from "./confirmationPopup.js";
-
-export function Task() {
- // DOM References
- const taskPopupOverlay = document.getElementById("task-popup-overlay");
- const closeTaskPopupButton = document.getElementById("close-task-popup-button");
- const cancelTaskButton = document.getElementById("cancel-task-button");
- const addTaskForm = document.getElementById("add-task-form");
- const fileContainer = document.getElementById("file-container");
- const addMemberButton = document.getElementById("add-member-button");
- const startDateButton = document.getElementById("start-date-button");
- const dueDateButton = document.getElementById("due-date-button");
- const setLabelButton = document.getElementById("set-label-button");
- const reminderInput = document.getElementById("reminder");
-
- const { showConfirmationPopup, hideConfirmationPopup } = ConfirmationPopup();
-
- const projectMembers = [
- { id: "1", name: "Alice", profilePicture: "https://via.placeholder.com/40" },
- { id: "2", name: "Bob", profilePicture: "https://via.placeholder.com/40" },
- { id: "3", name: "Charlie", profilePicture: "https://via.placeholder.com/40" },
- ];
-
- const { showMemberPopup } = Member(projectMembers);
- const { showLabelPopup } = TaskLabel();
-
- let uploadedFiles = [];
- let taskData = {};
- document.getElementById("task-popup-content").style.height = "75vh";
-
- // Show Task Popup
- function showTaskPopup() {
- taskPopupOverlay.classList.remove("hidden");
- }
-
- // Close Task Popup with Confirmation
- function closeTaskPopupWithConfirmation() {
- showConfirmationPopup();
-
- // Attach event listener to confirm button in confirmation popup
- const discardButton = document.querySelector("#discard-button");
- discardButton.addEventListener("click", () => {
- closeTaskPopup(); // Close the popup and reset the inputs
- hideConfirmationPopup(); // Hide the confirmation popup
- });
-
- // Cancel button simply hides the confirmation popup
- const cancelDiscardButton = document.querySelector("#cancel-discard-button");
- cancelDiscardButton.addEventListener("click", () => {
- hideConfirmationPopup();
- });
- }
-
- // Close Task Popup (without confirmation, for confirmed discard)
- function closeTaskPopup() {
- taskPopupOverlay.classList.add("hidden");
- resetTaskPopupInputs(); // Reset all inputs
- }
-
- // Reset Task Popup Inputs
- function resetTaskPopupInputs() {
- if (addTaskForm) addTaskForm.reset();
-
- // Clear file container
- fileContainer.innerHTML = "";
-
- // Restore "Add File" button
- const addFileButtonElement = document.createElement("button");
- addFileButtonElement.id = "add-file-button";
- addFileButtonElement.type = "button";
- addFileButtonElement.textContent = "+ add file";
- addFileButtonElement.classList.add("file-button-class");
-
- fileContainer.appendChild(addFileButtonElement);
- initializeFileHandler(addFileButtonElement);
-
- // Reset date and label buttons
- startDateButton.textContent = "dd/mm/yy";
- startDateButton.style.backgroundColor = "";
- startDateButton.style.color = "#949AA0";
-
- dueDateButton.textContent = "dd/mm/yy";
- dueDateButton.style.backgroundColor = "";
- dueDateButton.style.color = "#949AA0";
-
- setLabelButton.textContent = "set label";
- setLabelButton.style.backgroundColor = "";
- setLabelButton.style.color = "#949AA0";
-
- addMemberButton.textContent = "+ add member";
- addMemberButton.style.backgroundColor = "";
- addMemberButton.style.color = "#949AA0";
-
- uploadedFiles = [];
- taskData = {};
- }
-
- // Initialize File Handling Logic
- function initializeFileHandler(button) {
- const fileInput = document.createElement("input");
- fileInput.type = "file";
- fileInput.style.display = "none";
-
- button.addEventListener("click", () => {
- fileInput.value = "";
- fileInput.click();
- });
-
- fileInput.addEventListener("change", (event) => {
- const file = event.target.files[0];
- if (file) {
- displayFile(file);
- }
- });
-
- fileContainer.appendChild(fileInput);
- }
-
- // Display Selected File
- function displayFile(file) {
- uploadedFiles.push(file);
-
- const fileDisplay = document.createElement("div");
- fileDisplay.classList.add("file-display");
- fileDisplay.innerHTML = `
-
${file.name}
-
- `;
-
- const removeButton = fileDisplay.querySelector(".remove-file-button");
- removeButton.addEventListener("click", () => {
- uploadedFiles = uploadedFiles.filter((f) => f !== file);
- fileDisplay.remove();
- });
-
- fileContainer.appendChild(fileDisplay);
- }
-
- // Restrict Reminder Input to Numbers Only
- reminderInput.addEventListener("input", () => {
- reminderInput.value = reminderInput.value.replace(/\D/g, "");
- if (parseInt(reminderInput.value) > 100) {
- reminderInput.value = "99";
- }
- });
-
- reminderInput.addEventListener("blur", () => {
- if (!reminderInput.value || parseInt(reminderInput.value) <= 0) {
- reminderInput.value = "";
- }
- });
-
- // Attach Event Listeners
- closeTaskPopupButton.addEventListener("click", closeTaskPopupWithConfirmation);
- cancelTaskButton.addEventListener("click", closeTaskPopupWithConfirmation);
-
- taskPopupOverlay.addEventListener("click", (event) => {
- if (event.target === taskPopupOverlay) {
- closeTaskPopupWithConfirmation();
- }
- });
-
- // Show Label Popup when setLabelButton is clicked
- setLabelButton.addEventListener("click", () => {
- showLabelPopup();
- });
-
- // Show Member Popup when addMemberButton is clicked
- addMemberButton.addEventListener("click", () => {
- console.log("Add member button clicked.");
- showMemberPopup();
- });
-
- console.log("Task module initialized.");
- resetTaskPopupInputs();
-}
diff --git a/client/components/taskLabel.js b/client/components/taskLabel.js
deleted file mode 100644
index d24e865..0000000
--- a/client/components/taskLabel.js
+++ /dev/null
@@ -1,80 +0,0 @@
-export function TaskLabel() {
- const labelPopup = document.getElementById("label-popup");
- const doneLabelButton = document.getElementById("done-label-button");
- const labelOptions = document.querySelectorAll(".label-option");
- const setLabelButton = document.getElementById("set-label-button");
-
- let selectedColorButton = null; // Track the currently selected color button
-
- // Show the Label Popup
- function showLabelPopup() {
- if (labelPopup) {
- labelPopup.style.display = "block"; // Show the popup
- labelPopup.classList.remove("hidden");
- console.log("Showing label popup.");
- console.log(labelPopup);
- } else {
- console.error("Label popup element not found.");
- }
- }
-
- // Hide the Label Popup
- function hideLabelPopup() {
- if (labelPopup) {
- labelPopup.style.display = "none"; // Hide the popup
- }
- }
-
- // Handle Label Selection
- labelOptions.forEach((button) => {
- button.addEventListener("click", () => {
- // Clear the previous selection
- if (selectedColorButton) {
- selectedColorButton.innerHTML = ""; // Remove the checkmark
- }
-
- // Mark the clicked button as selected
- selectedColorButton = button;
- button.innerHTML = "✓"; // Add the checkmark symbol
-
- console.log("Selected color:", button.getAttribute("data-color"));
- });
- });
-
- // Handle Done Button Click
- doneLabelButton.addEventListener("click", () => {
- if (selectedColorButton) {
- const selectedColor = selectedColorButton.getAttribute("data-color");
-
- // Update the "set-label-button" with the selected color
- setLabelButton.style.backgroundColor = selectedColor;
- setLabelButton.style.border = "none"; // Remove border for a clean look
- setLabelButton.textContent = ""; // Clear any existing text
-
- // Ensure the button retains its original size
- setLabelButton.style.width = "27%"; // Adjust width as needed
- setLabelButton.style.height = "35%";
- setLabelButton.style.borderRadius = "12px"; // Optional: add rounded corners
- setLabelButton.style.border = "1px solid #949AA0"; // Optional: add border to the button
-
- hideLabelPopup(); // Close the popup
- } else {
- alert("Please select a color before clicking 'Done'.");
- }
- });
-
- // Hide the popup on outside click
- document.addEventListener("click", (event) => {
- if (
- labelPopup &&
- !labelPopup.contains(event.target) &&
- event.target.id !== "set-label-button"
- ) {
- hideLabelPopup();
- }
- });
-
- return {
- showLabelPopup,
- };
-}
diff --git a/client/style.css b/client/index.css
similarity index 77%
rename from client/style.css
rename to client/index.css
index 540558a..a022dc7 100644
--- a/client/style.css
+++ b/client/index.css
@@ -1,4 +1,4 @@
-/* style.css */
+/* index.css */
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
@@ -14,16 +14,6 @@
-moz-osx-font-smoothing: grayscale;
}
-a {
- font-weight: 500;
- color: #646cff;
- text-decoration: inherit;
-}
-
-a:hover {
- color: #535bf2;
-}
-
body {
margin: 0;
display: flex;
@@ -48,21 +38,6 @@ h1 {
text-align: left;
}
-.logo {
- height: 6em;
- padding: 1.5em;
- will-change: filter;
- transition: filter 300ms;
-}
-
-.logo:hover {
- filter: drop-shadow(0 0 2em #646cffaa);
-}
-
-.logo.vanilla:hover {
- filter: drop-shadow(0 0 2em #f7df1eaa);
-}
-
button {
border-radius: 8px;
border: 1px solid transparent;
@@ -75,28 +50,6 @@ button {
transition: border-color 0.25s;
}
-button:hover {
- border-color: #646cff;
-}
-
-button:focus,
-button:focus-visible {
- outline: 4px auto -webkit-focus-ring-color;
-}
-
-@media (prefers-color-scheme: light) {
- :root {
- color: #213547;
- background-color: #ffffff;
- }
- a:hover {
- color: #747bff;
- }
- button {
- background-color: #f9f9f9;
- }
-}
-
/* Ensure the entire area is clickable */
#tasks-checkbox {
position: fixed;
diff --git a/client/index.html b/client/index.html
index e77f5d6..320bc32 100644
--- a/client/index.html
+++ b/client/index.html
@@ -1,30 +1,11 @@
-
-
-
-
Planify
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+