Skip to content

Commit 42984f2

Browse files
committed
refactor(main: db): no need to add inbox folder
1 parent 5cf809a commit 42984f2

File tree

2 files changed

+8
-38
lines changed

2 files changed

+8
-38
lines changed

src/main/services/db/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,6 @@ import { snakeCase } from 'lodash'
1212

1313
const DB_NAME = 'db.json'
1414

15-
const DEFAULT_SYSTEM_FOLDERS: Folder[] = [
16-
{
17-
id: nanoid(8),
18-
name: 'Inbox',
19-
defaultLanguage: 'plain_text',
20-
parentId: null,
21-
isOpen: false,
22-
isSystem: true,
23-
createdAt: new Date().valueOf(),
24-
updatedAt: new Date().valueOf()
25-
}
26-
]
27-
2815
const DEFAULT_FOLDER = {
2916
id: nanoid(8),
3017
name: 'Default',
@@ -46,7 +33,7 @@ export const createDb = () => {
4633
}
4734

4835
const db = {
49-
folders: [...DEFAULT_SYSTEM_FOLDERS, DEFAULT_FOLDER],
36+
folders: [DEFAULT_FOLDER],
5037
snippets: [],
5138
tags: []
5239
}
@@ -124,8 +111,6 @@ export const migrate = async (path: string) => {
124111
const folderIdsMap: any[] = []
125112
const tagIdsMap: any[] = []
126113

127-
folders.push(...DEFAULT_SYSTEM_FOLDERS)
128-
129114
masscodeJSONList.forEach(
130115
({ id, open, parentId, defaultLanguage, ...rest }) => {
131116
const newId = nanoid(8)
@@ -243,7 +228,7 @@ export const migrateFromSnippetsLab = (path: string) => {
243228
const tags = new Set<string>()
244229

245230
const db: DB = {
246-
folders: [...DEFAULT_SYSTEM_FOLDERS],
231+
folders: [],
247232
snippets: [],
248233
tags: []
249234
}

src/renderer/components/sidebar/TheSidebar.vue

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,27 +110,12 @@ const treeRef = ref()
110110
const sidebarRef = ref()
111111
const gutterRef = ref()
112112
113-
const systemFolders = computed(() => {
114-
const folders = folderStore.system.map(i => {
115-
let icon
116-
let alias
117-
if (i.name === 'Inbox') {
118-
icon = Inbox
119-
alias = 'inbox'
120-
}
121-
return { ...i, alias, icon }
122-
}) as SidebarSystemFolder[]
123-
124-
const other: SidebarSystemFolder[] = [
125-
{ name: 'Favorites', alias: 'favorites', icon: Favorite },
126-
{ name: 'All Snippets', alias: 'all', icon: Archive },
127-
{ name: 'Trash', alias: 'trash', icon: Trash }
128-
]
129-
130-
folders.splice(1, 0, ...other)
131-
132-
return folders
133-
})
113+
const systemFolders: SidebarSystemFolder[] = [
114+
{ name: 'Inbox', alias: 'inbox', icon: Inbox },
115+
{ name: 'Favorites', alias: 'favorites', icon: Favorite },
116+
{ name: 'All Snippets', alias: 'all', icon: Archive },
117+
{ name: 'Trash', alias: 'trash', icon: Trash }
118+
]
134119
135120
const tabs: Tabs[] = [
136121
{ label: 'Library', value: 'library' },

0 commit comments

Comments
 (0)