1
0
mirror of https://github.com/flarum/core.git synced 2025-08-09 09:57:06 +02:00

chore: major frontend JS cleanup (#3609)

This commit is contained in:
David Wheatley
2023-05-07 17:40:18 +01:00
committed by GitHub
parent 3264455068
commit e63e161be6
105 changed files with 817 additions and 1064 deletions

View File

@@ -41,13 +41,10 @@ export default function addMentionedByList() {
<>
{replies.map((reply) => (
<li data-number={reply.number()}>
{PostPreview.component({
post: reply,
onclick: hidePreview.bind(this),
})}
<PostPreview post={reply} onclick={hidePreview.bind(this)} />
</li>
))}
{replies.length < post.mentionedByCount() ? (
{replies.length < post.mentionedByCount() && (
<li className="Post-mentionedBy-preview-more">
<Button
className="PostPreview Button"
@@ -64,7 +61,7 @@ export default function addMentionedByList() {
</span>
</Button>
</li>
) : null}
)}
</>
);
@@ -149,7 +146,7 @@ export default function addMentionedByList() {
<div className="Post-mentionedBy">
<span className="Post-mentionedBy-summary">
{icon('fas fa-reply')}
{app.translator.trans('flarum-mentions.forum.post.mentioned_by' + (repliers[0].user() === app.session.user ? '_self' : '') + '_text', {
{app.translator.trans(`flarum-mentions.forum.post.mentioned_by${repliers[0].user() === app.session.user ? '_self' : ''}_text`, {
count: names.length,
users: punctuateSeries(names),
})}

View File

@@ -80,14 +80,14 @@ export default function addPostMentionPreviews() {
const discussion = post.discussion();
m.render($preview[0], [
discussion !== parentPost.discussion() ? (
discussion !== parentPost.discussion() && (
<li>
<span className="PostMention-preview-discussion">{discussion.title()}</span>
</li>
) : (
''
),
<li>{PostPreview.component({ post })}</li>,
<li>
<PostPreview post={post} />
</li>,
]);
positionPreview();
};
@@ -96,7 +96,7 @@ export default function addPostMentionPreviews() {
if (post && post.discussion()) {
showPost(post);
} else {
m.render($preview[0], LoadingIndicator.component());
m.render($preview[0], <LoadingIndicator />);
app.store.find('posts', id).then(showPost);
positionPreview();
}

View File

@@ -14,7 +14,7 @@ export default class PostQuoteButton extends Fragment {
view() {
return (
<button
class="Button PostQuoteButton"
className="Button PostQuoteButton"
onclick={() => {
reply(this.post, this.content);
}}

View File

@@ -70,14 +70,9 @@ app.initializers.add('flarum-mentions', function () {
const user = this.user;
items.add(
'mentions',
LinkButton.component(
{
href: app.route('user.mentions', { username: user.slug() }),
name: 'mentions',
icon: 'fas fa-at',
},
app.translator.trans('flarum-mentions.forum.user.mentions_link')
),
<LinkButton href={app.route('user.mentions', { username: user.slug() })} name="mentions" icon="fas fa-at">
{app.translator.trans('flarum-mentions.forum.user.mentions_link')}
</LinkButton>,
80
);
});