From 715fe50055e50535b110d00a0eeabf4def4da2a2 Mon Sep 17 00:00:00 2001
From: davidcrair <115373655+davidcrair@users.noreply.github.com>
Date: Sun, 31 Mar 2024 20:34:02 -0400
Subject: [PATCH 1/4] Update page.jsx
---
src/app/unify/[users]/page.jsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/app/unify/[users]/page.jsx b/src/app/unify/[users]/page.jsx
index 6841538..c2b8e5c 100644
--- a/src/app/unify/[users]/page.jsx
+++ b/src/app/unify/[users]/page.jsx
@@ -109,7 +109,9 @@ export default function UnifyPage({ params: { users } }) {
setLoading(false);
} else {
setLoading(true);
- setError("User not found.");
+ if (users.includes("%26")) {
+ setError("User not found.");
+ }
}
// console.log(loading, user1Data, user2Data);
From 1230b08e47479d718db69f0c7c851c955250b704 Mon Sep 17 00:00:00 2001
From: davidcrair <115373655+davidcrair@users.noreply.github.com>
Date: Sun, 31 Mar 2024 21:01:51 -0400
Subject: [PATCH 2/4] Move index_content to Index
Also added dynamic continue to account to log in with Spotify
---
package-lock.json | 53 +++++++++++++++
package.json | 1 +
src/app/Index.jsx | 85 +++++++++++++++++++++---
src/components/svg-art/index_content.jsx | 68 -------------------
4 files changed, 129 insertions(+), 78 deletions(-)
delete mode 100644 src/components/svg-art/index_content.jsx
diff --git a/package-lock.json b/package-lock.json
index a916f30..38c3a21 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -23,6 +23,7 @@
"prop-types": "^15.8.1",
"react": "^18",
"react-bootstrap": "^2.10.1",
+ "react-cookie": "^7.1.2",
"react-dom": "^18",
"react-router-dom": "^6.22.0",
"react-svg-to-image": "^3.0.0"
@@ -2157,6 +2158,11 @@
"@babel/types": "^7.20.7"
}
},
+ "node_modules/@types/cookie": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
+ "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA=="
+ },
"node_modules/@types/d3-color": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
@@ -2202,6 +2208,15 @@
"@types/node": "*"
}
},
+ "node_modules/@types/hoist-non-react-statics": {
+ "version": "3.3.5",
+ "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz",
+ "integrity": "sha512-SbcrWzkKBw2cdwRTwQAswfpB9g9LJWfjtUeW/jvNwbhC8cpmmNYVePa+ncbUe0rGTQ7G3Ff6mYUN2VMfLVr+Sg==",
+ "dependencies": {
+ "@types/react": "*",
+ "hoist-non-react-statics": "^3.3.0"
+ }
+ },
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
@@ -5614,6 +5629,14 @@
"node": ">=8"
}
},
+ "node_modules/hoist-non-react-statics": {
+ "version": "3.3.2",
+ "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz",
+ "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==",
+ "dependencies": {
+ "react-is": "^16.7.0"
+ }
+ },
"node_modules/html-encoding-sniffer": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
@@ -9028,6 +9051,19 @@
}
}
},
+ "node_modules/react-cookie": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-7.1.2.tgz",
+ "integrity": "sha512-zmxFrVNLl03OAM8Xnh43cg4Tz9t4K0DRToWuyQcDUf0jHZLugvCA5t3skmcKgG07L11qXltzWWJUFTF97Toj9w==",
+ "dependencies": {
+ "@types/hoist-non-react-statics": "^3.3.5",
+ "hoist-non-react-statics": "^3.3.2",
+ "universal-cookie": "^7.0.0"
+ },
+ "peerDependencies": {
+ "react": ">= 16.3.0"
+ }
+ },
"node_modules/react-dom": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
@@ -10537,6 +10573,23 @@
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
+ "node_modules/universal-cookie": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-7.1.2.tgz",
+ "integrity": "sha512-GK9ygNUNk+u1umTtFoWItePuIGYy0TEu2w084mfjBpIIg9pikcN18EM6IMt+9VJCyR3uftu3yF2fFUMbwH1Kdw==",
+ "dependencies": {
+ "@types/cookie": "^0.6.0",
+ "cookie": "^0.6.0"
+ }
+ },
+ "node_modules/universal-cookie/node_modules/cookie": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
+ "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/universalify": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
diff --git a/package.json b/package.json
index cf4dc83..92176a4 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"prop-types": "^15.8.1",
"react": "^18",
"react-bootstrap": "^2.10.1",
+ "react-cookie": "^7.1.2",
"react-dom": "^18",
"react-router-dom": "^6.22.0",
"react-svg-to-image": "^3.0.0"
diff --git a/src/app/Index.jsx b/src/app/Index.jsx
index c9ac042..10cc86f 100644
--- a/src/app/Index.jsx
+++ b/src/app/Index.jsx
@@ -1,13 +1,19 @@
"use client";
-import { useEffect } from "react";
-
-import IndexContent from "@/components/svg-art/index_content";
+import { useEffect, useState } from "react";
+import { useCookies } from "react-cookie";
+import { loginWithSpotify } from "@/app/login/actions";
+import Ipod from "@/components/svg-art/ipod";
+import "@/app/globals.css";
+import LeftPanel from "@/components/svg-art/left_panel";
import createClient from "@/utils/supabase/client";
-export default function HomePage() {
+export default function IndexContent() {
+ const [userData, setUser] = useState(null);
const supabase = createClient();
+ const [cookies] = useCookies();
+
// check if user is already logged in
useEffect(() => {
(async () => {
@@ -16,17 +22,76 @@ export default function HomePage() {
data: { user },
} = await supabase.auth.getUser();
// console.log("user: ", user);
- if (user) {
+ if (user && cookies && Object.keys(cookies).length > 0) {
// already logged in
- // router.replace("/account");
- // console.log("user is logged in");
- } else {
- // console.log("user is not logged in");
+ // console.log("logged in");
+ setUser("user");
}
})().catch(() => {
// TODO display error message to user
});
}, []);
- return