Skip to content

Commit 8a4f2b4

Browse files
committed
fix(addon-manager): order
1 parent 23a84ff commit 8a4f2b4

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

addons/addon-manager/src/renderer/AddonManagerPane.vue

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ipcRenderer } from '@commas/electron-ipc'
33
import type { AddonInfo } from '@commas/types/addon'
44
import type { TerminalTab } from '@commas/types/terminal'
55
import * as commas from 'commas:api/renderer'
6+
import { sortBy } from 'lodash'
67
import { onMounted, watchEffect } from 'vue'
78
import { useDiscoveredAddons } from './compositions'
89
@@ -34,16 +35,23 @@ watchEffect(() => {
3435
})
3536
3637
const addonList = $computed(() => {
37-
return discoveredAddons
38-
.filter(addon => {
39-
if (!isBuiltinAddonsVisible && addon.type === 'builtin') return false
40-
return true
41-
})
42-
.map(addon => ({
43-
addon,
44-
manifest: commas.remote.getI18nManifest(addon.manifest),
45-
enabled: enabledAddons.includes(addon.name),
46-
}))
38+
return sortBy(
39+
discoveredAddons
40+
.filter(addon => {
41+
if (!isBuiltinAddonsVisible && addon.type === 'builtin') return false
42+
return true
43+
})
44+
.map(addon => ({
45+
addon,
46+
manifest: commas.remote.getI18nManifest(addon.manifest),
47+
enabled: enabledAddons.includes(addon.name),
48+
})),
49+
[
50+
({ enabled }) => (enabled ? 0 : 1),
51+
({ addon }) => (addon.type === 'builtin' ? 1 : 0),
52+
({ addon }) => addon.name,
53+
],
54+
)
4755
})
4856
4957
function toggle(addon: AddonInfo, enabled: boolean) {

0 commit comments

Comments
 (0)