From e5a8d05c547ee978acfa9f6bd192792c24e8049c Mon Sep 17 00:00:00 2001 From: OMGDuke Date: Tue, 9 Apr 2024 21:54:04 +0100 Subject: [PATCH] Fix context menu key --- .github/workflows/build.yml | 106 +++++++++++++++++------------------ src/lib/patchContextMenu.tsx | 6 +- 2 files changed, 53 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90e9daf..742191f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,62 +1,56 @@ name: Build and Release Game Theme Music on: - push: - tags: - - 'v*' - pull_request: - branches: ['main'] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + push: + tags: + - 'v*' + pull_request: + branches: ['main'] + workflow_dispatch: jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup Node - uses: actions/setup-node@v1 - with: - node-version: '18.3' - - - name: Install Dependencies - run: npm install - - - name: build - run: npm run build - - - name: copy files into build - run: | - cp plugin.json ./dist/ - mkdir ./dist/dist - mv ./dist/index.js ./dist/dist/ - - name: Upload package - uses: actions/upload-artifact@v2 - with: - name: SDH-GameThemeMusic - path: | - ./dist/* - release: - needs: build - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - uses: actions/download-artifact@v3 - with: - name: SDH-GameThemeMusic - path: SDH-GameThemeMusic - - name: zip/tar release - run: | - zip -r SDH-GameThemeMusic.zip SDH-GameThemeMusic/* - tar -czvf SDH-GameThemeMusic.tar.gz SDH-GameThemeMusic - - name: Create a release - uses: ncipollo/release-action@v1 - with: - artifacts: 'SDH-GameThemeMusic.zip,SDH-GameThemeMusic.tar.gz' - allowUpdates: true - token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '20.x' + - name: Install Dependencies + run: npm install + - name: build + run: npm run build + - name: copy files into build + run: | + cp plugin.json ./dist/ + mkdir ./dist/dist + mv ./dist/index.js ./dist/dist/ + - name: Upload package + uses: actions/upload-artifact@v3 + with: + name: SDH-GameThemeMusic + path: | + ./dist/* + + release: + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + name: SDH-GameThemeMusic + path: SDH-GameThemeMusic + - name: zip/tar release + run: | + zip -r SDH-GameThemeMusic.zip SDH-GameThemeMusic/* + tar -czvf SDH-GameThemeMusic.tar.gz SDH-GameThemeMusic + - name: Create a release + uses: ncipollo/release-action@v1 + with: + artifacts: 'SDH-GameThemeMusic.zip,SDH-GameThemeMusic.tar.gz' + allowUpdates: true + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/src/lib/patchContextMenu.tsx b/src/lib/patchContextMenu.tsx index a8ff8f2..811be9f 100644 --- a/src/lib/patchContextMenu.tsx +++ b/src/lib/patchContextMenu.tsx @@ -68,10 +68,10 @@ const contextMenuPatch = (LibraryContextMenu: any) => { component.type.prototype, 'shouldComponentUpdate', ([nextProps]: any, shouldUpdate: any) => { - const sgdbIdx = nextProps.children.findIndex( - (x: any) => x?.key === 'sgdb-change-artwork' + const gtmIdx = nextProps.children.findIndex( + (x: any) => x?.key === 'game-theme-music-change-music' ) - if (sgdbIdx != -1) nextProps.children.splice(sgdbIdx, 1) + if (gtmIdx != -1) nextProps.children.splice(gtmIdx, 1) if (shouldUpdate === true) { let updatedAppid: number = appid