Skip to content

Commit a51ced0

Browse files
fix(ui): Resources not sorted
1 parent 9b90e3b commit a51ced0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

packages/userscript/source/ui/ResourcesSettingsUi.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ export class ResourcesSettingsUi extends SettingsPanel<ResourcesSettings> {
2525
}),
2626
});
2727

28-
// Disable checkbox. Resource control is always active.
29-
//this.readOnly = true;
30-
3128
// Add all the current resources
29+
const preparedResources: Array<[ResourcesSettingsItem, string]> = Object.values(
30+
this.setting.resources
31+
).map(resource => [
32+
resource,
33+
ucfirst(this._host.engine.i18n(`$resources.${resource.resource}.title`)),
34+
]);
35+
3236
this._resources = [];
33-
for (const setting of Object.values(this.setting.resources)) {
34-
this._resources.push(
35-
this._makeResourceSetting(
36-
ucfirst(this._host.engine.i18n(`$resources.${setting.resource}.title`)),
37-
setting
38-
)
39-
);
37+
for (const [setting, title] of preparedResources.sort((a, b) => a[1].localeCompare(b[1]))) {
38+
this._resources.push(this._makeResourceSetting(title, setting));
4039
}
4140
const listResource = new SettingsList(this._host);
4241
listResource.addChildren(this._resources);

0 commit comments

Comments
 (0)