From 3d12d7ad1b3fb839dad7e6d7197acfaa526ed711 Mon Sep 17 00:00:00 2001 From: toni-santos Date: Wed, 25 Sep 2024 15:34:17 +0100 Subject: [PATCH 1/2] add CI yaml file --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2a8a4e3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: + push: # Run on pushes to "develop" + branches: + - develop + pull_request: # Run on PRs to "develop" + branches: + - develop + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + prettier: + if: ${{ github.event.pull_request.draft == false }} + + name: Check Javascript code style + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Enable Corepack + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 21 + cache: yarn + + - name: Install dependencies + run: yarn install + + - name: Run Prettier + run: yarn format + + eslint: + if: ${{ github.event.pull_request.draft == false }} + + name: Lint Javascript code + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Enable Corepack + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 21 + cache: yarn + + - name: Install dependencies + run: yarn install + + - name: Run Eslint + run: yarn lint From 71d5c195a6a6136d92982c203d32c126b033c67e Mon Sep 17 00:00:00 2001 From: toni-santos Date: Wed, 25 Sep 2024 16:01:15 +0100 Subject: [PATCH 2/2] fix CI and components paeg --- content-scripts/index.js | 2 +- content-scripts/pages/components_page.tsx | 188 +++++++++++++--------- css/componentsPage.css | 137 ++++++++-------- manifest.js | 5 + 4 files changed, 183 insertions(+), 149 deletions(-) diff --git a/content-scripts/index.js b/content-scripts/index.js index a5d1dd0..d701920 100644 --- a/content-scripts/index.js +++ b/content-scripts/index.js @@ -50,9 +50,9 @@ const functionsToExecute = [ { name: "courseUnitPage", func: courseUnitPage }, { name: "injectOverrideFunctions", func: injectOverrideFunctions }, { name: "addStarIconToCard", func: addStarIconToCard }, + { name: "componentsPage", func: createComponentsPage }, ]; - const init = async () => { // Inject user preferences const data = await getStorage(userPreferences); diff --git a/content-scripts/pages/components_page.tsx b/content-scripts/pages/components_page.tsx index c94db19..c79edd4 100644 --- a/content-scripts/pages/components_page.tsx +++ b/content-scripts/pages/components_page.tsx @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars import jsx from "texsaur"; import Button from "../components/Button"; import { Table } from "../components/Table"; @@ -6,51 +7,74 @@ import Icon from "../components/Icon"; const components = ["Icon", "Button", "Table"]; export function createComponentsPage() { - if (!document.location.href.toLowerCase().includes("components")) { - return; - } - document.body.innerHTML = ""; - document.title = "Components"; + if (!document.location.href.toLowerCase().includes("components")) { + return; + } + document.body.innerHTML = ""; + document.title = "Components"; - const sidebarItems = components.map((component) => ( - -
  • - {component} -
  • -
    - )); + const sidebarItems = components.map((component) => ( + +
  • {component}
  • +
    + )); - const page = ( -
    - {/* Sidebar */} -
    - NitSig Logo -
      {sidebarItems}
    -
    + const page = ( +
    + {/* Sidebar */} +
    + NitSig Logo +
      {sidebarItems}
    +
    - {/* Main Content */} -
    -

    NitSig Components

    -
    -

    These components were created by the NitSig team in order to use them across the Sigarra pages.

    -

    If you find something in your Sigarra that would be interesting to change by one of the following components, send an email to ni@aefeup.pt.

    -

    Interesting to see the extension code base? Check our open source GitHub Repository!

    -
    + {/* Main Content */} +
    +

    NitSig Components

    +
    +

    + These components were created by the NitSig team in + order to use them across the Sigarra pages. +

    +

    + If you find something in your Sigarra that would be + interesting to change by one of the following + components, send an email to{" "} + ni@aefeup.pt. +

    +

    + Interesting to see the extension code base? Check our + open source{" "} + + GitHub Repository + + ! +

    +
    - {/* Icon */} - `} - > - - + > + + - {/* Button */} - alert("Button was clicked")} /> `} + > +