Skip to content

Commit

Permalink
Merge pull request #249 from Future-Scholars/rc-v2.2.2
Browse files Browse the repository at this point in the history
Release v2.2.2
  • Loading branch information
GeoffreyChen777 authored May 25, 2023
2 parents 6649da4 + 51327eb commit ba96ce3
Show file tree
Hide file tree
Showing 19 changed files with 275 additions and 152 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# v2.2.2 25/05 2023

1. 新功能: Smart Filter。
2. 标签/文件夹支持更多的颜色。
3. 记住上次关闭时的窗口尺寸。
4. 修复 Windows 的快速预览。
5. 修复下载器设置的按钮文字。Thanks @qzydustin

## v2.2.1 09/04 2023

1. 支持模糊搜索,比如论文标题为 Semi-supervised Classification via AABBCC,那么可以通过输入 "semi" / "semi sup" / "classi" / "semi classi" / "AA CC" 等等来搜索到这篇论文。
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG_EN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## v2.2.2 May 25 2024

1. New Feature: Smart Filter.
2. More colours for tags and folders.
3. Remember the window size.
4. Fix PDF quicklook for Windows.
5. Fix downloader delete button display bug. Thanks @qzydustin

## v2.2.1 Apr 09 2023

1. Support fuzzy searching. For example, to search a paper with title like: Semi-supervised Classification via AABBCC, you can input "semi" / "semi sup" / "classi" / "semi classi" / "AA CC" etc. to the search bar.
Expand Down
35 changes: 21 additions & 14 deletions app/interactors/feed-interactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ export class FeedInteractor {
);
} catch (error) {
console.error(error);
this.stateStore.logState.alertLog = `Add feeds failed: ${error as string
}`;
this.stateStore.logState.alertLog = `Add feeds failed: ${
error as string
}`;
}
this.stateStore.viewState.processingQueueCount -= feeds.length;
}
Expand Down Expand Up @@ -133,7 +134,6 @@ export class FeedInteractor {
)
).flat();


// let paperEntityDrafts = feedEntityDrafts.map((feedEntityDraft) => {
// const draft = new PaperEntity(false);
// draft.fromFeed(feedEntityDraft);
Expand Down Expand Up @@ -183,8 +183,9 @@ export class FeedInteractor {
await this.dbRepository.updateFeedEntities(feedEntityDrafts, true);
} catch (error) {
console.error(error);
this.stateStore.logState.alertLog = `Refresh feeds failed: ${error as string
}`;
this.stateStore.logState.alertLog = `Refresh feeds failed: ${
error as string
}`;
}
this.stateStore.viewState.processingQueueCount -= feedNames.length;
}
Expand All @@ -197,8 +198,9 @@ export class FeedInteractor {
await this.dbRepository.updateFeeds(feeds);
} catch (error) {
console.error(error);
this.stateStore.logState.alertLog = `Updating feeds failed: ${error as string
}`;
this.stateStore.logState.alertLog = `Updating feeds failed: ${
error as string
}`;
}
this.stateStore.viewState.processingQueueCount -= feeds.length;
}
Expand All @@ -222,8 +224,9 @@ export class FeedInteractor {
await this.dbRepository.updateFeedEntities(feedEntities);
} catch (error) {
console.error(error);
this.stateStore.logState.alertLog = `Updating feed entities failed: ${error as string
}`;
this.stateStore.logState.alertLog = `Updating feed entities failed: ${
error as string
}`;
}
this.stateStore.viewState.processingQueueCount -= feedEntities.length;
}
Expand All @@ -236,7 +239,9 @@ export class FeedInteractor {
const addPromise = async (feedEntityDraft: FeedEntity) => {
let paperEntityDraft = new PaperEntity(true);
paperEntityDraft.fromFeed(feedEntityDraft);
return await this.scraperRepository.scrape(paperEntityDraft);
return await this.scraperRepository.scrape(paperEntityDraft, [
"semanticscholar",
]);
};

const paperEntityDrafts = await Promise.all(
Expand All @@ -247,8 +252,9 @@ export class FeedInteractor {
await this.dbRepository.updatePaperEntities(paperEntityDrafts);
} catch (error) {
console.error(error);
this.stateStore.logState.alertLog = `Adding to library failed: ${error as string
}`;
this.stateStore.logState.alertLog = `Adding to library failed: ${
error as string
}`;
}
this.stateStore.viewState.processingQueueCount -= feedEntities.length;
}
Expand Down Expand Up @@ -280,8 +286,9 @@ export class FeedInteractor {
await this.dbRepository.deleteOutdatedFeedEntities();
} catch (error) {
console.error(error);
this.stateStore.logState.alertLog = `Routine feed refreshing failed: ${error as string
}`;
this.stateStore.logState.alertLog = `Routine feed refreshing failed: ${
error as string
}`;
}
this.stateStore.viewState.processingQueueCount -= 1;
}
Expand Down
17 changes: 7 additions & 10 deletions app/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,6 @@ async function createWindow() {
setMainPluginCommunicationChannel(win, winPlugin);

setWindowsSpecificStyles(winPlugin);

const { x, y } = screen.getCursorScreenPoint();
const currentDisplay = screen.getDisplayNearestPoint({ x, y });
const bounds = currentDisplay.bounds;
const centerx = bounds.x + (bounds.width - 600) / 2;
const centery = bounds.y + (bounds.height - 76) / 2;
winPlugin?.setPosition(
parseInt(`${centerx}`),
parseInt(`${centery}`)
);
});

winPlugin.on("hide", () => {
Expand All @@ -85,6 +75,13 @@ async function createWindow() {
}
});
}

const { x, y } = screen.getCursorScreenPoint();
const currentDisplay = screen.getDisplayNearestPoint({ x, y });
const bounds = currentDisplay.bounds;
const centerx = bounds.x + (bounds.width - 600) / 2;
const centery = bounds.y + (bounds.height - 76) / 2;
winPlugin?.setPosition(parseInt(`${centerx}`), parseInt(`${centery}`));
winPlugin?.show();
}
);
Expand Down
14 changes: 11 additions & 3 deletions app/main/win_main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,23 @@ export async function createMainWindow(

// Make all links open with the browser, not with the application
win.webContents.setWindowOpenHandler(({ url }) => {
if (url.includes(process.env.VITE_DEV_SERVER_URL || "")) {
if (
url.includes(process.env.VITE_DEV_SERVER_URL || "") &&
process.env.NODE_ENV === "development"
) {
return { action: "allow" };
}
if (url.startsWith("http")) shell.openExternal(url);
if (url.startsWith("http")) {
shell.openExternal(url);
}
return { action: "deny" };
});

win.webContents.on("will-navigate", function (e, url) {
if (url.includes(process.env.VITE_DEV_SERVER_URL || "")) {
if (
url.includes(process.env.VITE_DEV_SERVER_URL || "") &&
process.env.NODE_ENV === "development"
) {
return;
}
e.preventDefault();
Expand Down
Binary file added app/renderer/assets/smart-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/renderer/assets/whatsnew-1.png
Binary file not shown.
8 changes: 7 additions & 1 deletion app/renderer/ui/app-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ const reloadPaperEntities = async () => {
let folder = "";
if (selectionState.selectedCategorizer.startsWith("tag-")) {
tag = selectionState.selectedCategorizer.replace("tag-", "");
viewState.searchText = "";
viewState.searchMode = "general";
} else if (selectionState.selectedCategorizer.startsWith("folder-")) {
folder = selectionState.selectedCategorizer.replace("folder-", "");
viewState.searchText = "";
viewState.searchMode = "general";
} else if (selectionState.selectedCategorizer === "lib-flaged") {
flaged = true;
viewState.searchText = "";
viewState.searchMode = "general";
}
paperEntities.value = await window.entityInteractor.loadPaperEntities(
viewState.searchText,
Expand Down Expand Up @@ -117,7 +123,7 @@ watch(
const reloadPaperSmartFilters = async () => {
smartfilters.value = await window.entityInteractor.loadPaperSmartFilters(
"PaperPaperSmartFilter",
prefState.sidebarSortBy,
prefState.sidebarSortBy === "count" ? "name" : prefState.sidebarSortBy,
prefState.sidebarSortOrder
);
};
Expand Down
24 changes: 20 additions & 4 deletions app/renderer/ui/edit-view/smartfilter-edit-view.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { BIconPlus } from "bootstrap-icons-vue";
import { ref, watch } from "vue";
import { onMounted, ref, watch } from "vue";
import { Feed } from "@/models/feed";
import { PaperSmartFilter } from "@/models/smart-filter";
Expand All @@ -21,6 +21,10 @@ watch(
() => viewState.isPaperSmartFilterEditViewShown,
(value) => {
if (value) {
editingPaperSmartFilterDraft.value = new PaperSmartFilter("", "");
filterRules.value = [];
filterMatchType.value = "AND";
infoText.value = "";
window.addEventListener("keydown", keyDownListener, { once: true });
}
Expand Down Expand Up @@ -96,6 +100,14 @@ const constructFilter = () => {
const filter = filterRules.value.join(` ${filterMatchType.value} `);
editingPaperSmartFilterDraft.value.filter = filter;
};
onMounted(() => {
editingPaperSmartFilterDraft.value = new PaperSmartFilter("", "");
filterRules.value = [];
filterMatchType.value = "AND";
infoText.value = "";
});
</script>

<template>
Expand Down Expand Up @@ -140,16 +152,20 @@ const constructFilter = () => {
/>

<div class="flex space-x-1">
<div class="dark:bg-neutral-700 grow h-[1px] my-auto" />
<div
class="w-4 h-4 my-auto flex-none dark:bg-neutral-700 dark:hover:bg-neutral-600 rounded-sm cursor-pointer"
class="bg-neutral-200 dark:bg-neutral-700 grow h-[1px] my-auto"
/>
<div
class="w-4 h-4 my-auto flex-none bg-neutral-200 hover:bg-neutral-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 rounded-sm cursor-pointer"
@click="onAddRuleClicked"
>
<BIconPlus
class="m-auto text-neutral-500 dark:text-neutral-400"
/>
</div>
<div class="dark:bg-neutral-700 grow h-[1px] my-auto" />
<div
class="bg-neutral-200 dark:bg-neutral-700 grow h-[1px] my-auto"
/>
</div>
<div class="flex justify-end space-x-2 py-1">
<div class="text-xs h-6 flex text-red-500">
Expand Down
60 changes: 60 additions & 0 deletions app/renderer/ui/whats-new-view/header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script setup lang="ts">
import {
BIconCoin,
BIconDiscord,
BIconGithub,
BIconGlobe,
} from "bootstrap-icons-vue";
defineProps({
darkMode: Boolean,
});
const openURL = (url: string) => {
window.appInteractor.open(url);
};
</script>

<template>
<div class="flex flex-col">
<img
class="w-12 mx-auto mb-2"
src="../../assets/logo-dark.png"
v-if="darkMode"
/>
<img class="w-10 mx-auto mb-2" src="../../assets/logo-light.png" v-else />

<div class="mx-auto text-xl font-semibold mb-4">PAPERLIB</div>

<div class="flex mx-auto space-x-5">
<div
class="flex flex-col space-y-1 hover:text-neutral-500 cursor-pointer"
@click="openURL('https://github.com/Future-Scholars/paperlib')"
>
<BIconGithub class="mx-auto" />
<span class="mx-auto text-xs">Github</span>
</div>
<div
class="flex flex-col space-y-1 hover:text-neutral-500 cursor-pointer"
@click="openURL('https://discord.gg/4unrSRjcM9')"
>
<BIconDiscord class="mx-auto" />
<span class="mx-auto text-xs">Discord</span>
</div>
<div
class="flex flex-col space-y-1 hover:text-neutral-500 cursor-pointer"
@click="openURL('https://paperlib.app')"
>
<BIconGlobe class="mx-auto" />
<span class="mx-auto text-xs">Webpage</span>
</div>
<div
class="flex flex-col space-y-1 hover:text-neutral-500 cursor-pointer"
@click="openURL('https://paperlib.app/en/donate.html')"
>
<BIconCoin class="mx-auto" />
<span class="mx-auto text-xs">Donate</span>
</div>
</div>
</div>
</template>
54 changes: 27 additions & 27 deletions app/renderer/ui/whats-new-view/whats-new-view-cn.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import WhatsNewHeader from "./header.vue";
const show = ref(false);
const checkShouldShow = async () => {
Expand Down Expand Up @@ -30,10 +32,6 @@ const loadHistoryReleaseNote = () => {
xhr.send();
};
const openIntro = () => {
window.appInteractor.open("https://paperlib.app/cn/blog/word-addin/");
};
const darkMode = ref(false);
onMounted(() => {
loadHistoryReleaseNote();
Expand Down Expand Up @@ -75,34 +73,36 @@ onMounted(() => {
v-if="show"
>
<div class="w-[45rem] px-3 mx-auto my-20">
<img
class="w-12 mx-auto mb-6"
src="../../assets/logo-dark.png"
v-if="darkMode"
/>
<img
class="w-10 mx-auto mb-6"
src="../../assets/logo-light.png"
v-else
/>
<p class="text-center text-2xl font-bold mb-8">
Paperlib 2.2.1 更新内容
</p>
<WhatsNewHeader :darkMode="darkMode" />
<div class="h-[1px] bg-neutral-200 dark:bg-neutral-600 my-8"></div>

<p class="text-center text-2xl font-bold mb-8">版本 2.2.2 更新内容</p>

<ul class="list-disc mb-5">
<li>
加入我们的 Discard channel 来讨论新 features,提出问题,或建议!
<a href="https://discord.com/invite/4unrSRjcM9"
>https://discord.com/invite/4unrSRjcM9
</a>
新功能: <b>Smart Filter</b>! <br />
你可以创建一个 smart filter 来进行高级过滤。例如: 同时具有 'tag A'
和 'tag B'
的论文;最近添加的论文;某个作者发表的论文;标题里有某个关键字的论文等等。
<span class="text-red-500"
>请打开 'DEV mode' 如果你使用在线 MongoDB Atlas 数据库</span
>。 详情请见
<a
class="underline"
href="https://paperlib.app/cn/doc/smart-filter/"
>文档</a
>。
<img
class="rounded-md drop-shadow-lg my-4"
src="../../assets/smart-filter.png"
/>
</li>
<li>
支持模糊搜索,比如论文标题为 Semi-supervised Classification via
AABBCC,那么可以通过输入 "semi" / "semi sup" / "classi" / "semi
classi" / "AA CC" 等等来搜索到这篇论文。
</li>
<li>改进了一点文件导入逻辑。</li>
<li>标签/文件夹支持更多的颜色。</li>
<li>记住上次关闭时的窗口尺寸。</li>
<li>修复 Windows 的快速预览。</li>
<li>修复下载器设置的按钮文字。Thanks @qzydustin</li>
</ul>

<div
id="whats-new-close-btn"
class="mt-10 mx-auto flex w-60 h-10 bg-accentlight dark:bg-accentdark text-neutral-50 rounded-md shadow-md cursor-pointer"
Expand Down
Loading

0 comments on commit ba96ce3

Please sign in to comment.