|
|
@ -9,6 +9,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
|
|
|
import { MediaGallery, Video } from 'themes/glitch/util/async-components';
|
|
|
|
import { MediaGallery, Video } from 'themes/glitch/util/async-components';
|
|
|
|
import { HotKeys } from 'react-hotkeys';
|
|
|
|
import { HotKeys } from 'react-hotkeys';
|
|
|
|
import NotificationOverlayContainer from 'themes/glitch/features/notifications/containers/overlay_container';
|
|
|
|
import NotificationOverlayContainer from 'themes/glitch/features/notifications/containers/overlay_container';
|
|
|
|
|
|
|
|
import classNames from 'classnames';
|
|
|
|
|
|
|
|
|
|
|
|
// We use the component (and not the container) since we do not want
|
|
|
|
// We use the component (and not the container) since we do not want
|
|
|
|
// to use the progress bar to show download progress
|
|
|
|
// to use the progress bar to show download progress
|
|
|
@ -21,6 +22,7 @@ export default class Status extends ImmutablePureComponent {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
static propTypes = {
|
|
|
|
|
|
|
|
containerId: PropTypes.string,
|
|
|
|
id: PropTypes.string,
|
|
|
|
id: PropTypes.string,
|
|
|
|
status: ImmutablePropTypes.map,
|
|
|
|
status: ImmutablePropTypes.map,
|
|
|
|
account: ImmutablePropTypes.map,
|
|
|
|
account: ImmutablePropTypes.map,
|
|
|
@ -188,7 +190,9 @@ export default class Status extends ImmutablePureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleExpandedToggle = () => {
|
|
|
|
handleExpandedToggle = () => {
|
|
|
|
this.setExpansion(this.state.isExpanded || !this.props.status.get('spoiler') ? null : true);
|
|
|
|
if (this.props.status.get('spoiler_text')) {
|
|
|
|
|
|
|
|
this.setExpansion(this.state.isExpanded ? null : true);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
handleOpenVideo = startTime => {
|
|
|
|
handleOpenVideo = startTime => {
|
|
|
@ -222,11 +226,11 @@ export default class Status extends ImmutablePureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleHotkeyMoveUp = () => {
|
|
|
|
handleHotkeyMoveUp = () => {
|
|
|
|
this.props.onMoveUp(this.props.status.get('id'));
|
|
|
|
this.props.onMoveUp(this.props.containerId || this.props.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleHotkeyMoveDown = () => {
|
|
|
|
handleHotkeyMoveDown = () => {
|
|
|
|
this.props.onMoveDown(this.props.status.get('id'));
|
|
|
|
this.props.onMoveDown(this.props.containerId || this.props.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleRef = c => {
|
|
|
|
handleRef = c => {
|
|
|
@ -371,31 +375,24 @@ export default class Status extends ImmutablePureComponent {
|
|
|
|
openProfile: this.handleHotkeyOpenProfile,
|
|
|
|
openProfile: this.handleHotkeyOpenProfile,
|
|
|
|
moveUp: this.handleHotkeyMoveUp,
|
|
|
|
moveUp: this.handleHotkeyMoveUp,
|
|
|
|
moveDown: this.handleHotkeyMoveDown,
|
|
|
|
moveDown: this.handleHotkeyMoveDown,
|
|
|
|
|
|
|
|
toggleSpoiler: this.handleExpandedToggle,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const computedClass = classNames('status', `status-${status.get('visibility')}`, {
|
|
|
|
|
|
|
|
collapsed: isExpanded === false,
|
|
|
|
|
|
|
|
'has-background': isExpanded === false && background,
|
|
|
|
|
|
|
|
'marked-for-delete': this.state.markedForDelete,
|
|
|
|
|
|
|
|
muted,
|
|
|
|
|
|
|
|
}, 'focusable');
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<HotKeys handlers={handlers}>
|
|
|
|
<HotKeys handlers={handlers}>
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
className={
|
|
|
|
className={computedClass}
|
|
|
|
`status${
|
|
|
|
style={isExpanded === false && background ? { backgroundImage: `url(${background})` } : null}
|
|
|
|
muted ? ' muted' : ''
|
|
|
|
|
|
|
|
} status-${status.get('visibility')}${
|
|
|
|
|
|
|
|
isExpanded === false ? ' collapsed' : ''
|
|
|
|
|
|
|
|
}${
|
|
|
|
|
|
|
|
isExpanded === false && background ? ' has-background' : ''
|
|
|
|
|
|
|
|
}${
|
|
|
|
|
|
|
|
this.state.markedForDelete ? ' marked-for-delete' : ''
|
|
|
|
|
|
|
|
}`
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
style={{
|
|
|
|
|
|
|
|
backgroundImage: (
|
|
|
|
|
|
|
|
isExpanded === false && background ?
|
|
|
|
|
|
|
|
`url(${background})` :
|
|
|
|
|
|
|
|
'none'
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
{...selectorAttribs}
|
|
|
|
{...selectorAttribs}
|
|
|
|
ref={handleRef}
|
|
|
|
ref={handleRef}
|
|
|
|
|
|
|
|
tabIndex='0'
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{prepend && account ? (
|
|
|
|
{prepend && account ? (
|
|
|
|
<StatusPrepend
|
|
|
|
<StatusPrepend
|
|
|
|