Skip to content

Commit

Permalink
Merge pull request #3 from Kreedzt/develop
Browse files Browse the repository at this point in the history
✨  add clipboard share logic
  • Loading branch information
Kreedzt committed Dec 6, 2023
2 parents 91e7257 + cf4d076 commit 4d1f2ef
Show file tree
Hide file tree
Showing 21 changed files with 539 additions and 59 deletions.
80 changes: 61 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,66 @@ on: [push, pull_request]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
contents: read
pages: write
id-token: write

jobs:
test:
runs-on: ubuntu-latest
name: Test Coverage
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install
run: npm i -g pnpm && pnpm i
- name: test coverage
run: pnpm run coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
test:
runs-on: ubuntu-latest
name: Test Coverage
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.11.0
- name: Setup Nodejs
uses: actions/setup-node@v4
with:
node-version: '20.10.0'
cache: 'pnpm'
- name: Install
run: pnpm i
- name: test coverage
run: pnpm run coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

test-tauri:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.11.0

- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20.10.0'
cache: 'pnpm'

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: install frontend dependencies
run: pnpm install # change this to npm or pnpm depending on which one you use

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 21 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# .github/workflows/release.yml
name: Release

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

on:
release:
types: [created]


jobs:
release:
strategy:
Expand All @@ -15,7 +20,21 @@ jobs:
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.11.0

- name: Sync node version and setup cache
uses: actions/setup-node@v4
with:
node-version: '20.10.0'
cache: 'pnpm' # Set this to npm, yarn or pnpm.

- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
Expand All @@ -24,25 +43,11 @@ jobs:
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.11.0

- name: Sync node version and setup cache
uses: actions/setup-node@v3
with:
node-version: '20.10.0'
cache: 'pnpm' # Set this to npm, yarn or pnpm.

- name: Install app dependencies and build web
# Remove `&& yarn build` if you build your frontend in `beforeBuildCommand`
run: pnpm i && pnpm build # Change this to npm, yarn or pnpm.
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 版本更新历史

## 0.1.0

- 增加分享功能: 主页现在可以分享配置 / 读取分享的内容了
- 交互优化: 现应用 / 删除操作会有二次确认提示
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ Quick edit `hotkeys.xml` file tool
English | [简体中文](README_zhCN.md)

## Quick Start

Download latest [Release](https://github.com/Kreedzt/rwr-hotkey-editor/releases), double-click exe to run app.

Available features:

- [x] Save by group
- [x] Quick overwrite
- [x] Share by clipboard

For `Windows 7` users, please [download](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section) webview2 runtime.

Expand Down
1 change: 1 addition & 0 deletions README_zhCN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- [x] 分组保存
- [x] 快速覆盖
- [x] 通过剪贴板分享

针对 `Windows 7` 用户, 请去 [官网](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section) 下载 `webview2` 运行时

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.48.2",
"react-router-dom": "^6.11.1",
"styled-components": "^5.3.10"
"styled-components": "^5.3.10",
"zod": "^3.22.4"
},
"devDependencies": {
"@tauri-apps/cli": "^1.5.6",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "rwr-hotkey-editor",
"version": "0.0.1"
"version": "0.1.0"
},
"tauri": {
"allowlist": {
Expand Down
23 changes: 19 additions & 4 deletions src/components/hotkey/HotkeyConfigItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ import DeleteIcon from '@mui/icons-material/Delete';
import EditIcon from '@mui/icons-material/Edit';
import ToggleOnIcon from '@mui/icons-material/ToggleOn';
import ToggleOffIcon from '@mui/icons-material/ToggleOff';
import ShareIcon from '@mui/icons-material/Share';
import { IHotkeyProfileItem } from '../../share/types';

type TEventCallback = (id: string) => void;

type HotkeyListItemProps = {
data: IHotkeyProfileItem;
onActive: (id: string) => void;
onEdit: (id: string) => void;
onDelete: (id: string) => void;
onActive: TEventCallback;
onEdit: TEventCallback;
onDelete: TEventCallback;
onShare: TEventCallback;
};

const HotkeyConfigItem: FC<HotkeyListItemProps> = ({
data,
onActive,
onEdit,
onDelete,
onShare,
}) => {
return (
<ListItem
Expand All @@ -39,7 +44,17 @@ const HotkeyConfigItem: FC<HotkeyListItemProps> = ({
onClick={() => onActive(data.id)}
>
<ToggleOffIcon />
{/* <ToggleOnIcon /> */}
{/* <ToggleOnIcon /> */}
</IconButton>
</Tooltip>

<Tooltip title="分享">
<IconButton
edge="end"
aria-label="share"
onClick={() => onShare(data.id)}
>
<ShareIcon />
</IconButton>
</Tooltip>

Expand Down
11 changes: 8 additions & 3 deletions src/components/hotkey/HotkeyConfigList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@ import List from '@mui/material/List';
import { IHotkeyProfileItem } from '../../share/types';
import HotkeyConfigItem from './HotkeyConfigItem';

type TEventCallback = (id: string) => void;

type HotkeyListProps = {
data: IHotkeyProfileItem[];
onActive: (id: string) => void;
onEdit: (id: string) => void;
onDelete: (id: string) => void;
onActive: TEventCallback;
onEdit: TEventCallback;
onDelete: TEventCallback;
onShare: TEventCallback;
};

const HotkeyConfigList: FC<HotkeyListProps> = ({
data,
onActive,
onEdit,
onDelete,
onShare,
}) => {
return (
<List dense={true}>
Expand All @@ -26,6 +30,7 @@ const HotkeyConfigList: FC<HotkeyListProps> = ({
onActive={onActive}
onEdit={onEdit}
onDelete={onDelete}
onShare={onShare}
/>
);
})}
Expand Down
Loading

0 comments on commit 4d1f2ef

Please sign in to comment.