Skip to content

Commit

Permalink
Assign default category Others (#339)
Browse files Browse the repository at this point in the history
* Assign default category Others

* nit
  • Loading branch information
huchenlei authored Aug 9, 2024
1 parent a5f0d2b commit 5490ccf
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/stores/settingStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,23 @@ export const useSettingStore = defineStore('setting', {
}),
getters: {
settingTree(): SettingTreeNode {
return buildTree(Object.values(this.settings), (setting: SettingParams) =>
setting.id.split('.')
const root = buildTree(
Object.values(this.settings),
(setting: SettingParams) => setting.id.split('.')
)

const floatingSettings = root.children.filter((node) => node.leaf)
if (floatingSettings.length) {
root.children = root.children.filter((node) => !node.leaf)
root.children.push({
key: 'Other',
label: 'Other',
leaf: false,
children: floatingSettings
})
}

return root
}
},
actions: {
Expand Down

0 comments on commit 5490ccf

Please sign in to comment.