import { setupTippy } from "../../tippy";
import { Icon, PurgeWarning, Spinner } from "../common/icon";
import { MomentTime } from "../common/moment-time";
+import { UserBadges } from "../common/user-badges";
import { VoteButtonsCompact } from "../common/vote-buttons";
import { CommunityLink } from "../community/community-link";
import { PersonListing } from "../person/person-listing";
moderators?: CommunityModeratorView[];
admins?: PersonView[];
noBorder?: boolean;
- noIndent?: boolean;
+ isTopLevel?: boolean;
viewOnly?: boolean;
locked?: boolean;
markable?: boolean;
mark: this.isCommentNew || this.commentView.comment.distinguished,
})}
>
- <div
- className={classNames({
- "ms-2": !this.props.noIndent,
- })}
- >
+ <div className="ms-2">
<div className="d-flex flex-wrap align-items-center text-muted small">
<button
- className="btn btn-sm text-muted me-2"
+ className="btn btn-sm btn-link text-muted me-2"
onClick={linkEvent(this, this.handleCommentCollapse)}
aria-label={this.expandText}
data-tippy-content={this.expandText}
/>
</button>
- <span className="me-2">
- <PersonListing person={cv.creator} />
- </span>
+ <PersonListing person={cv.creator} />
{cv.comment.distinguished && (
- <Icon icon="shield" inline classes="text-danger me-2" />
+ <Icon icon="shield" inline classes="text-danger ms-1" />
)}
- {this.isPostCreator &&
- this.getRoleLabelPill({
- label: I18NextService.i18n.t("op").toUpperCase(),
- tooltip: I18NextService.i18n.t("creator"),
- textClasses: "text-info",
- hideOnMobile: false,
- })}
-
- {isMod_ &&
- this.getRoleLabelPill({
- label: I18NextService.i18n.t("mod"),
- tooltip: I18NextService.i18n.t("mod"),
- hideOnMobile: true,
- })}
-
- {isAdmin_ &&
- this.getRoleLabelPill({
- label: I18NextService.i18n.t("admin"),
- tooltip: I18NextService.i18n.t("admin"),
- hideOnMobile: true,
- })}
-
- {cv.creator.bot_account &&
- this.getRoleLabelPill({
- label: I18NextService.i18n.t("bot_account").toLowerCase(),
- tooltip: I18NextService.i18n.t("bot_account"),
- hideOnMobile: true,
- })}
+ <UserBadges
+ classNames="ms-1"
+ isPostCreator={this.isPostCreator}
+ isMod={isMod_}
+ isAdmin={isAdmin_}
+ isBot={cv.creator.bot_account}
+ />
{this.props.showCommunity && (
<>
allLanguages={this.props.allLanguages}
siteLanguages={this.props.siteLanguages}
hideImages={this.props.hideImages}
- isChild={!this.props.noIndent}
+ isChild={!this.props.isTopLevel}
depth={this.props.node.depth + 1}
finished={this.props.finished}
onCommentReplyRead={this.props.onCommentReplyRead}
}
}
- getRoleLabelPill({
- label,
- tooltip,
- textClasses,
- hideOnMobile,
- }: {
- label: string;
- tooltip: string;
- textClasses?: string;
- hideOnMobile?: boolean;
- }) {
- const classnames = classNames(`badge me-2 text-bg-light ${textClasses}`, {
- "d-none d-md-inline": hideOnMobile,
- });
-
- return (
- <span
- className={classnames}
- aria-label={tooltip}
- data-tippy-content={tooltip}
- >
- {label}
- </span>
- );
- }
-
getLinkButton(small = false) {
const cv = this.commentView;
comment_id: i.commentId,
removed: !i.commentView.comment.removed,
auth: myAuthRequired(),
+ reason: i.state.removeReason,
});
}