Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
daocatt committed Mar 21, 2024
1 parent 1dda1c7 commit 29ff2e8
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 33 deletions.
3 changes: 1 addition & 2 deletions js/src/forum/addBadgesToUserCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function addBadgesToUserCard() {
if (user.attribute('badges_count') <= 0) return;

const limit = app.forum.attribute('numberOfBadgesOnUserCard');

const badges = [];

visibleBadges.forEach((badgeItem, indx) => {
Expand Down Expand Up @@ -58,6 +58,5 @@ export default function addBadgesToUserCard() {
}

items.add('badges', badges);

});
}
8 changes: 3 additions & 5 deletions js/src/forum/components/BadgeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,11 @@ export default class BadgeModal extends Modal {
background: 'radial-gradient(' + radials + ',' + radiale + ')',
}}
>

{this.attrs.badge.image() ? (
<img src={this.attrs.badge.image() } className="icon" />
{this.attrs.badge.image() ? (
<img src={this.attrs.badge.image()} className="icon" />
) : (
<i className={this.attrs.badge.icon()} style={'color:'+this.attrs.badge.iconColor()}></i>
<i className={this.attrs.badge.icon()} style={'color:' + this.attrs.badge.iconColor()}></i>
)}

</div>
);

Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/components/SelectUserCardBadgesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default class SelectUserCardBadgesModal extends Modal {
.save({ userCardBadges: this.selectedBadges })
.then(() => {
// Update current user badges store

// this.attrs.user.attribute('badges').map((badgeItem) => {
// badgeItem.in_user_card = this.selectedBadges.indexOf(parseInt(badgeItem.id)) >= 0;
// });
Expand Down
28 changes: 14 additions & 14 deletions js/src/forum/components/UserBadgesContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ export default class UserBadgesContent extends Component {

{category && category.description() && <p>{category.description()}</p>}
<div className="badgeList">
{badges
.sort((a, b) => a.badge().order() - b.badge().order())
.map((userBadge) => (
<UserBadge
badge={userBadge.badge()}
onclick={() =>
app.modal.show(BadgeModal, {
badge: userBadge.badge(),
userBadgeData: userBadge,
})
}
/>
))}
</div>
{badges
.sort((a, b) => a.badge().order() - b.badge().order())
.map((userBadge) => (
<UserBadge
badge={userBadge.badge()}
onclick={() =>
app.modal.show(BadgeModal, {
badge: userBadge.badge(),
userBadgeData: userBadge,
})
}
/>
))}
</div>
</div>
);
})}
Expand Down
2 changes: 0 additions & 2 deletions js/src/forum/components/UserCardBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import Component from 'flarum/common/Component';
import Tooltip from 'flarum/common/components/Tooltip';

export default class UserCardBadge extends Component {


view() {
const item = this.attrs.badge;
const tooltip = this.attrs.tooltip !== false;
Expand Down
18 changes: 10 additions & 8 deletions js/src/forum/components/UserCardBadgeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ export default class UserCardBadgeModal extends Modal {
const that = this;
// this.badgeData.delete().then(() => this.hide());

app.request({
method: 'DELETE',
url: app.forum.attribute('apiUrl') + '/user-badges/' + this.badgeData.id,
body: {},
}).then(() => {
that.hide();
});
app
.request({
method: 'DELETE',
url: app.forum.attribute('apiUrl') + '/user-badges/' + this.badgeData.id,
body: {},
})
.then(() => {
that.hide();
});
}
}}
loading={this.loading}
Expand Down Expand Up @@ -86,7 +88,7 @@ export default class UserCardBadgeModal extends Modal {
{this.badgeItem.image ? (
<img src={this.badgeItem.image} className="icon" />
) : (
<i className={this.badgeItem.icon} style={'color:'+this.badgeItem.icon_color}></i>
<i className={this.badgeItem.icon} style={'color:' + this.badgeItem.icon_color}></i>
)}
</div>
);
Expand Down
1 change: 0 additions & 1 deletion js/src/forum/notification/BadgeReceivedNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default class BadgeReceivedNotification extends Notification {
}

excerpt() {

const subject = this.attrs.notification.subject();

return (
Expand Down

0 comments on commit 29ff2e8

Please sign in to comment.