Skip to content

Commit

Permalink
Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervriends committed Mar 27, 2021
1 parent 2046d66 commit 31e2c63
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
9 changes: 3 additions & 6 deletions js/src/forum/components/BadgeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,13 @@ export default class BadgeModal extends Modal {
</b>
</p>
<p>
{this.attrs.badge.category() && (
this.attrs.badge.category().name()
)}
{this.attrs.badge.category() && this.attrs.badge.category().name()}

{/* Uncategorized */}
{!this.attrs.badge.category() && (
{!this.attrs.badge.category() &&
app.translator.trans(
"v17development-flarum-badges.forum.uncategorized"
)
)}
)}
{/* <Link
href={app.route("badges.category", {
category: this.attrs.badge.category().id(),
Expand Down
18 changes: 9 additions & 9 deletions js/src/forum/components/BadgesProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export default class BadgesProfilePage extends UserPage {

content() {
if (!this.user || this.loading) {
return (
<LoadingIndicator size={46} />
);
return <LoadingIndicator size={46} />;
}

return UserBadgeList.component({
Expand All @@ -29,11 +27,13 @@ export default class BadgesProfilePage extends UserPage {
super.show(user);
this.user = user;

app.store.find('users', user.id(), {
include: 'userBadges,userBadges.badge,userBadges.badge.category'
}).then(() => {
this.loading = false;
m.redraw();
});
app.store
.find("users", user.id(), {
include: "userBadges,userBadges.badge,userBadges.badge.category",
})
.then(() => {
this.loading = false;
m.redraw();
});
}
}
37 changes: 20 additions & 17 deletions js/src/forum/components/GiveBadgeModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export default class GiveBadgeModal extends Modal {
this.loading = true;

app.store
.find('badges', {
include: 'category'
.find("badges", {
include: "category",
})
.then(badges => {
badges.forEach(badge => {
.then((badges) => {
badges.forEach((badge) => {
// Categorized
if(badge.category()) {
if (badge.category()) {
const category = badge.category();

if (!this.categories[category.id()]) {
this.categories[category.id()] = {
category,
Expand All @@ -57,7 +57,7 @@ export default class GiveBadgeModal extends Modal {
}
}
// Uncategorized
else{
else {
this.uncategorizedBadges.push(badge);
}
});
Expand Down Expand Up @@ -141,22 +141,25 @@ export default class GiveBadgeModal extends Modal {

{/* When no badge is selected, show all available badges */}
{!this.attrs.badge &&
Object.values(this.categories).map(({ category, badges}) => (
Object.values(this.categories).map(({ category, badges }) => (
<optgroup label={category.name()}>
{badges.map((badge) => (
<option value={badge.id()}>{badge.name()}</option>
))}
</optgroup>
))}

{!this.attrs.badge &&
this.uncategorizedBadges.length >= 1 && (
<optgroup label={app.translator.trans("v17development-flarum-badges.forum.uncategorized")}>
{this.uncategorizedBadges.map((badge) => (
<option value={badge.id()}>{badge.name()}</option>
))}
</optgroup>
)}

{!this.attrs.badge && this.uncategorizedBadges.length >= 1 && (
<optgroup
label={app.translator.trans(
"v17development-flarum-badges.forum.uncategorized"
)}
>
{this.uncategorizedBadges.map((badge) => (
<option value={badge.id()}>{badge.name()}</option>
))}
</optgroup>
)}

{/* When a badge is already assigned */}
{!!this.attrs.badge && (
Expand Down
4 changes: 2 additions & 2 deletions js/src/forum/components/UserBadgeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class UserBadgeList extends Component {
if (!userBadge) return null;

// Categorized
if(userBadge.badge().category()) {
if (userBadge.badge().category()) {
const category = userBadge.badge().category();

if (!categories[category.id()]) {
Expand All @@ -23,7 +23,7 @@ export default class UserBadgeList extends Component {
}
}
// Uncategorized
else{
else {
uncategorized.push(userBadge);
}
});
Expand Down

0 comments on commit 31e2c63

Please sign in to comment.