feature(database-connection): Add routing for dynamic seasons
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import React from 'react';
|
||||
import TableEntry from '../../models/TableEntry';
|
||||
import './UserList.scss';
|
||||
import SeasonSwitch from "../SeasonSwitch/SeasonSwitch";
|
||||
import UserStatsResponse from "../../models/UserStatsResponse";
|
||||
|
||||
// const UserList: React.FC = () => (
|
||||
// <div className="UserList" data-testid="UserList">
|
||||
@@ -8,17 +10,15 @@ import './UserList.scss';
|
||||
// </div>
|
||||
// );
|
||||
|
||||
interface UserListProperties {
|
||||
users: TableEntry[]
|
||||
}
|
||||
export default class UserList extends React.Component<IUserListProperties, IUserListState> {
|
||||
|
||||
class UserList extends React.Component<UserListProperties> {
|
||||
constructor(props: Readonly<IUserListProperties> | IUserListProperties) {
|
||||
super(props);
|
||||
|
||||
constructor(props: Readonly<UserListProperties>) {
|
||||
super(props);
|
||||
}
|
||||
this.state = { mocked: this.props.mocked }
|
||||
}
|
||||
|
||||
private createTableEntries(entries: TableEntry[]) {
|
||||
private createTableEntries(entries: TableEntry[]) {
|
||||
return entries.map((entry, index) => {
|
||||
const placement = index + 1;
|
||||
const placementClassName = placement === 1 ? "first-place"
|
||||
@@ -51,6 +51,7 @@ class UserList extends React.Component<UserListProperties> {
|
||||
render() {
|
||||
return (
|
||||
<div className="UserList" data-testid="UserList">
|
||||
<SeasonSwitch seasonId={this.props.userStats.seasonId} dates={this.props.userStats.dates} />
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -61,7 +62,7 @@ class UserList extends React.Component<UserListProperties> {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{this.createTableEntries(this.props.users)}
|
||||
{this.createTableEntries(this.props.userStats.stats)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -69,4 +70,11 @@ class UserList extends React.Component<UserListProperties> {
|
||||
}
|
||||
}
|
||||
|
||||
export default UserList;
|
||||
interface IUserListProperties {
|
||||
userStats: UserStatsResponse
|
||||
mocked: boolean
|
||||
}
|
||||
|
||||
interface IUserListState {
|
||||
mocked: boolean
|
||||
}
|
||||
Reference in New Issue
Block a user