From cb69e35b3b13a67df5216b2c5fd657a62b3bda7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Thu, 27 Jul 2017 00:41:28 +0200 Subject: [PATCH] Add visibility icon to Detailed status --- .../glitch/components/status/header.js | 24 +++------- .../glitch/components/status/index.js | 3 +- .../components/status/visibility_icon.js | 48 +++++++++++++++++++ .../features/status/components/action_bar.js | 4 +- .../status/components/detailed_status.js | 3 +- app/javascript/styles/components.scss | 6 +-- 6 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 app/javascript/glitch/components/status/visibility_icon.js diff --git a/app/javascript/glitch/components/status/header.js b/app/javascript/glitch/components/status/header.js index 3187fa7fb..5ce59fba4 100644 --- a/app/javascript/glitch/components/status/header.js +++ b/app/javascript/glitch/components/status/header.js @@ -29,6 +29,7 @@ import Avatar from '../../../mastodon/components/avatar'; import AvatarOverlay from '../../../mastodon/components/avatar_overlay'; import DisplayName from '../../../mastodon/components/display_name'; import IconButton from '../../../mastodon/components/icon_button'; +import VisibilityIcon from './visibility_icon'; /* * * * */ @@ -94,7 +95,7 @@ icons) into a single `
` element. export default class StatusHeader extends React.PureComponent { static propTypes = { - account: ImmutablePropTypes.map.isRequired, + status: ImmutablePropTypes.map.isRequired, friend: ImmutablePropTypes.map, mediaIcon: PropTypes.string, collapsible: PropTypes.bool, @@ -102,7 +103,6 @@ export default class StatusHeader extends React.PureComponent { parseClick: PropTypes.func.isRequired, setExpansion: PropTypes.func.isRequired, intl: PropTypes.object.isRequired, - visibility: PropTypes.string, }; /* @@ -135,8 +135,8 @@ status. */ handleAccountClick = (e) => { - const { account, parseClick } = this.props; - parseClick(e, `/accounts/${+account.get('id')}`); + const { status, parseClick } = this.props; + parseClick(e, `/accounts/${+status.getIn(['account', 'id'])}`); } /* @@ -150,21 +150,15 @@ has a very straightforward rendering process. render () { const { - account, + status, friend, mediaIcon, collapsible, collapsed, intl, - visibility, } = this.props; - const visibilityClass = { - public: 'globe', - unlisted: 'unlock-alt', - private: 'lock', - direct: 'envelope', - }[visibility]; + const account = status.get('account'); return (
@@ -186,11 +180,7 @@ it is rendered as a float. /> ) : null} {( -