diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index f292803..b092bac 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -11,9 +11,6 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: - - # Automatically run on Pull Request - pull_request: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: diff --git a/.github/workflows/nextjsbuildonly.yml b/.github/workflows/nextjsbuildonly.yml new file mode 100644 index 0000000..11137fb --- /dev/null +++ b/.github/workflows/nextjsbuildonly.yml @@ -0,0 +1,62 @@ +# Sample workflow for building and deploying a Next.js site to GitHub Pages +# +# To get started with Next.js see: https://nextjs.org/docs/getting-started +# +name: Build Next.js site + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + + # Automatically run on Pull Request + pull_request: + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Detect package manager + id: detect-package-manager + run: | + if [ -f "${{ github.workspace }}/yarn.lock" ]; then + echo "manager=yarn" >> $GITHUB_OUTPUT + echo "command=install" >> $GITHUB_OUTPUT + echo "runner=yarn" >> $GITHUB_OUTPUT + exit 0 + elif [ -f "${{ github.workspace }}/package.json" ]; then + echo "manager=npm" >> $GITHUB_OUTPUT + echo "command=ci" >> $GITHUB_OUTPUT + echo "runner=npx --no-install" >> $GITHUB_OUTPUT + exit 0 + else + echo "Unable to determine package manager" + exit 1 + fi + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: ${{ steps.detect-package-manager.outputs.manager }} + - name: Restore cache + uses: actions/cache@v4 + with: + path: | + .next/cache + # Generate a new cache whenever packages or source files change. + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} + # If source files changed but packages didn't, rebuild from a prior cache. + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- + - name: Install dependencies + run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} + - name: Build with Next.js + run: ${{ steps.detect-package-manager.outputs.runner }} next build diff --git a/src/app/lang.ts b/src/app/lang.ts index 4b1f2d1..c61f566 100644 --- a/src/app/lang.ts +++ b/src/app/lang.ts @@ -24,6 +24,8 @@ export default function text(lang: string, input: string): string { return "Listen Sie alle Ihre Variablen auf. Eine pro Zeile (mit der 'Enter'-Taste trennen). Erlaubte Symbole sind a-z, A-Z.\nBeispiel:\nx\ny"; case "boxExportLP": return "Als LP exportieren"; + case "boxExportMPS": + return "Als MPS exportieren"; case "boxOut": return "Geben Sie ein Problem ein und drücken Sie eine Aktionstaste, um die Ausgabe anzuzeigen..."; case "buttonCalc": @@ -92,8 +94,12 @@ export default function text(lang: string, input: string): string { return "Download wird vorbereitet..."; case "downloadFetchInput": return "Eingaben werden geladen..."; + case "downloadCheckInput": + return "Überprüfe auf leere Eingabefelder..."; case "importing": return "Importiere..."; + case "err_invalidConstraintFormat": + return "Fehler: Nicht erlaubter Operator verwendet."; default: return input; } @@ -125,6 +131,8 @@ export default function text(lang: string, input: string): string { return "List all your variables. One per line (divide by 'return' button). Allowed symbols are a-z, A-Z.\nExample:\nx\ny"; case "boxExportLP": return "Export as LP"; + case "boxExportMPS": + return "Export as MPS"; case "boxOut": return "Input a problem and an action button to display output..."; case "buttonCalc": @@ -193,8 +201,12 @@ export default function text(lang: string, input: string): string { return "Preparing download..."; case "downloadFetchInput": return "Fetching input..."; + case "downloadCheckInput": + return "Checking for empty input boxes..."; case "importing": return "Importing..."; + case "err_invalidConstraintFormat": + return "Error: Invalid constraint format."; default: return input; } diff --git a/src/app/page.tsx b/src/app/page.tsx index 332c116..b321e2e 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { Box, Button, Output } from "./modules"; -import { calculate_click, downloadLP } from "./scripts"; +import { calculate_click, downloadLP, downloadMPS } from "./scripts"; import text from "./lang"; export default function Home() { @@ -24,6 +24,7 @@ export default function Home() { const tr_calc_max = text(language, "maximize"); const tr_calc_min = text(language, "minimize"); const tr_calcButton = text(language, "buttonCalc"); + const tr_boxExportMPS = text(language, "boxExportMPS"); const handleLanguageChange = (event: React.ChangeEvent) => { setLanguage(event.target.value); @@ -85,6 +86,10 @@ export default function Home() { className={"button"} onClickFunc={downloadLP} /> +