User details ui fix (#1032)

* User details ui fix

* User details ui fix
This commit is contained in:
ernestwisniewski 2020-07-28 02:05:29 +02:00 committed by GitHub
parent 5ada39f39c
commit aaa4361158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 29 deletions

View file

@ -64,6 +64,7 @@ interface CommentNodeState {
interface CommentNodeProps { interface CommentNodeProps {
node: CommentNodeI; node: CommentNodeI;
noBorder?: boolean;
noIndent?: boolean; noIndent?: boolean;
viewOnly?: boolean; viewOnly?: boolean;
locked?: boolean; locked?: boolean;
@ -136,9 +137,9 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
> >
<div <div
id={`comment-${node.comment.id}`} id={`comment-${node.comment.id}`}
className={`details comment-node border-top border-light py-2 ${ className={`details comment-node py-2 ${
this.isCommentNew ? 'mark' : '' !this.props.noBorder ? 'border-top border-light' : ''
}`} } ${this.isCommentNew ? 'mark' : ''}`}
style={ style={
!this.props.noIndent && !this.props.noIndent &&
this.props.node.comment.parent_id && this.props.node.comment.parent_id &&

View file

@ -16,6 +16,7 @@ interface CommentNodesProps {
moderators?: Array<CommunityUser>; moderators?: Array<CommunityUser>;
admins?: Array<UserView>; admins?: Array<UserView>;
postCreatorId?: number; postCreatorId?: number;
noBorder?: boolean;
noIndent?: boolean; noIndent?: boolean;
viewOnly?: boolean; viewOnly?: boolean;
locked?: boolean; locked?: boolean;
@ -42,6 +43,7 @@ export class CommentNodes extends Component<
<CommentNode <CommentNode
key={node.comment.id} key={node.comment.id}
node={node} node={node}
noBorder={this.props.noBorder}
noIndent={this.props.noIndent} noIndent={this.props.noIndent}
viewOnly={this.props.viewOnly} viewOnly={this.props.viewOnly}
locked={this.props.locked} locked={this.props.locked}

View file

@ -146,25 +146,30 @@ export class UserDetails extends Component<UserDetailsProps, UserDetailsState> {
return ( return (
<div> <div>
{combined.map(i => ( {combined.map(i => (
<div> <>
{i.type === 'posts' ? ( <div>
<PostListing {i.type === 'posts' ? (
post={i.data as Post} <PostListing
admins={this.props.admins} post={i.data as Post}
showCommunity admins={this.props.admins}
enableDownvotes={this.props.enableDownvotes} showCommunity
enableNsfw={this.props.enableNsfw} enableDownvotes={this.props.enableDownvotes}
/> enableNsfw={this.props.enableNsfw}
) : ( />
<CommentNodes ) : (
nodes={[{ comment: i.data as Comment }]} <CommentNodes
admins={this.props.admins} nodes={[{ comment: i.data as Comment }]}
noIndent admins={this.props.admins}
showContext noBorder
enableDownvotes={this.props.enableDownvotes} noIndent
/> showCommunity
)} showContext
</div> enableDownvotes={this.props.enableDownvotes}
/>
)}
</div>
<hr class="my-3" />
</>
))} ))}
</div> </div>
); );
@ -177,6 +182,7 @@ export class UserDetails extends Component<UserDetailsProps, UserDetailsState> {
nodes={commentsToFlatNodes(this.state.comments)} nodes={commentsToFlatNodes(this.state.comments)}
admins={this.props.admins} admins={this.props.admins}
noIndent noIndent
showCommunity
showContext showContext
enableDownvotes={this.props.enableDownvotes} enableDownvotes={this.props.enableDownvotes}
/> />
@ -188,13 +194,16 @@ export class UserDetails extends Component<UserDetailsProps, UserDetailsState> {
return ( return (
<div> <div>
{this.state.posts.map(post => ( {this.state.posts.map(post => (
<PostListing <>
post={post} <PostListing
admins={this.props.admins} post={post}
showCommunity admins={this.props.admins}
enableDownvotes={this.props.enableDownvotes} showCommunity
enableNsfw={this.props.enableNsfw} enableDownvotes={this.props.enableDownvotes}
/> enableNsfw={this.props.enableNsfw}
/>
<hr class="my-3" />
</>
))} ))}
</div> </div>
); );