From dec2178132a1b04beb80f01c44b6e9d47b08aaba Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Thu, 3 Aug 2023 20:29:44 +0000 Subject: [PATCH 01/18] feat: add a notifications page --- .../NotificationsCard/notification-card.tsx | 13 +- lib/utils/get-notification-url.ts | 10 + pages/user/[username]/notifications.tsx | 227 ++++++++++++++++++ 3 files changed, 240 insertions(+), 10 deletions(-) create mode 100644 lib/utils/get-notification-url.ts create mode 100644 pages/user/[username]/notifications.tsx diff --git a/components/atoms/NotificationsCard/notification-card.tsx b/components/atoms/NotificationsCard/notification-card.tsx index 4324dcfde0..3272248b96 100644 --- a/components/atoms/NotificationsCard/notification-card.tsx +++ b/components/atoms/NotificationsCard/notification-card.tsx @@ -2,21 +2,14 @@ import Link from "next/link"; import React from "react"; import { FaRegSmile, FaUserCircle } from "react-icons/fa"; +import { getNotificationURL } from "lib/utils/get-notification-url"; + interface NotificationCard { type: "highlight_reaction" | "follow" | "collaboration"; message: string; id: string; } -const getSourceURL = (type: string, id: string) => { - switch (type) { - case "highlight_reaction": - return `/feed/${id}`; - case "follow": - return `/user/${id}`; - } -}; - const NotificationCard = ({ type, message, id }: NotificationCard) => { const Icons = { highlight_reaction: FaRegSmile, @@ -25,7 +18,7 @@ const NotificationCard = ({ type, message, id }: NotificationCard) => { }; const Icon = Icons[type]; - const linkURL = getSourceURL(type, id); + const linkURL = getNotificationURL(type, id); return (
diff --git a/lib/utils/get-notification-url.ts b/lib/utils/get-notification-url.ts new file mode 100644 index 0000000000..5ab8e366c8 --- /dev/null +++ b/lib/utils/get-notification-url.ts @@ -0,0 +1,10 @@ +export const getNotificationURL = (type: string, id: string) => { + switch (type) { + case "highlight_reaction": + return `/feed/${id}`; + case "follow": + return `/user/${id}`; + default: + return "/"; + } +}; diff --git a/pages/user/[username]/notifications.tsx b/pages/user/[username]/notifications.tsx new file mode 100644 index 0000000000..0e8461aafd --- /dev/null +++ b/pages/user/[username]/notifications.tsx @@ -0,0 +1,227 @@ +import { NextPage } from "next"; +import { useEffect, useMemo, useRef, useState } from "react"; +import { useRouter } from "next/router"; +import clsx from "clsx"; +import Link from "next/link"; +import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict"; +import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; +import TopNav from "components/organisms/TopNav/top-nav"; +import Title from "components/atoms/Typography/title"; +import Button from "components/atoms/Button/button"; +import SkeletonWrapper from "components/atoms/SkeletonLoader/skeleton-wrapper"; +import PaginationResults from "components/molecules/PaginationResults/pagination-result"; +import Pagination from "components/molecules/Pagination/pagination"; +import DashContainer from "components/atoms/DashedContainer/DashContainer"; +import Avatar from "components/atoms/Avatar/avatar"; +import { getAvatarByUsername } from "lib/utils/github"; +import { getNotificationURL } from "lib/utils/get-notification-url"; +import changeCapitalization from "lib/utils/change-capitalization"; + +interface NotificationProps {} +interface NotificationResponse { + data: DbUserNotification[]; + meta: Meta; +} + +const Notifications: NextPage = () => { + const [page, setPage] = useState(1); + const [loading, setLoading] = useState(false); + const [user, setUser] = useState(); + const [notificationsResponse, setNotificationsResponse] = useState(); + const [filter, setFilter] = useState<"all" | "follow" | "highlight_reaction">("all"); + const topRef = useRef(null); + const { sessionToken } = useSupabaseAuth(true); + console.log({ notificationsResponse }); + + const router = useRouter(); + const { username } = router.query; + + const fetchUserData = async (page = 1) => { + if (!username) return; + setLoading(true); + const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/users/${username}?limit=10&page=${page}`, { + headers: { + accept: "application/json", + }, + }); + + const data = (await req.json()) as DbUser; + setUser(data); + setLoading(false); + }; + + const fetchNotifications = async () => { + if (!sessionToken) return; + setLoading(true); + const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user/notifications`, { + headers: { + accept: "application/json", + Authorization: `Bearer ${sessionToken}`, + }, + }); + const notifications = await req.json(); + setNotificationsResponse(notifications); + setLoading(false); + }; + + const notifications = useMemo(() => { + if (!notificationsResponse?.data) return []; + if (filter === "all") return notificationsResponse?.data!; + return notificationsResponse?.data.filter((notification) => notification.type === filter); + }, [notificationsResponse?.data, filter]); + + useEffect(() => { + fetchNotifications(); + fetchUserData(); + if (username && sessionToken) { + router.push(`/user/${username}/notifications?filter=all`); + } + }, [sessionToken]); + + const handlePageChange = (page: number) => { + setPage(page); + fetchUserData(page); + }; + + return ( +
+ +
+
+ + Notifications + + +
+
+
+ {loading && + Array.from({ length: 8 }).map((_, index) => ( +
+ +
+ + +
+
+ ))} +
+ {!loading && !notifications?.length ? ( + +
+

+ You don't have any{" "} + {changeCapitalization(filter === "highlight_reaction" ? "Highlight Reactions" : filter, true)}{" "} + notifications yet!
+

+
+
+ ) : ( +
+ {notifications?.map((notification) => ( +
+ +
+

+ + {notification.meta_id} + + {notification.message.replace(notification.meta_id, " ")} +

+ + {formatDistanceToNowStrict(new Date(notification.notified_at), { addSuffix: true })} + +
+
+ ))} +
+ )} + {(notificationsResponse?.meta?.pageCount ?? 0) > 1 && ( +
+
+ +
+ +
+ )} +
+
+
+ ); +}; + +export default Notifications; From 7f1fa5232955a73c1c1d344873030ab57ad4ff0d Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Fri, 4 Aug 2023 00:08:42 +0000 Subject: [PATCH 02/18] remove notification dropdown --- .../molecules/AuthSection/auth-section.tsx | 66 +++---------------- pages/user/[username]/notifications.tsx | 60 ++++++++--------- 2 files changed, 37 insertions(+), 89 deletions(-) diff --git a/components/molecules/AuthSection/auth-section.tsx b/components/molecules/AuthSection/auth-section.tsx index ec45a4e75c..753334da20 100644 --- a/components/molecules/AuthSection/auth-section.tsx +++ b/components/molecules/AuthSection/auth-section.tsx @@ -17,9 +17,6 @@ import Button from "components/atoms/Button/button"; import Text from "components/atoms/Typography/text"; import GitHubIcon from "img/icons/github-icon.svg"; import Icon from "components/atoms/Icon/icon"; -import NotificationCard from "components/atoms/NotificationsCard/notification-card"; -import { Spinner } from "components/atoms/SpinLoader/spin-loader"; -import { Popover, PopoverContent, PopoverTrigger } from "../Popover/popover"; import DropdownList from "../DropdownList/dropdown-list"; import OnboardingButton from "../OnboardingButton/onboarding-button"; import userAvatar from "../../../img/ellipse-1.png"; @@ -42,26 +39,6 @@ const AuthSection: React.FC = ({}) => { } }, []); - // Fetch user notifications - const fetchNotifications = async () => { - if (userInfo && userInfo.notification_count > 0) { - setLoading(true); - const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user/notifications`, { - headers: { - accept: "application/json", - Authorization: `Bearer ${sessionToken}`, - }, - }); - setLoading(false); - if (req.ok) { - const notifications = await req.json(); - setNotifications(notifications.data as DbUserNotification[]); - } - } else { - return; - } - }; - useEffect(() => { const getUser = async () => { if (session && !userInfo) { @@ -132,42 +109,15 @@ const AuthSection: React.FC = ({}) => { ) : ( "" )} - { - // reset the notification state to empty when the popover is closed - if (!loading && !state) setUserInfo(undefined); - }} + - - - {loading ? ( -
- -
- ) : ( - <> - {notifications.length > 0 ? ( -
- {notifications.map(({ type, message, id, meta_id }) => ( - - ))} -
- ) : ( -
- You do not have any unread notification -
- )} - - )} -
-
+ {userInfo && userInfo.notification_count > 0 && ( + + )} + +
diff --git a/pages/user/[username]/notifications.tsx b/pages/user/[username]/notifications.tsx index 0e8461aafd..6cf55b73af 100644 --- a/pages/user/[username]/notifications.tsx +++ b/pages/user/[username]/notifications.tsx @@ -1,8 +1,8 @@ -import { NextPage } from "next"; import { useEffect, useMemo, useRef, useState } from "react"; import { useRouter } from "next/router"; import clsx from "clsx"; import Link from "next/link"; + import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict"; import useSupabaseAuth from "lib/hooks/useSupabaseAuth"; import TopNav from "components/organisms/TopNav/top-nav"; @@ -16,14 +16,14 @@ import Avatar from "components/atoms/Avatar/avatar"; import { getAvatarByUsername } from "lib/utils/github"; import { getNotificationURL } from "lib/utils/get-notification-url"; import changeCapitalization from "lib/utils/change-capitalization"; +import { WithPageLayout } from "interfaces/with-page-layout"; -interface NotificationProps {} interface NotificationResponse { data: DbUserNotification[]; meta: Meta; } -const Notifications: NextPage = () => { +const Notifications: WithPageLayout = () => { const [page, setPage] = useState(1); const [loading, setLoading] = useState(false); const [user, setUser] = useState(); @@ -36,10 +36,10 @@ const Notifications: NextPage = () => { const router = useRouter(); const { username } = router.query; - const fetchUserData = async (page = 1) => { + const fetchUserData = async () => { if (!username) return; setLoading(true); - const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/users/${username}?limit=10&page=${page}`, { + const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/users/${username}`, { headers: { accept: "application/json", }, @@ -50,10 +50,10 @@ const Notifications: NextPage = () => { setLoading(false); }; - const fetchNotifications = async () => { + const fetchNotifications = async (page = 1) => { if (!sessionToken) return; setLoading(true); - const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user/notifications`, { + const req = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/user/notifications?limit=10&page=${page}`, { headers: { accept: "application/json", Authorization: `Bearer ${sessionToken}`, @@ -76,18 +76,23 @@ const Notifications: NextPage = () => { if (username && sessionToken) { router.push(`/user/${username}/notifications?filter=all`); } - }, [sessionToken]); + }, [sessionToken, username]); const handlePageChange = (page: number) => { setPage(page); - fetchUserData(page); + fetchNotifications(page); + if (topRef.current) { + topRef.current.scrollIntoView({ + behavior: "smooth", + }); + } }; return (
@@ -130,10 +135,10 @@ const Notifications: NextPage = () => {
-
-
- {loading && - Array.from({ length: 8 }).map((_, index) => ( +
+ {loading ? ( +
+ {Array.from({ length: 8 }).map((_, index) => (
@@ -142,8 +147,8 @@ const Notifications: NextPage = () => {
))} -
- {!loading && !notifications?.length ? ( +
+ ) : notifications?.length <= 0 ? (

@@ -160,7 +165,6 @@ const Notifications: NextPage = () => { = () => { ))}

)} - {(notificationsResponse?.meta?.pageCount ?? 0) > 1 && ( -
+ {notifications?.length > 0 && (notificationsResponse?.meta?.pageCount ?? 0) > 1 && ( +
= () => { } } total={notificationsResponse?.meta?.itemCount ?? 0} - entity={"highlights"} + entity={"notifications"} />
handlePageChange(pageNumber)} />
)} @@ -224,4 +221,5 @@ const Notifications: NextPage = () => { ); }; +Notifications.isPrivateRoute = true; export default Notifications; From a6409cc141fc1557ead2135396f5ee980d64a35d Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Fri, 4 Aug 2023 18:29:54 +0000 Subject: [PATCH 03/18] redirect user if they try to access other user's notifications --- lib/utils/get-notification-url.ts | 12 +++++++++--- middleware.ts | 20 ++++++++++++++++---- pages/user/[username]/notifications.tsx | 13 +++++++++---- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/lib/utils/get-notification-url.ts b/lib/utils/get-notification-url.ts index 5ab8e366c8..ca35dbad12 100644 --- a/lib/utils/get-notification-url.ts +++ b/lib/utils/get-notification-url.ts @@ -1,9 +1,15 @@ -export const getNotificationURL = (type: string, id: string) => { +/** + * Returns the URL for a notification based on its type and ID or username. + * @param type - The type of the notification. + * @param idOrUsername - The ID or username associated with the notification. + * @returns The URL for the notification. + */ +export const getNotificationURL = (type: string, idOrUsername: string) => { switch (type) { case "highlight_reaction": - return `/feed/${id}`; + return `/feed/${idOrUsername}`; case "follow": - return `/user/${id}`; + return `/user/${idOrUsername}`; default: return "/"; } diff --git a/middleware.ts b/middleware.ts index 8be350516a..973513efc1 100644 --- a/middleware.ts +++ b/middleware.ts @@ -11,6 +11,21 @@ export async function middleware(req: NextRequest) { data: { session }, } = await supabase.auth.getSession(); + const redirectUrl = req.nextUrl.clone(); + redirectUrl.pathname = "/javascript/dashboard/filter/recent"; + redirectUrl.searchParams.set("redirectedFrom", req.nextUrl.pathname); + + // redirect user if they are trying to access a user's notifications page + if (req.nextUrl.pathname.includes("/user/") && req.nextUrl.pathname.includes("/notifications")) { + const username = req.nextUrl.pathname.split("/")[2]; + + if (username && (!session || session.user?.user_metadata.user_name.toLowerCase() !== username.toLowerCase())) { + return NextResponse.redirect(redirectUrl); + } + + return res; + } + // Check auth condition if (session?.user || req.nextUrl.searchParams.has("login")) { // Authentication successful, forward request to protected route. @@ -18,12 +33,9 @@ export async function middleware(req: NextRequest) { } // Auth condition not met, redirect to home page. - const redirectUrl = req.nextUrl.clone(); - redirectUrl.pathname = "/javascript/dashboard/filter/recent"; - redirectUrl.searchParams.set("redirectedFrom", req.nextUrl.pathname); return NextResponse.redirect(redirectUrl); } export const config = { - matcher: ["/hub/insights/:path*", "/user/:path"], + matcher: ["/hub/insights/:path*", "/user/:path", "/user/:username/notifications"], }; diff --git a/pages/user/[username]/notifications.tsx b/pages/user/[username]/notifications.tsx index 6cf55b73af..a9f3eb894f 100644 --- a/pages/user/[username]/notifications.tsx +++ b/pages/user/[username]/notifications.tsx @@ -31,7 +31,6 @@ const Notifications: WithPageLayout = () => { const [filter, setFilter] = useState<"all" | "follow" | "highlight_reaction">("all"); const topRef = useRef(null); const { sessionToken } = useSupabaseAuth(true); - console.log({ notificationsResponse }); const router = useRouter(); const { username } = router.query; @@ -66,13 +65,19 @@ const Notifications: WithPageLayout = () => { const notifications = useMemo(() => { if (!notificationsResponse?.data) return []; - if (filter === "all") return notificationsResponse?.data!; - return notificationsResponse?.data.filter((notification) => notification.type === filter); + if (filter === "all") + return notificationsResponse?.data?.sort( + (a, b) => new Date(b.notified_at).getTime() - new Date(a.notified_at).getTime() + ); + return notificationsResponse?.data + .filter((notification) => notification.type === filter) + ?.sort((a, b) => new Date(b.notified_at).getTime() - new Date(a.notified_at).getTime()); }, [notificationsResponse?.data, filter]); useEffect(() => { fetchNotifications(); fetchUserData(); + if (username && sessionToken) { router.push(`/user/${username}/notifications?filter=all`); } @@ -172,7 +177,7 @@ const Notifications: WithPageLayout = () => { />

- + {notification.meta_id} {notification.message.replace(notification.meta_id, " ")} From cc4e48343fce40e609df83fedb07973c02b8067f Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Fri, 4 Aug 2023 11:47:21 -0700 Subject: [PATCH 04/18] Update pages/user/[username]/notifications.tsx --- pages/user/[username]/notifications.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/user/[username]/notifications.tsx b/pages/user/[username]/notifications.tsx index a9f3eb894f..f1c0129093 100644 --- a/pages/user/[username]/notifications.tsx +++ b/pages/user/[username]/notifications.tsx @@ -158,7 +158,7 @@ const Notifications: WithPageLayout = () => {

You don't have any{" "} - {changeCapitalization(filter === "highlight_reaction" ? "Highlight Reactions" : filter, true)}{" "} + {changeCapitalization(filter === "highlight_reaction" ? "reaction" : filter, true)}{" "} notifications yet!

From a34f58dc3f2cc6f1e97216f4e9e281853ca49dfa Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Fri, 4 Aug 2023 11:47:31 -0700 Subject: [PATCH 05/18] Update pages/user/[username]/notifications.tsx --- pages/user/[username]/notifications.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/user/[username]/notifications.tsx b/pages/user/[username]/notifications.tsx index f1c0129093..6bc2673926 100644 --- a/pages/user/[username]/notifications.tsx +++ b/pages/user/[username]/notifications.tsx @@ -136,7 +136,7 @@ const Notifications: WithPageLayout = () => { router.push(`/user/${username}/notifications?filter=highlight_reaction`); }} > - Highlight Reaction + Reaction
From aaae34dec17fcba33dee9cf12f896347827b018d Mon Sep 17 00:00:00 2001 From: El Hadji Malick Seck Date: Fri, 4 Aug 2023 18:50:52 +0000 Subject: [PATCH 06/18] Update pages/user/[username]/notifications.tsx Co-authored-by: Brandon Roberts --- pages/user/[username]/notifications.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/user/[username]/notifications.tsx b/pages/user/[username]/notifications.tsx index 6bc2673926..9edcdb3d56 100644 --- a/pages/user/[username]/notifications.tsx +++ b/pages/user/[username]/notifications.tsx @@ -153,7 +153,7 @@ const Notifications: WithPageLayout = () => {
))}
- ) : notifications?.length <= 0 ? ( + ) : notifications?.length <= 0 && !loading ? (

From 74eaeeb88fa63fe0661f77a74354a8385e826ef9 Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Fri, 4 Aug 2023 18:57:03 +0000 Subject: [PATCH 07/18] update notifications path and middleware --- middleware.ts | 13 +------------ pages/user/{[username] => }/notifications.tsx | 6 +++--- 2 files changed, 4 insertions(+), 15 deletions(-) rename pages/user/{[username] => }/notifications.tsx (98%) diff --git a/middleware.ts b/middleware.ts index 973513efc1..8113e78bff 100644 --- a/middleware.ts +++ b/middleware.ts @@ -15,17 +15,6 @@ export async function middleware(req: NextRequest) { redirectUrl.pathname = "/javascript/dashboard/filter/recent"; redirectUrl.searchParams.set("redirectedFrom", req.nextUrl.pathname); - // redirect user if they are trying to access a user's notifications page - if (req.nextUrl.pathname.includes("/user/") && req.nextUrl.pathname.includes("/notifications")) { - const username = req.nextUrl.pathname.split("/")[2]; - - if (username && (!session || session.user?.user_metadata.user_name.toLowerCase() !== username.toLowerCase())) { - return NextResponse.redirect(redirectUrl); - } - - return res; - } - // Check auth condition if (session?.user || req.nextUrl.searchParams.has("login")) { // Authentication successful, forward request to protected route. @@ -37,5 +26,5 @@ export async function middleware(req: NextRequest) { } export const config = { - matcher: ["/hub/insights/:path*", "/user/:path", "/user/:username/notifications"], + matcher: ["/hub/insights/:path*", "/user/:path"], }; diff --git a/pages/user/[username]/notifications.tsx b/pages/user/notifications.tsx similarity index 98% rename from pages/user/[username]/notifications.tsx rename to pages/user/notifications.tsx index 9edcdb3d56..4f838f759f 100644 --- a/pages/user/[username]/notifications.tsx +++ b/pages/user/notifications.tsx @@ -136,7 +136,7 @@ const Notifications: WithPageLayout = () => { router.push(`/user/${username}/notifications?filter=highlight_reaction`); }} > - Reaction + Reaction

@@ -158,8 +158,8 @@ const Notifications: WithPageLayout = () => {

You don't have any{" "} - {changeCapitalization(filter === "highlight_reaction" ? "reaction" : filter, true)}{" "} - notifications yet!
+ {changeCapitalization(filter === "highlight_reaction" ? "reaction" : filter, true)} notifications yet!{" "} +

From 5076a55fb34d8c9018d246d292aa1a47d1cca6aa Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Fri, 4 Aug 2023 19:11:24 +0000 Subject: [PATCH 08/18] add test for get notifications function --- lib/utils/get-notification-url.ts | 8 +++---- tests/lib/utils/get-notifications-url.test.ts | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 tests/lib/utils/get-notifications-url.test.ts diff --git a/lib/utils/get-notification-url.ts b/lib/utils/get-notification-url.ts index ca35dbad12..4f5fc4d82b 100644 --- a/lib/utils/get-notification-url.ts +++ b/lib/utils/get-notification-url.ts @@ -1,15 +1,15 @@ /** * Returns the URL for a notification based on its type and ID or username. * @param type - The type of the notification. - * @param idOrUsername - The ID or username associated with the notification. + * @param id - The ID or username associated with the notification. * @returns The URL for the notification. */ -export const getNotificationURL = (type: string, idOrUsername: string) => { +export const getNotificationURL = (type: string, id: string | number) => { switch (type) { case "highlight_reaction": - return `/feed/${idOrUsername}`; + return `/feed/${id}`; case "follow": - return `/user/${idOrUsername}`; + return `/user/${id}`; default: return "/"; } diff --git a/tests/lib/utils/get-notifications-url.test.ts b/tests/lib/utils/get-notifications-url.test.ts new file mode 100644 index 0000000000..19d3c5e0df --- /dev/null +++ b/tests/lib/utils/get-notifications-url.test.ts @@ -0,0 +1,24 @@ +import { getNotificationURL } from "lib/utils/get-notification-url"; + +describe("[lib] getNotificationURL()", () => { + it("should return the correct URL for a highlight reaction notification", () => { + const type = "highlight_reaction"; + const idOrUsername = 30; + const result = getNotificationURL(type, idOrUsername); + expect(result).toBe("/feed/30"); + }); + + it("should return the correct URL for a follow notification", () => { + const type = "follow"; + const idOrUsername = "takanome-dev"; + const result = getNotificationURL(type, idOrUsername); + expect(result).toBe("/user/takanome-dev"); + }); + + it("should return the correct URL for an unknown notification", () => { + const type = "unknown"; + const idOrUsername = "unknown"; + const result = getNotificationURL(type, idOrUsername); + expect(result).toBe("/"); + }); +}); From 42d6797534a78c33862a5dc7641cb9af408e7f48 Mon Sep 17 00:00:00 2001 From: takanome_dev Date: Fri, 4 Aug 2023 19:37:50 +0000 Subject: [PATCH 09/18] remove unnecessary request and checks --- .../molecules/AuthSection/auth-section.tsx | 10 ++--- pages/user/notifications.tsx | 37 ++++++------------- 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/components/molecules/AuthSection/auth-section.tsx b/components/molecules/AuthSection/auth-section.tsx index 753334da20..fa5a6f7259 100644 --- a/components/molecules/AuthSection/auth-section.tsx +++ b/components/molecules/AuthSection/auth-section.tsx @@ -27,12 +27,11 @@ const AuthSection: React.FC = ({}) => { const router = useRouter(); const currentPath = router.asPath; - const { signIn, signOut, user, sessionToken } = useSupabaseAuth(); + const { signIn, signOut, user } = useSupabaseAuth(); const { onboarded, session } = useSession(true); - const [notifications, setNotifications] = useState([]); - const [loading, setLoading] = useState(false); const [userInfo, setUserInfo] = useState(undefined); const [host, setHost] = useState(""); + useEffect(() => { if (typeof window !== "undefined") { setHost(window.location.origin as string); @@ -109,10 +108,7 @@ const AuthSection: React.FC = ({}) => { ) : ( "" )} -
From 24e4323bcdc2293a348a6aba9a17f11259d43571 Mon Sep 17 00:00:00 2001 From: Brian Douglas Date: Sat, 5 Aug 2023 07:20:28 -0700 Subject: [PATCH 14/18] Update pages/user/notifications.tsx --- pages/user/notifications.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/user/notifications.tsx b/pages/user/notifications.tsx index 6d34864160..9ccc78f920 100644 --- a/pages/user/notifications.tsx +++ b/pages/user/notifications.tsx @@ -107,7 +107,7 @@ const Notifications: WithPageLayout = () => { router.push(`/user/notifications?filter=follow`); }} > - Follow + Follows