Skip to content

Commit 6fd8e8d

Browse files
committed
Change the Route for profile user stats
1 parent c827fdd commit 6fd8e8d

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

src/app/components/Leaderboard/LeaderboardElement.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ const colors = ['#FFB900', '#69797E', '#847545', '#038387'];
1616
export class LeaderboardElement extends React.Component<LeaderboardInterfaces.ElementProps, {}> {
1717
public render() {
1818
const { player, index, isPlayAgainstDisabled, runMatch, currentUsername } = this.props;
19+
let urlToProfile;
1920
if (player.username === currentUsername) {
20-
const urlToProfile = `/profile`;
21+
urlToProfile = `/profile`;
2122
} else {
22-
const urlToProfile = `/profile/${player.username}`;
23+
urlToProfile = `/profile/${player.username}`;
2324
}
24-
const playerTotalMatches = player.numWin + player.numLoss + player.numTie;
25+
const playerTotalMatches = player.numWin + player.numLoss + player.numTie;
2526

2627
return (
2728
<Col
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as ProfileUserInterface from 'app/types/ProfileUser';
22
import * as React from 'react';
33

4-
export class ProfileUserStats extends React.Component<ProfileUserInterface.Props, {}> {
4+
export default class ProfileUserStats extends React.Component<ProfileUserInterface.Props, {}> {
55
public render() {
6+
console.log(this.props.match.params.username);
67
return <p>This is the Page for Profile user stats</p>;
78
}
89
}

src/app/containers/ProfileUsersStats.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ProfileUserActions } from 'app/actions';
2-
import { ProfileUserStats } from 'app/components/ProfileUserStats';
2+
import ProfileUserStats from 'app/components/ProfileUserStats';
33
import { RootState } from 'app/reducers';
44
import * as ProfileUserInterfaces from 'app/types/ProfileUser';
55
import { connect } from 'react-redux';

src/app/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import Login from 'app/containers/Authentication/Login';
33
import Register from 'app/containers/Authentication/Register';
44
import Dashboard from 'app/containers/Dashboard';
55
import Leaderboard from 'app/containers/Leaderboard';
6+
import ProfileUsersStats from 'app/containers/ProfileUsersStats';
67
import UserProfileModal from 'app/containers/UserProfileModal';
7-
import profileUserContainer from 'app/containers/ProfileUsersStats'
88
import { Routes } from 'app/routes';
99
// @ts-ignore
1010
import { initializeRendererAssets } from 'codecharacter-renderer';
@@ -25,7 +25,7 @@ export const App = hot(module)(() => (
2525
<Route exact path={Routes.REGISTER} component={Register} />
2626
<Route exact path={Routes.LEADERBOARD} component={Leaderboard} />
2727
<Route exact path={Routes.USER_PROFILE_MODEL} component={UserProfileModal} />
28-
<Route exact path={Routes.PROFILE_USER_STATS} component={profileUserContainer} />
28+
<Route exact path={Routes.PROFILE_USER_STATS} component={ProfileUsersStats} />
2929
</Switch>
3030
<PopUpMenu />
3131
<Sugar background="#484848" color="white" />

src/app/routes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ export enum Routes {
44
REGISTER = '/register',
55
LEADERBOARD = '/leaderboard',
66
USER_PROFILE_MODEL = '/profile',
7-
PROFILE_USER_STATS = '/profile/:username',
7+
PROFILE_USER_STATS = '/:username',
88
}

0 commit comments

Comments
 (0)