From af919bd439c9a47f0fa5178e8fbc32873ca2be6d Mon Sep 17 00:00:00 2001 From: Haoyang Gao Date: Thu, 22 Aug 2024 11:38:29 -0400 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09fb7fd..bab4d81 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pte-crx", "private": true, - "version": "1.0.0", + "version": "1.0.1", "type": "module", "scripts": { "dev": "vite", From b53a8c586c34b79eccdcb87297061ae3f7a80a0f Mon Sep 17 00:00:00 2001 From: Haoyang Gao Date: Fri, 23 Aug 2024 13:38:02 -0400 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20drag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 5 +- pnpm-lock.yaml | 36 ++++++ src/ContentUI/index.tsx | 238 ++++++++++++++++++++++------------------ 3 files changed, 172 insertions(+), 107 deletions(-) diff --git a/package.json b/package.json index bab4d81..8aeb386 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pte-crx", "private": true, - "version": "1.0.1", + "version": "1.1.0", "type": "module", "scripts": { "dev": "vite", @@ -12,7 +12,8 @@ "dependencies": { "clsx": "^2.1.1", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "react-draggable": "^4.4.6" }, "devDependencies": { "@crxjs/vite-plugin": "2.0.0-beta.25", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8389333..f855255 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) + react-draggable: + specifier: ^4.4.6 + version: 4.4.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1) devDependencies: '@crxjs/vite-plugin': specifier: 2.0.0-beta.25 @@ -688,6 +691,10 @@ packages: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + clsx@1.2.1: + resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==} + engines: {node: '>=6'} + clsx@2.1.1: resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} engines: {node: '>=6'} @@ -1278,6 +1285,9 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prop-types@15.8.1: + resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -1298,6 +1308,15 @@ packages: peerDependencies: react: ^18.3.1 + react-draggable@4.4.6: + resolution: {integrity: sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw==} + peerDependencies: + react: '>= 16.3.0' + react-dom: '>= 16.3.0' + + react-is@16.13.1: + resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + react-refresh@0.13.0: resolution: {integrity: sha512-XP8A9BT0CpRBD+NYLLeIhld/RqG9+gktUjW1FkE+Vm7OCinbG1SshcK5tb9ls4kzvjZr9mOQc7HYgBngEyPAXg==} engines: {node: '>=0.10.0'} @@ -2203,6 +2222,8 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + clsx@1.2.1: {} + clsx@2.1.1: {} color-convert@1.9.3: @@ -2769,6 +2790,12 @@ snapshots: prelude-ls@1.2.1: {} + prop-types@15.8.1: + dependencies: + loose-envify: 1.4.0 + object-assign: 4.1.1 + react-is: 16.13.1 + punycode@2.3.1: {} q@1.5.1: {} @@ -2781,6 +2808,15 @@ snapshots: react: 18.3.1 scheduler: 0.23.2 + react-draggable@4.4.6(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + dependencies: + clsx: 1.2.1 + prop-types: 15.8.1 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + + react-is@16.13.1: {} + react-refresh@0.13.0: {} react-refresh@0.14.2: {} diff --git a/src/ContentUI/index.tsx b/src/ContentUI/index.tsx index f15b896..e8146e9 100644 --- a/src/ContentUI/index.tsx +++ b/src/ContentUI/index.tsx @@ -3,6 +3,7 @@ import { getEqualScores, skillsAnalysis, clbEEScore } from './scoreList'; import { PTEDataType } from '../type/PTEDataType'; import ProgressBar from './ProgressBar'; import clsx from 'clsx'; +import Draggable from 'react-draggable'; const ContentUI = () => { const [scoresComparison, setScoresComparison] = useState< @@ -182,127 +183,154 @@ const ContentUI = () => { }, 80); }; + const [dragging, setDragging] = useState(false); + if (!showContent) { return null; } return ( -
-
setMinimize(() => !minimize)} + <> + { + setDragging(true); + }} + onStop={() => { + setDragging(false); + }} > - {minimize ? ( - - ) : ( - - )} -
-
Score
- - - - - - - - - - - - - {scoresComparison.map((item) => ( - - {item.testName === 'PTE' && ( - +
+
+ +
{ + setMinimize(() => !minimize); + }} + onMouseDown={(e) => e.stopPropagation()} + > + {minimize ? ( + + ) : ( + + )} +
+
+
Score
+
ListeningReadingSpeakingWritingTotal
Your PTE score
+ + + + + + + + + + + + {scoresComparison.map((item) => ( + + {item.testName === 'PTE' && ( + + )} - {item.testName === 'CLB' && ( - - )} + {item.testName === 'CLB' && ( + + )} - {item.testName === 'IELTS(G)' && ( - - )} + {item.testName === 'IELTS(G)' && ( + + )} - {item.testName === 'Points for EE(Without Spouse)' && ( - - )} + {item.testName === 'Points for EE(Without Spouse)' && ( + + )} - {item.testName === 'Points for EE(With Spouse)' && ( - - )} - {item.testName === 'Points for EE(As Spouse)' && ( - - )} + {item.testName === 'Points for EE(With Spouse)' && ( + + )} + {item.testName === 'Points for EE(As Spouse)' && ( + + )} - - - - + + + + - - - ))} - -
ListeningReadingSpeakingWritingTotal
Your PTE scoreCLBCLB - Equivalent to IELTS(G) score - + Equivalent to IELTS(G) score + - Pts for EE (Without Spouse) - + Pts for EE (Without Spouse) + - Pts for EE (With Spouse) - - Pts for EE (As Spouse) - + Pts for EE (With Spouse) + + Pts for EE (As Spouse) + {item.listening}{item.reading}{item.speaking}{item.writing}{item.listening}{item.reading}{item.speaking}{item.writing} - {item.testName === 'Points for EE(Without Spouse)' || - item.testName === 'Points for EE(With Spouse)' || - item.testName === 'Points for EE(As Spouse)' - ? item.listening! + item.reading! + item.speaking! + item.writing! - : ''} -
-
Sub-Skills Score
-
- {skillsProfile.map((skill) => ( -
-
-
{skill.name}
-
-
{skill.skills.join(', ')}
-
- {skill.score} + + {item.testName === 'Points for EE(Without Spouse)' || + item.testName === 'Points for EE(With Spouse)' || + item.testName === 'Points for EE(As Spouse)' + ? item.listening! + item.reading! + item.speaking! + item.writing! + : ''} + + + ))} + + +
Sub-Skills Score
+
+ {skillsProfile.map((skill) => ( +
+
+
{skill.name}
+
+
{skill.skills.join(', ')}
+
+ {skill.score} +
+
+
+
-
+ ))}
-
- ))} -
-
+
+ + ); }; From cf0a51d45c25bb203d1ab8c38d8ed674d83f0a27 Mon Sep 17 00:00:00 2001 From: Haoyang Gao Date: Fri, 23 Aug 2024 13:45:25 -0400 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20max=20height?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ContentUI/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ContentUI/index.tsx b/src/ContentUI/index.tsx index e8146e9..20463e7 100644 --- a/src/ContentUI/index.tsx +++ b/src/ContentUI/index.tsx @@ -200,11 +200,11 @@ const ContentUI = () => { setDragging(false); }} > -
+
From f47218c8d7fe8e7982a0d2e59e3752fb48e79be2 Mon Sep 17 00:00:00 2001 From: Haoyang Gao Date: Fri, 23 Aug 2024 14:23:55 -0400 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..25b7c96 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,61 @@ +name: npm build and publish + +# 执行脚本的生命周期 +on: + #选择在 push 到 github 时触发工作流 + push: + #分支可以选择多个 + branches: [main] + +# 一个 workflow 可以有多个 job +jobs: + build: + permissions: + id-token: write + contents: write + # 指定操作系统为'ubuntu-latest' + runs-on: ubuntu-latest + steps: + - name: Setup repo + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Version Check + id: check + uses: EndBug/version-check@v2 + with: + diff-search: true + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: latest + if: steps.check.outputs.changed == 'true' + + - name: Node env setup + uses: actions/setup-node@v4 + if: steps.check.outputs.changed == 'true' + with: + node-version: lts/* + cache: pnpm + registry-url: 'https://registry.npmjs.org' + + - run: pnpm i + if: steps.check.outputs.changed == 'true' + # 发布命令 + + - run: pnpm run build && pnpm publish + if: steps.check.outputs.changed == 'true' + env: + # npm_token 就是刚刚填写 token 时取的名字 + NODE_AUTH_TOKEN: ${{ secrets.NPMPUBHAOYANG }} + NPM_CONFIG_PROVENANCE: true + - name: Create a tag + uses: salsify/action-detect-and-tag-new-version@v2 + if: steps.check.outputs.changed == 'true' + + - run: npx changelogithub + if: steps.check.outputs.changed == 'true' + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From c21ca3f114b873098a59e587b51a4fc72bdda581 Mon Sep 17 00:00:00 2001 From: Haoyang Gao Date: Fri, 23 Aug 2024 14:49:24 -0400 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20update=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 25b7c96..2dcba52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,19 +43,22 @@ jobs: - run: pnpm i if: steps.check.outputs.changed == 'true' - # 发布命令 - - run: pnpm run build && pnpm publish + - run: pnpm run build if: steps.check.outputs.changed == 'true' - env: - # npm_token 就是刚刚填写 token 时取的名字 - NODE_AUTH_TOKEN: ${{ secrets.NPMPUBHAOYANG }} - NPM_CONFIG_PROVENANCE: true - - name: Create a tag - uses: salsify/action-detect-and-tag-new-version@v2 + + - name: zip if: steps.check.outputs.changed == 'true' + uses: montudor/action-zip@v1 + with: + args: zip -qq -r dist.zip dist - - run: npx changelogithub + - name: Upload & release if: steps.check.outputs.changed == 'true' - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + uses: mnao305/chrome-extension-upload@v5.0.0 + with: + file-path: dist.zip + extension-id: hibclclepijigjnfdkmkfhjogfhgicda + client-id: ${{ secrets.CLIENT_ID }} + client-secret: ${{ secrets.CLIENT_SECRET }} + refresh-token: ${{ secrets.REFRESH_TOKEN }}