render () {
const status = this.props.status.get('reblog') ? this.props.status.get('reblog') : this.props.status;
- const { settings } = this.props;
+ const { expanded, setExpansion, settings } = this.props;
let media = '';
let mediaIcon = null;
status={status}
media={media}
mediaIcon={mediaIcon}
+ expanded={expanded}
+ setExpansion={setExpansion}
/>
<div className='detailed-status__meta'>
state = {
fullscreen: false,
+ isExpanded: null,
};
componentWillMount () {
}
}
+ handleExpandedToggle = () => {
+ if (this.props.status.get('spoiler_text')) {
+ this.setExpansion(this.state.isExpanded ? null : true);
+ }
+ };
+
handleFavouriteClick = (status) => {
if (status.get('favourited')) {
this.props.dispatch(unfavourite(status));
));
}
+ setExpansion = value => {
+ this.setState({ isExpanded: value ? true : null });
+ }
+
setRef = c => {
this.node = c;
}
render () {
let ancestors, descendants;
+ const { setExpansion } = this;
const { status, settings, ancestorsIds, descendantsIds } = this.props;
- const { fullscreen } = this.state;
+ const { fullscreen, isExpanded } = this.state;
if (status === null) {
return (
boost: this.handleHotkeyBoost,
mention: this.handleHotkeyMention,
openProfile: this.handleHotkeyOpenProfile,
+ toggleSpoiler: this.handleExpandedToggle,
};
return (
settings={settings}
onOpenVideo={this.handleOpenVideo}
onOpenMedia={this.handleOpenMedia}
+ expanded={isExpanded}
+ setExpansion={setExpansion}
/>
<ActionBar