Skip to content

Commit

Permalink
Merge pull request #166 from thearyadev/165-season-disclaimer-missing
Browse files Browse the repository at this point in the history
add disclaimer
  • Loading branch information
thearyadev authored Feb 28, 2024
2 parents f8abc92 + 357f005 commit 145fac3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 5 additions & 1 deletion frontend/app/components/topmatter/topmatter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const TopMatter = ({ seasonNumber }: { seasonNumber: string }) => {
const TopMatter = ({ seasonNumber, disclaimer }: { seasonNumber: string, disclaimer?: string }) => {
let indicator = "";
if (seasonNumber == "trends") {
indicator = "Trends";
Expand All @@ -9,6 +9,10 @@ const TopMatter = ({ seasonNumber }: { seasonNumber: string }) => {
return (
<div className="mt-5 lg:ml-3 lg:mr-3 sm:ml-1 sm:mr-1">
<h1 className="text-3xl pb-4">{indicator}</h1>

{disclaimer ?
(<p className="text-red-500"><span className="font-bold">DISCLAIMER: </span>{disclaimer}</p>) : undefined
}
<p className="pb-2">
<strong>Welcome to Overwatch 2 Top 500 Aggregator</strong>
</p>
Expand Down
5 changes: 3 additions & 2 deletions frontend/app/season/[seasonNumber]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { Card } from "@/app/components";
import {
fetchSeasonDisclaimer,
fetchSeasonList,
fetchSingleSeasonPageChartData,
fetchSingleSeasonStdDevs,
Expand Down Expand Up @@ -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 (
<main>
<TopMatter seasonNumber={params.seasonNumber} />
<TopMatter seasonNumber={params.seasonNumber} disclaimer={disclaimer} />
<Card
title="Role Standard Deviation: All Slots, All Regions"
subtitle={
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/utils/serverSideProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ export async function fetchSeasonalStdDevTrendByRole(): Promise<TrendLine[]> {
const response = await fetch(`${backendUrl}/d/all_seasons_std_by_role`);
return await response.json();
}

export async function fetchSeasonDisclaimer(seasonNumber: number): Promise<string> {
const response = await fetch(`${backendUrl}/d/season_disclaimer/${seasonNumber}`)
return await response.json()

}
4 changes: 4 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit 145fac3

Please sign in to comment.