Adding left border color, removing indent.

pull/722/head
Dessalines 4 years ago
parent c999579c05
commit eeef752a5c

@ -27,6 +27,7 @@ import {
pictshareAvatarThumbnail, pictshareAvatarThumbnail,
showAvatars, showAvatars,
setupTippy, setupTippy,
randomHsl,
} from '../utils'; } from '../utils';
import moment from 'moment'; import moment from 'moment';
import { MomentTime } from './moment-time'; import { MomentTime } from './moment-time';
@ -54,6 +55,7 @@ interface CommentNodeState {
score: number; score: number;
upvotes: number; upvotes: number;
downvotes: number; downvotes: number;
borderColor: string;
} }
interface CommentNodeProps { interface CommentNodeProps {
@ -92,6 +94,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
score: this.props.node.comment.score, score: this.props.node.comment.score,
upvotes: this.props.node.comment.upvotes, upvotes: this.props.node.comment.upvotes,
downvotes: this.props.node.comment.downvotes, downvotes: this.props.node.comment.downvotes,
borderColor: randomHsl(),
}; };
constructor(props: any, context: any) { constructor(props: any, context: any) {
@ -116,7 +119,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
return ( return (
<div <div
className={`comment ${ className={`comment ${
node.comment.parent_id && !this.props.noIndent ? 'ml-4' : '' node.comment.parent_id && !this.props.noIndent ? 'ml-2' : ''
}`} }`}
> >
<div <div
@ -124,364 +127,422 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
className={`details comment-node mb-1 ${ className={`details comment-node mb-1 ${
this.isCommentNew ? 'mark' : '' this.isCommentNew ? 'mark' : ''
}`} }`}
style={
!this.props.noIndent &&
`border-left: 1px solid; border-color: ${this.state.borderColor} !important`
}
> >
<ul class="list-inline mb-1 text-muted small"> <div class={`${!this.props.noIndent && 'ml-2'}`}>
<li className="list-inline-item"> <ul class="list-inline mb-1 text-muted small">
<Link
className="text-info"
to={`/u/${node.comment.creator_name}`}
>
{node.comment.creator_avatar && showAvatars() && (
<img
height="32"
width="32"
src={pictshareAvatarThumbnail(node.comment.creator_avatar)}
class="rounded-circle mr-1"
/>
)}
<span>{node.comment.creator_name}</span>
</Link>
</li>
{this.isMod && (
<li className="list-inline-item badge badge-light">
{i18n.t('mod')}
</li>
)}
{this.isAdmin && (
<li className="list-inline-item badge badge-light">
{i18n.t('admin')}
</li>
)}
{this.isPostCreator && (
<li className="list-inline-item badge badge-light">
{i18n.t('creator')}
</li>
)}
{(node.comment.banned_from_community || node.comment.banned) && (
<li className="list-inline-item badge badge-danger">
{i18n.t('banned')}
</li>
)}
<li className="list-inline-item"></li>
<span
class="unselectable pointer mr-2"
data-tippy-content={i18n.t('number_of_points', {
count: this.state.score,
})}
>
<li className="list-inline-item">
<span className={this.scoreColor}>
<svg className="small icon icon-inline mr-1">
<use xlinkHref="#icon-zap"></use>
</svg>
{this.state.score}
</span>
</li>
<li className="list-inline-item"> <li className="list-inline-item">
<svg class="small icon icon-inline mr-1"> <Link
<use xlinkHref="#icon-arrow-up"></use> className="text-info"
</svg> to={`/u/${node.comment.creator_name}`}
{this.state.upvotes} >
{node.comment.creator_avatar && showAvatars() && (
<img
height="32"
width="32"
src={pictshareAvatarThumbnail(
node.comment.creator_avatar
)}
class="rounded-circle mr-1"
/>
)}
<span>{node.comment.creator_name}</span>
</Link>
</li> </li>
{this.isMod && (
<li className="list-inline-item badge badge-light">
{i18n.t('mod')}
</li>
)}
{this.isAdmin && (
<li className="list-inline-item badge badge-light">
{i18n.t('admin')}
</li>
)}
{this.isPostCreator && (
<li className="list-inline-item badge badge-light">
{i18n.t('creator')}
</li>
)}
{(node.comment.banned_from_community || node.comment.banned) && (
<li className="list-inline-item badge badge-danger">
{i18n.t('banned')}
</li>
)}
<li className="list-inline-item"></li>
<span
class="unselectable pointer mr-2"
data-tippy-content={i18n.t('number_of_points', {
count: this.state.score,
})}
>
<li className="list-inline-item">
<span className={this.scoreColor}>
<svg className="small icon icon-inline mr-1">
<use xlinkHref="#icon-zap"></use>
</svg>
{this.state.score}
</span>
</li>
<li className="list-inline-item">
<svg class="small icon icon-inline mr-1">
<use xlinkHref="#icon-arrow-up"></use>
</svg>
{this.state.upvotes}
</li>
<li className="list-inline-item">
<svg class="small icon icon-inline mr-1">
<use xlinkHref="#icon-arrow-down"></use>
</svg>
{this.state.downvotes}
</li>
</span>
{this.props.showCommunity && (
<li className="list-inline-item">
<span> {i18n.t('to')} </span>
<Link to={`/c/${node.comment.community_name}`}>
{node.comment.community_name}
</Link>
</li>
)}
<li className="list-inline-item"></li>
<li className="list-inline-item"> <li className="list-inline-item">
<svg class="small icon icon-inline mr-1"> <span>
<use xlinkHref="#icon-arrow-down"></use> <MomentTime data={node.comment} />
</svg> </span>
{this.state.downvotes}
</li> </li>
</span>
{this.props.showCommunity && (
<li className="list-inline-item"> <li className="list-inline-item">
<span> {i18n.t('to')} </span> <div
<Link to={`/c/${node.comment.community_name}`}> className="unselectable pointer text-monospace"
{node.comment.community_name} onClick={linkEvent(this, this.handleCommentCollapse)}
</Link> >
{this.state.collapsed ? (
<svg class="icon">
<use xlinkHref="#icon-plus-square"></use>
</svg>
) : (
<svg class="icon">
<use xlinkHref="#icon-minus-square"></use>
</svg>
)}
</div>
</li> </li>
</ul>
{this.state.showEdit && (
<CommentForm
node={node}
edit
onReplyCancel={this.handleReplyCancel}
disabled={this.props.locked}
/>
)} )}
<li className="list-inline-item"></li> {!this.state.showEdit && !this.state.collapsed && (
<li className="list-inline-item"> <div>
<span> {this.state.viewSource ? (
<MomentTime data={node.comment} /> <pre>{this.commentUnlessRemoved}</pre>
</span>
</li>
<li className="list-inline-item">
<div
className="unselectable pointer text-monospace"
onClick={linkEvent(this, this.handleCommentCollapse)}
>
{this.state.collapsed ? (
<svg class="icon">
<use xlinkHref="#icon-plus-square"></use>
</svg>
) : ( ) : (
<svg class="icon"> <div
<use xlinkHref="#icon-minus-square"></use> className="md-div"
</svg> dangerouslySetInnerHTML={mdToHtml(
)} this.commentUnlessRemoved
</div> )}
</li> />
</ul>
{this.state.showEdit && (
<CommentForm
node={node}
edit
onReplyCancel={this.handleReplyCancel}
disabled={this.props.locked}
/>
)}
{!this.state.showEdit && !this.state.collapsed && (
<div>
{this.state.viewSource ? (
<pre>{this.commentUnlessRemoved}</pre>
) : (
<div
className="md-div"
dangerouslySetInnerHTML={mdToHtml(this.commentUnlessRemoved)}
/>
)}
<ul class="list-inline mb-0 text-muted font-weight-bold h5">
{this.props.markable && (
<li className="list-inline-item-action">
<span
class="pointer"
onClick={linkEvent(this, this.handleMarkRead)}
data-tippy-content={
node.comment.read
? i18n.t('mark_as_unread')
: i18n.t('mark_as_read')
}
>
<svg
class={`icon icon-inline ${node.comment.read &&
'text-success'}`}
>
<use xlinkHref="#icon-check"></use>
</svg>
</span>
</li>
)} )}
{UserService.Instance.user && !this.props.viewOnly && ( <ul class="list-inline mb-0 text-muted font-weight-bold h5">
<> {this.props.markable && (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
<button <span
className={`vote-animate btn btn-link p-0 mb-1 ${ class="pointer"
this.state.my_vote == 1 ? 'text-info' : 'text-muted' onClick={linkEvent(this, this.handleMarkRead)}
}`} data-tippy-content={
onClick={linkEvent(node, this.handleCommentUpvote)} node.comment.read
data-tippy-content={i18n.t('upvote')} ? i18n.t('mark_as_unread')
: i18n.t('mark_as_read')
}
> >
<svg class="icon"> <svg
<use xlinkHref="#icon-arrow-up"></use> class={`icon icon-inline ${node.comment.read &&
'text-success'}`}
>
<use xlinkHref="#icon-check"></use>
</svg> </svg>
</button> </span>
</li> </li>
{WebSocketService.Instance.site.enable_downvotes && ( )}
{UserService.Instance.user && !this.props.viewOnly && (
<>
<li className="list-inline-item-action"> <li className="list-inline-item-action">
<button <button
className={`vote-animate btn btn-link p-0 mb-1 ${ className={`vote-animate btn btn-link p-0 mb-1 ${
this.state.my_vote == -1 this.state.my_vote == 1 ? 'text-info' : 'text-muted'
? 'text-danger'
: 'text-muted'
}`} }`}
onClick={linkEvent(node, this.handleCommentDownvote)} onClick={linkEvent(node, this.handleCommentUpvote)}
data-tippy-content={i18n.t('downvote')} data-tippy-content={i18n.t('upvote')}
> >
<svg class="icon"> <svg class="icon">
<use xlinkHref="#icon-arrow-down"></use> <use xlinkHref="#icon-arrow-up"></use>
</svg> </svg>
</button> </button>
</li> </li>
)} {WebSocketService.Instance.site.enable_downvotes && (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
<span <button
class="pointer" className={`vote-animate btn btn-link p-0 mb-1 ${
onClick={linkEvent(this, this.handleReplyClick)} this.state.my_vote == -1
data-tippy-content={i18n.t('reply')} ? 'text-danger'
> : 'text-muted'
<svg class="icon icon-inline"> }`}
<use xlinkHref="#icon-reply1"></use> onClick={linkEvent(
</svg> node,
</span> this.handleCommentDownvote
</li> )}
{!this.myComment && ( data-tippy-content={i18n.t('downvote')}
<li className="list-inline-item-action"> >
<Link <svg class="icon">
class="text-muted" <use xlinkHref="#icon-arrow-down"></use>
to={`/create_private_message?recipient_id=${node.comment.creator_id}`} </svg>
title={i18n.t('message').toLowerCase()} </button>
> </li>
<svg class="icon"> )}
<use xlinkHref="#icon-mail"></use>
</svg>
</Link>
</li>
)}
<li className="list-inline-item-action">
<Link
className="text-muted"
to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
title={i18n.t('link')}
>
<svg class="icon icon-inline">
<use xlinkHref="#icon-link"></use>
</svg>
</Link>
</li>
{!this.state.showAdvanced ? (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
<span <span
className="unselectable pointer" class="pointer"
onClick={linkEvent(this, this.handleShowAdvanced)} onClick={linkEvent(this, this.handleReplyClick)}
data-tippy-content={i18n.t('more')} data-tippy-content={i18n.t('reply')}
> >
<svg class="icon icon-inline"> <svg class="icon icon-inline">
<use xlinkHref="#icon-more-vertical"></use> <use xlinkHref="#icon-reply1"></use>
</svg> </svg>
</span> </span>
</li> </li>
) : ( {!this.myComment && (
<>
<li className="list-inline-item-action"> <li className="list-inline-item-action">
<span <Link
class="pointer" class="text-muted"
onClick={linkEvent( to={`/create_private_message?recipient_id=${node.comment.creator_id}`}
this, title={i18n.t('message').toLowerCase()}
this.handleSaveCommentClick
)}
data-tippy-content={
node.comment.saved
? i18n.t('unsave')
: i18n.t('save')
}
> >
<svg <svg class="icon">
class={`icon icon-inline ${node.comment.saved && <use xlinkHref="#icon-mail"></use>
'text-warning'}`}
>
<use xlinkHref="#icon-star"></use>
</svg> </svg>
</span> </Link>
</li> </li>
)}
<li className="list-inline-item-action">
<Link
className="text-muted"
to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
title={i18n.t('link')}
>
<svg class="icon icon-inline">
<use xlinkHref="#icon-link"></use>
</svg>
</Link>
</li>
{!this.state.showAdvanced ? (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
<span <span
className="pointer" className="unselectable pointer"
onClick={linkEvent(this, this.handleViewSource)} onClick={linkEvent(this, this.handleShowAdvanced)}
data-tippy-content={i18n.t('view_source')} data-tippy-content={i18n.t('more')}
> >
<svg <svg class="icon icon-inline">
class={`icon icon-inline ${this.state <use xlinkHref="#icon-more-vertical"></use>
.viewSource && 'text-success'}`}
>
<use xlinkHref="#icon-file-text"></use>
</svg> </svg>
</span> </span>
</li> </li>
{this.myComment && ( ) : (
<> <>
<li className="list-inline-item-action"></li> <li className="list-inline-item-action">
<li className="list-inline-item-action"> <span
<span class="pointer"
class="pointer" onClick={linkEvent(
onClick={linkEvent(this, this.handleEditClick)} this,
data-tippy-content={i18n.t('edit')} this.handleSaveCommentClick
)}
data-tippy-content={
node.comment.saved
? i18n.t('unsave')
: i18n.t('save')
}
>
<svg
class={`icon icon-inline ${node.comment.saved &&
'text-warning'}`}
> >
<svg class="icon icon-inline"> <use xlinkHref="#icon-star"></use>
<use xlinkHref="#icon-edit"></use> </svg>
</svg> </span>
</span> </li>
</li> <li className="list-inline-item-action">
<li className="list-inline-item-action"> <span
<span className="pointer"
class="pointer" onClick={linkEvent(this, this.handleViewSource)}
onClick={linkEvent( data-tippy-content={i18n.t('view_source')}
this, >
this.handleDeleteClick <svg
)} class={`icon icon-inline ${this.state
data-tippy-content={ .viewSource && 'text-success'}`}
!node.comment.deleted
? i18n.t('delete')
: i18n.t('restore')
}
> >
<svg <use xlinkHref="#icon-file-text"></use>
class={`icon icon-inline ${node.comment </svg>
.deleted && 'text-danger'}`} </span>
> </li>
<use xlinkHref="#icon-trash"></use> {this.myComment && (
</svg> <>
</span> <li className="list-inline-item-action"></li>
</li> <li className="list-inline-item-action">
</>
)}
{/* Admins and mods can remove comments */}
{(this.canMod || this.canAdmin) && (
<>
<li className="list-inline-item-action">
{!node.comment.removed ? (
<span <span
class="pointer" class="pointer"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleModRemoveShow this.handleEditClick
)} )}
data-tippy-content={i18n.t('edit')}
> >
{i18n.t('remove')} <svg class="icon icon-inline">
<use xlinkHref="#icon-edit"></use>
</svg>
</span> </span>
) : ( </li>
<li className="list-inline-item-action">
<span <span
class="pointer" class="pointer"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleModRemoveSubmit this.handleDeleteClick
)} )}
data-tippy-content={
!node.comment.deleted
? i18n.t('delete')
: i18n.t('restore')
}
> >
{i18n.t('restore')} <svg
class={`icon icon-inline ${node.comment
.deleted && 'text-danger'}`}
>
<use xlinkHref="#icon-trash"></use>
</svg>
</span> </span>
)} </li>
</li> </>
</> )}
)} {/* Admins and mods can remove comments */}
{/* Mods can ban from community, and appoint as mods to community */} {(this.canMod || this.canAdmin) && (
{this.canMod && ( <>
<>
{!this.isMod && (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
{!node.comment.banned_from_community ? ( {!node.comment.removed ? (
<span <span
class="pointer" class="pointer"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleModBanFromCommunityShow this.handleModRemoveShow
)} )}
> >
{i18n.t('ban')} {i18n.t('remove')}
</span> </span>
) : ( ) : (
<span <span
class="pointer" class="pointer"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleModBanFromCommunitySubmit this.handleModRemoveSubmit
)} )}
> >
{i18n.t('unban')} {i18n.t('restore')}
</span> </span>
)} )}
</li> </li>
)} </>
{!node.comment.banned_from_community && ( )}
{/* Mods can ban from community, and appoint as mods to community */}
{this.canMod && (
<>
{!this.isMod && (
<li className="list-inline-item-action">
{!node.comment.banned_from_community ? (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleModBanFromCommunityShow
)}
>
{i18n.t('ban')}
</span>
) : (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleModBanFromCommunitySubmit
)}
>
{i18n.t('unban')}
</span>
)}
</li>
)}
{!node.comment.banned_from_community && (
<li className="list-inline-item-action">
{!this.state.showConfirmAppointAsMod ? (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleShowConfirmAppointAsMod
)}
>
{this.isMod
? i18n.t('remove_as_mod')
: i18n.t('appoint_as_mod')}
</span>
) : (
<>
<span class="d-inline-block mr-1">
{i18n.t('are_you_sure')}
</span>
<span
class="pointer d-inline-block mr-1"
onClick={linkEvent(
this,
this.handleAddModToCommunity
)}
>
{i18n.t('yes')}
</span>
<span
class="pointer d-inline-block"
onClick={linkEvent(
this,
this.handleCancelConfirmAppointAsMod
)}
>
{i18n.t('no')}
</span>
</>
)}
</li>
)}
</>
)}
{/* Community creators and admins can transfer community to another mod */}
{(this.amCommunityCreator || this.canAdmin) &&
this.isMod && (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
{!this.state.showConfirmAppointAsMod ? ( {!this.state.showConfirmTransferCommunity ? (
<span <span
class="pointer" class="pointer"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleShowConfirmAppointAsMod this.handleShowConfirmTransferCommunity
)} )}
> >
{this.isMod {i18n.t('transfer_community')}
? i18n.t('remove_as_mod')
: i18n.t('appoint_as_mod')}
</span> </span>
) : ( ) : (
<> <>
@ -492,7 +553,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
class="pointer d-inline-block mr-1" class="pointer d-inline-block mr-1"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleAddModToCommunity this.handleTransferCommunity
)} )}
> >
{i18n.t('yes')} {i18n.t('yes')}
@ -501,7 +562,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
class="pointer d-inline-block" class="pointer d-inline-block"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleCancelConfirmAppointAsMod this
.handleCancelShowConfirmTransferCommunity
)} )}
> >
{i18n.t('no')} {i18n.t('no')}
@ -510,21 +572,89 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
)} )}
</li> </li>
)} )}
</> {/* Admins can ban from all, and appoint other admins */}
)} {this.canAdmin && (
{/* Community creators and admins can transfer community to another mod */} <>
{(this.amCommunityCreator || this.canAdmin) && {!this.isAdmin && (
this.isMod && ( <li className="list-inline-item-action">
{!node.comment.banned ? (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleModBanShow
)}
>
{i18n.t('ban_from_site')}
</span>
) : (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleModBanSubmit
)}
>
{i18n.t('unban_from_site')}
</span>
)}
</li>
)}
{!node.comment.banned && (
<li className="list-inline-item-action">
{!this.state.showConfirmAppointAsAdmin ? (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleShowConfirmAppointAsAdmin
)}
>
{this.isAdmin
? i18n.t('remove_as_admin')
: i18n.t('appoint_as_admin')}
</span>
) : (
<>
<span class="d-inline-block mr-1">
{i18n.t('are_you_sure')}
</span>
<span
class="pointer d-inline-block mr-1"
onClick={linkEvent(
this,
this.handleAddAdmin
)}
>
{i18n.t('yes')}
</span>
<span
class="pointer d-inline-block"
onClick={linkEvent(
this,
this.handleCancelConfirmAppointAsAdmin
)}
>
{i18n.t('no')}
</span>
</>
)}
</li>
)}
</>
)}
{/* Site Creator can transfer to another admin */}
{this.amSiteCreator && this.isAdmin && (
<li className="list-inline-item-action"> <li className="list-inline-item-action">
{!this.state.showConfirmTransferCommunity ? ( {!this.state.showConfirmTransferSite ? (
<span <span
class="pointer" class="pointer"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleShowConfirmTransferCommunity this.handleShowConfirmTransferSite
)} )}
> >
{i18n.t('transfer_community')} {i18n.t('transfer_site')}
</span> </span>
) : ( ) : (
<> <>
@ -535,7 +665,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
class="pointer d-inline-block mr-1" class="pointer d-inline-block mr-1"
onClick={linkEvent( onClick={linkEvent(
this, this,
this.handleTransferCommunity this.handleTransferSite
)} )}
> >
{i18n.t('yes')} {i18n.t('yes')}
@ -544,8 +674,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
class="pointer d-inline-block" class="pointer d-inline-block"
onClick={linkEvent( onClick={linkEvent(
this, this,
this this.handleCancelShowConfirmTransferSite
.handleCancelShowConfirmTransferCommunity
)} )}
> >
{i18n.t('no')} {i18n.t('no')}
@ -554,124 +683,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
)} )}
</li> </li>
)} )}
{/* Admins can ban from all, and appoint other admins */} </>
{this.canAdmin && ( )}
<> </>
{!this.isAdmin && ( )}
<li className="list-inline-item-action"> </ul>
{!node.comment.banned ? ( </div>
<span )}
class="pointer" </div>
onClick={linkEvent(
this,
this.handleModBanShow
)}
>
{i18n.t('ban_from_site')}
</span>
) : (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleModBanSubmit
)}
>
{i18n.t('unban_from_site')}
</span>
)}
</li>
)}
{!node.comment.banned && (
<li className="list-inline-item-action">
{!this.state.showConfirmAppointAsAdmin ? (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleShowConfirmAppointAsAdmin
)}
>
{this.isAdmin
? i18n.t('remove_as_admin')
: i18n.t('appoint_as_admin')}
</span>
) : (
<>
<span class="d-inline-block mr-1">
{i18n.t('are_you_sure')}
</span>
<span
class="pointer d-inline-block mr-1"
onClick={linkEvent(
this,
this.handleAddAdmin
)}
>
{i18n.t('yes')}
</span>
<span
class="pointer d-inline-block"
onClick={linkEvent(
this,
this.handleCancelConfirmAppointAsAdmin
)}
>
{i18n.t('no')}
</span>
</>
)}
</li>
)}
</>
)}
{/* Site Creator can transfer to another admin */}
{this.amSiteCreator && this.isAdmin && (
<li className="list-inline-item-action">
{!this.state.showConfirmTransferSite ? (
<span
class="pointer"
onClick={linkEvent(
this,
this.handleShowConfirmTransferSite
)}
>
{i18n.t('transfer_site')}
</span>
) : (
<>
<span class="d-inline-block mr-1">
{i18n.t('are_you_sure')}
</span>
<span
class="pointer d-inline-block mr-1"
onClick={linkEvent(
this,
this.handleTransferSite
)}
>
{i18n.t('yes')}
</span>
<span
class="pointer d-inline-block"
onClick={linkEvent(
this,
this.handleCancelShowConfirmTransferSite
)}
>
{i18n.t('no')}
</span>
</>
)}
</li>
)}
</>
)}
</>
)}
</ul>
</div>
)}
</div> </div>
{this.state.showRemoveDialog && ( {this.state.showRemoveDialog && (
<form <form

4
ui/src/utils.ts vendored

@ -767,3 +767,7 @@ export function postSort(
); );
} }
} }
export function randomHsl() {
return `hsla(${Math.random() * 360}, 100%, 50%, 1)`;
}

Loading…
Cancel
Save