From 6effa5b4be9cae906a54e277615e0b7b39d0fea9 Mon Sep 17 00:00:00 2001 From: Giovanni Martire Date: Wed, 31 Jan 2024 23:44:25 +0100 Subject: [PATCH 1/2] Hide login button if user is logged --- app/page.tsx | 9 ------ components/Button/LoginButton.tsx | 46 +++++++++++++++++-------------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index ba2d83d..bb6878d 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -6,18 +6,9 @@ import decoration4 from '@/public/decorations/decoration-4.svg'; import fullLogo from '@/public/logos/full-logo.svg'; import Image from 'next/image'; import Balancer from 'react-wrap-balancer'; -import { getUserData } from './actions'; import styles from './page.module.css'; -export const revalidate = 60; - -const getUser = async () => { - return await getUserData(); -}; - export default async function Home() { - const user = await getUser(); - return (
diff --git a/components/Button/LoginButton.tsx b/components/Button/LoginButton.tsx index ee1a4a4..7983795 100644 --- a/components/Button/LoginButton.tsx +++ b/components/Button/LoginButton.tsx @@ -1,26 +1,30 @@ 'use client'; import { loginIntoWebsite } from '@/app/actions'; +import { useUser } from '@/util/hooks'; export default function LoginButton() { - return ( - - ); + const user = useUser(); + + if (!user?.osuId) + return ( + + ); } From 3886d0e926ff2973009ac37ac58022c483f905b1 Mon Sep 17 00:00:00 2001 From: Giovanni Martire Date: Thu, 1 Feb 2024 01:19:45 +0100 Subject: [PATCH 2/2] Fix unmatched rating value --- app/dashboard/page.tsx | 2 +- app/users/[id]/page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 55b4a35..4dee5fa 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -67,7 +67,7 @@ export default async function page({
- {Math.floor(data.generalStats.rating)} + {Math.round(data.generalStats.rating)}
- {Math.floor(data.generalStats.rating)} + {Math.round(data.generalStats.rating)}