From 66ceb0093f11e9a3d3ad565568da511af446158d Mon Sep 17 00:00:00 2001 From: Arjan Frans Date: Tue, 19 Mar 2024 15:01:26 +0100 Subject: [PATCH] add download button --- .github/workflows/main.yml | 40 ++------------------------------------ src/web/login-container.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f43153..51984c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,35 +8,6 @@ env: jobs: - cxt: - runs-on: ubuntu-latest - permissions: - pages: write - id-token: write - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Build - run: | - npm ci - npm run build - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - # Upload dist directory - name: 'wbsc-ticker-chrome-extension' - path: './dist/cxt/' - web: runs-on: ubuntu-latest permissions: @@ -47,9 +18,6 @@ jobs: matrix: node-version: [20.x] - needs: - - cxt - steps: - uses: actions/checkout@v3 @@ -58,16 +26,12 @@ jobs: with: node-version: ${{ matrix.node-version }} - - uses: actions/download-artifact@master - with: - name: 'wbsc-ticker-chrome-extension' - path: './cxt' - - name: Build run: | - cd cxt && zip -r -q wbsc-ticker-cxt.zip . * && mv wbsc-ticker-cxt.zip ./dist/web/ && cd - ls npm ci + npm run build + zip -r -q wbsc-ticker-cxt.zip ./dist/cxt/* && mv wbsc-ticker-cxt.zip ./dist/web/ npm run build:web - name: Setup Pages uses: actions/configure-pages@v3 diff --git a/src/web/login-container.ts b/src/web/login-container.ts index 1b05a43..b76b611 100644 --- a/src/web/login-container.ts +++ b/src/web/login-container.ts @@ -1,4 +1,4 @@ -import './login-container.css' +import "./login-container.css"; import { setComponent } from "../framework"; import { LoginComponent } from "./login-component"; @@ -13,13 +13,18 @@ export class LoginContainer extends HTMLElement { super(); this.innerHTML = this.render(); - this.style.marginInline = '24px'; + this.style.marginInline = "24px"; const loginComponent = new LoginComponent(defaultCredentials, async (username, password) => { return await handleLogin(username, password); }); - (this.querySelector('#login-form-container') as HTMLDivElement).append(loginComponent); + (this.querySelector("#login-form-container") as HTMLDivElement).append(loginComponent); + const downloadCxtButton = this.querySelector("#download-cxt-button") as HTMLButtonElement; + + downloadCxtButton.addEventListener("click", () => { + window.open("./wbsc-ticker-cxt.zip"); + }); } private render(): string {