mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-23 23:11:14 +00:00
commit
de4b1a0518
|
@ -218,6 +218,11 @@ blockquote {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comments {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
min-height: 60px;
|
min-height: 60px;
|
||||||
|
|
|
@ -156,7 +156,7 @@ server.get("/*", async (req, res) => {
|
||||||
site = try_site.data;
|
site = try_site.data;
|
||||||
initializeSite(site);
|
initializeSite(site);
|
||||||
|
|
||||||
if (path != "/setup" && !site.site_view.local_site.site_setup) {
|
if (path !== "/setup" && !site.site_view.local_site.site_setup) {
|
||||||
return res.redirect("/setup");
|
return res.redirect("/setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,9 +270,6 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
this.props.moderators
|
this.props.moderators
|
||||||
);
|
);
|
||||||
|
|
||||||
const borderColor = this.props.node.depth
|
|
||||||
? colorList[(this.props.node.depth - 1) % colorList.length]
|
|
||||||
: colorList[0];
|
|
||||||
const moreRepliesBorderColor = this.props.node.depth
|
const moreRepliesBorderColor = this.props.node.depth
|
||||||
? colorList[this.props.node.depth % colorList.length]
|
? colorList[this.props.node.depth % colorList.length]
|
||||||
: colorList[0];
|
: colorList[0];
|
||||||
|
@ -284,26 +281,17 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
node.comment_view.counts.child_count > 0;
|
node.comment_view.counts.child_count > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<li className="comment" role="comment">
|
||||||
className={`comment ${
|
|
||||||
this.props.node.depth && !this.props.noIndent ? "ml-1" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<div
|
<div
|
||||||
id={`comment-${cv.comment.id}`}
|
id={`comment-${cv.comment.id}`}
|
||||||
className={classNames(`details comment-node py-2`, {
|
className={classNames(`details comment-node py-2`, {
|
||||||
"border-top border-light": !this.props.noBorder,
|
"border-top border-light": !this.props.noBorder,
|
||||||
mark: this.isCommentNew || this.commentView.comment.distinguished,
|
mark: this.isCommentNew || this.commentView.comment.distinguished,
|
||||||
})}
|
})}
|
||||||
style={
|
|
||||||
!this.props.noIndent && this.props.node.depth
|
|
||||||
? `border-left: 2px ${borderColor} solid !important`
|
|
||||||
: ""
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={classNames({
|
className={classNames({
|
||||||
"ml-2": !this.props.noIndent && this.props.node.depth,
|
"ml-2": !this.props.noIndent,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div className="d-flex flex-wrap align-items-center text-muted small">
|
<div className="d-flex flex-wrap align-items-center text-muted small">
|
||||||
|
@ -959,9 +947,9 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
</div>
|
</div>
|
||||||
{showMoreChildren && (
|
{showMoreChildren && (
|
||||||
<div
|
<div
|
||||||
className={`details ml-1 comment-node py-2 ${
|
className={classNames("details ml-1 comment-node py-2", {
|
||||||
!this.props.noBorder ? "border-top border-light" : ""
|
"border-top border-light": !this.props.noBorder,
|
||||||
}`}
|
})}
|
||||||
style={`border-left: 2px ${moreRepliesBorderColor} solid !important`}
|
style={`border-left: 2px ${moreRepliesBorderColor} solid !important`}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
|
@ -1169,6 +1157,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
allLanguages={this.props.allLanguages}
|
allLanguages={this.props.allLanguages}
|
||||||
siteLanguages={this.props.siteLanguages}
|
siteLanguages={this.props.siteLanguages}
|
||||||
hideImages={this.props.hideImages}
|
hideImages={this.props.hideImages}
|
||||||
|
isChild={!this.props.noIndent}
|
||||||
|
depth={this.props.node.depth + 1}
|
||||||
finished={this.props.finished}
|
finished={this.props.finished}
|
||||||
onCommentReplyRead={this.props.onCommentReplyRead}
|
onCommentReplyRead={this.props.onCommentReplyRead}
|
||||||
onPersonMentionRead={this.props.onPersonMentionRead}
|
onPersonMentionRead={this.props.onPersonMentionRead}
|
||||||
|
@ -1192,8 +1182,8 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* A collapsed clearfix */}
|
{/* A collapsed clearfix */}
|
||||||
{this.state.collapsed && <div className="row col-12"></div>}
|
{this.state.collapsed && <div className="row col-12" />}
|
||||||
</div>
|
</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1211,6 +1201,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
|
|
||||||
linkBtn(small = false) {
|
linkBtn(small = false) {
|
||||||
const cv = this.commentView;
|
const cv = this.commentView;
|
||||||
|
|
||||||
const classnames = classNames("btn btn-link btn-animate text-muted", {
|
const classnames = classNames("btn btn-link btn-animate text-muted", {
|
||||||
"btn-sm": small,
|
"btn-sm": small,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import classNames from "classnames";
|
||||||
import { Component } from "inferno";
|
import { Component } from "inferno";
|
||||||
import {
|
import {
|
||||||
AddAdmin,
|
AddAdmin,
|
||||||
|
@ -25,6 +26,7 @@ import {
|
||||||
TransferCommunity,
|
TransferCommunity,
|
||||||
} from "lemmy-js-client";
|
} from "lemmy-js-client";
|
||||||
import { CommentNodeI, CommentViewType } from "../../interfaces";
|
import { CommentNodeI, CommentViewType } from "../../interfaces";
|
||||||
|
import { colorList } from "../../utils";
|
||||||
import { CommentNode } from "./comment-node";
|
import { CommentNode } from "./comment-node";
|
||||||
|
|
||||||
interface CommentNodesProps {
|
interface CommentNodesProps {
|
||||||
|
@ -44,6 +46,8 @@ interface CommentNodesProps {
|
||||||
allLanguages: Language[];
|
allLanguages: Language[];
|
||||||
siteLanguages: number[];
|
siteLanguages: number[];
|
||||||
hideImages?: boolean;
|
hideImages?: boolean;
|
||||||
|
isChild?: boolean;
|
||||||
|
depth?: number;
|
||||||
finished: Map<CommentId, boolean | undefined>;
|
finished: Map<CommentId, boolean | undefined>;
|
||||||
onSaveComment(form: SaveComment): void;
|
onSaveComment(form: SaveComment): void;
|
||||||
onCommentReplyRead(form: MarkCommentReplyAsRead): void;
|
onCommentReplyRead(form: MarkCommentReplyAsRead): void;
|
||||||
|
@ -74,49 +78,61 @@ export class CommentNodes extends Component<CommentNodesProps, any> {
|
||||||
render() {
|
render() {
|
||||||
const maxComments = this.props.maxCommentsShown ?? this.props.nodes.length;
|
const maxComments = this.props.maxCommentsShown ?? this.props.nodes.length;
|
||||||
|
|
||||||
|
const borderColor = this.props.depth
|
||||||
|
? colorList[this.props.depth % colorList.length]
|
||||||
|
: colorList[0];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="comments">
|
this.props.nodes.length > 0 && (
|
||||||
{this.props.nodes.slice(0, maxComments).map(node => (
|
<ul
|
||||||
<CommentNode
|
className={classNames("comments", {
|
||||||
key={node.comment_view.comment.id}
|
"ms-1": !!this.props.isChild,
|
||||||
node={node}
|
"border-top border-light": !this.props.noBorder,
|
||||||
noBorder={this.props.noBorder}
|
})}
|
||||||
noIndent={this.props.noIndent}
|
style={`border-left: 2px solid ${borderColor} !important;`}
|
||||||
viewOnly={this.props.viewOnly}
|
>
|
||||||
locked={this.props.locked}
|
{this.props.nodes.slice(0, maxComments).map(node => (
|
||||||
moderators={this.props.moderators}
|
<CommentNode
|
||||||
admins={this.props.admins}
|
key={node.comment_view.comment.id}
|
||||||
markable={this.props.markable}
|
node={node}
|
||||||
showContext={this.props.showContext}
|
noBorder={this.props.noBorder}
|
||||||
showCommunity={this.props.showCommunity}
|
noIndent={this.props.noIndent}
|
||||||
enableDownvotes={this.props.enableDownvotes}
|
viewOnly={this.props.viewOnly}
|
||||||
viewType={this.props.viewType}
|
locked={this.props.locked}
|
||||||
allLanguages={this.props.allLanguages}
|
moderators={this.props.moderators}
|
||||||
siteLanguages={this.props.siteLanguages}
|
admins={this.props.admins}
|
||||||
hideImages={this.props.hideImages}
|
markable={this.props.markable}
|
||||||
onCommentReplyRead={this.props.onCommentReplyRead}
|
showContext={this.props.showContext}
|
||||||
onPersonMentionRead={this.props.onPersonMentionRead}
|
showCommunity={this.props.showCommunity}
|
||||||
finished={this.props.finished}
|
enableDownvotes={this.props.enableDownvotes}
|
||||||
onCreateComment={this.props.onCreateComment}
|
viewType={this.props.viewType}
|
||||||
onEditComment={this.props.onEditComment}
|
allLanguages={this.props.allLanguages}
|
||||||
onCommentVote={this.props.onCommentVote}
|
siteLanguages={this.props.siteLanguages}
|
||||||
onBlockPerson={this.props.onBlockPerson}
|
hideImages={this.props.hideImages}
|
||||||
onSaveComment={this.props.onSaveComment}
|
onCommentReplyRead={this.props.onCommentReplyRead}
|
||||||
onDeleteComment={this.props.onDeleteComment}
|
onPersonMentionRead={this.props.onPersonMentionRead}
|
||||||
onRemoveComment={this.props.onRemoveComment}
|
finished={this.props.finished}
|
||||||
onDistinguishComment={this.props.onDistinguishComment}
|
onCreateComment={this.props.onCreateComment}
|
||||||
onAddModToCommunity={this.props.onAddModToCommunity}
|
onEditComment={this.props.onEditComment}
|
||||||
onAddAdmin={this.props.onAddAdmin}
|
onCommentVote={this.props.onCommentVote}
|
||||||
onBanPersonFromCommunity={this.props.onBanPersonFromCommunity}
|
onBlockPerson={this.props.onBlockPerson}
|
||||||
onBanPerson={this.props.onBanPerson}
|
onSaveComment={this.props.onSaveComment}
|
||||||
onTransferCommunity={this.props.onTransferCommunity}
|
onDeleteComment={this.props.onDeleteComment}
|
||||||
onFetchChildren={this.props.onFetchChildren}
|
onRemoveComment={this.props.onRemoveComment}
|
||||||
onCommentReport={this.props.onCommentReport}
|
onDistinguishComment={this.props.onDistinguishComment}
|
||||||
onPurgePerson={this.props.onPurgePerson}
|
onAddModToCommunity={this.props.onAddModToCommunity}
|
||||||
onPurgeComment={this.props.onPurgeComment}
|
onAddAdmin={this.props.onAddAdmin}
|
||||||
/>
|
onBanPersonFromCommunity={this.props.onBanPersonFromCommunity}
|
||||||
))}
|
onBanPerson={this.props.onBanPerson}
|
||||||
</div>
|
onTransferCommunity={this.props.onTransferCommunity}
|
||||||
|
onFetchChildren={this.props.onFetchChildren}
|
||||||
|
onCommentReport={this.props.onCommentReport}
|
||||||
|
onPurgePerson={this.props.onPurgePerson}
|
||||||
|
onPurgeComment={this.props.onPurgeComment}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1128,7 +1128,7 @@ export const colorList: string[] = [
|
||||||
];
|
];
|
||||||
|
|
||||||
function hsl(num: number) {
|
function hsl(num: number) {
|
||||||
return `hsla(${num}, 35%, 50%, 1)`;
|
return `hsla(${num}, 35%, 50%, 0.5)`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hostname(url: string): string {
|
export function hostname(url: string): string {
|
||||||
|
|
Loading…
Reference in a new issue