Skip to content

Commit

Permalink
change project.path to project.pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
HuntFeng committed Dec 8, 2023
1 parent f9e9d3d commit bc9866d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "research-helper",
"version": "3.3.0-beta",
"version": "3.4.0-beta",
"description": "A paper / book / note management tool",
"productName": "Research Helper",
"author": "Hunt Feng <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/export/sophosiadb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export async function exportDB(
const oldFilePath = path.join(oldProjectFolder, entry);
const newFilePath = path.join(projectFolder, entry);
fs.copyFileSync(oldFilePath, newFilePath);
project.path = newFilePath;
project.pdf = path.basename(newFilePath);
} else {
// notes: md, and excalidraw
const ext = path.extname(entry); // ext has the .
Expand Down
37 changes: 8 additions & 29 deletions src/components/settings/GeneralTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
readonly
input-style="cursor: pointer; font-size: 1rem"
v-model="stateStore.settings.storagePath"
@click="showFolderPicker(true)"
@click="showFolderPicker()"
>
<template v-slot:before>
<div style="font-size: 1rem">{{ $t("storage-path") }}</div>
Expand All @@ -123,7 +123,6 @@
color="primary"
:ripple="false"
:label="$t('export-database')"
:disable="disableExportBtn"
@click="() => exportAsSophosiaDB()"
>
</q-btn>
Expand All @@ -138,20 +137,6 @@
>{{ " " + $t("what-is-sophosia") }}</a
>
</p>
<q-input
dense
outlined
square
readonly
input-style="cursor: pointer; font-size: 1rem"
v-model="newStoragePath"
:placeholder="$t('select-new-path')"
@click="showFolderPicker(false)"
>
<template v-slot:before>
<div style="font-size: 1rem">{{ $t("new-storage-path") }}</div>
</template>
</q-input>
</q-card-section>
</q-card>

Expand Down Expand Up @@ -262,10 +247,6 @@ const showProgressDialog = ref(false);
const errors = ref<Error[]>([]);
const progress = ref(0.0);
// export sophosia db
const newStoragePath = ref("");
const disableExportBtn = ref(false);
// options
const languageOptions = [
{ value: "en_US", label: "English (en_US)" },
Expand Down Expand Up @@ -355,15 +336,11 @@ const citeKeyConnector = ref(
* so that the newStoragePath select can be used in exportDB section
* @param changePath
*/
async function showFolderPicker(changePath: boolean) {
async function showFolderPicker() {
let result = window.fileBrowser.showFolderPicker();
if (result !== undefined && !!result[0]) {
let storagePath = result[0]; // do not update texts in label yet
if (changePath) await changeStoragePath(storagePath);
else {
newStoragePath.value = storagePath;
disableExportBtn.value = false;
}
await changeStoragePath(storagePath);
}
}
Expand Down Expand Up @@ -426,12 +403,14 @@ async function moveFiles(oldPath: string, newPath: string) {
}
async function exportAsSophosiaDB() {
if (!newStoragePath.value) return;
let result = window.fileBrowser.showFolderPicker();
if (!result || !result[0]) return;
const newStoragePath = result[0]; // do not update texts in label yet
if (!newStoragePath) return;
showProgressDialog.value = true;
await exportDB(newStoragePath.value, (prog) => {
await exportDB(newStoragePath, (prog) => {
progress.value = prog;
});
disableExportBtn.value = true;
}
function citeKeyExample(meta: Meta) {
Expand Down

0 comments on commit bc9866d

Please sign in to comment.