-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Add links to webpage for papers with arxiv and doi (#475)
This PR implemented #469 I added two link button that open the system default external browser to open the arxiv or doi link based on the `arxiv` and `doi` properties in `PaperEntity`. These two buttons only shows when these two properties existed. I also remove the `formatOnSave` settings in `.vscode/settings.json` because the format behaviour may vary on different platform, which may mess up the format of entire file. --------- Co-authored-by: geoffreychen777 <geoffreychen777@gmail.com>
- Loading branch information
1 parent
ff31740
commit 0b8e429
Showing
7 changed files
with
78 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,5 @@ mongodb-realm | |
|
||
crypto | ||
|
||
!paperlib-api/dist | ||
!paperlib-api/dist | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{ | ||
"editor.tabSize": 2, | ||
"editor.formatOnSave": true, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
app/renderer/ui/main-view/detail-view/components/online-resources.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<script setup lang="ts"> | ||
import { defineProps } from "vue"; | ||
import { BIconCodeSlash, BIconGithub, BIconLink } from "bootstrap-icons-vue"; | ||
const props = defineProps({ | ||
codes: Object as () => Array<string>, | ||
arxiv: String, | ||
doi: String, | ||
}); | ||
const isCodeOfficial = (codeJSONstr: string) => { | ||
const code = JSON.parse(codeJSONstr) as { | ||
url: string; | ||
isOfficial: boolean; | ||
}; | ||
const official = code.isOfficial ? "codeofficial" : "codecommunity"; | ||
return official; | ||
}; | ||
const onLinkClick = (url: string) => { | ||
fileService.open(url); | ||
}; | ||
const onCodeClick = (codeJSONstr: string) => { | ||
const code = JSON.parse(codeJSONstr) as { | ||
url: string; | ||
isOfficial: boolean; | ||
}; | ||
fileService.open(code.url); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-wrap mt-1 text-xs"> | ||
<div | ||
class="flex space-x-1 bg-neutral-200 dark:bg-neutral-700 rounded-md p-1 hover:bg-neutral-300 hover:dark:bg-neutral-600 hover:shadow-sm select-none cursor-pointer mb-1 mr-1" | ||
v-if="arxiv" | ||
@click="onLinkClick(`https://arxiv.org/abs/${arxiv.toLowerCase().replaceAll('arxiv:', '').trim()}`)" | ||
> | ||
<BIconLink class="text-xs my-auto" /> | ||
<div class="text-xxs my-auto">arXiv</div> | ||
</div> | ||
<div | ||
class="flex space-x-1 bg-neutral-200 dark:bg-neutral-700 rounded-md p-1 hover:bg-neutral-300 hover:dark:bg-neutral-600 hover:shadow-sm select-none cursor-pointer mb-1 mr-1" | ||
v-if="doi" | ||
@click="onLinkClick(`https://doi.org/${doi}`)" | ||
> | ||
<BIconLink class="text-xs my-auto" /> | ||
<div class="text-xxs my-auto">DOI</div> | ||
</div> | ||
<div | ||
class="flex space-x-1 bg-neutral-200 dark:bg-neutral-700 rounded-md p-1 hover:bg-neutral-300 hover:dark:bg-neutral-600 hover:shadow-sm select-none cursor-pointer mb-1 mr-1" | ||
v-for="code in codes" | ||
@click="onCodeClick(code)" | ||
> | ||
<BIconGithub class="text-xs my-auto" v-if="code.includes('github')" /> | ||
<BIconCodeSlash class="text-xs my-auto" v-if="!code.includes('github')" /> | ||
<div class="text-xxs my-auto"> | ||
{{ $t(`mainview.${isCodeOfficial(code)}`) }} | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters