From 0ccea23384914b8e690f192336e22b972a8f37e6 Mon Sep 17 00:00:00 2001 From: Howard Chung Date: Sun, 18 Feb 2024 12:14:46 -0800 Subject: [PATCH] Revert "feat(issue-3133): hide player matches if player profile is private" --- src/components/Player/Header/PlayerHeader.jsx | 11 +-- src/components/Player/Player.jsx | 29 ++++---- .../Player/PlayerProfilePrivate/index.jsx | 68 ------------------- src/components/Player/playerPages.jsx | 3 +- src/lang/en-US.json | 5 +- 5 files changed, 17 insertions(+), 99 deletions(-) delete mode 100644 src/components/Player/PlayerProfilePrivate/index.jsx diff --git a/src/components/Player/Header/PlayerHeader.jsx b/src/components/Player/Header/PlayerHeader.jsx index 815301893a..66d3f58a11 100644 --- a/src/components/Player/Header/PlayerHeader.jsx +++ b/src/components/Player/Header/PlayerHeader.jsx @@ -187,6 +187,7 @@ grid-template-columns: 1fr minmax(min-content, ${constants.appWidth}px) 1fr; position: absolute; } } + `; const LARGE_IMAGE_SIZE = 124; @@ -284,7 +285,6 @@ const PlayerHeader = ({ rankTier, leaderboardRank, strings, - isPlayerProfilePrivate, }) => { if (error) { return ; @@ -340,12 +340,8 @@ const PlayerHeader = ({ {officialPlayerName || playerName} - {!isPlayerProfilePrivate && ( - <> - - - - )} + +
{getDotaPlusBadge(plus, strings)} @@ -372,7 +368,6 @@ PlayerHeader.propTypes = { rankTier: PropTypes.number, leaderboardRank: PropTypes.number, strings: PropTypes.shape({}), - isPlayerProfilePrivate: PropTypes.bool, }; const mapStateToProps = state => ({ diff --git a/src/components/Player/Player.jsx b/src/components/Player/Player.jsx index 395d5d375a..5791c3f76b 100644 --- a/src/components/Player/Player.jsx +++ b/src/components/Player/Player.jsx @@ -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'; @@ -30,7 +32,6 @@ class RequestLayer extends React.Component { playerName: PropTypes.string, playerLoading: PropTypes.bool, strings: PropTypes.shape({}), - isPlayerProfilePrivate: PropTypes.bool, } componentDidMount() { @@ -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')}`); } @@ -66,17 +66,13 @@ class RequestLayer extends React.Component {
{!this.props.playerLoading && }
- - + + +
+
+ + {page ? page.content(playerId, match.params, location) : }
- {isPlayerProfilePrivate ? ( - - ) : ( -
- - {page ? page.content(playerId, match.params, location) : } -
- )}
); } @@ -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)), diff --git a/src/components/Player/PlayerProfilePrivate/index.jsx b/src/components/Player/PlayerProfilePrivate/index.jsx deleted file mode 100644 index 10d95f3cc5..0000000000 --- a/src/components/Player/PlayerProfilePrivate/index.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import styled from 'styled-components'; -import Button from '@material-ui/core/Button'; -import LockIcon from '@material-ui/icons/Lock'; -import config from '../../../config'; - -const Styled = styled.div` -text-align: center; -padding-top: 5%; - -.playerProfilePrivateTitle { - font-size: 2rem; - margin-bottom: 1%; - display: flex; - justify-content: center; - align-items: center; -} - -.lockIcon { - font-size: 1.8rem; - margin-right: 2%; -} - -.playerProfilePrivateDescription { - margin-bottom: 2%; -} - -.signInWithSteamButton { - border: solid 1px #FFFFFF; - color: #FFFFFF; - padding: 1% 2%; -} -` - -const PlayerProfilePrivate = ({ strings }) => { - const handleButtonClick = () => window.location.href = `${config.VITE_API_HOST}/login`; - const playerProfilePrivateTitle = (strings.player_profile_private_title || "").toUpperCase(); - - return ( - -
-
- -
{playerProfilePrivateTitle}
-
-
{strings.player_profile_private_description}
- -
-
- ); -} - -PlayerProfilePrivate.PropTypes = { - strings: PropTypes.shape({}), -} - -const mapStateToProps = state => ({ - strings: state.app.strings, -}) - -export default connect(mapStateToProps)(PlayerProfilePrivate); \ No newline at end of file diff --git a/src/components/Player/playerPages.jsx b/src/components/Player/playerPages.jsx index 2200592f56..79dadf7f95 100644 --- a/src/components/Player/playerPages.jsx +++ b/src/components/Player/playerPages.jsx @@ -90,8 +90,7 @@ const playerPages = strings => [{ content: (playerId, routeParams, 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, })); diff --git a/src/lang/en-US.json b/src/lang/en-US.json index 0370d5c06b..722c9454ea 100644 --- a/src/lang/en-US.json +++ b/src/lang/en-US.json @@ -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" }