Skip to content

Commit

Permalink
Merge pull request #3155 from odota/revert-3151-feature/issue-3133
Browse files Browse the repository at this point in the history
Revert "feat(issue-3133): hide player matches if player profile is private"
  • Loading branch information
howardchung authored Feb 18, 2024
2 parents bd171f6 + 0ccea23 commit 4cf62f8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 99 deletions.
11 changes: 3 additions & 8 deletions src/components/Player/Header/PlayerHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ grid-template-columns: 1fr minmax(min-content, ${constants.appWidth}px) 1fr;
position: absolute;
}
}
`;

const LARGE_IMAGE_SIZE = 124;
Expand Down Expand Up @@ -284,7 +285,6 @@ const PlayerHeader = ({
rankTier,
leaderboardRank,
strings,
isPlayerProfilePrivate,
}) => {
if (error) {
return <Error />;
Expand Down Expand Up @@ -340,12 +340,8 @@ const PlayerHeader = ({
<span className="playerName">{officialPlayerName || playerName}</span>
<PlayerBadges playerId={playerId} />
</div>
{!isPlayerProfilePrivate && (
<>
<PlayerStats playerId={playerId} loggedInId={loggedInUser && String(loggedInUser.account_id)} compact={!small} />
<PlayerButtons playerId={playerId} playerSoloCompetitiveRank={playerSoloCompetitiveRank} compact={!small} />
</>
)}
<PlayerStats playerId={playerId} loggedInId={loggedInUser && String(loggedInUser.account_id)} compact={!small} />
<PlayerButtons playerId={playerId} playerSoloCompetitiveRank={playerSoloCompetitiveRank} compact={!small} />
</div>
<div style={{ display: 'flex' }}>
{getDotaPlusBadge(plus, strings)}
Expand All @@ -372,7 +368,6 @@ PlayerHeader.propTypes = {
rankTier: PropTypes.number,
leaderboardRank: PropTypes.number,
strings: PropTypes.shape({}),
isPlayerProfilePrivate: PropTypes.bool,
};

const mapStateToProps = state => ({
Expand Down
29 changes: 12 additions & 17 deletions src/components/Player/Player.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { withRouter } from 'react-router-dom';
import Long from 'long';
import { getPlayer, getPlayerWinLoss } from '../../actions';
import {
getPlayer,
getPlayerWinLoss,
} from '../../actions';
import TabBar from '../TabBar';
import Spinner from '../Spinner';
import TableFilterForm from './TableFilterForm';
import PlayerHeader from './Header/PlayerHeader';
import PlayerProfilePrivate from './PlayerProfilePrivate';
// import Error from '../Error';
import playerPages from './playerPages';

Expand All @@ -30,7 +32,6 @@ class RequestLayer extends React.Component {
playerName: PropTypes.string,
playerLoading: PropTypes.bool,
strings: PropTypes.shape({}),
isPlayerProfilePrivate: PropTypes.bool,
}

componentDidMount() {
Expand All @@ -52,9 +53,8 @@ class RequestLayer extends React.Component {
}

render() {
const { location, match, strings, isPlayerProfilePrivate } = this.props;
const { location, match, strings } = this.props;
const { playerId } = this.props.match.params;

if (Long.fromString(playerId).greaterThan('76561197960265728')) {
this.props.history.push(`/players/${Long.fromString(playerId).subtract('76561197960265728')}`);
}
Expand All @@ -66,17 +66,13 @@ class RequestLayer extends React.Component {
<div>
{!this.props.playerLoading && <Helmet title={title} />}
<div>
<PlayerHeader playerId={playerId} location={location} isPlayerProfilePrivate={isPlayerProfilePrivate} />
<TabBar info={info} tabs={playerPages(playerId, strings, isPlayerProfilePrivate)} />
<PlayerHeader playerId={playerId} location={location} />
<TabBar info={info} tabs={playerPages(playerId, strings)} />
</div>
<div>
<TableFilterForm playerId={playerId} />
{page ? page.content(playerId, match.params, location) : <Spinner />}
</div>
{isPlayerProfilePrivate ? (
<PlayerProfilePrivate />
) : (
<div>
<TableFilterForm playerId={playerId} />
{page ? page.content(playerId, match.params, location) : <Spinner />}
</div>
)}
</div>
);
}
Expand All @@ -87,8 +83,7 @@ const mapStateToProps = state => ({
playerLoading: (state.app.player.loading),
officialPlayerName: (state.app.player.data.profile || {}).name,
strings: state.app.strings,
isPlayerProfilePrivate: (state.app.player.data.profile || {}).fh_unavailable && !(state.app.player.data.profile || {}).name,
})
});

const mapDispatchToProps = dispatch => ({
getPlayer: playerId => dispatch(getPlayer(playerId)),
Expand Down
68 changes: 0 additions & 68 deletions src/components/Player/PlayerProfilePrivate/index.jsx

This file was deleted.

3 changes: 1 addition & 2 deletions src/components/Player/playerPages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ const playerPages = strings => [{
content: (playerId, routeParams, location) => (<ActivityPage playerId={playerId} routeParams={routeParams} location={location} />),
}];

export default (playerId, strings, isPlayerProfilePrivate) => playerPages(strings).map(page => ({
export default (playerId, strings) => playerPages(strings).map(page => ({
...page,
route: `/players/${playerId}/${page.key}`,
disabled: isPlayerProfilePrivate,
}));
5 changes: 1 addition & 4 deletions src/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1203,8 +1203,5 @@
"killed": "killed",
"team_courier": "{team}'s courier",
"slain_roshan": "Have slain Roshan",
"drew_first_blood": "Drew First Blood",
"player_profile_private_title": "This profile is private" ,
"player_profile_private_description": "If this is your profile, sign in with Steam in order to view your statistics.",
"sign_in_with_steam": "Sign in with Steam"
"drew_first_blood": "Drew First Blood"
}

0 comments on commit 4cf62f8

Please sign in to comment.