Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable node/prefer-global/process */
import { readFileSync } from 'node:fs'
import { existsSync, readFileSync } from 'node:fs'
import path from 'node:path'
import { app, BrowserWindow, Menu } from 'electron'
import { initApi } from './api'
Expand Down Expand Up @@ -115,7 +115,12 @@ else {
}

try {
const jsonDbPath = `${store.preferences.get('storagePath')}/db.json`
const storagePath = store.preferences.get('storagePath')
const jsonDbPath = `${storagePath}/db.json`

if (!existsSync(jsonDbPath))
return

const jsonData = readFileSync(jsonDbPath, 'utf8')

migrateJsonToSqlite(JSON.parse(jsonData))
Expand Down
85 changes: 46 additions & 39 deletions src/renderer/components/sidebar/folders/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,45 +234,52 @@ provide(treeKeys, {
</div>
</ContextMenu.Trigger>
<ContextMenu.Content>
<ContextMenu.Item @click="createFolderAndSelect(contextNode?.id)">
{{ i18n.t("action.new.folder") }}
</ContextMenu.Item>
<ContextMenu.Separator />
<ContextMenu.Item @click="onRenameFolder">
{{ i18n.t("action.rename") }}
</ContextMenu.Item>
<ContextMenu.Item @click="onDeleteFolder">
{{ i18n.t("action.delete.common") }}
</ContextMenu.Item>
<ContextMenu.Separator />
<ContextMenu.Item @click="onSetCustomIcon">
{{ i18n.t("action.setCustomIcon") }}
</ContextMenu.Item>
<ContextMenu.Item
v-if="contextNode?.icon"
@click="onRemoveCustomIcon"
>
{{ i18n.t("action.removeCustomIcon") }}
</ContextMenu.Item>
<ContextMenu.Separator />
<ContextMenu.Sub>
<ContextMenu.SubTrigger>
{{ i18n.t("action.defaultLanguage") }}
</ContextMenu.SubTrigger>
<ContextMenu.SubContent>
<PerfectScrollbar :options="{ minScrollbarLength: 20 }">
<div class="max-h-[250px]">
<ContextMenu.Item
v-for="language in languages"
:key="language.value"
@click="onSelectLanguage(language.value)"
>
{{ language.name }}
</ContextMenu.Item>
</div>
</PerfectScrollbar>
</ContextMenu.SubContent>
</ContextMenu.Sub>
<template v-if="isContextMultiSelection">
<ContextMenu.Item @click="onDeleteFolder">
{{ i18n.t("action.delete.common") }}
</ContextMenu.Item>
</template>
<template v-else>
<ContextMenu.Item @click="createFolderAndSelect(contextNode?.id)">
{{ i18n.t("action.new.folder") }}
</ContextMenu.Item>
<ContextMenu.Separator />
<ContextMenu.Item @click="onRenameFolder">
{{ i18n.t("action.rename") }}
</ContextMenu.Item>
<ContextMenu.Item @click="onDeleteFolder">
{{ i18n.t("action.delete.common") }}
</ContextMenu.Item>
<ContextMenu.Separator />
<ContextMenu.Item @click="onSetCustomIcon">
{{ i18n.t("action.setCustomIcon") }}
</ContextMenu.Item>
<ContextMenu.Item
v-if="contextNode?.icon"
@click="onRemoveCustomIcon"
>
{{ i18n.t("action.removeCustomIcon") }}
</ContextMenu.Item>
<ContextMenu.Separator />
<ContextMenu.Sub>
<ContextMenu.SubTrigger>
{{ i18n.t("action.defaultLanguage") }}
</ContextMenu.SubTrigger>
<ContextMenu.SubContent>
<PerfectScrollbar :options="{ minScrollbarLength: 20 }">
<div class="max-h-[250px]">
<ContextMenu.Item
v-for="language in languages"
:key="language.value"
@click="onSelectLanguage(language.value)"
>
{{ language.name }}
</ContextMenu.Item>
</div>
</PerfectScrollbar>
</ContextMenu.SubContent>
</ContextMenu.Sub>
</template>
</ContextMenu.Content>
</ContextMenu.Root>
</PerfectScrollbar>
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.