diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..84fdb0f --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,34 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Prepare Pages artifact + run: | + mkdir _site + cp index.html styles.css worktime.js app.js .nojekyll _site/ + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v3 + with: + path: _site + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3fa3cf3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,15 @@ +name: Test + +on: + push: + pull_request: + +jobs: + worktime: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + - run: node --test worktime.test.js diff --git a/.gitignore b/.gitignore index 7e5a80c..e6d03cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,39 +1,18 @@ -# Visual Studio +# Visual Studio / editors .vs/ .vscode/ - -# Archivos de compilación -bin/ -obj/ - -# Configuración de usuario -*.userprefs -*.user *.suo +*.user +*.userprefs -# Dependencias restaurables -packages/ -.nuget/ - -# Archivos de caché y logs +# Logs and swap *.log *.swp *.swo -# MAUI-specific ignores -Platforms/**/bin/ -Platforms/**/obj/ -Resources/Raw/**/*.db -Resources/Raw/**/*.sqlite - -# Archivos específicos de macOS/iOS -xcuserdata/ -Pods/ -DerivedData/ -*.xcworkspace -*.xcuserstate +# OS +.DS_Store +Thumbs.db -# Archivos específicos de Android -*.apk -*.aab -*.keystore \ No newline at end of file +# Local Pages artifact +_site/ diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/AGENTS.md b/AGENTS.md index 76f985e..397e854 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,89 +1,60 @@ -# Agent Guide — Worktime Calculator +# Agent Guide — Horas laborales -This document helps AI coding agents work effectively in this repository. - -## Repository Overview - -**Worktime Calculator** is a small .NET MAUI application (.NET 9) for analyzing working hours over a date range. It is not a backend service or multi-module monorepo—the entire app lives under `WorktimeCalculator/`. +This repository is a **static GitHub Pages site**. There is no .NET / MAUI app, no backend, and no bundler. | Path | Purpose | |------|---------| -| `WorktimeCalculator/Utilities/WorktimeCalculator.cs` | Working-day count, expected hours, daily average | -| `WorktimeCalculator/ViewModels/WorktimeCalculatorVM.cs` | Main view model; parse input and bind results | -| `WorktimeCalculator/Views/WorktimeCalculatorPage.xaml` | Primary (and only) user screen | -| `WorktimeCalculator/Converters/BoolToColorConverter.cs` | Red text when hours difference is negative | -| `WorktimeCalculator/MauiProgram.cs` | App bootstrap; minimal configuration | +| `index.html` | Single page UI (Spanish) | +| `styles.css` | Page styles | +| `worktime.js` | Working-day count, expected hours, parse/format `h:mm` | +| `app.js` | Form defaults and live recalculation | +| `worktime.test.js` | Node tests for `worktime.js` | +| `.github/workflows/pages.yml` | Deploy to GitHub Pages from `main` | +| `.github/workflows/test.yml` | Run `node --test worktime.test.js` | ## Conventions -- **Language**: C# with `ImplicitUsings` and `Nullable` enabled. -- **MVVM**: View models use `CommunityToolkit.Mvvm` (`ObservableObject`, `SetProperty`, `ICommand` via `Command`). -- **Namespaces**: Match folder structure (e.g. `WorktimeCalculator.ViewModels`). -- **Time format**: User input and display use `h:mm` strings (hours and minutes separated by `:`). -- **Working day rules**: Monday–Friday minus dates in the static `holydays` list in `WorktimeCalculator.cs` (note: the field name is `holydays`, not `holidays`). -- **Expected hours**: Fixed at **8 hours per working day**; change `CalculateExpectedWorkinghours` if this should be configurable. - -## Build Commands - -From the repo root: - -```bash -dotnet restore WorktimeCalculator.sln -dotnet build WorktimeCalculator.sln -``` +- Vanilla HTML/CSS/JS. Classic ` + + + diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..572c0e0 --- /dev/null +++ b/styles.css @@ -0,0 +1,170 @@ +:root { + --paper: #f3efe6; + --ink: #1c1917; + --muted: #5c574e; + --line: #d8d0c2; + --card: #fbf8f1; + --accent: #0f4c3a; + --behind: #9b1c1c; + --focus: #1f6f54; +} + +* { + box-sizing: border-box; +} + +html, +body { + margin: 0; + min-height: 100%; +} + +body { + font-family: "Segoe UI", system-ui, sans-serif; + color: var(--ink); + background: var(--paper); + line-height: 1.45; +} + +.page { + width: min(34rem, calc(100% - 2rem)); + margin: 2.5rem auto 4rem; +} + +header h1 { + font-family: Georgia, "Iowan Old Style", serif; + font-size: 1.85rem; + font-weight: 600; + margin: 0 0 0.35rem; +} + +.lede { + margin: 0 0 1.75rem; + color: var(--muted); +} + +form, +.results { + background: var(--card); + border: 1px solid var(--line); + border-radius: 12px; + padding: 1.15rem 1.15rem 1.25rem; +} + +.field { + display: grid; + gap: 0.35rem; + margin-bottom: 0.9rem; +} + +.field:last-of-type { + margin-bottom: 1rem; +} + +label { + font-size: 0.92rem; + font-weight: 600; +} + +input[type="date"], +input[type="text"] { + font: inherit; + padding: 0.5rem 0.65rem; + border: 1px solid var(--line); + border-radius: 8px; + background: #fff; + color: inherit; +} + +input:focus { + outline: 2px solid var(--focus); + outline-offset: 1px; +} + +button { + font: inherit; + font-weight: 600; + cursor: pointer; + border: 0; + border-radius: 8px; + padding: 0.6rem 1rem; + background: var(--accent); + color: #f7f4ee; +} + +button:hover { + filter: brightness(1.08); +} + +.error { + margin: 0.85rem 0 0; + color: var(--behind); + font-size: 0.92rem; +} + +.results { + margin-top: 1rem; +} + +.hero { + padding-bottom: 1rem; + margin-bottom: 0.35rem; + border-bottom: 1px solid var(--line); +} + +.hero-label { + display: block; + color: var(--muted); + font-size: 0.88rem; + letter-spacing: 0.02em; + text-transform: uppercase; +} + +.hero-value { + display: block; + margin-top: 0.2rem; + font-family: Georgia, "Iowan Old Style", serif; + font-size: 2.6rem; + color: var(--accent); + line-height: 1.1; +} + +.row { + display: flex; + justify-content: space-between; + gap: 1rem; + padding: 0.65rem 0; + border-bottom: 1px solid var(--line); +} + +.row:last-child { + border-bottom: 0; + padding-bottom: 0; +} + +.row dt { + margin: 0; + color: var(--muted); +} + +.row dd { + margin: 0; + font-variant-numeric: tabular-nums; + font-weight: 600; +} + +.is-behind { + color: var(--behind); +} + +.note { + margin: 1rem 0 0; + color: var(--muted); + font-size: 0.88rem; +} + +footer { + margin-top: 1.5rem; + color: var(--muted); + font-size: 0.85rem; +} diff --git a/worktime.js b/worktime.js new file mode 100644 index 0000000..d36aaac --- /dev/null +++ b/worktime.js @@ -0,0 +1,115 @@ +/** + * Working-hours calculator (ported from WorktimeCalculator/Utilities/WorktimeCalculator.cs). + * No DOM. Safe to load as a classic