mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-24 05:48:07 +01:00
Use a consumer for identity
This commit is contained in:
parent
21a23b58ab
commit
327da54e23
2 changed files with 29 additions and 8 deletions
|
@ -20,6 +20,7 @@ import Card from '../features/status/components/card';
|
||||||
// to use the progress bar to show download progress
|
// to use the progress bar to show download progress
|
||||||
import Bundle from '../features/ui/components/bundle';
|
import Bundle from '../features/ui/components/bundle';
|
||||||
import { MediaGallery, Video, Audio } from '../features/ui/util/async-components';
|
import { MediaGallery, Video, Audio } from '../features/ui/util/async-components';
|
||||||
|
import { IdentityConsumer } from '../features/ui/util/identity_consumer';
|
||||||
import { SensitiveMediaContext } from '../features/ui/util/sensitive_media_context';
|
import { SensitiveMediaContext } from '../features/ui/util/sensitive_media_context';
|
||||||
import { displayMedia, visibleReactions } from '../initial_state';
|
import { displayMedia, visibleReactions } from '../initial_state';
|
||||||
|
|
||||||
|
@ -845,14 +846,18 @@ class Status extends ImmutablePureComponent {
|
||||||
{...statusContentProps}
|
{...statusContentProps}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<IdentityConsumer>
|
||||||
|
{identity => (
|
||||||
<StatusReactions
|
<StatusReactions
|
||||||
statusId={status.get('id')}
|
statusId={status.get('id')}
|
||||||
reactions={status.get('reactions')}
|
reactions={status.get('reactions')}
|
||||||
numVisible={visibleReactions}
|
numVisible={visibleReactions}
|
||||||
addReaction={this.props.onReactionAdd}
|
addReaction={this.props.onReactionAdd}
|
||||||
removeReaction={this.props.onReactionRemove}
|
removeReaction={this.props.onReactionRemove}
|
||||||
canReact={this.context.identity.signedIn}
|
canReact={identity.signedIn}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</IdentityConsumer>
|
||||||
|
|
||||||
{(!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar']))) && (
|
{(!isCollapsed || !(muted || !settings.getIn(['collapsed', 'show_action_bar']))) && (
|
||||||
<StatusActionBar
|
<StatusActionBar
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { PureComponent } from 'react';
|
||||||
|
|
||||||
|
export class IdentityConsumer extends PureComponent {
|
||||||
|
static contextTypes = {
|
||||||
|
identity: PropTypes.object
|
||||||
|
};
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
children: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return this.props.children(this.context.identity);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue