From 6df1acb37450b94a458db47ee45d4f4e74ef3f59 Mon Sep 17 00:00:00 2001 From: GeoffreyChen777 Date: Fri, 24 May 2024 16:39:40 +0100 Subject: [PATCH] feat: add guide view for new users (#544) --- app/common/services/preference-service.ts | 2 + app/locales/locales/en.GB.json | 22 ++ app/locales/locales/zh.CN.json | 22 ++ app/renderer/ui/app-view.vue | 12 + app/renderer/ui/guide-view/guide-view.vue | 284 ++++++++++++++++++ app/renderer/ui/presetting-view/lang-view.vue | 2 +- 6 files changed, 343 insertions(+), 1 deletion(-) create mode 100644 app/renderer/ui/guide-view/guide-view.vue diff --git a/app/common/services/preference-service.ts b/app/common/services/preference-service.ts index 41182384..4193c947 100644 --- a/app/common/services/preference-service.ts +++ b/app/common/services/preference-service.ts @@ -93,6 +93,7 @@ export interface IPreferenceStore { importedCSLStylesPath: string; showPresetting: boolean; + showGuide: boolean; showWelcome: boolean; fontsize: "normal" | "large" | "larger"; } @@ -211,6 +212,7 @@ const _defaultPreferences: IPreferenceStore = { importedCSLStylesPath: "", showPresetting: true, + showGuide: true, showWelcome: true, fontsize: "normal", }; diff --git a/app/locales/locales/en.GB.json b/app/locales/locales/en.GB.json index 222340e7..c1a90c6e 100644 --- a/app/locales/locales/en.GB.json +++ b/app/locales/locales/en.GB.json @@ -245,5 +245,27 @@ "extensionscraper": "Scraper Extensions", "extensionscraperrequired": "Please install the scraper extensions", "extensionrecommend": "Recommened Extensions" + }, + "guide": { + "import1title": "1. Import to the Library", + "import1info1": "Drag and drop your PDF files here to import them.", + "import1info2": "You can also download our browser extension to import PDFs directly from the web.", + "import2title": "2. Import to Tags/Folders", + "import2info1": "Drag and drop your PDF files to a tag/folder to import them directly to it.", + "supp1title": "Add supplementary files.", + "supp1info1": "Drag and drop your files here to add them as supplementary files.", + "supp1info2": "Right click on a file to delete or rename it.", + "search1title": "Search and Command Bar", + "search1info1": "You can search your library using the search bar.", + "search1info2": "By pressing '\\', you can open the command bar to do fulltext or advanced searching, and also perform various actions.", + "viewmode1title": "Three View Modes", + "viewmode1info1": "You can switch between list view, table view, and table reader view.", + "viewmode1info2": "In the preference view - mainview tab, you can choose which information to display in each view mode.", + "quickpaste1title": "Quick Copy-paste Window", + "quickpaste1info1": "By pressing `Ctrl/Cmd + Shift + I`, you can open the quick copy-paste window to copy and paste references.", + "quickpaste1info2": "It's a convenient way to copy BibTex, or plain text references to your clipboard when you are writing a paper.", + "more1title": "For More", + "more1info1": "Please visit our website for more guides and tutorials.", + "more1info2": "Click here." } } \ No newline at end of file diff --git a/app/locales/locales/zh.CN.json b/app/locales/locales/zh.CN.json index 0e01329a..01183a4e 100644 --- a/app/locales/locales/zh.CN.json +++ b/app/locales/locales/zh.CN.json @@ -245,5 +245,27 @@ "extensionscraper": "元数据搜刮器插件", "extensionscraperrequired": "请安装元数据搜刮器插件", "extensionrecommend": "推荐插件" + }, + "guide": { + "import1title": "1. 导入论文到库", + "import1info1": "拖动你的 PDF 文件到这里导入论文。", + "import1info2": "你也可以下载我们的浏览器插件,来从网页上直接导入论文。", + "import2title": "2. 导入到标签或组", + "import2info1": "直接拖动 PDF 到一个标签或者组可以将论文直接导入到这个标签或组。", + "supp1title": "添加附件", + "supp1info1": "拖动你的文件到这里导入为附件。", + "supp1info2": "右键附件以删除和重命名", + "search1title": "搜索和命令栏", + "search1info1": "使用搜索栏搜索你的论文库。", + "search1info2": "按下 '\\', 你可以打开命令栏,进行全文或者高级搜索。或者运行各种命令。", + "viewmode1title": "三种视图", + "viewmode1info1": "你可以切换列表、表格、表格阅读三种视图。", + "viewmode1info2": "在设置界面的主视图设置,你可以选择在视图内显示哪些信息。", + "quickpaste1title": "快速引用窗口", + "quickpaste1info1": "按下 `Ctrl/Cmd + Shift + I`,你可以打开快速引用窗口来复制论文的引用。", + "quickpaste1info2": "这是一个十分便捷的方式,来帮你在写论文时,复制 BibTex,纯文本等引用。", + "more1title": "更多使用帮助", + "more1info1": "请访问官方网站,查看更多使用帮助。", + "more1info2": "点击这里。" } } \ No newline at end of file diff --git a/app/renderer/ui/app-view.vue b/app/renderer/ui/app-view.vue index cd50e908..27c8c074 100644 --- a/app/renderer/ui/app-view.vue +++ b/app/renderer/ui/app-view.vue @@ -25,6 +25,7 @@ import PresettingView from "./presetting-view/presetting-view.vue"; import WhatsNewView from "./whats-new-view/whats-new-view.vue"; import WelcomeView from "./welcome-view/welcome-view.vue"; import OverlayNotificationView from "./overlay-notification-view/overlay-notification-view.vue"; +import GuideView from "./guide-view/guide-view.vue"; // ================================ // State @@ -497,6 +498,17 @@ onMounted(async () => { + + + + +import { PaperEntity } from "@/models/paper-entity"; +import { ref } from "vue"; + +const uiState = uiStateService.useState(); +const currentGuide = ref(0); + +const onClicked = (e: MouseEvent) => { + currentGuide.value += 1; + + if (currentGuide.value === 1) { + selectAPaper(); + } + + if (currentGuide.value === 6) { + preferenceService.set({ showGuide: false }); + } +}; + + +const selectAPaper = async () => { + const papers = await paperService.load("", "addTime", "desc", undefined); + + if (papers.length === 0) { + await paperService.update( + [ + new PaperEntity({ + title: "Welcome to PaperLib!", + authors: "Future Scholars, Geoffrey Chen", + publication: "Github, https://paperlib.app", + pubTime: "2020", + note: "\n# Welcome to PaperLib!\n\nThis is a guide to help you get started with PaperLib.\n\n", + }), + ], + false, + false + ); + } + uiState.selectedIndex = [0]; +}; + + + diff --git a/app/renderer/ui/presetting-view/lang-view.vue b/app/renderer/ui/presetting-view/lang-view.vue index 4fad205f..21c6e4a9 100644 --- a/app/renderer/ui/presetting-view/lang-view.vue +++ b/app/renderer/ui/presetting-view/lang-view.vue @@ -26,7 +26,7 @@ const onChangeLanguage = (language: string) => { > - +