diff --git a/README.md b/README.md index c403366..652d99e 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,5 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). +![osu! Tournament Rating](https://akinariosu.s-ul.eu/X1Me0Jpd) -## Getting Started +# o!TR Web -First, run the development server: - -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev -``` - -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. - -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. - -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. - -## Learn More - -To learn more about Next.js, take a look at the following resources: - -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. - -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! - -## Deploy on Vercel - -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. - -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +[![CodeFactor](https://www.codefactor.io/repository/github/osu-tournament-rating/otr-web/badge)](https://www.codefactor.io/repository/github/osu-tournament-rating/otr-web) diff --git a/app/actions.ts b/app/actions.ts index cb2d2fa..5abf906 100644 --- a/app/actions.ts +++ b/app/actions.ts @@ -23,7 +23,7 @@ export async function getUserData() { }, */ }); - if (res.status !== 200) { + if (!res?.ok) { const errorMessage = await res.text(); return { @@ -35,22 +35,9 @@ export async function getUserData() { }; } - if (res.status === 200) { - res = await res.json(); - - return res; - } + res = await res.json(); - /* .then((response) => { - return response.json(); - }) - .then((data) => { - console.log(data); - return data; - }) - .catch((error) => { - console.error('Error fetching authenticated user:', error); - }); */ + return res; } export async function checkUserLogin() { @@ -67,11 +54,13 @@ export async function checkUserLogin() { }); if (!res?.ok) { - const errorCode = res?.status; + const errorMessage = await res.text(); return { error: { - errorCode, + status: res?.status, + text: res?.statusText, + message: errorMessage, }, }; } @@ -204,6 +193,10 @@ export async function saveTournamentMatches( } } +export async function getOsuModeCookie() { + return cookies().get('OTR-user-selected-osu-mode'); +} + export async function changeOsuModeCookie(mode?: string) { await cookies().set('OTR-user-selected-osu-mode', mode ?? '0'); return; diff --git a/app/dashboard/page.module.css b/app/dashboard/page.module.css index 64b7bd0..d961a3d 100644 --- a/app/dashboard/page.module.css +++ b/app/dashboard/page.module.css @@ -65,10 +65,6 @@ color: hsla(var(--red-400)); } -.change.negative::before { - content: '-'; -} - .header .stats { display: flex; flex-flow: row; diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index e90e753..702ff82 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -102,7 +102,7 @@ export default async function page({
- +
@@ -162,32 +162,6 @@ export default async function page({ - -
- Most played - - {data?.matchStats.mostPlayedTeammateName} - -
-
- Best teammate - - {data?.matchStats.bestTeammateName} - -
-
- -
- Most played - - {data?.matchStats.mostPlayedOpponentName} - -
-
- Best opponent - TO DO -
-
diff --git a/app/globals.css b/app/globals.css index ee8bd14..c0a4747 100644 --- a/app/globals.css +++ b/app/globals.css @@ -117,6 +117,10 @@ /* USER RATING TIER */ --tier-bar-background: var(--gray-300); --tier-bar-accent: var(--accent-color); + + /* TOAST */ + --toast-error-bg: var(--yellow-200); + --toast-error-border: 50, 70%, 64%; } * { diff --git a/app/layout.tsx b/app/layout.tsx index e38bd47..6732abc 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,5 +1,6 @@ import Footer from '@/components/Footer/Footer'; -import NavBar from '@/components/NavBar/NavBar'; +import { LayoutProvider } from '@/components/LayoutProvider/LayoutProvider'; +import ErrorProvider from '@/util/ErrorContext'; import UserProvider from '@/util/UserLoggedContext'; import type { Metadata } from 'next'; import { Viewport } from 'next'; @@ -32,11 +33,14 @@ export default function RootLayout({ return ( - - - {children} -