Skip to content

Commit

Permalink
Merge pull request #72 from AkinariHex/nextjs
Browse files Browse the repository at this point in the history
Unmatched values fix and hide to login button
  • Loading branch information
AkinariHex authored Feb 1, 2024
2 parents 5a9977f + 3886d0e commit d4a74aa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default async function page({
<div className={styles.graphContainer}>
<div className={styles.header}>
<div className={styles.rating}>
<span>{Math.floor(data.generalStats.rating)}</span>
<span>{Math.round(data.generalStats.rating)}</span>
<span
className={clsx(
styles.change,
Expand Down
9 changes: 0 additions & 9 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<main className={styles.main}>
<div className={styles.row}>
Expand Down
2 changes: 1 addition & 1 deletion app/users/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default async function page({
<div className={styles.graphContainer}>
<div className={styles.header}>
<div className={styles.rating}>
<span>{Math.floor(data.generalStats.rating)}</span>
<span>{Math.round(data.generalStats.rating)}</span>
<span
className={clsx(
styles.change,
Expand Down
46 changes: 25 additions & 21 deletions components/Button/LoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
'use client';
import { loginIntoWebsite } from '@/app/actions';
import { useUser } from '@/util/hooks';

export default function LoginButton() {
return (
<button
onClick={(e) => {
e.preventDefault();
return loginIntoWebsite();
}}
style={{
padding: '1.2rem 5rem',
backgroundColor: 'hsla(var(--blue-500))',
border: '0',
borderRadius: 'var(--main-borderRadius)',
fontSize: '1.2rem',
fontWeight: 500,
color: '#fff',
width: 'fit-content',
cursor: 'pointer',
}}
>
Login
</button>
);
const user = useUser();

if (!user?.osuId)
return (
<button
onClick={(e) => {
e.preventDefault();
return loginIntoWebsite();
}}
style={{
padding: '1.2rem 5rem',
backgroundColor: 'hsla(var(--blue-500))',
border: '0',
borderRadius: 'var(--main-borderRadius)',
fontSize: '1.2rem',
fontWeight: 500,
color: '#fff',
width: 'fit-content',
cursor: 'pointer',
}}
>
Login
</button>
);
}

0 comments on commit d4a74aa

Please sign in to comment.