+
diff --git a/src/components/LeftSidebar.js b/src/components/LeftSidebar.js
index 4fe461c..8b717fd 100644
--- a/src/components/LeftSidebar.js
+++ b/src/components/LeftSidebar.js
@@ -83,7 +83,7 @@ export default function LeftSidebar ({ className }) {
-
From a0f09f00dd41b5f5e898130943e691812939bae8 Mon Sep 17 00:00:00 2001
From: Mya Schroder <80082701+schromya@users.noreply.github.com>
Date: Sat, 25 Nov 2023 14:38:02 -0900
Subject: [PATCH 02/22] Fixed bug where new users could not log in
---
src/app/api/auth/[...nextauth]/options.js | 20 ++++++++++----------
src/app/api/mongoDB/createUser/createUser.js | 3 +--
src/app/api/mongoDB/createUser/route.js | 5 -----
3 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/src/app/api/auth/[...nextauth]/options.js b/src/app/api/auth/[...nextauth]/options.js
index f9cc617..c857fcc 100644
--- a/src/app/api/auth/[...nextauth]/options.js
+++ b/src/app/api/auth/[...nextauth]/options.js
@@ -21,7 +21,7 @@ export const options = {
async signIn ({ user, account, profile }) {
const existingUser = await getUsers(null, user.email)
- if (existingUser) {
+ if (existingUser && existingUser.length > 0) {
return true
} else {
// Get first and last name
@@ -30,17 +30,11 @@ export const options = {
const lastName = nameParts.length > 1 ? nameParts.slice(1).join(' ') : ''
// Create User
- const newUser = await createUser(user.email, firstName, lastName)
- return !!newUser // Return true if creation is successful
+ const createdUser = await createUser(user.email, firstName, lastName)
+ return !!createdUser // Return true if creation is successful
}
},
- async session ({ session, user, token }) {
- // Assign the user ID to the session to make it available on the client side
- session.userId = token.sub // 'sub' is typically the field where the user ID from the provider is stored
- return session
- },
-
async jwt ({ token, user, account, profile, isNewUser }) {
// This callback is called whenever a JWT is created. So session.userId is the mongo User _id
if (user) {
@@ -48,7 +42,13 @@ export const options = {
token.sub = mongoUsers[0]._id
}
return token
- }
+ },
+
+ async session ({ session, user, token }) {
+ // Assign the user ID to the session to make it available on the client side
+ session.userId = token.sub // 'sub' is typically the field where the user ID from the provider is stored
+ return session
+ },
}
/*
diff --git a/src/app/api/mongoDB/createUser/createUser.js b/src/app/api/mongoDB/createUser/createUser.js
index 963cf82..7f1beac 100644
--- a/src/app/api/mongoDB/createUser/createUser.js
+++ b/src/app/api/mongoDB/createUser/createUser.js
@@ -21,8 +21,8 @@ import { URI } from '../mongoData.js'
*/
export async function createUser (email, firstName = null, lastName = null, username = null, teamIDs = []) {
- if (mongoose.connection.readyState !== 1) await mongoose.connect(URI)
+ if (mongoose.connection.readyState !== 1) await mongoose.connect(URI);
const user = await User.create({
email,
firstName,
@@ -30,6 +30,5 @@ export async function createUser (email, firstName = null, lastName = null, user
username,
teamIDs
})
-
return user
}
diff --git a/src/app/api/mongoDB/createUser/route.js b/src/app/api/mongoDB/createUser/route.js
index a1b9629..76e394b 100644
--- a/src/app/api/mongoDB/createUser/route.js
+++ b/src/app/api/mongoDB/createUser/route.js
@@ -40,11 +40,6 @@ import { createUser } from './createUser'
*/
export async function POST (request) {
try {
- const session = await getServerSession(options)
- if (!session) {
- return NextResponse.json({ success: false, message: 'authentication failed' }, { status: 401 })
- }
-
const params = await request.json()
if (!params.email) {
From 0928db6aa66f04161236a10205b5ffa0e39875c6 Mon Sep 17 00:00:00 2001
From: yumenoxana
Date: Sat, 25 Nov 2023 14:50:55 -0900
Subject: [PATCH 03/22] some spacing changes in Graph.js
---
package-lock.json | 17 +++++++++++++----
package.json | 1 +
src/components/Graph.js | 20 +++++++++++++++++---
3 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index ee6bc96..1c903ec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"autoprefixer": "10.4.15",
"cookie-cutter": "^0.2.0",
"cytoscape": "^3.26.0",
+ "cytoscape-cxtmenu": "^3.5.0",
"dotenv": "^16.3.1",
"eslint-config-next": "13.4.19",
"mongodb": "^6.2.0",
@@ -1803,6 +1804,14 @@
"node": ">=0.10"
}
},
+ "node_modules/cytoscape-cxtmenu": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/cytoscape-cxtmenu/-/cytoscape-cxtmenu-3.5.0.tgz",
+ "integrity": "sha512-CoqgKAxvQhmHO5fEgJdBqqR2VjwK1dNkxehc2i0MUMqY0araA13z3oP/9KkprHp9Td++KlVBz6JnncNAD76T0Q==",
+ "peerDependencies": {
+ "cytoscape": "^3.2.0"
+ }
+ },
"node_modules/damerau-levenshtein": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz",
@@ -4605,9 +4614,9 @@
}
},
"node_modules/next-auth": {
- "version": "4.24.3",
- "resolved": "https://registry.npmjs.org/next-auth/-/next-auth-4.24.3.tgz",
- "integrity": "sha512-n1EvmY7MwQMSOkCh6jhI6uBneB6VVtkYELVMEwVaCLD1mBD3IAAucwk+90kgxramW09nSp5drvynwfNCi1JjaQ==",
+ "version": "4.24.5",
+ "resolved": "https://registry.npmjs.org/next-auth/-/next-auth-4.24.5.tgz",
+ "integrity": "sha512-3RafV3XbfIKk6rF6GlLE4/KxjTcuMCifqrmD+98ejFq73SRoj2rmzoca8u764977lH/Q7jo6Xu6yM+Re1Mz/Og==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@panva/hkdf": "^1.0.2",
@@ -4620,7 +4629,7 @@
"uuid": "^8.3.2"
},
"peerDependencies": {
- "next": "^12.2.5 || ^13",
+ "next": "^12.2.5 || ^13 || ^14",
"nodemailer": "^6.6.5",
"react": "^17.0.2 || ^18",
"react-dom": "^17.0.2 || ^18"
diff --git a/package.json b/package.json
index 712d985..af275c8 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,7 @@
"autoprefixer": "10.4.15",
"cookie-cutter": "^0.2.0",
"cytoscape": "^3.26.0",
+ "cytoscape-cxtmenu": "^3.5.0",
"dotenv": "^16.3.1",
"eslint-config-next": "13.4.19",
"mongodb": "^6.2.0",
diff --git a/src/components/Graph.js b/src/components/Graph.js
index fba2884..cb01b09 100644
--- a/src/components/Graph.js
+++ b/src/components/Graph.js
@@ -1,6 +1,7 @@
'use client'
import React, { useEffect, useRef, useState } from 'react'
import cytoscape from 'cytoscape'
+import cxtmenu from 'cytoscape-cxtmenu'
/**
* A component that fetches task data and renders it as a tree graph using the Cytoscape.js library.
@@ -56,7 +57,7 @@ function TreeGraph ({ className, projectID }) {
})
// Tailwind's bg-gray-200 #E5E7EB
- cytoscape({
+ const cy = cytoscape({
container: containerRef.current,
elements,
@@ -70,8 +71,8 @@ function TreeGraph ({ className, projectID }) {
'text-valign': 'center',
label: 'data(label)',
'text-wrap': 'wrap',
- 'text-max-width': 500,
- padding: '30px',
+ 'text-max-width': 900,
+ padding: '50px',
color: 'white', // Tailwind's text-gray-900
'font-size': 100,
'border-width': 10,
@@ -96,6 +97,19 @@ function TreeGraph ({ className, projectID }) {
directed: true
}
})
+
+ // Calculate and set node dimensions based on label text
+ cy.nodes().forEach(node => {
+ const label = node.data('label');
+ const labelWidth = 1000; // Adjust the factor based on your font and styling
+ const labelHeight = label.height * 10; // Set a fixed height or adjust based on your design
+
+ node.style({
+ width: labelWidth + 'px',
+ height: labelHeight + 'px',
+ });
+ });
+
}, [tasks])
return (
From 9d98e6ca9cfcfe0ce5bc78b3a6fa49701f3b44e7 Mon Sep 17 00:00:00 2001
From: Mya Schroder <80082701+schromya@users.noreply.github.com>
Date: Sat, 25 Nov 2023 15:06:29 -0900
Subject: [PATCH 04/22] Added dropdown movemnt
---
src/components/Dropdown.js | 31 ++++++++++++++++++++-----------
src/components/LeftSidebar.js | 3 +--
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/src/components/Dropdown.js b/src/components/Dropdown.js
index 3726366..fedf0d1 100644
--- a/src/components/Dropdown.js
+++ b/src/components/Dropdown.js
@@ -1,6 +1,7 @@
'use client'
import React from 'react'
import Image from 'next/image'
+import {useState } from 'react'
import dropdownIcon from '../../public/svg/dropdown.svg'
@@ -21,20 +22,28 @@ import dropdownIcon from '../../public/svg/dropdown.svg'
*
* @returns {React.Element} The rendered Dropdown button element.
*/
-const Dropdown = ({ label, clickAction, imagePath }) => {
- return (
+const Dropdown = ({ label, imagePath, dropdownComponents}) => {
+ const [dropdownHidden, setDropdown] = useState(false)
-
From 4a2d99c4df969c38331351b5beae665b93f62fa5 Mon Sep 17 00:00:00 2001
From: Ashtonrcurry