From 357f0051a09c0977de9d67ea8c240721eec0f535 Mon Sep 17 00:00:00 2001 From: Aryan Kothari <87589047+thearyadev@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:34:57 -0500 Subject: [PATCH] add disclaimer --- frontend/app/components/topmatter/topmatter.tsx | 6 +++++- frontend/app/season/[seasonNumber]/page.tsx | 5 +++-- frontend/app/utils/serverSideProps.ts | 6 ++++++ server.py | 4 ++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/app/components/topmatter/topmatter.tsx b/frontend/app/components/topmatter/topmatter.tsx index fc6ab7d4..780256f3 100644 --- a/frontend/app/components/topmatter/topmatter.tsx +++ b/frontend/app/components/topmatter/topmatter.tsx @@ -1,4 +1,4 @@ -const TopMatter = ({ seasonNumber }: { seasonNumber: string }) => { +const TopMatter = ({ seasonNumber, disclaimer }: { seasonNumber: string, disclaimer?: string }) => { let indicator = ""; if (seasonNumber == "trends") { indicator = "Trends"; @@ -9,6 +9,10 @@ const TopMatter = ({ seasonNumber }: { seasonNumber: string }) => { return (

{indicator}

+ + {disclaimer ? + (

DISCLAIMER: {disclaimer}

) : undefined + }

Welcome to Overwatch 2 Top 500 Aggregator

diff --git a/frontend/app/season/[seasonNumber]/page.tsx b/frontend/app/season/[seasonNumber]/page.tsx index 45c54ddd..9baadd28 100644 --- a/frontend/app/season/[seasonNumber]/page.tsx +++ b/frontend/app/season/[seasonNumber]/page.tsx @@ -1,6 +1,7 @@ import React from "react"; import { Card } from "@/app/components"; import { + fetchSeasonDisclaimer, fetchSeasonList, fetchSingleSeasonPageChartData, fetchSingleSeasonStdDevs, @@ -30,10 +31,10 @@ const SeasonPage = async ({ params }: { params: { seasonNumber: string } }) => { +params.seasonNumber, ); const seasonStdDevs = await fetchSingleSeasonStdDevs(+params.seasonNumber); - + const disclaimer = await fetchSeasonDisclaimer(+params.seasonNumber) ?? undefined return (
- + { const response = await fetch(`${backendUrl}/d/all_seasons_std_by_role`); return await response.json(); } + +export async function fetchSeasonDisclaimer(seasonNumber: number): Promise { + const response = await fetch(`${backendUrl}/d/season_disclaimer/${seasonNumber}`) + return await response.json() + +} diff --git a/server.py b/server.py index 4e45af29..a2acffc9 100644 --- a/server.py +++ b/server.py @@ -503,6 +503,10 @@ async def chart_data(season: str): async def trend_chart_data(): return Response(content=json.dumps(trends_data()), media_type="application/json") +@app.get("/d/season_disclaimer/{season}") +async def single_season_disclaimer(season: str): + return db.get_season_disclaimer(season) + @app.on_event("startup") async def startup():