Skip to content

Commit

Permalink
Reposition stats page under user profile settings
Browse files Browse the repository at this point in the history
  • Loading branch information
kprist committed Oct 12, 2018
1 parent 9333bbb commit 4255de9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import UserDecks from './UserDecks';
import UserCollections from '../../../DeckCollection/UserCollections';
import UserMenu from './UserMenu';
import UserRecommendations from '../UserRecommendations';
import UserStats from './UserStats';
import classNames from 'classnames/bind';
import { fetchUserDecks } from '../../../../actions/user/userprofile/fetchUserDecks';

Expand All @@ -28,18 +27,12 @@ class PrivatePublicUserProfile extends React.Component {
return <UserRecommendations loggedinuser={this.props.loggedinuser} loggedinUserId={this.props.loggedinUserId} />;
}

showUserStats(){
return (<UserStats userStats={this.props.userStats}></UserStats>);
}

chooseView(){
switch(this.props.category){
case 'playlists':
return this.showUserCollections();
case 'recommendations':
return this.showUserRecommendactions();
case 'stats':
return this.showUserStats();
case 'deck':
default:
return this.showUserDecks();
Expand Down Expand Up @@ -76,7 +69,7 @@ class PrivatePublicUserProfile extends React.Component {
</div>
<div className = "sixteen wide column">
<UserMenu user={ this.props.user } loggedinuser={this.props.loggedinuser} choice={ this.props.category } />
{ this.props.user.uname === this.props.loggedinuser && this.props.category !== 'playlists' && this.props.category !== 'recommendations' && this.props.category !== 'stats' &&
{ this.props.user.uname === this.props.loggedinuser && this.props.category !== 'playlists' && this.props.category !== 'recommendations' &&
<Segment>
<Header size='small' dividing >Publication status</Header>
<List>{
Expand Down
6 changes: 0 additions & 6 deletions components/User/UserProfile/PublicUserData.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ class PublicUserData extends React.Component {
</div>
: '' }
</div>
{(this.props.user.uname === this.props.loggedinuser) &&
<NavLink className="ui basic button bottom attached" href={'/user/' + this.props.user.uname + '/stats'}
role="button">
<p><i className="icon chart line"/>{this.context.intl.formatMessage(this.messages.stats)}</p>
</NavLink>
}
</div>;

return (
Expand Down
9 changes: 8 additions & 1 deletion components/User/UserProfile/UserProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import PrivatePublicUserProfile from './PrivatePublicUserProfile/PrivatePublicUs
import Integrations from './Integrations';
import {defineMessages, FormattedMessage} from 'react-intl';
import {categories} from '../../../actions/user/userprofile/chooseAction';
import UserStats from './UserStats';

let MediaQuery = require ('react-responsive');

Expand Down Expand Up @@ -115,6 +116,8 @@ class UserProfile extends React.Component {
default:
return this.notImplemented();
}});
case 'stats':
return this.addScaffold(() => this.displayUserStats());
default:
return this.displayUserProfile();
};
Expand Down Expand Up @@ -230,7 +233,7 @@ class UserProfile extends React.Component {
loggedinUserId={this.props.UserProfileStore.userid}
category={this.props.UserProfileStore.category}
categoryItem={this.props.UserProfileStore.categoryItem}
userStats={this.props.UserStatsStore}/>);
/>);
}

displayIntegrations() {
Expand All @@ -247,6 +250,10 @@ class UserProfile extends React.Component {
return (<UserGroupEdit saveUsergroupError={this.props.UserProfileStore.saveUsergroupError} username={this.props.UserProfileStore.username} displayName={this.props.UserProfileStore.user.displayName} currentUsergroup={this.props.UserProfileStore.currentUsergroup} userid={this.props.UserProfileStore.userid} saveUsergroupIsLoading={this.props.UserProfileStore.saveUsergroupIsLoading} picture={this.props.UserProfileStore.user.picture} />);
}

displayUserStats(){
return (<UserStats userStats={this.props.UserStatsStore} />);
}

notImplemented() {
return (<h3>
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import {Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';
import {Dropdown, Grid, Message, Segment, Table} from 'semantic-ui-react';
import moment from 'moment';
import updateUserStatsPeriod from '../../../../actions/stats/updateUserStatsPeriod';
import updateUserStatsActivityType from '../../../../actions/stats/updateUserStatsActivityType';
import updateUserStatsPeriod from '../../../actions/stats/updateUserStatsPeriod';
import updateUserStatsActivityType from '../../../actions/stats/updateUserStatsActivityType';
import {TagCloud} from 'react-tagcloud';
import {defineMessages} from 'react-intl';

Expand Down Expand Up @@ -100,7 +100,7 @@ class UserStats extends React.Component {
);
});
return (
<Grid relaxed padded>
<Grid relaxed>
{this.props.userStats.statsByTime && this.props.userStats.statsByTime.length > 0 &&
<Grid.Row columns={1}>
<Grid.Column>
Expand Down
4 changes: 2 additions & 2 deletions services/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
}];
rp({
method: 'GET',
uri: Microservices.lrs.uri + '/api/statements/aggregate',
uri: Microservices.lrs.uri + '/statements/aggregate',
qs: {
pipeline: JSON.stringify(pipeline),
},
Expand Down Expand Up @@ -142,7 +142,7 @@ export default {
];
rp({
method: 'GET',
uri: Microservices.lrs.uri + '/api/statements/aggregate',
uri: Microservices.lrs.uri + '/statements/aggregate',
qs: {
pipeline: JSON.stringify(pipeline),
},
Expand Down

0 comments on commit 4255de9

Please sign in to comment.