Skip to content

Commit

Permalink
chore: add priorities to profile settings page (#3657)
Browse files Browse the repository at this point in the history
To give extensions more flexibility
  • Loading branch information
SychO9 authored Oct 18, 2022
1 parent fcb1ca6 commit a85ac3e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions js/src/forum/components/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ export default class SettingsPage<CustomAttrs extends IUserPageAttrs = IUserPage
settingsItems() {
const items = new ItemList<Mithril.Children>();

['account', 'notifications', 'privacy'].forEach((section) => {
['account', 'notifications', 'privacy'].forEach((section, index) => {
const sectionItems = `${section}Items` as 'accountItems' | 'notificationsItems' | 'privacyItems';

items.add(
section,
<FieldSet className={`Settings-${section}`} label={app.translator.trans(`core.forum.settings.${section}_heading`)}>
{this[sectionItems]().toArray()}
</FieldSet>
</FieldSet>,
100 - index * 10
);
});

Expand All @@ -64,14 +65,16 @@ export default class SettingsPage<CustomAttrs extends IUserPageAttrs = IUserPage
'changePassword',
<Button className="Button" onclick={() => app.modal.show(ChangePasswordModal)}>
{app.translator.trans('core.forum.settings.change_password_button')}
</Button>
</Button>,
100
);

items.add(
'changeEmail',
<Button className="Button" onclick={() => app.modal.show(ChangeEmailModal)}>
{app.translator.trans('core.forum.settings.change_email_button')}
</Button>
</Button>,
90
);

return items;
Expand All @@ -83,7 +86,7 @@ export default class SettingsPage<CustomAttrs extends IUserPageAttrs = IUserPage
notificationsItems() {
const items = new ItemList<Mithril.Children>();

items.add('notificationGrid', <NotificationGrid user={this.user} />);
items.add('notificationGrid', <NotificationGrid user={this.user} />, 100);

return items;
}
Expand All @@ -109,7 +112,8 @@ export default class SettingsPage<CustomAttrs extends IUserPageAttrs = IUserPage
loading={this.discloseOnlineLoading}
>
{app.translator.trans('core.forum.settings.privacy_disclose_online_label')}
</Switch>
</Switch>,
100
);

return items;
Expand Down

0 comments on commit a85ac3e

Please sign in to comment.