diff --git a/README.md b/README.md index 12b6168..e868e24 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ I wish to develop **emo** as an **all in one** desktop application. Now, it incl ![Reader screenshot](./docs/images/screenshot.png) ### Keyboard shortcus +- ?: Toggle keyboard shortcus help - g then i: Go to Unread items - g then s: Go to Starred items - g then a: Go to All items diff --git a/forge.config.js b/forge.config.js index 2009130..5bc6916 100644 --- a/forge.config.js +++ b/forge.config.js @@ -52,7 +52,6 @@ module.exports = { }, prerelease: true, draft: true, - tagPrefix: '', }, }, ], diff --git a/package-lock.json b/package-lock.json index 70b85dc..a7d5fa2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "emo", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "emo", - "version": "0.1.3", + "version": "0.1.4", "license": "MIT", "dependencies": { "@fluentui/react-components": "^9.30.1", diff --git a/package.json b/package.json index d14ab01..99f396d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emo", - "version": "0.1.3", + "version": "0.1.4", "description": "An all in one application, includes Reader-a rss reader", "main": "./dist/main.js", "scripts": { diff --git a/src/i18n/en-US.json b/src/i18n/en-US.json index 1c341ef..bb44aae 100644 --- a/src/i18n/en-US.json +++ b/src/i18n/en-US.json @@ -11,7 +11,11 @@ "markRead": "Mark as read", "markUnread": "Mark as unread", "refresh": "Refresh", - "openExternal": "Open in browser" + "openExternal": "Open in browser", + "copy": { + "title": "Copy url", + "success": "Copied" + } }, "form": { @@ -26,6 +30,25 @@ "subscribe": "Subscribe", "close": "Close" } + }, + + "keyboard": { + "title": "Keyboard shortcuts", + "keys": { + "sw": "Toggle shortcurts help", + "gi": "Go to Unread", + "gs": "Go to Starred", + "ga": "Go to All", + "selectAll": "Select All", + "deselect": "Deselect All", + "x": "Select/Deselect item", + "s": "Toggle star", + "j": "Next item", + "k": "Previous item", + "o": "Open item", + "u": "Close item", + "v": "Open item in browser" + } } }, diff --git a/src/i18n/zh-CN.json b/src/i18n/zh-CN.json index 5592b4f..7f5af7d 100644 --- a/src/i18n/zh-CN.json +++ b/src/i18n/zh-CN.json @@ -11,7 +11,11 @@ "markRead": "标记为已读", "markUnread": "标记为未读", "refresh": "刷新", - "openExternal": "在浏览器中打开" + "openExternal": "在浏览器中打开", + "copy": { + "title": "复制链接", + "success": "已复制到剪贴板" + } }, "form": { @@ -26,6 +30,25 @@ "subscribe": "订阅", "close": "关闭" } + }, + + "keyboard": { + "title": "快捷键", + "keys": { + "sw": "切换显示快捷键帮助", + "gi": "转到未读列表", + "gs": "转到标星列表", + "ga": "转到全部列表", + "selectAll": "全选", + "deselect": "取消全选", + "x": "选中/取消选中", + "s": "切换标星", + "j": "下一条", + "k": "上一条", + "o": "打开条目", + "u": "关闭条目", + "v": "浏览器中打开" + } } }, diff --git a/src/renderer/apps/reader/SidePanel/feed-item.tsx b/src/renderer/apps/reader/SidePanel/feed-item.tsx index bc980d2..7ad69e2 100644 --- a/src/renderer/apps/reader/SidePanel/feed-item.tsx +++ b/src/renderer/apps/reader/SidePanel/feed-item.tsx @@ -3,7 +3,7 @@ import { observer } from 'mobx-react-lite' import { makeStyles, tokens } from '@fluentui/react-components' import { store } from '@/renderer/store' -import { DeleteButton } from '@/renderer/apps/reader/components/toolbar' +import { DeleteButton, CopyButton } from '@/renderer/apps/reader/components/toolbar' import { Feed } from '@/types/reader' const { readerStore } = store @@ -29,7 +29,12 @@ const useStyles = makeStyles({ }) function Item({ data }: Props) { - const { id, title, unreadCount = 0 } = data + const { + id, + title, + unreadCount = 0, + url, + } = data const active = readerStore.tab === id const styles = useStyles() @@ -63,11 +68,18 @@ function Item({ data }: Props) {
- +
+ + +
diff --git a/src/renderer/apps/reader/components/toolbar/copy-button.tsx b/src/renderer/apps/reader/components/toolbar/copy-button.tsx new file mode 100644 index 0000000..ecfe5c4 --- /dev/null +++ b/src/renderer/apps/reader/components/toolbar/copy-button.tsx @@ -0,0 +1,58 @@ +import intl from 'react-intl-universal' +import { CopyRegular } from '@fluentui/react-icons' +import { + useId, + useToastController, + Toast, + ToastIntent, + ToastTitle, + Toaster, +} from '@fluentui/react-components' +import Button from './button' + +type Props = { + className: string + fontSize: number + content: string +} + +export default function CopyButton(props: Props) { + const { className, fontSize = 18, content } = props + + const toasterId = useId('toaster') + const { dispatchToast } = useToastController(toasterId) + + const notify = (text: string, intent: ToastIntent) => dispatchToast( + + + {text} + + , + { intent }, + ) + + const onClick = async () => { + try { + await navigator.clipboard.writeText(content) + notify(intl.get('reader.action.copy.success'), 'success') + } catch (e) { + notify(`${(e as Error).name}: ${(e as Error).message}`, 'error') + } + } + + return ( + <> +