Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement EpisodeChart.tsx #807

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Implement EpisodeChart.tsx #807

wants to merge 5 commits into from

Conversation

Desperationis
Copy link
Contributor

@Desperationis Desperationis commented May 12, 2024

EpisodeChart is a component that uses TeamChart to display the top 10 teams in any given year. I also added one more prop to TeamChart to take in tournament dates. I'll implement EpisodeChart automatically listing tournament dates later, for now there is only placeholder code that shows up in bc22.

Closes #783 🚀

@Desperationis Desperationis requested review from lowtorola and acrantel and removed request for lowtorola May 12, 2024 20:39
@lowtorola
Copy link
Contributor

@Desperationis see how the charts don't fill the section card? Is this how they look on your end?

Screenshot 2024-05-12 at 11 21 54 PM

@lowtorola lowtorola marked this pull request as draft May 13, 2024 15:40
Comment on lines +71 to +72
["Tournament 1", 1673156004189],
["Tournament 2", 1673164004189],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can query the tournaments from the api (would recommend) and just use the display_date field 😎

export interface TeamChartProps {
yAxisLabel: string;
values?: Record<string, ChartData[]>;
loading?: boolean;
loadingMessage?: string;
plotLines?: Array<[string, UTCMilliTimestamp]>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would a name like verticalLabels or similar be more descriptive of what these actually look like/are?


const EpisodeChart = (): JSX.Element => {
const queryClient = useQueryClient();
const [episode, setEpisode] = useState("bc23");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have an importable helper constant called DEFAULT_EPISODE that could be used for a default, or (I'd prefer) could simply query the name_short of the currently navigated-to episode id using useEpisodeId

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also nit: this is an episodeId not an episode (super minor)

Comment on lines +48 to +54
let options = [{ value: "", label: "" }];

if (episodeList?.results !== undefined) {
options = episodeList.results.map((e) => {
return { value: e.name_short, label: e.name_long };
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a useMemo might save some performance here, as well as make this more interpretable


return (
<div>
<SelectMenu
Copy link
Contributor

@lowtorola lowtorola May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a loading prop to the SelectMenu, so you could populate it here with episodeList.isLoading (although it should be always pre-loaded with stale data since it is one of the first queries we call on app launch)

@Desperationis
Copy link
Contributor Author

Hi Lowell, thanks for the feedback. I'm a little hosed studying for finals right now but once that is settled I'll do the tweaks

@lowtorola lowtorola mentioned this pull request Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-Year Ranking History Graph
2 participants