Skip to content

Commit

Permalink
fix(addon-manager): order
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Nov 22, 2024
1 parent 23a84ff commit 8a4f2b4
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions addons/addon-manager/src/renderer/AddonManagerPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ipcRenderer } from '@commas/electron-ipc'
import type { AddonInfo } from '@commas/types/addon'
import type { TerminalTab } from '@commas/types/terminal'
import * as commas from 'commas:api/renderer'
import { sortBy } from 'lodash'
import { onMounted, watchEffect } from 'vue'
import { useDiscoveredAddons } from './compositions'
Expand Down Expand Up @@ -34,16 +35,23 @@ watchEffect(() => {
})
const addonList = $computed(() => {
return discoveredAddons
.filter(addon => {
if (!isBuiltinAddonsVisible && addon.type === 'builtin') return false
return true
})
.map(addon => ({
addon,
manifest: commas.remote.getI18nManifest(addon.manifest),
enabled: enabledAddons.includes(addon.name),
}))
return sortBy(
discoveredAddons
.filter(addon => {
if (!isBuiltinAddonsVisible && addon.type === 'builtin') return false
return true
})
.map(addon => ({
addon,
manifest: commas.remote.getI18nManifest(addon.manifest),
enabled: enabledAddons.includes(addon.name),
})),
[
({ enabled }) => (enabled ? 0 : 1),
({ addon }) => (addon.type === 'builtin' ? 1 : 0),
({ addon }) => addon.name,
],
)
})
function toggle(addon: AddonInfo, enabled: boolean) {
Expand Down

0 comments on commit 8a4f2b4

Please sign in to comment.