-
Notifications
You must be signed in to change notification settings - Fork 1
/
TeamPage.js
46 lines (39 loc) · 1.16 KB
/
TeamPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React from "react";
import { Grid, Loader } from "semantic-ui-react";
import { useParams } from "react-router-dom";
import { useSelector } from "react-redux";
import PageHeader from "../../app/PageHeader";
import ContentCard from "../../cards/ContentCard";
import { selectTeamById } from "./teamsSlice";
import TeamDetail from "./TeamDetail";
function TeamPage() {
const { leagueId, teamId } = useParams();
const team = useSelector((state) => selectTeamById(state, +teamId));
const renderedHeader = (
<PageHeader>
{team ? (
<TeamDetail teamId={team.team_id} header={true} />
) : (
<Loader active={true} inline={true} />
)}
</PageHeader>
);
const renderedBody = team ? (
<Grid>
<ContentCard type="teamStandings" leagueId={+leagueId} teamId={+teamId} />
<ContentCard type="teamSchedule" leagueId={+leagueId} teamId={+teamId} />
<ContentCard type="teamForm" leagueId={+leagueId} teamId={+teamId} />
</Grid>
) : (
<Loader active={true} size="large">
Loading
</Loader>
);
return (
<div>
{renderedHeader}
{renderedBody}
</div>
);
}
export default TeamPage;