Add Python FastAPI service, cheap hotels page, and Tailwind theme refactor
Deploy with Docker Compose / deploy (push) Successful in 1m29s
Deploy with Docker Compose / deploy (push) Successful in 1m29s
- Replace searxng and open-webui with a FastAPI `python/` service proxied at /py/ (Travelodge hotel search, rate-limited in nginx) - Add CheapHotels view and CreateToggle component - Move design tokens into Tailwind @theme in styles.css and migrate components/views to utility classes; CVLayout re-points tokens for light theme - Update README, CLAUDE.md, and .gitignore accordingly Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01Dphx7LL5JC8dAFYU7MMpoA
This commit is contained in:
+4
-1
@@ -1,6 +1,5 @@
|
|||||||
icecast2/fallback_music/*
|
icecast2/fallback_music/*
|
||||||
!icecast2/fallback_music/.gitkeep
|
!icecast2/fallback_music/.gitkeep
|
||||||
searxng/settings.yml
|
|
||||||
certbot/conf
|
certbot/conf
|
||||||
certbot/www
|
certbot/www
|
||||||
backend/token/
|
backend/token/
|
||||||
@@ -17,6 +16,10 @@ gitea-runner/nohup.out
|
|||||||
# Rust build artifacts
|
# Rust build artifacts
|
||||||
**/target/
|
**/target/
|
||||||
|
|
||||||
|
# Python bytecode
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
# Generated WASM output
|
# Generated WASM output
|
||||||
vue/src/wasm/
|
vue/src/wasm/
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ Dockerized multi-service personal website self-hosted on a Raspberry Pi.
|
|||||||
|
|
||||||
**Frontend** (`vue/`): Vue 3 SPA with Vite, Tailwind CSS v4, Pinia stores, Vue Router. Built in a separate container; assets served through Nginx (production) or proxied to Vite dev server (dev mode).
|
**Frontend** (`vue/`): Vue 3 SPA with Vite, Tailwind CSS v4, Pinia stores, Vue Router. Built in a separate container; assets served through Nginx (production) or proxied to Vite dev server (dev mode).
|
||||||
|
|
||||||
|
**Python API** (`python/`): FastAPI app served by uvicorn on port 8000. Nginx proxies `/py/` to it and strips the prefix, so routes in `python/app/main.py` are written relative to `/`. Swagger UI at `/py/docs`. Dev mode mounts `python/app` and runs uvicorn with `--reload`.
|
||||||
|
|
||||||
**Nginx** (`nginx/`): Reverse proxy + SPA server. Config is templated (`nginx.conf.template`) and selected at runtime by `entrypoint.sh` based on `DEV_MODE` and certificate presence. Rate limiting on login (5/min), API (30/sec), uploads (5/min).
|
**Nginx** (`nginx/`): Reverse proxy + SPA server. Config is templated (`nginx.conf.template`) and selected at runtime by `entrypoint.sh` based on `DEV_MODE` and certificate presence. Rate limiting on login (5/min), API (30/sec), uploads (5/min).
|
||||||
|
|
||||||
## Backend Structure
|
## Backend Structure
|
||||||
@@ -68,6 +70,7 @@ Dockerized multi-service personal website self-hosted on a Raspberry Pi.
|
|||||||
- `src/stores/` — Pinia stores for auth, posts, favorites, activities, songs, messages, homeData
|
- `src/stores/` — Pinia stores for auth, posts, favorites, activities, songs, messages, homeData
|
||||||
- `src/views/` — page components (Home, Admin, CV, Notes, Bookmarks, shrines)
|
- `src/views/` — page components (Home, Admin, CV, Notes, Bookmarks, shrines)
|
||||||
- `src/components/` — reusable UI components
|
- `src/components/` — reusable UI components
|
||||||
|
- `src/assets/styles.css` — design tokens (Tailwind `@theme`), base element styles, shared classes and transitions. `layouts/CVLayout.vue` re-points the colour tokens for the light CV theme. See "Styling" in `vue/README.md`.
|
||||||
|
|
||||||
## Key Patterns
|
## Key Patterns
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ db (5432) ── PostgreSQL 16
|
|||||||
icecast2 (8000) ── Audio Streaming (Icecast2 + Liquidsoap)
|
icecast2 (8000) ── Audio Streaming (Icecast2 + Liquidsoap)
|
||||||
gitea (3000) ── Self-Hosted Git
|
gitea (3000) ── Self-Hosted Git
|
||||||
quartz (8080) ── Obsidian Notes Publisher (Quartz v4.4.0)
|
quartz (8080) ── Obsidian Notes Publisher (Quartz v4.4.0)
|
||||||
searxng (8080) ── Meta Search Engine
|
python (8000) ── Python API (FastAPI)
|
||||||
hasura (8080) ── Hasura GraphQL Engine (Docker profile: hasura)
|
hasura (8080) ── Hasura GraphQL Engine (Docker profile: hasura)
|
||||||
autoheal ── Auto-restart unhealthy containers
|
autoheal ── Auto-restart unhealthy containers
|
||||||
certbot ── SSL Certificate Management (disabled in dev)
|
certbot ── SSL Certificate Management (disabled in dev)
|
||||||
@@ -55,9 +55,8 @@ certbot ── SSL Certificate Management (disabled in dev)
|
|||||||
- Printable CV with role-specific sections
|
- Printable CV with role-specific sections
|
||||||
- Job application tracker with status workflow and CSV export (admin-only, `/cv/jobs`)
|
- Job application tracker with status workflow and CSV export (admin-only, `/cv/jobs`)
|
||||||
- Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
|
- Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
|
||||||
- SearXNG meta search engine (admin-only)
|
|
||||||
- Hasura GraphQL console (admin-only)
|
- Hasura GraphQL console (admin-only)
|
||||||
- Admin-gated routes: `/searxng`, `/notes`, `/hasura` require admin JWT via Nginx `auth_request`
|
- Admin-gated routes: `/notes`, `/hasura` require admin JWT via Nginx `auth_request`
|
||||||
- Landing page with animated stamps section
|
- Landing page with animated stamps section
|
||||||
- Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
|
- Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
|
||||||
- Backend healthcheck with autoheal container for automatic recovery
|
- Backend healthcheck with autoheal container for automatic recovery
|
||||||
@@ -183,10 +182,10 @@ Access tokens are valid for 7 days; refresh tokens for 365 days. `ValidateAdmin`
|
|||||||
| `/gitea` | gitea:3000 | Git service |
|
| `/gitea` | gitea:3000 | Git service |
|
||||||
| `/hasura` | hasura:8080 | GraphQL console + WebSocket (admin-only) |
|
| `/hasura` | hasura:8080 | GraphQL console + WebSocket (admin-only) |
|
||||||
| `/notes` | quartz:8080 | Obsidian notes (admin-only) |
|
| `/notes` | quartz:8080 | Obsidian notes (admin-only) |
|
||||||
| `/searxng` | searxng:8080 | Search engine (admin-only) |
|
| `/py` | python:8000 | Python API (FastAPI; docs at `/py/docs`) |
|
||||||
| `/uploads` | local alias | User-uploaded files |
|
| `/uploads` | local alias | User-uploaded files |
|
||||||
|
|
||||||
`/hasura`, `/notes`, and `/searxng` are protected by `auth_request` to `GET /api/auth/validate-admin`. Requests without a valid admin JWT are rejected with 401.
|
`/hasura` and `/notes` are protected by `auth_request` to `GET /api/auth/validate-admin`. Requests without a valid admin JWT are rejected with 401.
|
||||||
|
|
||||||
### Deprecated Endpoints
|
### Deprecated Endpoints
|
||||||
|
|
||||||
@@ -213,9 +212,6 @@ Create a `.env` file in the project root. All services read from this file.
|
|||||||
| `POSTGRES_GITEA_DB` | Gitea database name |
|
| `POSTGRES_GITEA_DB` | Gitea database name |
|
||||||
| `UPTIMEKUMA_HOST` | Uptime Kuma hostname (planned) |
|
| `UPTIMEKUMA_HOST` | Uptime Kuma hostname (planned) |
|
||||||
| `UPTIMEKUMA_PORT` | Uptime Kuma port (planned) |
|
| `UPTIMEKUMA_PORT` | Uptime Kuma port (planned) |
|
||||||
| `SEARXNG_HOST` | SearXNG hostname (use `searxng` for Docker) |
|
|
||||||
| `SEARXNG_PORT` | SearXNG port (typically `8080`) |
|
|
||||||
| `SEARXNG_SECRET_KEY` | SearXNG secret key (random hex string) |
|
|
||||||
| `WALLABAG_HOST` | Wallabag hostname (planned) |
|
| `WALLABAG_HOST` | Wallabag hostname (planned) |
|
||||||
| `WALLABAG_PORT` | Wallabag port (planned) |
|
| `WALLABAG_PORT` | Wallabag port (planned) |
|
||||||
| `QUARTZ_HOST` | Quartz hostname (use `quartz` for Docker) |
|
| `QUARTZ_HOST` | Quartz hostname (use `quartz` for Docker) |
|
||||||
@@ -249,6 +245,8 @@ Create a `.env` file in the project root. All services read from this file.
|
|||||||
| `HASURA_GRAPHQL_ADMIN_SECRET` | Hasura admin secret |
|
| `HASURA_GRAPHQL_ADMIN_SECRET` | Hasura admin secret |
|
||||||
| `HASURA_HOST` | Hasura hostname (use `hasura` for Docker) |
|
| `HASURA_HOST` | Hasura hostname (use `hasura` for Docker) |
|
||||||
| `HASURA_PORT` | Hasura port (typically `8080`) |
|
| `HASURA_PORT` | Hasura port (typically `8080`) |
|
||||||
|
| `PYTHON_HOST` | Python API hostname (defaults to `python`) |
|
||||||
|
| `PYTHON_PORT` | Python API port (defaults to `8000`) |
|
||||||
| `SEED_DB` | Set to `true` to seed test data on startup |
|
| `SEED_DB` | Set to `true` to seed test data on startup |
|
||||||
|
|
||||||
### Gitea Config
|
### Gitea Config
|
||||||
@@ -261,16 +259,6 @@ cp gitea/config/app.ini.template gitea/config/app.ini
|
|||||||
|
|
||||||
Populate `LFS_JWT_SECRET`, `SECRET_KEY`, `INTERNAL_TOKEN`, `JWT_SECRET`, and the database `PASSWD`. Alternatively, the Gitea entrypoint generates `app.ini` from the template using environment variables.
|
Populate `LFS_JWT_SECRET`, `SECRET_KEY`, `INTERNAL_TOKEN`, `JWT_SECRET`, and the database `PASSWD`. Alternatively, the Gitea entrypoint generates `app.ini` from the template using environment variables.
|
||||||
|
|
||||||
### SearXNG Config
|
|
||||||
|
|
||||||
Copy from the template:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cp searxng/settings.yml.template searxng/settings.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
The Docker entrypoint handles environment variable substitution (`${BASE_URL}`, `${SEARXNG_SECRET_KEY}`) automatically, so manual setup is only needed when running outside Docker.
|
|
||||||
|
|
||||||
### Spotify Token Setup
|
### Spotify Token Setup
|
||||||
|
|
||||||
4. After authorization, Spotify redirects to the callback endpoint which stores tokens at `/backend/token/spotify_token.json`
|
4. After authorization, Spotify redirects to the callback endpoint which stores tokens at `/backend/token/spotify_token.json`
|
||||||
@@ -340,7 +328,6 @@ These files are git-ignored and must be created manually:
|
|||||||
| ------------------------------- | --------------------------------------------------------------- |
|
| ------------------------------- | --------------------------------------------------------------- |
|
||||||
| `.env` | See setup section above |
|
| `.env` | See setup section above |
|
||||||
| `gitea/config/app.ini` | Copy from `app.ini.template` or let entrypoint generate it |
|
| `gitea/config/app.ini` | Copy from `app.ini.template` or let entrypoint generate it |
|
||||||
| `searxng/settings.yml` | Copy from `settings.yml.template` or let entrypoint generate it |
|
|
||||||
| `certbot/conf/`, `certbot/www/` | Created automatically by certbot; use dev mode to skip |
|
| `certbot/conf/`, `certbot/www/` | Created automatically by certbot; use dev mode to skip |
|
||||||
| `backend/token/` | Created automatically by Docker volume mount |
|
| `backend/token/` | Created automatically by Docker volume mount |
|
||||||
| `icecast2/fallback_music/*.mp3` | Place at least one MP3 file |
|
| `icecast2/fallback_music/*.mp3` | Place at least one MP3 file |
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
certbot certonly --webroot -w /var/www/certbot \
|
certbot certonly --webroot -w /var/www/certbot \
|
||||||
--email ${EMAIL} \
|
--email ${EMAIL} \
|
||||||
-d ${DOMAIN} -d www.${DOMAIN} -d chat.${DOMAIN} \
|
-d ${DOMAIN} -d www.${DOMAIN} \
|
||||||
|
--cert-name ${DOMAIN} \
|
||||||
--agree-tos --non-interactive --expand;
|
--agree-tos --non-interactive --expand;
|
||||||
|
|
||||||
trap exit TERM;
|
trap exit TERM;
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
|
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
|
||||||
HASURA_GRAPHQL_DEV_MODE: "true"
|
HASURA_GRAPHQL_DEV_MODE: "true"
|
||||||
|
python:
|
||||||
|
command: ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PYTHON_PORT:-8000} --root-path /py --reload"]
|
||||||
|
volumes:
|
||||||
|
- ./python/app:/app/app
|
||||||
certbot:
|
certbot:
|
||||||
profiles:
|
profiles:
|
||||||
- disabled
|
- disabled
|
||||||
|
|||||||
+13
-29
@@ -12,10 +12,6 @@ volumes:
|
|||||||
uploads:
|
uploads:
|
||||||
# Vue build
|
# Vue build
|
||||||
vue_dist:
|
vue_dist:
|
||||||
# Searxng data
|
|
||||||
searxng_data:
|
|
||||||
# Open-WebUI data
|
|
||||||
openwebui_data:
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
vue:
|
vue:
|
||||||
@@ -42,8 +38,7 @@ services:
|
|||||||
- gitea
|
- gitea
|
||||||
- hasura
|
- hasura
|
||||||
- quartz
|
- quartz
|
||||||
- searxng
|
- python
|
||||||
- open-webui
|
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
ports:
|
ports:
|
||||||
@@ -158,35 +153,24 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${OBSIDIAN_DIR}:/quartz/content:ro
|
- ${OBSIDIAN_DIR}:/quartz/content:ro
|
||||||
|
|
||||||
searxng:
|
python:
|
||||||
build:
|
build:
|
||||||
context: ./searxng
|
context: ./python
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
container_name: "${SEARXNG_HOST}"
|
container_name: "${PYTHON_HOST:-python}"
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
environment:
|
|
||||||
- BASE_URL=https://www.${DOMAIN}/searxng/
|
|
||||||
- INSTANCE_NAME=searxng
|
|
||||||
- SEARXNG_SECRET_KEY=${SEARXNG_SECRET_KEY}
|
|
||||||
volumes:
|
|
||||||
- searxng_data:/etc/searxng
|
|
||||||
|
|
||||||
open-webui:
|
|
||||||
image: ghcr.io/open-webui/open-webui:main
|
|
||||||
container_name: "${OPENWEBUI_HOST}"
|
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
env_file:
|
|
||||||
- ./.env
|
|
||||||
environment:
|
environment:
|
||||||
- OLLAMA_BASE_URL=${OLLAMA_BASE_URL}
|
- PYTHON_PORT=${PYTHON_PORT:-8000}
|
||||||
- WEBUI_AUTH=False
|
- ROOT_PATH=/py
|
||||||
- WEBUI_URL=https://chat.${DOMAIN}
|
- TFL_APP_KEY=${TFL_APP_KEY:-}
|
||||||
volumes:
|
healthcheck:
|
||||||
- openwebui_data:/app/backend/data
|
test: ["CMD", "python", "-c", "import urllib.request,os; urllib.request.urlopen(f\"http://localhost:{os.environ.get('PYTHON_PORT','8000')}/health\")"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
gitea:
|
gitea:
|
||||||
image: docker.gitea.com/gitea:1.25.4-rootless
|
image: docker.gitea.com/gitea:1.25.4-rootless
|
||||||
|
|||||||
+6
-2
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Defaults for optional services so envsubst never leaves an empty upstream
|
||||||
|
export PYTHON_HOST="${PYTHON_HOST:-python}"
|
||||||
|
export PYTHON_PORT="${PYTHON_PORT:-8000}"
|
||||||
|
|
||||||
# Check if DEV_MODE
|
# Check if DEV_MODE
|
||||||
if [ "$DEV_MODE" = "true" ]; then
|
if [ "$DEV_MODE" = "true" ]; then
|
||||||
echo "Dev mode. Generating self-signed certificate for HTTPS."
|
echo "Dev mode. Generating self-signed certificate for HTTPS."
|
||||||
@@ -13,13 +17,13 @@ if [ "$DEV_MODE" = "true" ]; then
|
|||||||
-subj "/CN=localhost" 2>/dev/null
|
-subj "/CN=localhost" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
# In dev mode, so use nginx_dev.conf.template
|
# In dev mode, so use nginx_dev.conf.template
|
||||||
envsubst '${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT} ${GITEA_HOST} ${GITEA_PORT} ${HASURA_HOST} ${HASURA_PORT} ${QUARTZ_HOST} ${QUARTZ_PORT} ${UPTIMEKUMA_HOST} ${UPTIMEKUMA_PORT} ${SEARXNG_HOST} ${SEARXNG_PORT} ${WALLABAG_HOST} ${WALLABAG_PORT} ${OPENWEBUI_HOST} ${OPENWEBUI_PORT}' \
|
envsubst '${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT} ${GITEA_HOST} ${GITEA_PORT} ${HASURA_HOST} ${HASURA_PORT} ${QUARTZ_HOST} ${QUARTZ_PORT} ${UPTIMEKUMA_HOST} ${UPTIMEKUMA_PORT} ${WALLABAG_HOST} ${WALLABAG_PORT} ${PYTHON_HOST} ${PYTHON_PORT}' \
|
||||||
</etc/nginx/nginx_dev.conf.template \
|
</etc/nginx/nginx_dev.conf.template \
|
||||||
>/etc/nginx/nginx.conf
|
>/etc/nginx/nginx.conf
|
||||||
elif [ -f "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" ] && [ -f "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ]; then
|
elif [ -f "/etc/letsencrypt/live/$DOMAIN/fullchain.pem" ] && [ -f "/etc/letsencrypt/live/$DOMAIN/privkey.pem" ]; then
|
||||||
echo "Certificates found. Using production nginx config."
|
echo "Certificates found. Using production nginx config."
|
||||||
# In production with certificates already existing, so use nginx.conf.template
|
# In production with certificates already existing, so use nginx.conf.template
|
||||||
envsubst '${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT} ${GITEA_HOST} ${GITEA_PORT} ${HASURA_HOST} ${HASURA_PORT} ${QUARTZ_HOST} ${QUARTZ_PORT} ${UPTIMEKUMA_HOST} ${UPTIMEKUMA_PORT} ${SEARXNG_HOST} ${SEARXNG_PORT} ${WALLABAG_HOST} ${WALLABAG_PORT} ${OPENWEBUI_HOST} ${OPENWEBUI_PORT}' \
|
envsubst '${DOMAIN} ${BACKEND_HOST} ${BACKEND_PORT} ${BACKEND_ENDPOINT} ${ICECAST_HOST} ${ICECAST_PORT} ${GITEA_HOST} ${GITEA_PORT} ${HASURA_HOST} ${HASURA_PORT} ${QUARTZ_HOST} ${QUARTZ_PORT} ${UPTIMEKUMA_HOST} ${UPTIMEKUMA_PORT} ${WALLABAG_HOST} ${WALLABAG_PORT} ${PYTHON_HOST} ${PYTHON_PORT}' \
|
||||||
</etc/nginx/nginx.conf.template \
|
</etc/nginx/nginx.conf.template \
|
||||||
>/etc/nginx/nginx.conf
|
>/etc/nginx/nginx.conf
|
||||||
else
|
else
|
||||||
|
|||||||
+31
-78
@@ -17,6 +17,7 @@ http {
|
|||||||
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
||||||
limit_req_zone $binary_remote_addr zone=graphql:10m rate=10r/s;
|
limit_req_zone $binary_remote_addr zone=graphql:10m rate=10r/s;
|
||||||
limit_req_zone $binary_remote_addr zone=upload:10m rate=5r/m;
|
limit_req_zone $binary_remote_addr zone=upload:10m rate=5r/m;
|
||||||
|
limit_req_zone $binary_remote_addr zone=hotel_search:10m rate=3r/m;
|
||||||
|
|
||||||
log_format compact
|
log_format compact
|
||||||
'$remote_addr "$request" $status rt=$request_time';
|
'$remote_addr "$request" $status rt=$request_time';
|
||||||
@@ -78,7 +79,7 @@ http {
|
|||||||
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
|
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
|
||||||
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
||||||
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
|
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
|
||||||
set $upstream_searxng http://$SEARXNG_HOST:$SEARXNG_PORT;
|
set $upstream_python http://$PYTHON_HOST:$PYTHON_PORT;
|
||||||
|
|
||||||
root /etc/nginx/html;
|
root /etc/nginx/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
@@ -259,6 +260,35 @@ http {
|
|||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /py {
|
||||||
|
return 301 /py/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /py/hotels/search {
|
||||||
|
# Public, minutes-long upstream call with a single search slot: keep it to a few per minute per IP
|
||||||
|
limit_req zone=hotel_search burst=2 nodelay;
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
rewrite ^/py/(.*)$ /$1 break;
|
||||||
|
proxy_pass $upstream_python;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /py/ {
|
||||||
|
limit_req zone=api burst=20 nodelay;
|
||||||
|
# Hotel search blocks for up to a few minutes while it calls Travelodge and TfL
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
rewrite ^/py/(.*)$ /$1 break;
|
||||||
|
proxy_pass $upstream_python;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
location = /internal/auth/admin-validate {
|
location = /internal/auth/admin-validate {
|
||||||
internal;
|
internal;
|
||||||
@@ -273,83 +303,6 @@ http {
|
|||||||
return 302 /admin/login?redirect=$request_uri;
|
return 302 /admin/login?redirect=$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /searxng {
|
|
||||||
return 301 /searxng/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /searxng/ {
|
|
||||||
auth_request /internal/auth/admin-validate;
|
|
||||||
error_page 401 403 = @auth_denied;
|
|
||||||
rewrite ^/searxng/(.*)$ /$1 break;
|
|
||||||
proxy_pass $upstream_searxng;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name chat.$DOMAIN;
|
|
||||||
|
|
||||||
location /.well-known/acme-challenge/ {
|
|
||||||
root /var/www/certbot;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
return 301 https://chat.$DOMAIN$request_uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 443 ssl;
|
|
||||||
http2 on;
|
|
||||||
server_name chat.$DOMAIN;
|
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/$DOMAIN/fullchain.pem;
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/$DOMAIN/privkey.pem;
|
|
||||||
|
|
||||||
set $upstream_openwebui http://$OPENWEBUI_HOST:$OPENWEBUI_PORT;
|
|
||||||
|
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
|
||||||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
||||||
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains" always;
|
|
||||||
|
|
||||||
client_max_body_size 50M;
|
|
||||||
|
|
||||||
location = /internal/auth/admin-validate {
|
|
||||||
internal;
|
|
||||||
rewrite ^ /auth/validate-admin break;
|
|
||||||
proxy_pass http://$BACKEND_HOST:$BACKEND_PORT;
|
|
||||||
proxy_pass_request_body off;
|
|
||||||
proxy_set_header Content-Length "";
|
|
||||||
proxy_set_header Cookie $http_cookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
location @auth_denied {
|
|
||||||
return 302 https://www.$DOMAIN/admin/login?redirect=https://chat.$DOMAIN$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
auth_request /internal/auth/admin-validate;
|
|
||||||
error_page 401 403 = @auth_denied;
|
|
||||||
proxy_pass $upstream_openwebui;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
proxy_buffering off;
|
|
||||||
proxy_read_timeout 300s;
|
|
||||||
proxy_send_timeout 300s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ http {
|
|||||||
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
|
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
|
||||||
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
limit_req_zone $binary_remote_addr zone=api:10m rate=30r/s;
|
||||||
limit_req_zone $binary_remote_addr zone=upload:10m rate=5r/m;
|
limit_req_zone $binary_remote_addr zone=upload:10m rate=5r/m;
|
||||||
|
limit_req_zone $binary_remote_addr zone=hotel_search:10m rate=3r/m;
|
||||||
|
|
||||||
log_format compact
|
log_format compact
|
||||||
'$remote_addr "$request" $status rt=$request_time';
|
'$remote_addr "$request" $status rt=$request_time';
|
||||||
@@ -51,7 +52,7 @@ http {
|
|||||||
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
|
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
|
||||||
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
||||||
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
|
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
|
||||||
set $upstream_searxng http://$SEARXNG_HOST:$SEARXNG_PORT;
|
set $upstream_python http://$PYTHON_HOST:$PYTHON_PORT;
|
||||||
|
|
||||||
location /uploads/ {
|
location /uploads/ {
|
||||||
alias /uploads/;
|
alias /uploads/;
|
||||||
@@ -176,6 +177,35 @@ http {
|
|||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /py {
|
||||||
|
return 301 /py/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /py/hotels/search {
|
||||||
|
# Public, minutes-long upstream call with a single search slot: keep it to a few per minute per IP
|
||||||
|
limit_req zone=hotel_search burst=2 nodelay;
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
rewrite ^/py/(.*)$ /$1 break;
|
||||||
|
proxy_pass $upstream_python;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /py/ {
|
||||||
|
limit_req zone=api burst=20 nodelay;
|
||||||
|
# Hotel search blocks for up to a few minutes while it calls Travelodge and TfL
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
rewrite ^/py/(.*)$ /$1 break;
|
||||||
|
proxy_pass $upstream_python;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
location = /internal/auth/admin-validate {
|
location = /internal/auth/admin-validate {
|
||||||
internal;
|
internal;
|
||||||
@@ -190,21 +220,6 @@ http {
|
|||||||
return 302 /admin/login?redirect=$request_uri;
|
return 302 /admin/login?redirect=$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /searxng {
|
|
||||||
return 301 /searxng/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /searxng/ {
|
|
||||||
auth_request /internal/auth/admin-validate;
|
|
||||||
error_page 401 403 = @auth_denied;
|
|
||||||
rewrite ^/searxng/(.*)$ /$1 break;
|
|
||||||
proxy_pass $upstream_searxng;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
@@ -219,7 +234,7 @@ http {
|
|||||||
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
|
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
|
||||||
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
||||||
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
|
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
|
||||||
set $upstream_searxng http://$SEARXNG_HOST:$SEARXNG_PORT;
|
set $upstream_python http://$PYTHON_HOST:$PYTHON_PORT;
|
||||||
|
|
||||||
location /uploads/ {
|
location /uploads/ {
|
||||||
alias /uploads/;
|
alias /uploads/;
|
||||||
@@ -344,6 +359,35 @@ http {
|
|||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location /py {
|
||||||
|
return 301 /py/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /py/hotels/search {
|
||||||
|
# Public, minutes-long upstream call with a single search slot: keep it to a few per minute per IP
|
||||||
|
limit_req zone=hotel_search burst=2 nodelay;
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
rewrite ^/py/(.*)$ /$1 break;
|
||||||
|
proxy_pass $upstream_python;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /py/ {
|
||||||
|
limit_req zone=api burst=20 nodelay;
|
||||||
|
# Hotel search blocks for up to a few minutes while it calls Travelodge and TfL
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
rewrite ^/py/(.*)$ /$1 break;
|
||||||
|
proxy_pass $upstream_python;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
|
||||||
location = /internal/auth/admin-validate {
|
location = /internal/auth/admin-validate {
|
||||||
internal;
|
internal;
|
||||||
@@ -358,21 +402,6 @@ http {
|
|||||||
return 302 /admin/login?redirect=$request_uri;
|
return 302 /admin/login?redirect=$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /searxng {
|
|
||||||
return 301 /searxng/;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /searxng/ {
|
|
||||||
auth_request /internal/auth/admin-validate;
|
|
||||||
error_page 401 403 = @auth_denied;
|
|
||||||
rewrite ^/searxng/(.*)$ /$1 break;
|
|
||||||
proxy_pass $upstream_searxng;
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
.venv/
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY app ./app
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# PYTHON_PORT and ROOT_PATH are supplied by docker compose (defaults below).
|
||||||
|
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PYTHON_PORT:-8000} --root-path ${ROOT_PATH:-/py}"]
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
"""Small Python API service.
|
||||||
|
|
||||||
|
Nginx proxies https://www.<DOMAIN>/py/... to this container and strips the
|
||||||
|
/py prefix, so routes here are defined relative to "/". FastAPI's root_path
|
||||||
|
(set via --root-path on the uvicorn command line) keeps the generated docs
|
||||||
|
at /py/docs working behind the proxy.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
from datetime import date, datetime, timedelta, timezone
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from fastapi import FastAPI, HTTPException
|
||||||
|
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||||
|
|
||||||
|
from . import travelodge
|
||||||
|
|
||||||
|
app = FastAPI(
|
||||||
|
title="Python API",
|
||||||
|
version="0.2.0",
|
||||||
|
docs_url="/docs",
|
||||||
|
openapi_url="/openapi.json",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class Health(BaseModel):
|
||||||
|
status: str
|
||||||
|
time: datetime
|
||||||
|
|
||||||
|
|
||||||
|
class Greeting(BaseModel):
|
||||||
|
message: str
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/", response_model=Greeting, summary="Service index")
|
||||||
|
def index() -> Greeting:
|
||||||
|
return Greeting(message="Python API is running. See /py/docs for the schema.")
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/health", response_model=Health, summary="Liveness check")
|
||||||
|
def health() -> Health:
|
||||||
|
return Health(status="ok", time=datetime.now(timezone.utc))
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/hello/{name}", response_model=Greeting, summary="Greet a caller")
|
||||||
|
def hello(name: str) -> Greeting:
|
||||||
|
return Greeting(message=f"Hello, {name}!")
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Cheap Travelodge finder
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
MAX_ROOMS = 4
|
||||||
|
MAX_ADULTS = 8
|
||||||
|
MAX_CHILDREN = 8
|
||||||
|
CACHE_TTL_S = 10 * 60
|
||||||
|
|
||||||
|
_search_slot = threading.Semaphore(1)
|
||||||
|
_cache_lock = threading.Lock()
|
||||||
|
_cache: dict = {} # key -> (expires_at, response dict)
|
||||||
|
|
||||||
|
|
||||||
|
class Origin(BaseModel):
|
||||||
|
key: str
|
||||||
|
name: str
|
||||||
|
lat: float
|
||||||
|
lon: float
|
||||||
|
|
||||||
|
|
||||||
|
class HotelSearchRequest(BaseModel):
|
||||||
|
location: str = Field("Central London", min_length=1, max_length=80, description="Travelodge search text")
|
||||||
|
checkin: date = Field(..., description="Check-in date (today or later)")
|
||||||
|
checkout: Optional[date] = Field(None, description="Check-out date; overrides nights")
|
||||||
|
nights: int = Field(1, ge=1, le=14, description="Used when checkout is not given")
|
||||||
|
guests: str = Field("1", max_length=40, description='Rooms/guests e.g. "1", "2+1", "2,2+2"')
|
||||||
|
railcard_holders: int = Field(1, ge=0, le=MAX_ADULTS, description="Adults with a Railcard (1/3 off off-peak rail)")
|
||||||
|
origin: str = Field("clapham junction", max_length=60, description="Known station key or 'lat,lon'")
|
||||||
|
depart: str = Field("19:30", description="Outbound departure time HH:MM")
|
||||||
|
top: int = Field(15, ge=1, le=25, description="Price transport for the N cheapest stays only")
|
||||||
|
max_miles: Optional[float] = Field(None, gt=0, le=50, description="Drop hotels further than this from the search")
|
||||||
|
max_travel_min: int = Field(75, ge=10, le=240, description="Ignore slower routes than this when picking cheapest")
|
||||||
|
|
||||||
|
@field_validator("location")
|
||||||
|
@classmethod
|
||||||
|
def _strip_location(cls, v: str) -> str:
|
||||||
|
v = v.strip()
|
||||||
|
if not v:
|
||||||
|
raise ValueError("location cannot be empty")
|
||||||
|
return v
|
||||||
|
|
||||||
|
@field_validator("depart")
|
||||||
|
@classmethod
|
||||||
|
def _check_depart(cls, v: str) -> str:
|
||||||
|
if not re.fullmatch(r"([01]\d|2[0-3]):[0-5]\d", v.strip()):
|
||||||
|
raise ValueError("depart must be HH:MM")
|
||||||
|
return v.strip()
|
||||||
|
|
||||||
|
@field_validator("guests")
|
||||||
|
@classmethod
|
||||||
|
def _check_guests(cls, v: str) -> str:
|
||||||
|
try:
|
||||||
|
rooms = travelodge.parse_guests(v)
|
||||||
|
except ValueError as e:
|
||||||
|
raise ValueError(f"invalid guests spec: {e}") from None
|
||||||
|
if len(rooms) > MAX_ROOMS:
|
||||||
|
raise ValueError(f"at most {MAX_ROOMS} rooms")
|
||||||
|
if sum(a for a, _ in rooms) > MAX_ADULTS:
|
||||||
|
raise ValueError(f"at most {MAX_ADULTS} adults")
|
||||||
|
if sum(c for _, c in rooms) > MAX_CHILDREN:
|
||||||
|
raise ValueError(f"at most {MAX_CHILDREN} children")
|
||||||
|
return v.strip()
|
||||||
|
|
||||||
|
@field_validator("origin")
|
||||||
|
@classmethod
|
||||||
|
def _check_origin(cls, v: str) -> str:
|
||||||
|
travelodge.parse_origin(v) # raises ValueError with a useful message
|
||||||
|
return v.strip()
|
||||||
|
|
||||||
|
@model_validator(mode="after")
|
||||||
|
def _check_dates(self):
|
||||||
|
if self.checkin < date.today():
|
||||||
|
raise ValueError("checkin must be today or later")
|
||||||
|
checkout = self.checkout or self.checkin + timedelta(days=self.nights)
|
||||||
|
if checkout <= self.checkin:
|
||||||
|
raise ValueError("checkout must be after checkin")
|
||||||
|
if (checkout - self.checkin).days > 14:
|
||||||
|
raise ValueError("stays are limited to 14 nights")
|
||||||
|
self.checkout = checkout
|
||||||
|
self.nights = (checkout - self.checkin).days
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
class HotelRow(BaseModel):
|
||||||
|
code: Optional[str] = None
|
||||||
|
name: Optional[str] = None
|
||||||
|
lat: Optional[float] = None
|
||||||
|
lon: Optional[float] = None
|
||||||
|
room_price: Optional[float] = None
|
||||||
|
room_code: Optional[str] = None
|
||||||
|
available: bool = True
|
||||||
|
low_availability: bool = False
|
||||||
|
distance_from_search_mi: Optional[float] = None
|
||||||
|
rating: Optional[float] = None
|
||||||
|
url: str
|
||||||
|
transport_out: Optional[float] = None
|
||||||
|
transport_return: Optional[float] = None
|
||||||
|
transport_total: Optional[float] = None
|
||||||
|
travel_minutes: Optional[int] = None
|
||||||
|
route: str
|
||||||
|
fastest_minutes: Optional[int] = None
|
||||||
|
fastest_total: Optional[float] = None
|
||||||
|
fastest_route: Optional[str] = None
|
||||||
|
total: Optional[float] = None
|
||||||
|
|
||||||
|
|
||||||
|
class HotelSearchSummary(BaseModel):
|
||||||
|
location: str
|
||||||
|
checkin: date
|
||||||
|
checkout: date
|
||||||
|
nights: int
|
||||||
|
rooms: int
|
||||||
|
adults: int
|
||||||
|
children: int
|
||||||
|
railcard_holders: int
|
||||||
|
origin_name: str
|
||||||
|
origin_lat: float
|
||||||
|
origin_lon: float
|
||||||
|
depart: datetime
|
||||||
|
max_travel_min: int
|
||||||
|
hotels_found: int
|
||||||
|
hotels_available: int
|
||||||
|
hotels_priced: int
|
||||||
|
truncated: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
class HotelSearchResponse(BaseModel):
|
||||||
|
summary: HotelSearchSummary
|
||||||
|
rows: list[HotelRow]
|
||||||
|
cached: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/hotels/origins", response_model=list[Origin], summary="Known origin stations")
|
||||||
|
def hotel_origins() -> list[Origin]:
|
||||||
|
return [Origin(key=k, name=n, lat=lat, lon=lon) for k, (n, lat, lon) in travelodge.ORIGINS.items()]
|
||||||
|
|
||||||
|
|
||||||
|
@app.post(
|
||||||
|
"/hotels/search",
|
||||||
|
response_model=HotelSearchResponse,
|
||||||
|
summary="Rank Travelodges by room price plus TfL transport",
|
||||||
|
description=(
|
||||||
|
"Blocking search: pulls live Travelodge prices, then prices a round trip on TfL for the "
|
||||||
|
"cheapest `top` hotels. Takes roughly a minute. Only one search runs at a time; identical "
|
||||||
|
"searches are cached for ten minutes."
|
||||||
|
),
|
||||||
|
responses={429: {"description": "Another search is already running"}, 502: {"description": "Upstream API failed"}},
|
||||||
|
)
|
||||||
|
def hotel_search(req: HotelSearchRequest) -> HotelSearchResponse:
|
||||||
|
key = json.dumps(req.model_dump(mode="json"), sort_keys=True)
|
||||||
|
now = time.monotonic()
|
||||||
|
|
||||||
|
with _cache_lock:
|
||||||
|
hit = _cache.get(key)
|
||||||
|
if hit and hit[0] > now:
|
||||||
|
return HotelSearchResponse(**hit[1], cached=True)
|
||||||
|
|
||||||
|
if not _search_slot.acquire(blocking=False):
|
||||||
|
raise HTTPException(status_code=429, detail="A search is already running, try again in a minute.")
|
||||||
|
try:
|
||||||
|
origin_name, origin = travelodge.parse_origin(req.origin)
|
||||||
|
result = travelodge.run_search(
|
||||||
|
location=req.location,
|
||||||
|
checkin=req.checkin,
|
||||||
|
checkout=req.checkout,
|
||||||
|
rooms=travelodge.parse_guests(req.guests),
|
||||||
|
railcard_holders=req.railcard_holders,
|
||||||
|
origin_name=origin_name,
|
||||||
|
origin=origin,
|
||||||
|
depart=req.depart,
|
||||||
|
top=req.top,
|
||||||
|
max_miles=req.max_miles,
|
||||||
|
max_travel_min=req.max_travel_min,
|
||||||
|
)
|
||||||
|
except travelodge.UpstreamError as e:
|
||||||
|
raise HTTPException(status_code=502, detail=str(e)) from e
|
||||||
|
except (KeyError, TypeError) as e:
|
||||||
|
raise HTTPException(status_code=502, detail=f"Unexpected upstream response: {e}") from e
|
||||||
|
except ValueError as e:
|
||||||
|
raise HTTPException(status_code=422, detail=str(e)) from e
|
||||||
|
finally:
|
||||||
|
_search_slot.release()
|
||||||
|
|
||||||
|
with _cache_lock:
|
||||||
|
expired = [k for k, (exp, _) in _cache.items() if exp <= now]
|
||||||
|
for k in expired:
|
||||||
|
del _cache[k]
|
||||||
|
_cache[key] = (time.monotonic() + CACHE_TTL_S, result)
|
||||||
|
|
||||||
|
return HotelSearchResponse(**result)
|
||||||
@@ -0,0 +1,396 @@
|
|||||||
|
"""Cheapest Travelodge (room + TfL transport) for a stay in London.
|
||||||
|
|
||||||
|
Ported from ~/cheap_hotel/cheap_travelodge.py. The pricing logic is unchanged;
|
||||||
|
only the CLI/report/CSV plumbing has been removed.
|
||||||
|
|
||||||
|
Data sources
|
||||||
|
* Travelodge's own search JSON API -> live room prices for every hotel
|
||||||
|
matching a location search.
|
||||||
|
* TfL Journey Planner API -> route + pay-as-you-go fare from the origin to
|
||||||
|
each hotel.
|
||||||
|
|
||||||
|
Method
|
||||||
|
1. Pull every hotel for the search, drop ones with no availability, sort by
|
||||||
|
cheapest room price and keep only the cheapest `top` hotels.
|
||||||
|
2. For each, ask TfL for (a) the fastest route and (b) a bus-only route at
|
||||||
|
the given departure time. Pick the cheapest that isn't slower than
|
||||||
|
`max_travel_min`.
|
||||||
|
3. Apply a Railcard discount (1/3 off) to OFF-PEAK rail/tube fares. Buses
|
||||||
|
are never discounted.
|
||||||
|
4. Assume the return journey the next morning costs the off-peak equivalent
|
||||||
|
of the outbound.
|
||||||
|
5. Rank by room + round-trip transport.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
from datetime import date, datetime
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
TL_API = "https://www.travelodge.co.uk/api/v2/hotel"
|
||||||
|
TL_SITE = "https://www.travelodge.co.uk"
|
||||||
|
TFL_API = "https://api.tfl.gov.uk/Journey/JourneyResults/{frm}/to/{to}"
|
||||||
|
HEADERS = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0 Safari/537.36",
|
||||||
|
"Accept": "application/json",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Well-known origins: key -> (display name, lat, lon)
|
||||||
|
ORIGINS = {
|
||||||
|
"clapham junction": ("Clapham Junction", 51.4645, -0.1705),
|
||||||
|
"waterloo": ("London Waterloo", 51.5031, -0.1132),
|
||||||
|
"victoria": ("London Victoria", 51.4952, -0.1441),
|
||||||
|
"kings cross": ("King's Cross St Pancras", 51.5308, -0.1238),
|
||||||
|
"liverpool street": ("Liverpool Street", 51.5178, -0.0817),
|
||||||
|
"paddington": ("London Paddington", 51.5154, -0.1755),
|
||||||
|
"london bridge": ("London Bridge", 51.5050, -0.0864),
|
||||||
|
"euston": ("London Euston", 51.5282, -0.1337),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Rough Greater London bounding box for custom "lat,lon" origins.
|
||||||
|
LONDON_BOX = (51.25, 51.75, -0.55, 0.35) # min lat, max lat, min lon, max lon
|
||||||
|
|
||||||
|
# Wall-clock budget for one run_search call. Nginx cuts the connection at
|
||||||
|
# 300s, so stop pricing transport well before that and return what we have.
|
||||||
|
SEARCH_DEADLINE_S = 240
|
||||||
|
|
||||||
|
|
||||||
|
class UpstreamError(Exception):
|
||||||
|
"""Travelodge or TfL could not be reached or returned garbage."""
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Input parsing
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
def parse_guests(spec):
|
||||||
|
"""'2,2+1' -> [(2, 0), (2, 1)] (list of (adults, children) per room)."""
|
||||||
|
rooms = []
|
||||||
|
for part in spec.split(","):
|
||||||
|
part = part.strip()
|
||||||
|
if not part:
|
||||||
|
continue
|
||||||
|
a, _, c = part.partition("+")
|
||||||
|
rooms.append((int(a), int(c or 0)))
|
||||||
|
if not rooms:
|
||||||
|
raise ValueError("guests spec is empty")
|
||||||
|
for adults, children in rooms:
|
||||||
|
if adults < 1:
|
||||||
|
raise ValueError("each room needs at least one adult")
|
||||||
|
if children < 0:
|
||||||
|
raise ValueError("children cannot be negative")
|
||||||
|
return rooms
|
||||||
|
|
||||||
|
|
||||||
|
def parse_origin(spec):
|
||||||
|
"""Return (name, (lat, lon)) for an ORIGINS key or a 'lat,lon' string."""
|
||||||
|
key = spec.strip().lower()
|
||||||
|
if key in ORIGINS:
|
||||||
|
name, lat, lon = ORIGINS[key]
|
||||||
|
return name, (lat, lon)
|
||||||
|
if "," in spec:
|
||||||
|
try:
|
||||||
|
lat, lon = (float(x) for x in spec.split(",", 1))
|
||||||
|
except ValueError:
|
||||||
|
raise ValueError("origin must be a known station or 'lat,lon'") from None
|
||||||
|
lo_lat, hi_lat, lo_lon, hi_lon = LONDON_BOX
|
||||||
|
if not (lo_lat <= lat <= hi_lat and lo_lon <= lon <= hi_lon):
|
||||||
|
raise ValueError("origin coordinates must be inside Greater London")
|
||||||
|
return f"{lat:.4f},{lon:.4f}", (lat, lon)
|
||||||
|
raise ValueError("unknown origin '%s' (known: %s, or 'lat,lon')" % (spec, ", ".join(ORIGINS)))
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Travelodge
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
def fetch_hotels(location, checkin, checkout, rooms, page_size=10):
|
||||||
|
"""Return list of hotel dicts from the Travelodge search API (all pages).
|
||||||
|
|
||||||
|
rooms: list of (adults, children) tuples, one per room.
|
||||||
|
"""
|
||||||
|
hotels, start, seen = [], 0, set()
|
||||||
|
while True:
|
||||||
|
params = {
|
||||||
|
"pagination": "false",
|
||||||
|
"checkIn": checkin.isoformat(),
|
||||||
|
"checkOut": checkout.isoformat(),
|
||||||
|
"q": location,
|
||||||
|
"action": "hotel_amend",
|
||||||
|
"start": start,
|
||||||
|
}
|
||||||
|
for i, (adults, children) in enumerate(rooms):
|
||||||
|
params[f"rooms[{i}][adults]"] = adults
|
||||||
|
params[f"rooms[{i}][children]"] = children
|
||||||
|
try:
|
||||||
|
r = requests.get(TL_API, params=params, headers=HEADERS, timeout=30)
|
||||||
|
r.raise_for_status()
|
||||||
|
results = r.json().get("results") or []
|
||||||
|
except (requests.RequestException, ValueError, AttributeError) as e:
|
||||||
|
raise UpstreamError(f"Travelodge search failed: {e}") from e
|
||||||
|
if not results:
|
||||||
|
break
|
||||||
|
new = [h for h in results if h.get("code") and h.get("code") not in seen]
|
||||||
|
if not new:
|
||||||
|
break
|
||||||
|
for h in new:
|
||||||
|
seen.add(h["code"])
|
||||||
|
hotels.extend(new)
|
||||||
|
start += page_size
|
||||||
|
if start > 500: # safety
|
||||||
|
break
|
||||||
|
return hotels
|
||||||
|
|
||||||
|
|
||||||
|
def normalise_hotel(h):
|
||||||
|
return {
|
||||||
|
"code": h.get("code"),
|
||||||
|
"name": h.get("title"),
|
||||||
|
"lat": h.get("lat"),
|
||||||
|
"lon": h.get("lon"),
|
||||||
|
"room_price": h.get("minPrice"),
|
||||||
|
"room_code": h.get("minRoomCode"),
|
||||||
|
"available": bool(h.get("hasAvailability")),
|
||||||
|
"low_availability": bool(h.get("hasLowAvailability")),
|
||||||
|
"distance_from_search_mi": h.get("distance"),
|
||||||
|
"rating": (h.get("rating") or {}).get("averageRating"),
|
||||||
|
"url": TL_SITE + (h.get("hotelUrl") or ""),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# TfL
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
def round_5p(pence):
|
||||||
|
return int(5 * round(pence / 5.0))
|
||||||
|
|
||||||
|
|
||||||
|
def price_journey(journey, adults=1, railcard_holders=1):
|
||||||
|
"""
|
||||||
|
Return (outbound_pence, return_pence, detail) for one TfL journey for the
|
||||||
|
whole party, or None if the fare can't be determined.
|
||||||
|
|
||||||
|
adults: number of fare-paying adults. railcard_holders: how many of them
|
||||||
|
get 1/3 off off-peak rail fares (0 = nobody has a railcard).
|
||||||
|
"""
|
||||||
|
railcard_holders = max(0, min(adults, railcard_holders))
|
||||||
|
full_fare = adults - railcard_holders
|
||||||
|
legs = journey.get("legs") or []
|
||||||
|
modes = [(l.get("mode") or {}).get("id") for l in legs]
|
||||||
|
modes = [m for m in modes if m] # skip legs without a mode id
|
||||||
|
non_walk = [m for m in modes if m != "walking"]
|
||||||
|
fare = journey.get("fare")
|
||||||
|
|
||||||
|
if not non_walk: # walking only
|
||||||
|
return 0, 0, "walk"
|
||||||
|
|
||||||
|
if not fare or not fare.get("fares"):
|
||||||
|
return None
|
||||||
|
|
||||||
|
out = ret = 0
|
||||||
|
for f in fare["fares"]:
|
||||||
|
cost = f.get("cost") or 0
|
||||||
|
peak, offpeak = f.get("peak") or 0, f.get("offPeak") or 0
|
||||||
|
is_bus = (peak == 0 and offpeak == 0) or any(
|
||||||
|
(t.get("tapDetails") or {}).get("modeType") == "Bus" for t in (f.get("taps") or [])
|
||||||
|
)
|
||||||
|
if is_bus:
|
||||||
|
# Bus: flat fare, hopper legs already come through as cost 0. No railcard.
|
||||||
|
out += cost * adults
|
||||||
|
ret += cost * adults
|
||||||
|
else:
|
||||||
|
level = (f.get("chargeLevel") or "").lower()
|
||||||
|
out_full = cost
|
||||||
|
ret_full = offpeak or cost # next-day return assumed off-peak
|
||||||
|
out_disc = round_5p(out_full * 2 / 3) if ("off" in level or cost == offpeak) else out_full
|
||||||
|
ret_disc = round_5p(ret_full * 2 / 3)
|
||||||
|
out += out_full * full_fare + out_disc * railcard_holders
|
||||||
|
ret += ret_full * full_fare + ret_disc * railcard_holders
|
||||||
|
|
||||||
|
# short human summary of the route
|
||||||
|
parts = []
|
||||||
|
for l in legs:
|
||||||
|
m = (l.get("mode") or {}).get("id")
|
||||||
|
if not m or m == "walking":
|
||||||
|
continue
|
||||||
|
ri = l.get("routeOptions") or [{}]
|
||||||
|
name = ri[0].get("name") or ""
|
||||||
|
parts.append(f"{m.replace('national-rail','rail')}{(' ' + name) if name else ''}")
|
||||||
|
return out, ret, " > ".join(parts) if parts else "walk"
|
||||||
|
|
||||||
|
|
||||||
|
def sleep_within(seconds, deadline):
|
||||||
|
"""Sleep for `seconds` unless that would overrun `deadline` (a time.monotonic()
|
||||||
|
value, or None for no limit). Returns False if the sleep was skipped."""
|
||||||
|
if deadline is not None and time.monotonic() + seconds > deadline:
|
||||||
|
return False
|
||||||
|
time.sleep(seconds)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def tfl_journeys(frm, to, when, extra=None, app_key=None, retries=3, deadline=None):
|
||||||
|
params = {
|
||||||
|
"date": when.strftime("%Y%m%d"),
|
||||||
|
"time": when.strftime("%H%M"),
|
||||||
|
"timeIs": "Departing",
|
||||||
|
"journeyPreference": "LeastTime",
|
||||||
|
}
|
||||||
|
if extra:
|
||||||
|
params.update(extra)
|
||||||
|
if app_key:
|
||||||
|
params["app_key"] = app_key
|
||||||
|
url = TFL_API.format(frm=f"{frm[0]},{frm[1]}", to=f"{to[0]},{to[1]}")
|
||||||
|
for attempt in range(retries):
|
||||||
|
remaining = 40 if deadline is None else deadline - time.monotonic()
|
||||||
|
if remaining < 1:
|
||||||
|
return []
|
||||||
|
try:
|
||||||
|
r = requests.get(url, params=params, headers=HEADERS, timeout=min(40, remaining))
|
||||||
|
except requests.RequestException:
|
||||||
|
if not sleep_within(2, deadline):
|
||||||
|
return []
|
||||||
|
continue
|
||||||
|
if r.status_code == 429:
|
||||||
|
if not sleep_within(10 * (attempt + 1), deadline):
|
||||||
|
return []
|
||||||
|
continue
|
||||||
|
if r.status_code >= 500:
|
||||||
|
if not sleep_within(2, deadline):
|
||||||
|
return []
|
||||||
|
continue
|
||||||
|
if r.status_code != 200:
|
||||||
|
return []
|
||||||
|
try:
|
||||||
|
return r.json().get("journeys") or []
|
||||||
|
except ValueError:
|
||||||
|
return []
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def best_transport(origin, hotel, when, adults, railcard_holders, max_minutes, app_key=None, pause=1.2, deadline=None):
|
||||||
|
"""Cheapest acceptable round-trip transport to a hotel. Returns dict or None."""
|
||||||
|
dest = (hotel["lat"], hotel["lon"])
|
||||||
|
options = []
|
||||||
|
queries = (("fast", None), ("bus", {"mode": "bus,walking"}))
|
||||||
|
for i, (label, extra) in enumerate(queries):
|
||||||
|
for j in tfl_journeys(origin, dest, when, extra, app_key, deadline=deadline):
|
||||||
|
if not isinstance(j.get("duration"), int):
|
||||||
|
continue
|
||||||
|
priced = price_journey(j, adults, railcard_holders)
|
||||||
|
if priced is None:
|
||||||
|
continue
|
||||||
|
out, ret, desc = priced
|
||||||
|
options.append({
|
||||||
|
"kind": label,
|
||||||
|
"outbound_p": out,
|
||||||
|
"return_p": ret,
|
||||||
|
"total_p": out + ret,
|
||||||
|
"minutes": j["duration"],
|
||||||
|
"route": desc,
|
||||||
|
})
|
||||||
|
if i < len(queries) - 1: # pause between TfL calls, not after the last
|
||||||
|
sleep_within(pause, deadline)
|
||||||
|
if not options:
|
||||||
|
return None
|
||||||
|
fastest = min(options, key=lambda o: o["minutes"])
|
||||||
|
ok = [o for o in options if o["minutes"] <= max_minutes] or [fastest]
|
||||||
|
cheapest = min(ok, key=lambda o: (o["total_p"], o["minutes"]))
|
||||||
|
cheapest["fastest_minutes"] = fastest["minutes"]
|
||||||
|
cheapest["fastest_total_p"] = fastest["total_p"]
|
||||||
|
cheapest["fastest_route"] = fastest["route"]
|
||||||
|
return cheapest
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
# Search
|
||||||
|
# --------------------------------------------------------------------------- #
|
||||||
|
def run_search(
|
||||||
|
*,
|
||||||
|
location: str,
|
||||||
|
checkin: date,
|
||||||
|
checkout: date,
|
||||||
|
rooms: list,
|
||||||
|
railcard_holders: int,
|
||||||
|
origin_name: str,
|
||||||
|
origin: tuple,
|
||||||
|
depart: str,
|
||||||
|
top: int,
|
||||||
|
max_miles,
|
||||||
|
max_travel_min: int,
|
||||||
|
):
|
||||||
|
"""Everything main() in the original script did between parsing and reporting."""
|
||||||
|
nights = (checkout - checkin).days
|
||||||
|
adults = sum(a for a, _ in rooms)
|
||||||
|
children = sum(c for _, c in rooms)
|
||||||
|
railcard_holders = max(0, min(adults, railcard_holders))
|
||||||
|
hh, mm = map(int, depart.split(":"))
|
||||||
|
depart_dt = datetime(checkin.year, checkin.month, checkin.day, hh, mm)
|
||||||
|
app_key = os.environ.get("TFL_APP_KEY") or None
|
||||||
|
deadline = time.monotonic() + SEARCH_DEADLINE_S
|
||||||
|
|
||||||
|
raw = fetch_hotels(location, checkin, checkout, rooms)
|
||||||
|
hotels = [normalise_hotel(h) for h in raw]
|
||||||
|
avail = [h for h in hotels if h["available"] and h["room_price"]]
|
||||||
|
if max_miles is not None:
|
||||||
|
avail = [h for h in avail if (h["distance_from_search_mi"] or 0) <= max_miles]
|
||||||
|
|
||||||
|
avail.sort(key=lambda h: h["room_price"])
|
||||||
|
shortlist = avail[:top]
|
||||||
|
|
||||||
|
rows = []
|
||||||
|
truncated = False
|
||||||
|
for h in shortlist:
|
||||||
|
skipped = time.monotonic() >= deadline
|
||||||
|
if skipped:
|
||||||
|
truncated = True
|
||||||
|
t = None
|
||||||
|
else:
|
||||||
|
t = best_transport(origin, h, depart_dt, adults, railcard_holders, max_travel_min, app_key, deadline=deadline)
|
||||||
|
row = dict(h)
|
||||||
|
if t:
|
||||||
|
row.update({
|
||||||
|
"transport_out": t["outbound_p"] / 100,
|
||||||
|
"transport_return": t["return_p"] / 100,
|
||||||
|
"transport_total": t["total_p"] / 100,
|
||||||
|
"travel_minutes": t["minutes"],
|
||||||
|
"route": t["route"],
|
||||||
|
"fastest_minutes": t["fastest_minutes"],
|
||||||
|
"fastest_total": t["fastest_total_p"] / 100,
|
||||||
|
"fastest_route": t["fastest_route"],
|
||||||
|
"total": round(h["room_price"] + t["total_p"] / 100, 2),
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
row.update({
|
||||||
|
"transport_out": None,
|
||||||
|
"transport_return": None,
|
||||||
|
"transport_total": None,
|
||||||
|
"travel_minutes": None,
|
||||||
|
"route": "not priced (time limit)" if skipped else "no TfL fare found",
|
||||||
|
"fastest_minutes": None,
|
||||||
|
"fastest_total": None,
|
||||||
|
"fastest_route": None,
|
||||||
|
"total": None,
|
||||||
|
})
|
||||||
|
rows.append(row)
|
||||||
|
|
||||||
|
rows.sort(key=lambda r: (r["total"] is None, r["total"] or 0, r["room_price"]))
|
||||||
|
|
||||||
|
summary = {
|
||||||
|
"location": location,
|
||||||
|
"checkin": checkin,
|
||||||
|
"checkout": checkout,
|
||||||
|
"nights": nights,
|
||||||
|
"rooms": len(rooms),
|
||||||
|
"adults": adults,
|
||||||
|
"children": children,
|
||||||
|
"railcard_holders": railcard_holders,
|
||||||
|
"origin_name": origin_name,
|
||||||
|
"origin_lat": origin[0],
|
||||||
|
"origin_lon": origin[1],
|
||||||
|
"depart": depart_dt,
|
||||||
|
"max_travel_min": max_travel_min,
|
||||||
|
"hotels_found": len(hotels),
|
||||||
|
"hotels_available": len(avail),
|
||||||
|
"hotels_priced": len(rows),
|
||||||
|
"truncated": truncated,
|
||||||
|
}
|
||||||
|
return {"summary": summary, "rows": rows}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fastapi==0.115.6
|
||||||
|
uvicorn[standard]==0.34.0
|
||||||
|
requests==2.32.3
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
FROM searxng/searxng:latest
|
|
||||||
|
|
||||||
|
|
||||||
COPY settings.yml.template /searxng/settings.yml.template
|
|
||||||
COPY entrypoint.sh /searxng/entrypoint.sh
|
|
||||||
RUN chmod +x /searxng/entrypoint.sh
|
|
||||||
|
|
||||||
ENTRYPOINT ["/searxng/entrypoint.sh"]
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sed -e "s|\${BASE_URL}|${BASE_URL}|g" \
|
|
||||||
-e "s|\${SEARXNG_SECRET_KEY}|${SEARXNG_SECRET_KEY}|g" \
|
|
||||||
/searxng/settings.yml.template > /etc/searxng/settings.yml
|
|
||||||
|
|
||||||
exec /usr/local/searxng/entrypoint.sh "$@"
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
use_default_settings: true
|
|
||||||
|
|
||||||
server:
|
|
||||||
base_url: ${BASE_URL}
|
|
||||||
secret_key: "${SEARXNG_SECRET_KEY}"
|
|
||||||
@@ -19,6 +19,43 @@ The Vite dev server proxies API requests:
|
|||||||
- `/gitea` -> `http://localhost:3000` (Gitea)
|
- `/gitea` -> `http://localhost:3000` (Gitea)
|
||||||
- `/radio` -> `http://localhost:8000` (Icecast2)
|
- `/radio` -> `http://localhost:8000` (Icecast2)
|
||||||
|
|
||||||
|
## Styling
|
||||||
|
|
||||||
|
Everything visual is defined in three places:
|
||||||
|
|
||||||
|
| File | What it holds |
|
||||||
|
| --- | --- |
|
||||||
|
| `src/assets/styles.css` | Fonts, **design tokens**, default element styles (dark theme), reusable classes (`bdr-1`, `bdr-2`, `page-a4`, `halftone`), the `slide` and `fade` transitions, print rules |
|
||||||
|
| `src/layouts/CVLayout.vue` | The **light theme** for `/cv` and `/cv/jobs`: re-points the colour tokens to ink-on-paper values and holds the shared `.cv-btn` styles |
|
||||||
|
| `src/views/CV/cv-shared.css` | Typography and page layout for the CV templates (`.cv-template`, `.cv-page`, `--cv-*` size variables) |
|
||||||
|
|
||||||
|
### Tokens
|
||||||
|
|
||||||
|
Tokens are declared once in a Tailwind `@theme` block, so each is available both as a utility class in templates and as a CSS variable in `<style>` blocks:
|
||||||
|
|
||||||
|
| Token | Utility | Variable | Role |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| primary | `text-primary` `border-primary` | `var(--color-primary)` | mint: headings, borders, link text |
|
||||||
|
| secondary | `text-secondary` | `var(--color-secondary)` | green: body text |
|
||||||
|
| tertiary | `text-tertiary` | `var(--color-tertiary)` | pink: accents, small print, lists |
|
||||||
|
| quaternary | `border-quaternary` | `var(--color-quaternary)` | teal: subtle borders |
|
||||||
|
| muted | `text-muted` | `var(--color-muted)` | grey: secondary labels |
|
||||||
|
| surface | `bg-surface` | `var(--color-surface)` | widget background |
|
||||||
|
| surface-deep | `bg-surface-deep` | `var(--color-surface-deep)` | page background |
|
||||||
|
| surface-tint | `bg-surface-tint` | `var(--color-surface-tint)` | halftone dots, list rows |
|
||||||
|
| link-bg | `bg-link-bg` | `var(--color-link-bg)` | background behind links and buttons |
|
||||||
|
| heading font | `font-heading` | `var(--font-heading)` | big_noodle_titling |
|
||||||
|
| body font | (default) | `var(--font-body)` | CreatoDisplay |
|
||||||
|
|
||||||
|
Note that Tailwind's spacing unit is set to **3px** (not the default 4px), so `p-1` is 3px, `gap-2` is 6px, `w-10` is 30px.
|
||||||
|
|
||||||
|
### Conventions
|
||||||
|
|
||||||
|
- Use Tailwind utilities for layout and one-off tweaks. Reach for a scoped `<style>` only for what utilities can't express: `grid-template-areas`, keyframe animations, media-query-specific layouts.
|
||||||
|
- Never hard-code a colour in a component; use a token. The one exception is `<canvas>` drawing (MobileAutomata), which can't read CSS variables.
|
||||||
|
- Home widgets: wrap the title in `<Header>`; admin-only create forms use `<CreateToggle v-model="showCreate">` in the header's `#action` slot.
|
||||||
|
- Crossfading content in place: `<Transition name="fade">` inside a `position: relative` parent. Route changes use `<Transition name="slide">`.
|
||||||
|
|
||||||
## Production Build
|
## Production Build
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
+153
-262
@@ -1,36 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Global stylesheet — the single place the site's look is defined.
|
||||||
|
*
|
||||||
|
* 1. Fonts @font-face for the two custom fonts
|
||||||
|
* 2. Tokens colours, fonts, spacing. Declared with Tailwind's @theme, so
|
||||||
|
* every token is BOTH a utility class in templates
|
||||||
|
* (text-primary, bg-surface, font-heading) AND a CSS variable
|
||||||
|
* in component <style> blocks (var(--color-primary)).
|
||||||
|
* 3. Base default look of plain HTML elements (the dark theme)
|
||||||
|
* 4. Components reusable classes: gif borders, A4 sheet, halftone background
|
||||||
|
* 5. Transitions <Transition name="slide"> and <Transition name="fade">
|
||||||
|
* 6. Print
|
||||||
|
*
|
||||||
|
* The CV pages are a light theme: src/layouts/CVLayout.vue re-points the colour
|
||||||
|
* tokens below to ink-on-paper values, so the same base styles render light.
|
||||||
|
*
|
||||||
|
* Rule of thumb for components: use Tailwind utilities for layout and
|
||||||
|
* one-off tweaks; use a scoped <style> only for things utilities can't express
|
||||||
|
* (grid-template-areas, animations, media-query-specific layout).
|
||||||
|
*/
|
||||||
|
|
||||||
@import "tailwindcss";
|
@import "tailwindcss";
|
||||||
|
|
||||||
/* Route transitions */
|
/* ------------------------------------------------------------------ */
|
||||||
.slide-enter-active,
|
/* 1. Fonts */
|
||||||
.slide-leave-active {
|
/* ------------------------------------------------------------------ */
|
||||||
transition:
|
|
||||||
transform 0.3s ease,
|
|
||||||
opacity 0.3s ease;
|
|
||||||
}
|
|
||||||
.slide-enter-from {
|
|
||||||
transform: translateX(30px);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
.slide-leave-to {
|
|
||||||
transform: translateX(-30px);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PRINTING */
|
|
||||||
@media print {
|
|
||||||
.no-print,
|
|
||||||
.no-print * {
|
|
||||||
display: none !important;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
width: 0x;
|
|
||||||
height: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* END OF PRINTING */
|
|
||||||
|
|
||||||
/* FONTS */
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "big_noodle_titling";
|
font-family: "big_noodle_titling";
|
||||||
src: url("/fonts/big_noodle_titling.woff2") format("woff2");
|
src: url("/fonts/big_noodle_titling.woff2") format("woff2");
|
||||||
@@ -47,106 +41,62 @@
|
|||||||
font-display: swap;
|
font-display: swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END OF FONTS */
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* 2. Tokens */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
/* VARIABLES */
|
/* `static` = always emit these variables, even when no utility uses them,
|
||||||
:root {
|
because component <style> blocks reference them with var(). */
|
||||||
/* RED, WHITE, BLACK are standard*/
|
@theme static {
|
||||||
--portal_grey: #dddddd;
|
/* Colours */
|
||||||
--portal_orange: #ff9a00;
|
--color-primary: #55ffbb; /* mint — headings, borders, link text */
|
||||||
--portal_light_orange: #ff5d00;
|
--color-secondary: #62ff57; /* green — body text */
|
||||||
--portal_blue: #0065ff;
|
--color-tertiary: #ff579a; /* pink — accents, small print, code, lists */
|
||||||
--portal_light_blue: #00a2ff;
|
--color-quaternary: #024942; /* teal — subtle borders, scrollbar thumb */
|
||||||
|
--color-muted: #dddddd; /* grey — secondary labels */
|
||||||
|
|
||||||
/* MAIN COLORS */
|
--color-surface: #1b110e; /* panel / widget background */
|
||||||
--primary: #55ffbb;
|
--color-surface-deep: #04080f; /* page background */
|
||||||
--secondary: #62ff57;
|
--color-surface-tint: #0c1c10; /* halftone dots, list-row background */
|
||||||
--tertiary: #ff579a;
|
--color-link-bg: #222222; /* background behind <a> and <Button> */
|
||||||
--quaternary: #024942;
|
|
||||||
|
|
||||||
/* BACKGROUND COLORS */
|
/* Fonts */
|
||||||
--bg_primary: #1b110e;
|
--font-heading: "big_noodle_titling", sans-serif;
|
||||||
--bg_secondary: #04080f;
|
--font-body: "CreatoDisplay", sans-serif;
|
||||||
--bg_tertiary: #0c1c10;
|
--default-font-family: var(--font-body);
|
||||||
--link: #222;
|
|
||||||
|
|
||||||
--bdr: 2px;
|
|
||||||
|
|
||||||
|
/* Tailwind's spacing unit. Tailwind's default is 0.25rem (4px); this site
|
||||||
|
is built on 3px, so p-1 = 3px, gap-2 = 6px, w-10 = 30px, h-20 = 60px. */
|
||||||
--spacing: 3px;
|
--spacing: 3px;
|
||||||
|
|
||||||
/* FONTS USED */
|
|
||||||
--font_heading: big_noodle_titling;
|
|
||||||
--font_default: CreatoDisplay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@theme {
|
/* ------------------------------------------------------------------ */
|
||||||
--color-primary: var(--primary);
|
/* 3. Base element styles (dark theme) */
|
||||||
--color-secondary: var(--secondary);
|
/* ------------------------------------------------------------------ */
|
||||||
--color-tertiary: var(--tertiary);
|
|
||||||
--color-quaternary: var(--quaternary);
|
|
||||||
|
|
||||||
--color-bg_primary: var(--bg_primary);
|
|
||||||
--color-bg_secondary: var(--bg_secondary);
|
|
||||||
--color-link: var(--link);
|
|
||||||
|
|
||||||
--borderWidth-primary: var(--primary);
|
|
||||||
--borderWidth-secondary: var(--secondary);
|
|
||||||
--borderWidth-tertiary: var(--tertiary);
|
|
||||||
|
|
||||||
--font-heading: var(--font_heading);
|
|
||||||
--default-font-family: var(--font_default);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* END OF VARIABLES */
|
|
||||||
/* ELEMENTS */
|
|
||||||
body {
|
body {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
scrollbar-color: var(--primary) var(--bg_secondary);
|
scrollbar-color: var(--color-primary) var(--color-surface-deep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Chrome/Edge scrollbar styling */
|
/* Chrome / Edge scrollbar */
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 6px;
|
width: 6px;
|
||||||
height: 6px;
|
height: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
background: var(--bg_secondary);
|
background: var(--color-surface-deep);
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background: var(--quaternary);
|
background: var(--color-quaternary);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
::-webkit-scrollbar-thumb:hover {
|
||||||
background: var(--primary);
|
background: var(--color-primary);
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
color: var(--secondary);
|
|
||||||
border-color: var(--primary);
|
|
||||||
border-width: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
small {
|
|
||||||
color: var(--tertiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
color: var(--tertiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
color: var(--tertiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
color: var(--tertiary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1,
|
h1,
|
||||||
@@ -154,170 +104,93 @@ h2,
|
|||||||
h3,
|
h3,
|
||||||
h4 {
|
h4 {
|
||||||
margin: 0.25rem;
|
margin: 0.25rem;
|
||||||
font-family: var(--font_heading);
|
font-family: var(--font-heading);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
font-size: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3,
|
h3,
|
||||||
h4 {
|
h4 {
|
||||||
font-size: 1.125rem;
|
font-size: 1.125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
small,
|
||||||
|
code,
|
||||||
|
ul,
|
||||||
|
li {
|
||||||
|
color: var(--color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
background-color: var(--link);
|
background-color: var(--color-link-bg);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: var(--font_heading);
|
font-family: var(--font-heading);
|
||||||
letter-spacing: 0.025em;
|
letter-spacing: 0.025em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input,
|
input,
|
||||||
textarea {
|
textarea {
|
||||||
color: var(--primary);
|
|
||||||
border-width: 1px;
|
|
||||||
padding: 0.5rem;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding: 0.5rem;
|
||||||
|
color: var(--color-primary);
|
||||||
|
border: 1px solid var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
input::placeholder,
|
input::placeholder,
|
||||||
textarea::placeholder {
|
textarea::placeholder {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-color: var(--primary);
|
color: var(--color-primary);
|
||||||
border-width: 1px;
|
border: 1px solid var(--color-primary);
|
||||||
color: var(--primary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
td {
|
|
||||||
gap: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
border-color: var(--primary);
|
color: var(--color-primary);
|
||||||
border-bottom-width: 1px;
|
border-bottom: 1px solid var(--color-primary);
|
||||||
color: var(--primary);
|
|
||||||
}
|
}
|
||||||
|
th,
|
||||||
th {
|
|
||||||
padding-right: 0.75rem;
|
|
||||||
padding-left: 0.75rem;
|
|
||||||
border-right-width: 1px;
|
|
||||||
border-style: dotted;
|
|
||||||
border-color: var(--tertiary);
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
td {
|
||||||
padding-right: 0.75rem;
|
padding-inline: 0.75rem;
|
||||||
padding-left: 0.75rem;
|
}
|
||||||
|
th {
|
||||||
|
border-right: 1px dotted var(--color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* END OF ELEMENTS */
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* 4. Reusable component classes */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
/* CLASSES */
|
/* Animated gif borders */
|
||||||
|
|
||||||
.img-stamp {
|
|
||||||
width: 99px;
|
|
||||||
height: 55px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* BORDERS */
|
|
||||||
.bdr-1 {
|
.bdr-1 {
|
||||||
border-width: 30px;
|
border-width: 30px;
|
||||||
border-image: url("/img/borders/border1.gif") 30 round;
|
border-image: url("/img/borders/border1.gif") 30 round;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bdr-1-inv {
|
|
||||||
border-width: 30px;
|
|
||||||
border-image: url("/img/borders/border1inv.gif") 30 round;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bdr-2 {
|
.bdr-2 {
|
||||||
border-width: 5px;
|
border-width: 5px;
|
||||||
border-image: url("/img/borders/border4.gif") 7 round;
|
border-image: url("/img/borders/border4.gif") 7 round;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bdr-cv {
|
/* An A4 sheet of paper — the home grid, 404 page and shrines are laid out on
|
||||||
border-width: 30px;
|
one. Collapses to full width on phones. (The CV pages use their own
|
||||||
border-image: url("/img/borders/bordercv.png") 30 round;
|
.cv-page class; see src/views/CV/cv-shared.css.) */
|
||||||
}
|
.page-a4 {
|
||||||
|
|
||||||
/* A5 Page */
|
|
||||||
.a5page-landscape {
|
|
||||||
margin: 0;
|
|
||||||
box-sizing: content-box;
|
|
||||||
height: 148mm;
|
|
||||||
width: 210mm;
|
|
||||||
}
|
|
||||||
|
|
||||||
.a5page-portrait {
|
|
||||||
margin: 0;
|
|
||||||
box-sizing: content-box;
|
|
||||||
width: 148mm;
|
|
||||||
height: 210mm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A4 Page */
|
|
||||||
.a4page-portrait {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
width: 210mm;
|
width: 210mm;
|
||||||
height: 297mm;
|
height: 297mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a4page-landscape {
|
|
||||||
margin: 0;
|
|
||||||
box-sizing: content-box;
|
|
||||||
height: 210mm;
|
|
||||||
width: 297mm;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* END OF CLASSES */
|
|
||||||
|
|
||||||
/* PHONE */
|
|
||||||
@media (max-width: 850px) {
|
@media (max-width: 850px) {
|
||||||
.a4page-portrait {
|
.page-a4 {
|
||||||
width: 100%;
|
|
||||||
/* fill mobile width */
|
|
||||||
height: fit-content;
|
|
||||||
margin: 0 auto;
|
|
||||||
/* center horizontally */
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.a4page-landscape {
|
|
||||||
width: 100%;
|
|
||||||
/* fill mobile width */
|
|
||||||
height: fit-content;
|
|
||||||
margin: 0 auto;
|
|
||||||
/* center horizontally */
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.a5page-portrait {
|
|
||||||
width: 100%;
|
|
||||||
height: fit-content;
|
|
||||||
margin: 0 auto;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.a5page-landscape {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@@ -325,52 +198,70 @@ td {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tl {
|
/* Dotted page background used by DefaultLayout */
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tr {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bl {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.br {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.background {
|
|
||||||
position: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.halftone {
|
.halftone {
|
||||||
--dot_size: 4px;
|
--dot-size: 4px;
|
||||||
--bg_size: 12px;
|
--grid-size: 12px;
|
||||||
--bg_pos: calc(var(--bg_size) / 2);
|
|
||||||
--blur: 0%;
|
|
||||||
|
|
||||||
background-color: var(--bg_secondary);
|
background-color: var(--color-surface-deep);
|
||||||
background-image:
|
background-image:
|
||||||
linear-gradient(to top, transparent 0%, var(--bg_primary) 100%),
|
linear-gradient(to top, transparent 0%, var(--color-surface) 100%),
|
||||||
radial-gradient(
|
radial-gradient(
|
||||||
circle at center,
|
circle at center,
|
||||||
var(--bg_tertiary) var(--dot_size),
|
var(--color-surface-tint) var(--dot-size),
|
||||||
transparent var(--blur)
|
transparent 0%
|
||||||
);
|
);
|
||||||
background-size:
|
background-size:
|
||||||
100% 100%,
|
100% 100%,
|
||||||
var(--bg_size) var(--bg_size);
|
var(--grid-size) var(--grid-size);
|
||||||
background-position:
|
}
|
||||||
0 0,
|
|
||||||
0 0;
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* 5. Transitions */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/* <Transition name="slide"> — route changes in DefaultLayout */
|
||||||
|
.slide-enter-active,
|
||||||
|
.slide-leave-active {
|
||||||
|
transition:
|
||||||
|
transform 0.3s ease,
|
||||||
|
opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
.slide-enter-from {
|
||||||
|
transform: translateX(30px);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.slide-leave-to {
|
||||||
|
transform: translateX(-30px);
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <Transition name="fade"> — crossfade between items in the same slot
|
||||||
|
(Listening, Steam, Slideshow). The leaving item is lifted out of flow so
|
||||||
|
the entering one takes its place immediately. Parent must be
|
||||||
|
position: relative. */
|
||||||
|
.fade-enter-active,
|
||||||
|
.fade-leave-active {
|
||||||
|
transition: opacity 0.5s ease;
|
||||||
|
}
|
||||||
|
.fade-leave-active {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
.fade-enter-from,
|
||||||
|
.fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* 6. Print */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.no-print,
|
||||||
|
.no-print * {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ const user = "visitor";
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.waybar {
|
.waybar {
|
||||||
font-family: "URWGothic-Book", monospace;
|
font-family: "URWGothic-Book", monospace;
|
||||||
background-color: var(--bg_primary);
|
background-color: var(--color-surface);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -65,10 +65,10 @@ const user = "visitor";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.workspace {
|
.workspace {
|
||||||
background: var(--quaternary);
|
background: var(--color-quaternary);
|
||||||
border: none;
|
border: none;
|
||||||
border-bottom: 2px solid var(--secondary);
|
border-bottom: 2px solid var(--color-secondary);
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
padding: 2px 10px;
|
padding: 2px 10px;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@@ -81,7 +81,7 @@ const user = "visitor";
|
|||||||
|
|
||||||
.module {
|
.module {
|
||||||
padding: 2px 12px;
|
padding: 2px 12px;
|
||||||
border-left: 1px solid var(--tertiary);
|
border-left: 1px solid var(--color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.module:first-child {
|
.module:first-child {
|
||||||
@@ -89,25 +89,25 @@ const user = "visitor";
|
|||||||
}
|
}
|
||||||
|
|
||||||
.greeting {
|
.greeting {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.clock {
|
.clock {
|
||||||
color: var(--tertiary);
|
color: var(--color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cpu,
|
.cpu,
|
||||||
.mem,
|
.mem,
|
||||||
.disk {
|
.disk {
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.network {
|
.network {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.battery {
|
.battery {
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 800px) {
|
@media (max-width: 800px) {
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ const faces_string = faces.join(" ");
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<nav class="flex flex-row w-full h-fit border border-primary bg-bg_primary">
|
<nav class="flex flex-row w-full h-fit border border-primary bg-surface">
|
||||||
<RouterLink class="bdr-2 bg-bg_primary" v-if="parentPath" :to="parentPath">
|
<RouterLink class="bdr-2 bg-surface" v-if="parentPath" :to="parentPath">
|
||||||
<span>UP</span>
|
<span>UP</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
<Headline class="border flex-1 max-w-full">
|
<Headline class="border flex-1 max-w-full">
|
||||||
@@ -50,11 +50,3 @@ const faces_string = faces.join(" ");
|
|||||||
</Headline>
|
</Headline>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.left {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<button
|
<button
|
||||||
class="text-primary bg-link text-center border cursor-pointer transition-colors duration-150 ease-in-out hover:bg-bg_primary active:scale-95"
|
class="text-primary bg-link-bg text-center border cursor-pointer transition-colors duration-150 ease-in-out hover:bg-surface active:scale-95"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<script setup>
|
||||||
|
import { useAuthStore } from "@/stores/auth";
|
||||||
|
|
||||||
|
// "+" / "x" button, shown to admins only. Toggles a home widget between its
|
||||||
|
// normal view and its create form. Designed for <Header>'s #action slot.
|
||||||
|
const show = defineModel({ type: Boolean, default: false });
|
||||||
|
const auth = useAuthStore();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<button v-if="auth.user.admin" class="text-sm px-1" @click="show = !show">
|
||||||
|
{{ show ? "x" : "+" }}
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
@@ -18,7 +18,7 @@ function toggle() {
|
|||||||
<button
|
<button
|
||||||
@click="toggle"
|
@click="toggle"
|
||||||
class="box-content border-2 border-primary w-10 h-fit rounded-full cursor-pointer"
|
class="box-content border-2 border-primary w-10 h-fit rounded-full cursor-pointer"
|
||||||
:class="[props.modelValue ? 'bg-bg_secondary' : 'bg-bg_primary']"
|
:class="[props.modelValue ? 'bg-surface-deep' : 'bg-surface']"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
viewBox="0 0 40 40"
|
viewBox="0 0 40 40"
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
|
<!--
|
||||||
|
Widget title: a heading with a rule underneath.
|
||||||
|
The optional #action slot puts a control (e.g. <CreateToggle>) on the right.
|
||||||
|
-->
|
||||||
<template>
|
<template>
|
||||||
<div class="w-full border-b border-primary pb-0.5">
|
<div class="w-full border-b border-primary pb-0.5">
|
||||||
<h1 class="p-0 m-0">
|
<h1
|
||||||
|
class="p-0 m-0"
|
||||||
|
:class="{ 'flex items-center justify-between gap-1': $slots.action }"
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
|
<slot name="action" />
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ const computedRel = computed(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.inline-link {
|
.inline-link {
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@@ -40,6 +40,6 @@ const computedRel = computed(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.inline-link:hover {
|
.inline-link:hover {
|
||||||
color: var(--tertiary);
|
color: var(--color-tertiary);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ const computedRel = computed(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.link {
|
.link {
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
transition: color 0.15s ease;
|
transition: color 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.link:hover {
|
.link:hover {
|
||||||
color: var(--tertiary);
|
color: var(--color-tertiary);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const show = ref(false);
|
|||||||
:key="i"
|
:key="i"
|
||||||
:href="item.link"
|
:href="item.link"
|
||||||
>
|
>
|
||||||
<p class="bdr-2 bg-bg_tertiary">{{ item.name }}</p>
|
<p class="bdr-2 bg-surface-tint">{{ item.name }}</p>
|
||||||
</Link>
|
</Link>
|
||||||
<table class="w-full" v-else>
|
<table class="w-full" v-else>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -51,7 +51,7 @@ const show = ref(false);
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<template v-if="variant === 'list'">
|
<template v-if="variant === 'list'">
|
||||||
<Link v-for="(item, i) in items" :key="i" :href="item.link">
|
<Link v-for="(item, i) in items" :key="i" :href="item.link">
|
||||||
<p class="bdr-2 bg-bg_tertiary">{{ item.name }}</p>
|
<p class="bdr-2 bg-surface-tint">{{ item.name }}</p>
|
||||||
</Link>
|
</Link>
|
||||||
</template>
|
</template>
|
||||||
<table class="w-full" v-else>
|
<table class="w-full" v-else>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const keys = ["name", "link"];
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<RouterLink
|
<RouterLink
|
||||||
class="bdr-2 bg-bg_primary"
|
class="bdr-2 bg-surface"
|
||||||
v-for="(row, rowIndex) in linkArr"
|
v-for="(row, rowIndex) in linkArr"
|
||||||
:key="rowIndex"
|
:key="rowIndex"
|
||||||
:to="row.link"
|
:to="row.link"
|
||||||
|
|||||||
@@ -49,13 +49,12 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.slideshow-wrapper {
|
.slideshow-wrapper {
|
||||||
display: grid;
|
position: relative; /* for the global .fade transition */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image-viewer {
|
.image-viewer {
|
||||||
grid-area: 1 / 1;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -65,13 +64,4 @@ img {
|
|||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: opacity 0.5s ease;
|
|
||||||
}
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="a4page-portrait bdr-1 flex flex-col relative overflow-scroll">
|
<div class="page-a4 bdr-1 flex flex-col relative overflow-scroll">
|
||||||
<RouterLink to="/" class="bdr-2">
|
<RouterLink to="/" class="bdr-2">
|
||||||
<img src="/img/memes/epic.jpeg" alt="" loading="lazy" />
|
<img src="/img/memes/epic.jpeg" alt="" loading="lazy" />
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
|||||||
@@ -8,29 +8,45 @@ import { RouterView } from "vue-router";
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<!--
|
||||||
.cv-layout {
|
Light theme for /cv and /cv/jobs.
|
||||||
min-height: 100vh;
|
|
||||||
background: white;
|
|
||||||
color: #111;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
Unscoped on purpose. It re-points the site's colour tokens (defined in
|
||||||
|
src/assets/styles.css) to ink-on-paper values so the global element styles
|
||||||
|
render light, then undoes the few dark-site element styles that aren't
|
||||||
|
colours. It also holds the button styles shared by the CV pages.
|
||||||
|
-->
|
||||||
<style>
|
<style>
|
||||||
.cv-layout h1,
|
.cv-layout {
|
||||||
.cv-layout h2,
|
/* Paper palette */
|
||||||
.cv-layout h3,
|
--color-ink: #111;
|
||||||
.cv-layout h4,
|
--color-ink-soft: #333;
|
||||||
.cv-layout p,
|
--color-ink-muted: #555;
|
||||||
.cv-layout small,
|
--color-ink-faint: #999;
|
||||||
.cv-layout code,
|
--color-ink-link: #0066cc;
|
||||||
.cv-layout ul,
|
--color-ink-danger: #c00;
|
||||||
.cv-layout li,
|
--color-paper: #fff;
|
||||||
.cv-layout td,
|
--color-paper-tint: #f5f5f5;
|
||||||
.cv-layout tr,
|
--color-paper-shade: #eee;
|
||||||
.cv-layout table {
|
--color-line: #ccc;
|
||||||
color: #111;
|
--color-line-soft: #e0e0e0;
|
||||||
|
|
||||||
|
/* Site tokens -> paper */
|
||||||
|
--color-primary: var(--color-ink);
|
||||||
|
--color-secondary: var(--color-ink);
|
||||||
|
--color-tertiary: var(--color-ink);
|
||||||
|
--color-quaternary: var(--color-line);
|
||||||
|
--color-muted: var(--color-ink-muted);
|
||||||
|
--color-surface: var(--color-paper);
|
||||||
|
--color-surface-deep: var(--color-paper);
|
||||||
|
--color-link-bg: transparent;
|
||||||
|
|
||||||
|
min-height: 100vh;
|
||||||
|
background: var(--color-paper);
|
||||||
|
color: var(--color-ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Undo dark-site element styling that isn't just colour */
|
||||||
.cv-layout h1,
|
.cv-layout h1,
|
||||||
.cv-layout h2,
|
.cv-layout h2,
|
||||||
.cv-layout h3,
|
.cv-layout h3,
|
||||||
@@ -38,34 +54,73 @@ import { RouterView } from "vue-router";
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.cv-layout a {
|
.cv-layout a {
|
||||||
color: #111;
|
text-align: left;
|
||||||
background-color: transparent !important;
|
font-family: inherit;
|
||||||
letter-spacing: normal;
|
letter-spacing: normal;
|
||||||
}
|
}
|
||||||
.cv-layout input,
|
.cv-layout input,
|
||||||
.cv-layout textarea {
|
.cv-layout textarea {
|
||||||
color: #111;
|
|
||||||
background-color: white;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 0;
|
|
||||||
width: auto;
|
width: auto;
|
||||||
|
padding: 0;
|
||||||
|
background: var(--color-paper);
|
||||||
|
border-color: var(--color-line);
|
||||||
}
|
}
|
||||||
.cv-layout input::placeholder,
|
.cv-layout input::placeholder,
|
||||||
.cv-layout textarea::placeholder {
|
.cv-layout textarea::placeholder {
|
||||||
color: #999;
|
color: var(--color-ink-faint);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.cv-layout table {
|
.cv-layout table,
|
||||||
border: 0 solid transparent;
|
|
||||||
}
|
|
||||||
.cv-layout tr {
|
.cv-layout tr {
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
.cv-layout th {
|
.cv-layout th {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
|
||||||
}
|
}
|
||||||
|
.cv-layout th,
|
||||||
.cv-layout td {
|
.cv-layout td {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Buttons shared by the CV selector bar and the job-applications page */
|
||||||
|
.cv-btn {
|
||||||
|
padding: 0.4rem 1rem;
|
||||||
|
border: 1px solid var(--color-ink-soft);
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--color-paper);
|
||||||
|
color: var(--color-ink-soft);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-decoration: none;
|
||||||
|
transition:
|
||||||
|
background 0.15s,
|
||||||
|
color 0.15s;
|
||||||
|
}
|
||||||
|
.cv-btn:hover {
|
||||||
|
background: var(--color-paper-shade);
|
||||||
|
}
|
||||||
|
.cv-btn:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
.cv-btn-sm {
|
||||||
|
padding: 0.2rem 0.55rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
.cv-btn-primary,
|
||||||
|
.cv-btn.active {
|
||||||
|
background: var(--color-ink-soft);
|
||||||
|
color: var(--color-paper);
|
||||||
|
}
|
||||||
|
.cv-btn-primary:hover {
|
||||||
|
background: var(--color-ink-muted);
|
||||||
|
}
|
||||||
|
.cv-btn-danger {
|
||||||
|
border-color: var(--color-ink-danger);
|
||||||
|
color: var(--color-ink-danger);
|
||||||
|
}
|
||||||
|
.cv-btn-danger:hover {
|
||||||
|
background: #fee;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ const router = createRouter({
|
|||||||
component: () =>
|
component: () =>
|
||||||
import("@/views/automata/MobileAutomata.vue"),
|
import("@/views/automata/MobileAutomata.vue"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "hotels",
|
||||||
|
name: "cheap-hotels",
|
||||||
|
component: () => import("@/views/hotels/CheapHotels.vue"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "shrines",
|
path: "shrines",
|
||||||
name: "shrine links",
|
name: "shrine links",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<main class="flex flex-col items-center">
|
<main class="flex flex-col items-center">
|
||||||
<div
|
<div
|
||||||
class="a4page-portrait items-center bdr-1 flex flex-col relative overflow-scroll"
|
class="page-a4 items-center bdr-1 flex flex-col relative overflow-scroll"
|
||||||
>
|
>
|
||||||
<h1>404</h1>
|
<h1>404</h1>
|
||||||
<RouterLink to="/" class="bdr-2">
|
<RouterLink to="/" class="bdr-2">
|
||||||
|
|||||||
+3
-32
@@ -62,7 +62,7 @@ function print() {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.cv-root {
|
.cv-root {
|
||||||
background: white;
|
background: var(--color-paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-selector {
|
.cv-selector {
|
||||||
@@ -74,30 +74,8 @@ function print() {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background: white;
|
background: var(--color-paper);
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid var(--color-line);
|
||||||
}
|
|
||||||
|
|
||||||
.cv-btn {
|
|
||||||
padding: 0.4rem 1rem;
|
|
||||||
border: 1px solid #333;
|
|
||||||
border-radius: 4px;
|
|
||||||
background: white;
|
|
||||||
color: #333;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
transition:
|
|
||||||
background 0.15s,
|
|
||||||
color 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cv-btn:hover {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cv-btn.active {
|
|
||||||
background: #333;
|
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-print-btn {
|
.cv-print-btn {
|
||||||
@@ -105,7 +83,6 @@ function print() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.cv-jobs-btn {
|
.cv-jobs-btn {
|
||||||
text-decoration: none;
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,12 +102,6 @@ function print() {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(-6px);
|
transform: translateY(-6px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
|
||||||
.no-print {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style src="./cv-shared.css"></style>
|
<style src="./cv-shared.css"></style>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
@@ -185,7 +185,7 @@ import Project from "./Project.vue";
|
|||||||
|
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
|
|
||||||
<div class="a4page gap-10">
|
<div class="cv-page gap-10">
|
||||||
<section>
|
<section>
|
||||||
<h2>Experience</h2>
|
<h2>Experience</h2>
|
||||||
<Project>
|
<Project>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
@@ -185,7 +185,7 @@ import Project from "./Project.vue";
|
|||||||
|
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
|
|
||||||
<div class="a4page gap-10">
|
<div class="cv-page gap-10">
|
||||||
<section>
|
<section>
|
||||||
<h2>Experience</h2>
|
<h2>Experience</h2>
|
||||||
<Project>
|
<Project>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
@@ -182,7 +182,7 @@ import Project from "./Project.vue";
|
|||||||
|
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
|
|
||||||
<div class="a4page gap-10">
|
<div class="cv-page gap-10">
|
||||||
<section>
|
<section>
|
||||||
<h2>Experience</h2>
|
<h2>Experience</h2>
|
||||||
<Project>
|
<Project>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page place-content-between">
|
<div class="cv-page place-content-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-around">
|
<div class="cv-page justify-around">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
@@ -216,7 +216,7 @@ import Project from "./Project.vue";
|
|||||||
|
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
|
|
||||||
<div class="a4page justify-around">
|
<div class="cv-page justify-around">
|
||||||
<section>
|
<section>
|
||||||
<h2>Secondary Education</h2>
|
<h2>Secondary Education</h2>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section>
|
<section>
|
||||||
<div class="flex flex-col sm:flex-row sm:justify-between">
|
<div class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="flex-1 name">Adam French</h1>
|
<h1 class="flex-1 name">Adam French</h1>
|
||||||
@@ -183,7 +183,7 @@ import Project from "./Project.vue";
|
|||||||
|
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
|
|
||||||
<div class="a4page gap-10">
|
<div class="cv-page gap-10">
|
||||||
<section>
|
<section>
|
||||||
<h2>Experience</h2>
|
<h2>Experience</h2>
|
||||||
<Project>
|
<Project>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="cv-template">
|
<main class="cv-template">
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
<div class="a4page justify-between">
|
<div class="cv-page justify-between">
|
||||||
<section class="flex flex-col sm:flex-row sm:justify-between">
|
<section class="flex flex-col sm:flex-row sm:justify-between">
|
||||||
<h1 class="name">Adam French</h1>
|
<h1 class="name">Adam French</h1>
|
||||||
<div class="contact-details">
|
<div class="contact-details">
|
||||||
@@ -147,7 +147,7 @@ import Project from "./Project.vue";
|
|||||||
|
|
||||||
<div class="no-print w-full h-20"></div>
|
<div class="no-print w-full h-20"></div>
|
||||||
|
|
||||||
<div class="a4page gap-10">
|
<div class="cv-page gap-10">
|
||||||
<div class="w-full flex flex-col sm:flex-row gap-5">
|
<div class="w-full flex flex-col sm:flex-row gap-5">
|
||||||
<section class="flex-1">
|
<section class="flex-1">
|
||||||
<h2>
|
<h2>
|
||||||
|
|||||||
@@ -254,14 +254,14 @@ function copyToClipboard(text) {
|
|||||||
|
|
||||||
function statusClass(status) {
|
function statusClass(status) {
|
||||||
const map = {
|
const map = {
|
||||||
Applied: "status-applied",
|
Applied: "bg-blue-100 text-blue-800",
|
||||||
Screening: "status-screening",
|
Screening: "bg-yellow-100 text-yellow-800",
|
||||||
Interview: "status-interview",
|
Interview: "bg-violet-100 text-violet-800",
|
||||||
Offer: "status-offer",
|
Offer: "bg-green-100 text-green-800",
|
||||||
Rejected: "status-rejected",
|
Rejected: "bg-red-100 text-red-800",
|
||||||
Withdrawn: "status-withdrawn",
|
Withdrawn: "bg-gray-100 text-gray-500",
|
||||||
};
|
};
|
||||||
return map[status] ?? "";
|
return map[status] ?? "bg-gray-200 text-gray-700";
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -278,7 +278,7 @@ onMounted(() => {
|
|||||||
<h2 class="ja-heading">Job Applications</h2>
|
<h2 class="ja-heading">Job Applications</h2>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
class="ja-btn"
|
class="cv-btn"
|
||||||
@click="exportCsv"
|
@click="exportCsv"
|
||||||
:disabled="!applications.length"
|
:disabled="!applications.length"
|
||||||
>
|
>
|
||||||
@@ -299,17 +299,17 @@ onMounted(() => {
|
|||||||
<span class="ja-ref-label">{{ ref.label }}</span>
|
<span class="ja-ref-label">{{ ref.label }}</span>
|
||||||
<span class="ja-ref-value" :title="ref.value">{{ ref.value }}</span>
|
<span class="ja-ref-value" :title="ref.value">{{ ref.value }}</span>
|
||||||
<button
|
<button
|
||||||
class="ja-btn ja-btn-sm"
|
class="cv-btn cv-btn-sm"
|
||||||
@click="copyToClipboard(ref.value)"
|
@click="copyToClipboard(ref.value)"
|
||||||
title="Copy"
|
title="Copy"
|
||||||
>
|
>
|
||||||
Copy
|
Copy
|
||||||
</button>
|
</button>
|
||||||
<button class="ja-btn ja-btn-sm" @click="startRefEdit(ref)">
|
<button class="cv-btn cv-btn-sm" @click="startRefEdit(ref)">
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="ja-btn ja-btn-sm ja-btn-danger"
|
class="cv-btn cv-btn-sm cv-btn-danger"
|
||||||
@click="deleteReference(ref.id)"
|
@click="deleteReference(ref.id)"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
@@ -335,12 +335,12 @@ onMounted(() => {
|
|||||||
placeholder="Value"
|
placeholder="Value"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="ja-btn ja-btn-sm ja-btn-primary"
|
class="cv-btn cv-btn-sm cv-btn-primary"
|
||||||
@click="saveRefEdit(ref.id)"
|
@click="saveRefEdit(ref.id)"
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button class="ja-btn ja-btn-sm" @click="cancelRefEdit">
|
<button class="cv-btn cv-btn-sm" @click="cancelRefEdit">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
@@ -367,7 +367,7 @@ onMounted(() => {
|
|||||||
placeholder="Value *"
|
placeholder="Value *"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<button type="submit" class="ja-btn ja-btn-primary">Add</button>
|
<button type="submit" class="cv-btn cv-btn-primary">Add</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ onMounted(() => {
|
|||||||
class="ja-input ja-textarea"
|
class="ja-input ja-textarea"
|
||||||
placeholder="Notes"
|
placeholder="Notes"
|
||||||
/>
|
/>
|
||||||
<button type="submit" class="ja-btn ja-btn-primary">Add</button>
|
<button type="submit" class="cv-btn cv-btn-primary">Add</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -451,11 +451,11 @@ onMounted(() => {
|
|||||||
<td>{{ app.appliedAt ? app.appliedAt.substring(0, 10) : "—" }}</td>
|
<td>{{ app.appliedAt ? app.appliedAt.substring(0, 10) : "—" }}</td>
|
||||||
<td class="ja-notes-cell">{{ app.notes ?? "" }}</td>
|
<td class="ja-notes-cell">{{ app.notes ?? "" }}</td>
|
||||||
<td class="ja-actions">
|
<td class="ja-actions">
|
||||||
<button class="ja-btn ja-btn-sm" @click="startEdit(app)">
|
<button class="cv-btn cv-btn-sm" @click="startEdit(app)">
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="ja-btn ja-btn-sm ja-btn-danger"
|
class="cv-btn cv-btn-sm cv-btn-danger"
|
||||||
@click="deleteApplication(app.id)"
|
@click="deleteApplication(app.id)"
|
||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
@@ -510,12 +510,12 @@ onMounted(() => {
|
|||||||
</td>
|
</td>
|
||||||
<td class="ja-actions">
|
<td class="ja-actions">
|
||||||
<button
|
<button
|
||||||
class="ja-btn ja-btn-sm ja-btn-primary"
|
class="cv-btn cv-btn-sm cv-btn-primary"
|
||||||
@click="saveEdit(app.id)"
|
@click="saveEdit(app.id)"
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</button>
|
</button>
|
||||||
<button class="ja-btn ja-btn-sm" @click="cancelEdit">
|
<button class="cv-btn cv-btn-sm" @click="cancelEdit">
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -528,10 +528,11 @@ onMounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
/* Colours are the paper palette from CVLayout.vue; buttons are .cv-btn from there too. */
|
||||||
.ja-root {
|
.ja-root {
|
||||||
padding: 1.5rem;
|
padding: 1.5rem;
|
||||||
border-top: 2px solid #333;
|
border-top: 2px solid var(--color-ink-soft);
|
||||||
background: #fafafa;
|
background: var(--color-paper-tint);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-header {
|
.ja-header {
|
||||||
@@ -549,21 +550,21 @@ onMounted(() => {
|
|||||||
|
|
||||||
.ja-back {
|
.ja-back {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
color: #555;
|
color: var(--color-ink-muted);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-back:hover {
|
.ja-back:hover {
|
||||||
color: #111;
|
color: var(--color-ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-heading {
|
.ja-heading {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0;
|
color: var(--color-ink-soft);
|
||||||
color: #333;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Forms */
|
||||||
.ja-form {
|
.ja-form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -579,17 +580,17 @@ onMounted(() => {
|
|||||||
|
|
||||||
.ja-input {
|
.ja-input {
|
||||||
padding: 0.35rem 0.6rem;
|
padding: 0.35rem 0.6rem;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid var(--color-line);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
background: white;
|
background: var(--color-paper);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 120px;
|
min-width: 120px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-input:focus {
|
.ja-input:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
border-color: #555;
|
border-color: var(--color-ink-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-select {
|
.ja-select {
|
||||||
@@ -608,47 +609,7 @@ onMounted(() => {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-btn {
|
/* Applications table */
|
||||||
padding: 0.35rem 0.8rem;
|
|
||||||
border: 1px solid #333;
|
|
||||||
border-radius: 4px;
|
|
||||||
background: white;
|
|
||||||
color: #333;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
white-space: nowrap;
|
|
||||||
transition:
|
|
||||||
background 0.15s,
|
|
||||||
color 0.15s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-btn:hover {
|
|
||||||
background: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-btn-sm {
|
|
||||||
padding: 0.2rem 0.55rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-btn-primary {
|
|
||||||
background: #333;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-btn-primary:hover {
|
|
||||||
background: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-btn-danger {
|
|
||||||
border-color: #c00;
|
|
||||||
color: #c00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-btn-danger:hover {
|
|
||||||
background: #fee;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ja-table {
|
.ja-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@@ -659,18 +620,18 @@ onMounted(() => {
|
|||||||
.ja-table td {
|
.ja-table td {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 0.45rem 0.6rem;
|
padding: 0.45rem 0.6rem;
|
||||||
border-bottom: 1px solid #e0e0e0;
|
border-bottom: 1px solid var(--color-line-soft);
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-table th {
|
.ja-table th {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #555;
|
color: var(--color-ink-muted);
|
||||||
background: #f0f0f0;
|
background: var(--color-paper-shade);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-table tr:hover td {
|
.ja-table tr:hover td {
|
||||||
background: #f5f5f5;
|
background: var(--color-paper-shade);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-edit-row td {
|
.ja-edit-row td {
|
||||||
@@ -691,7 +652,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ja-link {
|
.ja-link {
|
||||||
color: #0066cc;
|
color: var(--color-ink-link);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,59 +660,34 @@ onMounted(() => {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Status pill; colour classes come from statusClass() */
|
||||||
.ja-badge {
|
.ja-badge {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.15rem 0.5rem;
|
padding: 0.15rem 0.5rem;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
font-size: 0.78rem;
|
font-size: 0.78rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
background: #e0e0e0;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-applied {
|
|
||||||
background: #dbeafe;
|
|
||||||
color: #1e40af;
|
|
||||||
}
|
|
||||||
.status-screening {
|
|
||||||
background: #fef9c3;
|
|
||||||
color: #854d0e;
|
|
||||||
}
|
|
||||||
.status-interview {
|
|
||||||
background: #ede9fe;
|
|
||||||
color: #5b21b6;
|
|
||||||
}
|
|
||||||
.status-offer {
|
|
||||||
background: #dcfce7;
|
|
||||||
color: #166534;
|
|
||||||
}
|
|
||||||
.status-rejected {
|
|
||||||
background: #fee2e2;
|
|
||||||
color: #991b1b;
|
|
||||||
}
|
|
||||||
.status-withdrawn {
|
|
||||||
background: #f3f4f6;
|
|
||||||
color: #6b7280;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-empty {
|
.ja-empty {
|
||||||
color: #888;
|
color: var(--color-ink-faint);
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quick-reference box */
|
||||||
.ja-ref-section {
|
.ja-ref-section {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border: 1px solid #e0e0e0;
|
border: 1px solid var(--color-line-soft);
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #fff;
|
background: var(--color-paper);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-ref-heading {
|
.ja-ref-heading {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0 0 0.75rem 0;
|
margin-bottom: 0.75rem;
|
||||||
color: #333;
|
color: var(--color-ink-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-ref-category {
|
.ja-ref-category {
|
||||||
@@ -761,9 +697,9 @@ onMounted(() => {
|
|||||||
.ja-ref-cat-label {
|
.ja-ref-cat-label {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #555;
|
color: var(--color-ink-muted);
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
margin: 0 0 0.35rem 0;
|
margin-bottom: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-ref-item {
|
.ja-ref-item {
|
||||||
@@ -776,13 +712,13 @@ onMounted(() => {
|
|||||||
.ja-ref-label {
|
.ja-ref-label {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #333;
|
color: var(--color-ink-soft);
|
||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ja-ref-value {
|
.ja-ref-value {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
color: #555;
|
color: var(--color-ink-muted);
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -791,7 +727,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
.ja-ref-empty {
|
.ja-ref-empty {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
color: #999;
|
color: var(--color-ink-faint);
|
||||||
margin: 0.2rem 0;
|
margin: 0.2rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+130
-136
@@ -1,214 +1,208 @@
|
|||||||
/*
|
/*
|
||||||
* Shared styles for CV templates.
|
* Shared styles for the CV templates (src/views/CV/CV*.vue).
|
||||||
* Loaded once (unscoped) by CV.vue. Each CV template tags its root <main>
|
|
||||||
* with class="cv-template"; per-template variation is done by overriding
|
|
||||||
* the CSS variables defined here in the template's own scoped <style>.
|
|
||||||
*
|
*
|
||||||
* @font-face declarations live in /src/assets/styles.css.
|
* Loaded once, unscoped, by CV.vue. Each template wraps itself in
|
||||||
|
* <main class="cv-template"> and lays out each sheet as <div class="cv-page">.
|
||||||
|
*
|
||||||
|
* Colours are the site tokens from src/assets/styles.css. CVLayout.vue has
|
||||||
|
* already switched them to ink-on-paper; this file only adds the template's
|
||||||
|
* own accents (blue links, red table rules). Sizes are exposed as --cv-*
|
||||||
|
* variables so a template can tune them from its own scoped <style>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.cv-template {
|
.cv-template {
|
||||||
/* Color palette — overrides global :root vars within CV scope */
|
--color-primary: black;
|
||||||
--primary: black;
|
--color-secondary: #000088; /* links, table text */
|
||||||
--secondary: #000088;
|
--color-tertiary: #ff0000; /* link hover, table rules */
|
||||||
--tertiary: #ff0000;
|
--color-quaternary: #cccccc; /* table header background */
|
||||||
--quaternary: #cccccc;
|
--color-surface: white;
|
||||||
--background: white;
|
|
||||||
|
|
||||||
/* Fonts */
|
--cv-page-padding: 8mm;
|
||||||
--font-heading: big_noodle_titling;
|
--cv-line-height: 1.4;
|
||||||
--font-text: CreatoDisplay;
|
--cv-page-gap: 0;
|
||||||
|
--cv-name-size: 3.1em;
|
||||||
/* Variation hooks — defaults match Hospitality/Frontend/Backend/Temp */
|
--cv-heading-size: 2.1em;
|
||||||
--cv-page-padding: 8mm;
|
--cv-subheading-size: 1.7em;
|
||||||
--cv-line-height: 1.4;
|
--cv-subsubheading-size: 1.4em;
|
||||||
--cv-page-gap: 0;
|
--cv-text-size: 1em;
|
||||||
--cv-name-size: 3.1em;
|
--cv-small-size: 1em;
|
||||||
--cv-heading-size: 2.1em;
|
--cv-list-size: 0.92em;
|
||||||
--cv-subheading-size: 1.7em;
|
--cv-heading-transform: capitalize;
|
||||||
--cv-subsubheading-size: 1.4em;
|
--cv-heading-margin: 0;
|
||||||
--cv-text-size: 1em;
|
|
||||||
--cv-small-size: 1em;
|
|
||||||
--cv-list-size: 0.92em;
|
|
||||||
--cv-heading-transform: capitalize;
|
|
||||||
--cv-heading-margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template main {
|
.cv-template main {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
background-color: var(--background);
|
background-color: var(--color-surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template .a4page {
|
/* One A4 sheet */
|
||||||
width: 210mm;
|
.cv-template .cv-page {
|
||||||
height: 297mm;
|
width: 210mm;
|
||||||
padding: var(--cv-page-padding);
|
height: 297mm;
|
||||||
line-height: var(--cv-line-height);
|
padding: var(--cv-page-padding);
|
||||||
gap: var(--cv-page-gap);
|
line-height: var(--cv-line-height);
|
||||||
box-sizing: border-box;
|
gap: var(--cv-page-gap);
|
||||||
background-color: var(--background);
|
box-sizing: border-box;
|
||||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
background-color: var(--color-surface);
|
||||||
border: 1px solid var(--primary);
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
||||||
overflow: hidden;
|
border: 1px solid var(--color-primary);
|
||||||
margin: auto auto;
|
overflow: hidden;
|
||||||
display: flex;
|
margin: auto auto;
|
||||||
flex-direction: column;
|
display: flex;
|
||||||
font-family: var(--font-text);
|
flex-direction: column;
|
||||||
|
font-family: var(--font-body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Typography */
|
||||||
.cv-template .name {
|
.cv-template .name {
|
||||||
font-size: var(--cv-name-size);
|
font-size: var(--cv-name-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template h1,
|
.cv-template h1,
|
||||||
.cv-template h2,
|
.cv-template h2,
|
||||||
.cv-template h3,
|
.cv-template h3,
|
||||||
.cv-template h4 {
|
.cv-template h4 {
|
||||||
margin: var(--cv-heading-margin);
|
margin: var(--cv-heading-margin);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
font-family: var(--font-heading);
|
font-family: var(--font-heading);
|
||||||
text-transform: var(--cv-heading-transform);
|
text-transform: var(--cv-heading-transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template h1 {
|
.cv-template h1 {
|
||||||
font-size: var(--cv-heading-size);
|
font-size: var(--cv-heading-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template h2 {
|
.cv-template h2 {
|
||||||
border-bottom: 1px solid var(--primary);
|
border-bottom: 1px solid var(--color-primary);
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
font-size: var(--cv-subheading-size);
|
font-size: var(--cv-subheading-size);
|
||||||
}
|
|
||||||
|
|
||||||
.cv-template h3 {
|
|
||||||
font-size: var(--cv-subsubheading-size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cv-template h3,
|
||||||
.cv-template h4 {
|
.cv-template h4 {
|
||||||
font-size: var(--cv-subsubheading-size);
|
font-size: var(--cv-subsubheading-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template p {
|
.cv-template p {
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2em;
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
font-size: var(--cv-text-size);
|
font-size: var(--cv-text-size);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template a {
|
.cv-template a {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template a:hover {
|
.cv-template a:hover {
|
||||||
color: var(--tertiary);
|
color: var(--color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template small {
|
.cv-template small {
|
||||||
font-size: var(--cv-small-size);
|
font-size: var(--cv-small-size);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template ul {
|
.cv-template ul {
|
||||||
font-size: var(--cv-list-size);
|
font-size: var(--cv-list-size);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-left: 1.2em;
|
padding-left: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template li {
|
.cv-template li {
|
||||||
font-size: var(--cv-list-size);
|
font-size: var(--cv-list-size);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
list-style: disc;
|
list-style: disc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Grids */
|
||||||
.cv-template .skills-grid {
|
.cv-template .skills-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr 1fr;
|
grid-template-columns: 1fr 1fr 1fr;
|
||||||
gap: 0.3em 1em;
|
gap: 0.3em 1em;
|
||||||
margin-bottom: 0.2em;
|
margin-bottom: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template .grades-grid {
|
.cv-template .grades-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, auto 1fr);
|
grid-template-columns: repeat(2, auto 1fr);
|
||||||
column-gap: 0.5em;
|
column-gap: 0.5em;
|
||||||
row-gap: 0.1em;
|
row-gap: 0.1em;
|
||||||
font-size: var(--cv-text-size);
|
font-size: var(--cv-text-size);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
margin: 0.15em 0;
|
margin: 0.15em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template .grades-grid > span:nth-child(4n + 2),
|
.cv-template .grades-grid > span:nth-child(4n + 2),
|
||||||
.cv-template .grades-grid > span:nth-child(4n) {
|
.cv-template .grades-grid > span:nth-child(4n) {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
padding-right: 1.5em;
|
padding-right: 1.5em;
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.cv-template .grades-grid {
|
|
||||||
grid-template-columns: auto 1fr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tables */
|
||||||
.cv-template table {
|
.cv-template table {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template td {
|
.cv-template td {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
border-top: 1px solid var(--tertiary);
|
border-top: 1px solid var(--color-tertiary);
|
||||||
padding: 1px 10px;
|
padding: 1px 10px;
|
||||||
font-size: var(--cv-text-size);
|
font-size: var(--cv-text-size);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template th {
|
.cv-template th {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
border: 2px solid var(--tertiary);
|
border: 2px solid var(--color-tertiary);
|
||||||
padding: 1px 0 1px 7px;
|
padding: 1px 0 1px 7px;
|
||||||
font-family: var(--font-heading);
|
font-family: var(--font-heading);
|
||||||
font-size: var(--cv-subsubheading-size);
|
font-size: var(--cv-subsubheading-size);
|
||||||
background-color: var(--quaternary);
|
background-color: var(--color-quaternary);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Phone */
|
||||||
@media (max-width: 640px) {
|
@media (max-width: 640px) {
|
||||||
.cv-template .a4page {
|
.cv-template .cv-page {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-template .skills-grid {
|
.cv-template .skills-grid {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cv-template .grades-grid {
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Print: one sheet per page */
|
||||||
@page {
|
@page {
|
||||||
size: A4;
|
size: A4;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
.cv-template .no-print {
|
.cv-template .cv-page {
|
||||||
display: none !important;
|
margin: 0;
|
||||||
}
|
border: none;
|
||||||
|
box-shadow: none;
|
||||||
|
break-after: page;
|
||||||
|
}
|
||||||
|
|
||||||
.cv-template .a4page {
|
.cv-template .cv-page:last-of-type {
|
||||||
margin: 0;
|
break-after: auto;
|
||||||
border: none;
|
}
|
||||||
box-shadow: none;
|
|
||||||
break-after: page;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cv-template .a4page:last-of-type {
|
|
||||||
break-after: auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ import ManageRadio from "./ManageRadio.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="justify-center flex flex-row w-full h-full">
|
<main class="justify-center flex flex-row w-full h-full">
|
||||||
<div class="bdr-1 flex flex-col">
|
<div class="bdr-1 flex flex-col">
|
||||||
<CreateUser class="bdr-2 bg-bg_primary" />
|
<CreateUser class="bdr-2 bg-surface" />
|
||||||
<CreatePost class="bdr-2 bg-bg_primary" />
|
<CreatePost class="bdr-2 bg-surface" />
|
||||||
<CreateFavorite class="bdr-2 bg-bg_primary" />
|
<CreateFavorite class="bdr-2 bg-surface" />
|
||||||
<CreateActivity class="bdr-2 bg-bg_primary" />
|
<CreateActivity class="bdr-2 bg-surface" />
|
||||||
<CreateRowing class="bdr-2 bg-bg_primary" />
|
<CreateRowing class="bdr-2 bg-surface" />
|
||||||
<ManageUsers class="bdr-2 bg-bg_primary" />
|
<ManageUsers class="bdr-2 bg-surface" />
|
||||||
<ManageRadio class="bdr-2 bg-bg_primary" />
|
<ManageRadio class="bdr-2 bg-surface" />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -730,14 +730,14 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.panel {
|
.panel {
|
||||||
border: 1px solid var(--quaternary);
|
border: 1px solid var(--color-quaternary);
|
||||||
background: rgba(4, 8, 15, 0.55);
|
background: rgba(4, 8, 15, 0.55);
|
||||||
padding: 0.9rem;
|
padding: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panelTitle {
|
.panelTitle {
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
font-family: var(--font_heading);
|
font-family: var(--font-heading);
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
@@ -751,11 +751,11 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.statusChip {
|
.statusChip {
|
||||||
font-family: var(--font_heading);
|
font-family: var(--font-heading);
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
padding: 0.1rem 0.6rem;
|
padding: 0.1rem 0.6rem;
|
||||||
border: 1px solid currentColor;
|
border: 1px solid currentColor;
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.statusChip.paused {
|
.statusChip.paused {
|
||||||
@@ -763,21 +763,21 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.statusChip.accepted {
|
.statusChip.accepted {
|
||||||
color: var(--secondary);
|
color: var(--color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.statusChip.rejected,
|
.statusChip.rejected,
|
||||||
.statusChip.error {
|
.statusChip.error {
|
||||||
color: var(--tertiary);
|
color: var(--color-tertiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stepCounter {
|
.stepCounter {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
color: var(--portal_grey);
|
color: var(--color-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.terminalNote {
|
.terminalNote {
|
||||||
color: var(--portal_grey);
|
color: var(--color-muted);
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,9 +791,9 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
padding: 0.35rem 1.1rem;
|
padding: 0.35rem 1.1rem;
|
||||||
border: 1px solid var(--primary);
|
border: 1px solid var(--color-primary);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
font-family: var(--font_heading);
|
font-family: var(--font-heading);
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition:
|
transition:
|
||||||
@@ -802,8 +802,8 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn:hover:enabled {
|
.btn:hover:enabled {
|
||||||
background: var(--primary);
|
background: var(--color-primary);
|
||||||
color: var(--bg_secondary);
|
color: var(--color-surface-deep);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:disabled {
|
.btn:disabled {
|
||||||
@@ -815,12 +815,12 @@ onBeforeUnmount(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
color: var(--portal_grey);
|
color: var(--color-muted);
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.speedLabel input[type="range"] {
|
.speedLabel input[type="range"] {
|
||||||
accent-color: var(--primary);
|
accent-color: var(--color-primary);
|
||||||
width: 8rem;
|
width: 8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,17 +831,17 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
.presetSelect {
|
.presetSelect {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
background: var(--bg_secondary);
|
background: var(--color-surface-deep);
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
border: 1px solid var(--quaternary);
|
border: 1px solid var(--color-quaternary);
|
||||||
padding: 0.3rem 0.5rem;
|
padding: 0.3rem 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.errorBox {
|
.errorBox {
|
||||||
margin-top: 0.75rem;
|
margin-top: 0.75rem;
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
border: 1px solid var(--tertiary);
|
border: 1px solid var(--color-tertiary);
|
||||||
color: var(--tertiary);
|
color: var(--color-tertiary);
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
@@ -865,7 +865,7 @@ onBeforeUnmount(() => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 0.2rem;
|
gap: 0.2rem;
|
||||||
color: var(--portal_grey);
|
color: var(--color-muted);
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -876,8 +876,8 @@ onBeforeUnmount(() => {
|
|||||||
.configGrid input,
|
.configGrid input,
|
||||||
.configGrid textarea,
|
.configGrid textarea,
|
||||||
.derivedGrid input {
|
.derivedGrid input {
|
||||||
background: var(--bg_secondary);
|
background: var(--color-surface-deep);
|
||||||
border: 1px solid var(--quaternary);
|
border: 1px solid var(--color-quaternary);
|
||||||
color: #e5f4ee;
|
color: #e5f4ee;
|
||||||
padding: 0.35rem 0.5rem;
|
padding: 0.35rem 0.5rem;
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
@@ -888,24 +888,24 @@ onBeforeUnmount(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.derivedGrid input {
|
.derivedGrid input {
|
||||||
color: var(--portal_grey);
|
color: var(--color-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.configGrid input:focus,
|
.configGrid input:focus,
|
||||||
.configGrid textarea:focus {
|
.configGrid textarea:focus {
|
||||||
outline: 1px solid var(--primary);
|
outline: 1px solid var(--color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.help {
|
.help {
|
||||||
margin-top: 0.9rem;
|
margin-top: 0.9rem;
|
||||||
color: var(--portal_grey);
|
color: var(--color-muted);
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.help summary {
|
.help summary {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: var(--primary);
|
color: var(--color-primary);
|
||||||
font-family: var(--font_heading);
|
font-family: var(--font-heading);
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
import { computed, ref, defineAsyncComponent } from "vue";
|
import { computed, ref, defineAsyncComponent } from "vue";
|
||||||
import LinkTable from "@/components/util/LinkTable.vue";
|
import LinkTable from "@/components/util/LinkTable.vue";
|
||||||
import Header from "@/components/text/Header.vue";
|
import Header from "@/components/text/Header.vue";
|
||||||
|
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||||
import { useHomeDataStore } from "@/stores/homeData";
|
import { useHomeDataStore } from "@/stores/homeData";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
|
||||||
|
|
||||||
const CreateBookmark = defineAsyncComponent(
|
const CreateBookmark = defineAsyncComponent(
|
||||||
() => import("@/views/admin/CreateBookmark.vue"),
|
() => import("@/views/admin/CreateBookmark.vue"),
|
||||||
);
|
);
|
||||||
|
|
||||||
const homeData = useHomeDataStore();
|
const homeData = useHomeDataStore();
|
||||||
const authStore = useAuthStore();
|
|
||||||
|
|
||||||
const showCreate = ref(false);
|
const showCreate = ref(false);
|
||||||
|
|
||||||
@@ -27,16 +26,8 @@ const groupedBookmarks = computed(() => {
|
|||||||
<template>
|
<template>
|
||||||
<div class="bookmarks-wrapper">
|
<div class="bookmarks-wrapper">
|
||||||
<Header class="text-left">
|
<Header class="text-left">
|
||||||
<span class="flex items-center justify-between w-full">
|
{{ showCreate ? "Create Bookmark" : "Bookmarks" }}
|
||||||
{{ showCreate ? "Create Bookmark" : "Bookmarks" }}
|
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||||
<button
|
|
||||||
v-if="authStore.user.admin"
|
|
||||||
class="text-sm px-1"
|
|
||||||
@click="showCreate = !showCreate"
|
|
||||||
>
|
|
||||||
{{ showCreate ? "x" : "+" }}
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</Header>
|
</Header>
|
||||||
<CreateBookmark
|
<CreateBookmark
|
||||||
v-if="showCreate"
|
v-if="showCreate"
|
||||||
|
|||||||
@@ -2,33 +2,24 @@
|
|||||||
import AutoScroll from "@/components/util/AutoScroll.vue";
|
import AutoScroll from "@/components/util/AutoScroll.vue";
|
||||||
import LinkTable from "@/components/util/LinkTable.vue";
|
import LinkTable from "@/components/util/LinkTable.vue";
|
||||||
import Header from "@/components/text/Header.vue";
|
import Header from "@/components/text/Header.vue";
|
||||||
|
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||||
|
|
||||||
import { ref, defineAsyncComponent } from "vue";
|
import { ref, defineAsyncComponent } from "vue";
|
||||||
import { useActivityStore } from "@/stores/activity";
|
import { useActivityStore } from "@/stores/activity";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
|
||||||
|
|
||||||
const CreateActivity = defineAsyncComponent(
|
const CreateActivity = defineAsyncComponent(
|
||||||
() => import("@/views/admin/CreateActivity.vue"),
|
() => import("@/views/admin/CreateActivity.vue"),
|
||||||
);
|
);
|
||||||
|
|
||||||
const activityStore = useActivityStore();
|
const activityStore = useActivityStore();
|
||||||
const authStore = useAuthStore();
|
|
||||||
const showCreate = ref(false);
|
const showCreate = ref(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col items-center">
|
||||||
<Header>
|
<Header>
|
||||||
<span class="flex items-center justify-between w-full">
|
{{ showCreate ? "Create Activity" : "Consumption" }}
|
||||||
{{ showCreate ? "Create Activity" : "Consumption" }}
|
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||||
<button
|
|
||||||
v-if="authStore.user.admin"
|
|
||||||
class="text-sm px-1"
|
|
||||||
@click="showCreate = !showCreate"
|
|
||||||
>
|
|
||||||
{{ showCreate ? "x" : "+" }}
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</Header>
|
</Header>
|
||||||
<CreateActivity
|
<CreateActivity
|
||||||
v-if="showCreate"
|
v-if="showCreate"
|
||||||
|
|||||||
@@ -1,34 +1,25 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import Header from "@/components/text/Header.vue";
|
import Header from "@/components/text/Header.vue";
|
||||||
|
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||||
import LinkTable from "@/components/util/LinkTable.vue";
|
import LinkTable from "@/components/util/LinkTable.vue";
|
||||||
import AutoScroll from "@/components/util/AutoScroll.vue";
|
import AutoScroll from "@/components/util/AutoScroll.vue";
|
||||||
|
|
||||||
import { ref, defineAsyncComponent } from "vue";
|
import { ref, defineAsyncComponent } from "vue";
|
||||||
import { useFavoritesStore } from "@/stores/favorites";
|
import { useFavoritesStore } from "@/stores/favorites";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
|
||||||
|
|
||||||
const CreateFavorite = defineAsyncComponent(
|
const CreateFavorite = defineAsyncComponent(
|
||||||
() => import("@/views/admin/CreateFavorite.vue"),
|
() => import("@/views/admin/CreateFavorite.vue"),
|
||||||
);
|
);
|
||||||
|
|
||||||
const favoritesStore = useFavoritesStore();
|
const favoritesStore = useFavoritesStore();
|
||||||
const authStore = useAuthStore();
|
|
||||||
const showCreate = ref(false);
|
const showCreate = ref(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col items-center">
|
||||||
<Header>
|
<Header>
|
||||||
<span class="flex items-center justify-between w-full">
|
{{ showCreate ? "Create Favorite" : "favs" }}
|
||||||
{{ showCreate ? "Create Favorite" : "favs" }}
|
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||||
<button
|
|
||||||
v-if="authStore.user.admin"
|
|
||||||
class="text-sm px-1"
|
|
||||||
@click="showCreate = !showCreate"
|
|
||||||
>
|
|
||||||
{{ showCreate ? "x" : "+" }}
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</Header>
|
</Header>
|
||||||
<CreateFavorite
|
<CreateFavorite
|
||||||
v-if="showCreate"
|
v-if="showCreate"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import Button from "@/components/input/Button.vue";
|
import Button from "@/components/input/Button.vue";
|
||||||
import Markdown from "@/components/util/Markdown.vue";
|
import Markdown from "@/components/util/Markdown.vue";
|
||||||
import Header from "@/components/text/Header.vue";
|
import Header from "@/components/text/Header.vue";
|
||||||
|
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||||
|
|
||||||
import { ref, computed, defineAsyncComponent } from "vue";
|
import { ref, computed, defineAsyncComponent } from "vue";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
@@ -45,16 +46,8 @@ function deletePost() {
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col flex-1 min-h-0">
|
<div class="flex flex-col flex-1 min-h-0">
|
||||||
<Header>
|
<Header>
|
||||||
<span class="flex items-center justify-between w-full">
|
{{ showCreate ? "Create Post" : post.title }}
|
||||||
{{ showCreate ? "Create Post" : post.title }}
|
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||||
<button
|
|
||||||
v-if="authStore.user.admin"
|
|
||||||
class="text-sm px-1"
|
|
||||||
@click="showCreate = !showCreate"
|
|
||||||
>
|
|
||||||
{{ showCreate ? "x" : "+" }}
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</Header>
|
</Header>
|
||||||
<CreatePost
|
<CreatePost
|
||||||
v-if="showCreate"
|
v-if="showCreate"
|
||||||
|
|||||||
+21
-30
@@ -1,8 +1,8 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, defineAsyncComponent } from "vue";
|
import { ref, computed, defineAsyncComponent } from "vue";
|
||||||
import Header from "@/components/text/Header.vue";
|
import Header from "@/components/text/Header.vue";
|
||||||
|
import CreateToggle from "@/components/input/CreateToggle.vue";
|
||||||
import { useHomeDataStore } from "@/stores/homeData";
|
import { useHomeDataStore } from "@/stores/homeData";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
|
|
||||||
const CreateRowing = defineAsyncComponent(
|
const CreateRowing = defineAsyncComponent(
|
||||||
@@ -10,7 +10,6 @@ const CreateRowing = defineAsyncComponent(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const store = useHomeDataStore();
|
const store = useHomeDataStore();
|
||||||
const authStore = useAuthStore();
|
|
||||||
const { loaded, error, rowingSessions } = storeToRefs(store);
|
const { loaded, error, rowingSessions } = storeToRefs(store);
|
||||||
const showCreate = ref(false);
|
const showCreate = ref(false);
|
||||||
|
|
||||||
@@ -21,9 +20,9 @@ const metric = ref("distance");
|
|||||||
const hovered = ref(null);
|
const hovered = ref(null);
|
||||||
|
|
||||||
const METRICS = [
|
const METRICS = [
|
||||||
{ key: "distance", label: "Distance (m)", color: "#55ffbb" },
|
{ key: "distance", label: "Distance (m)", color: "var(--color-primary)" },
|
||||||
{ key: "timePer500m", label: "Pace /500m", color: "#ff579a" },
|
{ key: "timePer500m", label: "Pace /500m", color: "var(--color-tertiary)" },
|
||||||
{ key: "calories", label: "Calories", color: "#62ff57" },
|
{ key: "calories", label: "Calories", color: "var(--color-secondary)" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const activeMetric = computed(() =>
|
const activeMetric = computed(() =>
|
||||||
@@ -117,16 +116,8 @@ function formatValue(key, val) {
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col h-full overflow-hidden">
|
<div class="flex flex-col h-full overflow-hidden">
|
||||||
<Header>
|
<Header>
|
||||||
<span class="flex items-center justify-between w-full">
|
{{ showCreate ? "Upload Rowing" : "Rowing" }}
|
||||||
{{ showCreate ? "Upload Rowing" : "Rowing" }}
|
<template #action><CreateToggle v-model="showCreate" /></template>
|
||||||
<button
|
|
||||||
v-if="authStore.user.admin"
|
|
||||||
class="text-sm px-1"
|
|
||||||
@click="showCreate = !showCreate"
|
|
||||||
>
|
|
||||||
{{ showCreate ? "x" : "+" }}
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<CreateRowing
|
<CreateRowing
|
||||||
@@ -150,7 +141,7 @@ function formatValue(key, val) {
|
|||||||
class="metric-btn text-xs px-2 py-0.5 font-heading border"
|
class="metric-btn text-xs px-2 py-0.5 font-heading border"
|
||||||
:style="{
|
:style="{
|
||||||
borderColor: m.color,
|
borderColor: m.color,
|
||||||
color: metric === m.key ? '#1b110e' : m.color,
|
color: metric === m.key ? 'var(--color-surface)' : m.color,
|
||||||
backgroundColor: metric === m.key ? m.color : 'transparent',
|
backgroundColor: metric === m.key ? m.color : 'transparent',
|
||||||
}"
|
}"
|
||||||
@click="metric = m.key"
|
@click="metric = m.key"
|
||||||
@@ -176,7 +167,7 @@ function formatValue(key, val) {
|
|||||||
:y1="yl.y"
|
:y1="yl.y"
|
||||||
:x2="W - PR"
|
:x2="W - PR"
|
||||||
:y2="yl.y"
|
:y2="yl.y"
|
||||||
stroke="var(--quaternary)"
|
stroke="var(--color-quaternary)"
|
||||||
stroke-width="0.5"
|
stroke-width="0.5"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -220,8 +211,8 @@ function formatValue(key, val) {
|
|||||||
:y="yl.y + 3"
|
:y="yl.y + 3"
|
||||||
text-anchor="end"
|
text-anchor="end"
|
||||||
font-size="10"
|
font-size="10"
|
||||||
fill="var(--primary)"
|
fill="var(--color-primary)"
|
||||||
font-family="var(--font_heading)"
|
font-family="var(--font-heading)"
|
||||||
>
|
>
|
||||||
{{ yl.label }}
|
{{ yl.label }}
|
||||||
</text>
|
</text>
|
||||||
@@ -234,8 +225,8 @@ function formatValue(key, val) {
|
|||||||
:y="H - 4"
|
:y="H - 4"
|
||||||
text-anchor="middle"
|
text-anchor="middle"
|
||||||
font-size="10"
|
font-size="10"
|
||||||
fill="var(--primary)"
|
fill="var(--color-primary)"
|
||||||
font-family="var(--font_heading)"
|
font-family="var(--font-heading)"
|
||||||
>
|
>
|
||||||
{{ xl.label }}
|
{{ xl.label }}
|
||||||
</text>
|
</text>
|
||||||
@@ -246,7 +237,7 @@ function formatValue(key, val) {
|
|||||||
:y1="PT"
|
:y1="PT"
|
||||||
:x2="PL"
|
:x2="PL"
|
||||||
:y2="PT + PLOT_H"
|
:y2="PT + PLOT_H"
|
||||||
stroke="var(--primary)"
|
stroke="var(--color-primary)"
|
||||||
stroke-width="0.5"
|
stroke-width="0.5"
|
||||||
/>
|
/>
|
||||||
<line
|
<line
|
||||||
@@ -254,7 +245,7 @@ function formatValue(key, val) {
|
|||||||
:y1="PT + PLOT_H"
|
:y1="PT + PLOT_H"
|
||||||
:x2="W - PR"
|
:x2="W - PR"
|
||||||
:y2="PT + PLOT_H"
|
:y2="PT + PLOT_H"
|
||||||
stroke="var(--primary)"
|
stroke="var(--color-primary)"
|
||||||
stroke-width="0.5"
|
stroke-width="0.5"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -265,7 +256,7 @@ function formatValue(key, val) {
|
|||||||
:y="points[hovered].y - 20"
|
:y="points[hovered].y - 20"
|
||||||
width="82"
|
width="82"
|
||||||
height="32"
|
height="32"
|
||||||
fill="var(--bg_primary)"
|
fill="var(--color-surface)"
|
||||||
:stroke="activeMetric.color"
|
:stroke="activeMetric.color"
|
||||||
stroke-width="0.5"
|
stroke-width="0.5"
|
||||||
rx="1"
|
rx="1"
|
||||||
@@ -274,8 +265,8 @@ function formatValue(key, val) {
|
|||||||
:x="Math.min(points[hovered].x + 7, W - 82)"
|
:x="Math.min(points[hovered].x + 7, W - 82)"
|
||||||
:y="points[hovered].y - 6"
|
:y="points[hovered].y - 6"
|
||||||
font-size="12"
|
font-size="12"
|
||||||
fill="var(--secondary)"
|
fill="var(--color-secondary)"
|
||||||
font-family="var(--font_heading)"
|
font-family="var(--font-heading)"
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
points[hovered].date.toLocaleDateString("en-GB", {
|
points[hovered].date.toLocaleDateString("en-GB", {
|
||||||
@@ -290,7 +281,7 @@ function formatValue(key, val) {
|
|||||||
:y="points[hovered].y + 8"
|
:y="points[hovered].y + 8"
|
||||||
font-size="14"
|
font-size="14"
|
||||||
:fill="activeMetric.color"
|
:fill="activeMetric.color"
|
||||||
font-family="var(--font_heading)"
|
font-family="var(--font-heading)"
|
||||||
>
|
>
|
||||||
{{ formatValue(metric, points[hovered].value) }}
|
{{ formatValue(metric, points[hovered].value) }}
|
||||||
</text>
|
</text>
|
||||||
@@ -302,7 +293,7 @@ function formatValue(key, val) {
|
|||||||
<div class="flex justify-between text-xs border-t border-quaternary pt-1">
|
<div class="flex justify-between text-xs border-t border-quaternary pt-1">
|
||||||
<div class="flex flex-col items-center">
|
<div class="flex flex-col items-center">
|
||||||
<span class="text-primary font-heading">{{ rows.length }}</span>
|
<span class="text-primary font-heading">{{ rows.length }}</span>
|
||||||
<span class="text-quaternary" style="font-size: 0.6rem"
|
<span class="text-quaternary text-[0.6rem]"
|
||||||
>sessions</span
|
>sessions</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -312,7 +303,7 @@ function formatValue(key, val) {
|
|||||||
rows.reduce((s, r) => s + r.distance, 0).toLocaleString()
|
rows.reduce((s, r) => s + r.distance, 0).toLocaleString()
|
||||||
}}m</span
|
}}m</span
|
||||||
>
|
>
|
||||||
<span class="text-quaternary" style="font-size: 0.6rem"
|
<span class="text-quaternary text-[0.6rem]"
|
||||||
>total dist</span
|
>total dist</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -322,7 +313,7 @@ function formatValue(key, val) {
|
|||||||
rows.reduce((s, r) => s + r.timePer500m, 0) / (rows.length || 1),
|
rows.reduce((s, r) => s + r.timePer500m, 0) / (rows.length || 1),
|
||||||
)
|
)
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="text-quaternary" style="font-size: 0.6rem"
|
<span class="text-quaternary text-[0.6rem]"
|
||||||
>avg pace</span
|
>avg pace</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+26
-53
@@ -2,14 +2,10 @@
|
|||||||
import Timer from "@/components/util/Timer.vue";
|
import Timer from "@/components/util/Timer.vue";
|
||||||
import Time from "@/components/util/Time.vue";
|
import Time from "@/components/util/Time.vue";
|
||||||
import Radio from "@/components/util/Radio.vue";
|
import Radio from "@/components/util/Radio.vue";
|
||||||
import Elle from "@/components/elle/Elle.vue";
|
|
||||||
import Chat from "@/components/util/Chat.vue";
|
import Chat from "@/components/util/Chat.vue";
|
||||||
import MusicPlayer from "@/components/util/MusicPlayer.vue";
|
|
||||||
import CommitHistory from "@/components/util/CommitHistory.vue";
|
import CommitHistory from "@/components/util/CommitHistory.vue";
|
||||||
|
|
||||||
import Intro from "./Intro.vue";
|
|
||||||
import Intro2 from "./Intro2.vue";
|
import Intro2 from "./Intro2.vue";
|
||||||
import BadApple from "./BadApple.vue";
|
|
||||||
import Miku from "./Miku.vue";
|
import Miku from "./Miku.vue";
|
||||||
import Stamps from "./Stamps.vue";
|
import Stamps from "./Stamps.vue";
|
||||||
import Listening from "./Listening.vue";
|
import Listening from "./Listening.vue";
|
||||||
@@ -17,7 +13,6 @@ import Links from "./Links.vue";
|
|||||||
import Feed from "./Feed.vue";
|
import Feed from "./Feed.vue";
|
||||||
import Collage from "./Collage.vue";
|
import Collage from "./Collage.vue";
|
||||||
import Favorites from "./Favorites.vue";
|
import Favorites from "./Favorites.vue";
|
||||||
// import Gym from "./Gym.vue";
|
|
||||||
import Gym2 from "./Gym2.vue";
|
import Gym2 from "./Gym2.vue";
|
||||||
import Consumption from "./Consumption.vue";
|
import Consumption from "./Consumption.vue";
|
||||||
import Steam from "./Steam.vue";
|
import Steam from "./Steam.vue";
|
||||||
@@ -28,13 +23,10 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
<main class="justify-center flex flex-row w-full h-full overflow-x-hidden">
|
<main class="justify-center flex flex-row w-full h-full overflow-x-hidden">
|
||||||
<div class="outerWrap flex flex-row">
|
<div class="outerWrap flex flex-row">
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<Time class="time-sidebar sidebar-cell" />
|
<Time class="time-sidebar cell" />
|
||||||
<Timer class="timer-sidebar sidebar-cell" />
|
<Timer class="timer-sidebar cell" />
|
||||||
<Radio class="radio-sidebar sidebar-cell" />
|
<Radio class="radio-sidebar cell" />
|
||||||
<CommitHistory class="commits-sidebar flex-1 sidebar-cell" />
|
<CommitHistory class="commits-sidebar flex-1 cell" />
|
||||||
|
|
||||||
<!-- <Elle class="flex-1" /> -->
|
|
||||||
<!-- <MusicPlayer /> -->
|
|
||||||
<img
|
<img
|
||||||
src="/img/memes/fire-woman.gif"
|
src="/img/memes/fire-woman.gif"
|
||||||
alt=""
|
alt=""
|
||||||
@@ -44,26 +36,23 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
loading="lazy"
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="a4page-portrait homeGrid relative bdr-1 border-quaternary">
|
<div class="page-a4 homeGrid relative bdr-1 border-quaternary">
|
||||||
<!-- <Intro class="intro" /> -->
|
<Intro2 class="intro cell" />
|
||||||
<Intro2 class="intro grid-cell" />
|
<Listening class="listening cell" />
|
||||||
<!-- <BadApple class="intro" /> -->
|
<Stamps class="stamps cell" />
|
||||||
<Listening class="listening grid-cell" />
|
<Feed class="feed cell" />
|
||||||
<Stamps class="stamps grid-cell" />
|
<Links class="links cell" />
|
||||||
<Feed class="feed grid-cell" />
|
<Collage class="collage cell" />
|
||||||
<Links class="links grid-cell" />
|
<Consumption class="consumption cell" />
|
||||||
<Collage class="collage grid-cell" />
|
<Favorites class="favorites cell" />
|
||||||
<Consumption class="consumption grid-cell" />
|
<Gym2 class="gym cell" />
|
||||||
<Favorites class="favorites grid-cell" />
|
|
||||||
<!-- <Gym class="gym" /> -->
|
|
||||||
<Gym2 class="gym grid-cell" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<Steam class="steam-sidebar sidebar-cell" />
|
<Steam class="steam-sidebar cell" />
|
||||||
<Bookmarks class="bookmarks-sidebar sidebar-cell" />
|
<Bookmarks class="bookmarks-sidebar cell" />
|
||||||
<Chat class="chat-sidebar flex-1 min-h-0 chat-home sidebar-cell" />
|
<Chat class="chat-sidebar flex-1 min-h-0 chat-home cell" />
|
||||||
<Miku
|
<Miku
|
||||||
class="sidebar-image miku-image box-border border-tertiary border-2 bg-bg_primary"
|
class="sidebar-image miku-image box-border border-tertiary border-2 bg-surface"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -71,13 +60,13 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.grid-cell {
|
/* Every widget, in the grid or a sidebar */
|
||||||
background-color: var(--bg_primary);
|
.cell {
|
||||||
border-width: 2px;
|
background-color: var(--color-surface);
|
||||||
border-style: solid;
|
border: 2px solid var(--color-quaternary);
|
||||||
border-color: var(--quaternary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Grid placement — see grid-template-areas in .homeGrid below */
|
||||||
.intro {
|
.intro {
|
||||||
grid-area: intro;
|
grid-area: intro;
|
||||||
}
|
}
|
||||||
@@ -106,13 +95,6 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
grid-area: favorites;
|
grid-area: favorites;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-cell {
|
|
||||||
background-color: var(--bg_primary);
|
|
||||||
border-width: 2px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: var(--quaternary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -128,6 +110,7 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Desktop: 10x10 grid on the A4 sheet */
|
||||||
.homeGrid {
|
.homeGrid {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
@@ -154,6 +137,7 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
height: 15rem;
|
height: 15rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tablet: sidebars stack below the sheet */
|
||||||
@media (max-width: 1360px) {
|
@media (max-width: 1360px) {
|
||||||
.outerWrap {
|
.outerWrap {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -197,14 +181,9 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
.timer-sidebar {
|
.timer-sidebar {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .sidebar-image { */
|
|
||||||
/* max-height: 150px; */
|
|
||||||
/* max-width: 150px; */
|
|
||||||
/* object-fit: contain; */
|
|
||||||
/* } */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Phone: 3-column grid, collage and gym hidden */
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.homeGrid {
|
.homeGrid {
|
||||||
border-image: none;
|
border-image: none;
|
||||||
@@ -234,10 +213,4 @@ import Bookmarks from "./Bookmarks.vue";
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-random {
|
|
||||||
background-color: var(--bg_primary);
|
|
||||||
background-image: url("/img/miku/miku2.gif");
|
|
||||||
background-size: 10px 10px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ const site_links = [
|
|||||||
{ name: "CV", link: "/cv" },
|
{ name: "CV", link: "/cv" },
|
||||||
{ name: "Bookmarks", link: "/bookmarks" },
|
{ name: "Bookmarks", link: "/bookmarks" },
|
||||||
{ name: "Shrines", link: "/shrines" },
|
{ name: "Shrines", link: "/shrines" },
|
||||||
|
{ name: "Hotels", link: "/hotels" },
|
||||||
{ name: "Admin", link: "/admin" },
|
{ name: "Admin", link: "/admin" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -87,19 +87,4 @@ p {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: opacity 0.5s ease;
|
|
||||||
}
|
|
||||||
.fade-leave-active {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -108,21 +108,6 @@ p {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: opacity 0.5s ease;
|
|
||||||
}
|
|
||||||
.fade-leave-active {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 850px) {
|
@media (max-width: 850px) {
|
||||||
.steam-wrapper {
|
.steam-wrapper {
|
||||||
height: auto;
|
height: auto;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const videoSources = [
|
|||||||
<template>
|
<template>
|
||||||
<main class="items-center flex flex-col">
|
<main class="items-center flex flex-col">
|
||||||
<div
|
<div
|
||||||
class="a4page-portrait bdr-1 flex flex-row relative overflow-scroll items-center"
|
class="page-a4 bdr-1 flex flex-row relative overflow-scroll items-center"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<Link href="https://wiki.teamfortress.com/wiki/Demoman">The goat</Link>
|
<Link href="https://wiki.teamfortress.com/wiki/Demoman">The goat</Link>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Wip from "@/components/util/Wip.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="items-center flex flex-col">
|
<main class="items-center flex flex-col">
|
||||||
<div
|
<div
|
||||||
class="a4page-portrait items-center bdr-1 flex flex-col relative overflow-scroll"
|
class="page-a4 items-center bdr-1 flex flex-col relative overflow-scroll"
|
||||||
>
|
>
|
||||||
<Wip />
|
<Wip />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Wip from "@/components/util/Wip.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="items-center flex flex-col">
|
<main class="items-center flex flex-col">
|
||||||
<div
|
<div
|
||||||
class="a4page-portrait items-center bdr-1 flex flex-col relative overflow-scroll"
|
class="page-a4 items-center bdr-1 flex flex-col relative overflow-scroll"
|
||||||
>
|
>
|
||||||
<Wip />
|
<Wip />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,9 +10,8 @@ const shrine_links = [
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="items-center flex flex-col">
|
<main class="items-center flex flex-col">
|
||||||
<div class="background" />
|
|
||||||
<div
|
<div
|
||||||
class="a4page-portrait bdr-1 flex flex-col relative overflow-scroll gap-1"
|
class="page-a4 bdr-1 flex flex-col relative overflow-scroll gap-1"
|
||||||
>
|
>
|
||||||
<RouterTable :linkArr="shrine_links" />
|
<RouterTable :linkArr="shrine_links" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Wip from "@/components/util/Wip.vue";
|
|||||||
<template>
|
<template>
|
||||||
<main class="items-center flex flex-col">
|
<main class="items-center flex flex-col">
|
||||||
<div
|
<div
|
||||||
class="a4page-portrait items-center bdr-1 flex flex-col relative overflow-scroll"
|
class="page-a4 items-center bdr-1 flex flex-col relative overflow-scroll"
|
||||||
>
|
>
|
||||||
<Wip />
|
<Wip />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,793 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed, onMounted, onBeforeUnmount } from "vue";
|
||||||
|
import Header from "@/components/text/Header.vue";
|
||||||
|
import Paragraph from "@/components/text/Paragraph.vue";
|
||||||
|
import InlineLink from "@/components/text/InlineLink.vue";
|
||||||
|
|
||||||
|
const STORAGE_KEY = "cheap-hotels-config";
|
||||||
|
const CUSTOM_ORIGIN = "__custom__";
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Form state
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
function nextFriday() {
|
||||||
|
const d = new Date();
|
||||||
|
const delta = (5 - d.getDay() + 7) % 7 || 7;
|
||||||
|
d.setDate(d.getDate() + delta);
|
||||||
|
return d.toISOString().slice(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
const location = ref("Central London");
|
||||||
|
const checkin = ref(nextFriday());
|
||||||
|
const nights = ref(1);
|
||||||
|
const guests = ref("1");
|
||||||
|
const railcardHolders = ref(1);
|
||||||
|
const originKey = ref("clapham junction");
|
||||||
|
const customOrigin = ref("");
|
||||||
|
const depart = ref("19:30");
|
||||||
|
const top = ref(15);
|
||||||
|
const maxMiles = ref("");
|
||||||
|
const maxTravelMin = ref(75);
|
||||||
|
|
||||||
|
const origins = ref([]);
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Search state
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
const searching = ref(false);
|
||||||
|
const errorMsg = ref("");
|
||||||
|
const result = ref(null);
|
||||||
|
const elapsed = ref(0);
|
||||||
|
let ticker = null;
|
||||||
|
|
||||||
|
const statusText = computed(() => {
|
||||||
|
if (errorMsg.value) return "Error";
|
||||||
|
if (searching.value) return "Searching";
|
||||||
|
if (result.value) return "Done";
|
||||||
|
return "Idle";
|
||||||
|
});
|
||||||
|
|
||||||
|
const bestRow = computed(
|
||||||
|
() => result.value?.rows.find((r) => r.total !== null) ?? null,
|
||||||
|
);
|
||||||
|
|
||||||
|
const summaryText = computed(() => {
|
||||||
|
const s = result.value?.summary;
|
||||||
|
if (!s) return "";
|
||||||
|
const party =
|
||||||
|
`${s.adults} adult${s.adults === 1 ? "" : "s"}` +
|
||||||
|
(s.children ? ` + ${s.children} child${s.children === 1 ? "" : "ren"}` : "") +
|
||||||
|
` in ${s.rooms} room${s.rooms === 1 ? "" : "s"}`;
|
||||||
|
const railcard = s.railcard_holders
|
||||||
|
? ` (${s.railcard_holders} with railcard)`
|
||||||
|
: "";
|
||||||
|
return (
|
||||||
|
`${s.hotels_priced} of ${s.hotels_available} available Travelodges near ` +
|
||||||
|
`'${s.location}', ${fmtDate(s.checkin)} → ${fmtDate(s.checkout)} ` +
|
||||||
|
`(${s.nights} night${s.nights === 1 ? "" : "s"}, ${party}), ` +
|
||||||
|
`incl. round-trip transport from ${s.origin_name} departing ${fmtTime(s.depart)}${railcard}.`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Formatting
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
function gbp(v) {
|
||||||
|
return v === null || v === undefined ? "?" : `£${v.toFixed(2)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmtDate(iso) {
|
||||||
|
const d = new Date(iso + "T00:00:00");
|
||||||
|
return d.toLocaleDateString("en-GB", {
|
||||||
|
weekday: "short",
|
||||||
|
day: "numeric",
|
||||||
|
month: "short",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmtTime(iso) {
|
||||||
|
return new Date(iso).toLocaleTimeString("en-GB", {
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showFaster(r) {
|
||||||
|
return (
|
||||||
|
r.fastest_minutes !== null &&
|
||||||
|
r.travel_minutes !== null &&
|
||||||
|
r.fastest_minutes < r.travel_minutes - 10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Persistence
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
function saveConfig() {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(
|
||||||
|
STORAGE_KEY,
|
||||||
|
JSON.stringify({
|
||||||
|
location: location.value,
|
||||||
|
checkin: checkin.value,
|
||||||
|
nights: nights.value,
|
||||||
|
guests: guests.value,
|
||||||
|
railcardHolders: railcardHolders.value,
|
||||||
|
originKey: originKey.value,
|
||||||
|
customOrigin: customOrigin.value,
|
||||||
|
depart: depart.value,
|
||||||
|
top: top.value,
|
||||||
|
maxMiles: maxMiles.value,
|
||||||
|
maxTravelMin: maxTravelMin.value,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} catch {
|
||||||
|
/* storage unavailable: nothing to do */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadConfig() {
|
||||||
|
try {
|
||||||
|
const saved = localStorage.getItem(STORAGE_KEY);
|
||||||
|
if (!saved) return;
|
||||||
|
const c = JSON.parse(saved);
|
||||||
|
location.value = c.location ?? location.value;
|
||||||
|
nights.value = c.nights ?? nights.value;
|
||||||
|
guests.value = c.guests ?? guests.value;
|
||||||
|
railcardHolders.value = c.railcardHolders ?? railcardHolders.value;
|
||||||
|
originKey.value = c.originKey ?? originKey.value;
|
||||||
|
customOrigin.value = c.customOrigin ?? customOrigin.value;
|
||||||
|
depart.value = c.depart ?? depart.value;
|
||||||
|
top.value = c.top ?? top.value;
|
||||||
|
maxMiles.value = c.maxMiles ?? maxMiles.value;
|
||||||
|
maxTravelMin.value = c.maxTravelMin ?? maxTravelMin.value;
|
||||||
|
// Only restore the date if it is still in the future.
|
||||||
|
if (c.checkin && c.checkin >= new Date().toISOString().slice(0, 10))
|
||||||
|
checkin.value = c.checkin;
|
||||||
|
} catch {
|
||||||
|
/* corrupted saved config: keep the defaults */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Search
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
function buildRequest() {
|
||||||
|
const body = {
|
||||||
|
location: location.value,
|
||||||
|
checkin: checkin.value,
|
||||||
|
nights: Number(nights.value),
|
||||||
|
guests: guests.value,
|
||||||
|
railcard_holders: Number(railcardHolders.value),
|
||||||
|
origin:
|
||||||
|
originKey.value === CUSTOM_ORIGIN
|
||||||
|
? customOrigin.value
|
||||||
|
: originKey.value,
|
||||||
|
depart: depart.value,
|
||||||
|
top: Number(top.value),
|
||||||
|
max_travel_min: Number(maxTravelMin.value),
|
||||||
|
};
|
||||||
|
if (maxMiles.value !== "" && maxMiles.value !== null)
|
||||||
|
body.max_miles = Number(maxMiles.value);
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
function describeError(status, payload) {
|
||||||
|
if (status === 429)
|
||||||
|
return "Someone else is searching right now, try again shortly.";
|
||||||
|
const detail = payload?.detail;
|
||||||
|
if (Array.isArray(detail))
|
||||||
|
return detail
|
||||||
|
.map((d) => `${(d.loc || []).slice(-1)[0] ?? ""}: ${d.msg}`)
|
||||||
|
.join("; ");
|
||||||
|
if (typeof detail === "string") return detail;
|
||||||
|
return `Search failed (${status}).`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function onSearch() {
|
||||||
|
if (searching.value) return;
|
||||||
|
errorMsg.value = "";
|
||||||
|
result.value = null;
|
||||||
|
searching.value = true;
|
||||||
|
elapsed.value = 0;
|
||||||
|
saveConfig();
|
||||||
|
ticker = setInterval(() => elapsed.value++, 1000);
|
||||||
|
try {
|
||||||
|
const res = await fetch("/py/hotels/search", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify(buildRequest()),
|
||||||
|
});
|
||||||
|
let payload = null;
|
||||||
|
try {
|
||||||
|
payload = await res.json();
|
||||||
|
} catch {
|
||||||
|
/* non-JSON body (e.g. nginx timeout page) */
|
||||||
|
}
|
||||||
|
if (!res.ok) throw new Error(describeError(res.status, payload));
|
||||||
|
result.value = payload;
|
||||||
|
} catch (e) {
|
||||||
|
errorMsg.value = e.message || "Search failed.";
|
||||||
|
} finally {
|
||||||
|
clearInterval(ticker);
|
||||||
|
ticker = null;
|
||||||
|
searching.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function loadOrigins() {
|
||||||
|
try {
|
||||||
|
const res = await fetch("/py/hotels/origins");
|
||||||
|
if (res.ok) origins.value = await res.json();
|
||||||
|
} catch {
|
||||||
|
/* dropdown falls back to the default key only */
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
originKey.value !== CUSTOM_ORIGIN &&
|
||||||
|
origins.value.length &&
|
||||||
|
!origins.value.some((o) => o.key === originKey.value)
|
||||||
|
)
|
||||||
|
originKey.value = origins.value[0].key;
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadConfig();
|
||||||
|
loadOrigins();
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
if (ticker) clearInterval(ticker);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<main class="flex justify-center px-4 py-10">
|
||||||
|
<div class="max-w-4xl w-full flex flex-col gap-6">
|
||||||
|
<section>
|
||||||
|
<Header>Cheap Travelodge Finder</Header>
|
||||||
|
<Paragraph>
|
||||||
|
Finds the cheapest Travelodge for a stay in London
|
||||||
|
<em>including the cost of getting there and back</em> from
|
||||||
|
a chosen station, so a £45 room forty minutes out can be
|
||||||
|
compared fairly with a £90 room in Zone 1. Room prices come
|
||||||
|
live from Travelodge; fares and routes come from
|
||||||
|
<InlineLink
|
||||||
|
href="https://tfl.gov.uk/plan-a-journey/"
|
||||||
|
target="_blank"
|
||||||
|
>TfL Journey Planner</InlineLink
|
||||||
|
>.
|
||||||
|
</Paragraph>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="panel">
|
||||||
|
<h2 class="panelTitle">Search</h2>
|
||||||
|
<form class="configGrid" @submit.prevent="onSearch">
|
||||||
|
<label>
|
||||||
|
Search area
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="location"
|
||||||
|
maxlength="80"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Check-in
|
||||||
|
<input type="date" v-model="checkin" required />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Nights
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model.number="nights"
|
||||||
|
min="1"
|
||||||
|
max="14"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Rooms & guests
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
v-model="guests"
|
||||||
|
placeholder='"1", "2+1", "2,2+2"'
|
||||||
|
maxlength="40"
|
||||||
|
/>
|
||||||
|
<span class="hint"
|
||||||
|
>rooms separated by commas, each ADULTS or
|
||||||
|
ADULTS+CHILDREN</span
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Railcard holders
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model.number="railcardHolders"
|
||||||
|
min="0"
|
||||||
|
max="8"
|
||||||
|
/>
|
||||||
|
<span class="hint"
|
||||||
|
>adults getting 1/3 off off-peak rail</span
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Origin station
|
||||||
|
<select v-model="originKey">
|
||||||
|
<option v-for="o in origins" :key="o.key" :value="o.key">
|
||||||
|
{{ o.name }}
|
||||||
|
</option>
|
||||||
|
<option v-if="!origins.length" value="clapham junction">
|
||||||
|
Clapham Junction
|
||||||
|
</option>
|
||||||
|
<option :value="CUSTOM_ORIGIN">Custom lat,lon…</option>
|
||||||
|
</select>
|
||||||
|
<input
|
||||||
|
v-if="originKey === CUSTOM_ORIGIN"
|
||||||
|
type="text"
|
||||||
|
v-model="customOrigin"
|
||||||
|
placeholder="51.5031,-0.1132"
|
||||||
|
class="mt-1"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Leave at
|
||||||
|
<input type="time" v-model="depart" required />
|
||||||
|
<span class="hint"
|
||||||
|
>16:00–19:00 Mon–Fri is peak (dearer, no
|
||||||
|
railcard)</span
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Hotels to price
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model.number="top"
|
||||||
|
min="1"
|
||||||
|
max="25"
|
||||||
|
/>
|
||||||
|
<span class="hint"
|
||||||
|
>N cheapest by room rate; fewer is faster</span
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Max miles from search area
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model="maxMiles"
|
||||||
|
min="0.5"
|
||||||
|
max="50"
|
||||||
|
step="0.5"
|
||||||
|
placeholder="any"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Max travel minutes
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
v-model.number="maxTravelMin"
|
||||||
|
min="10"
|
||||||
|
max="240"
|
||||||
|
/>
|
||||||
|
<span class="hint"
|
||||||
|
>slower routes are ignored when picking the
|
||||||
|
cheapest</span
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<button class="btn" type="submit" :disabled="searching">
|
||||||
|
{{ searching ? "Searching…" : "Search" }}
|
||||||
|
</button>
|
||||||
|
<span class="statusChip" :class="statusText.toLowerCase()">
|
||||||
|
{{ statusText }}
|
||||||
|
</span>
|
||||||
|
<span v-if="searching" class="stepCounter"
|
||||||
|
>{{ elapsed }}s</span
|
||||||
|
>
|
||||||
|
<span class="note">
|
||||||
|
Takes about a minute: every hotel is priced on TfL
|
||||||
|
twice.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<p v-if="errorMsg" class="errorBox">{{ errorMsg }}</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section v-if="result" class="panel">
|
||||||
|
<h2 class="panelTitle">
|
||||||
|
Results
|
||||||
|
<span v-if="result.cached" class="cachedTag">cached</span>
|
||||||
|
</h2>
|
||||||
|
<p class="summary">{{ summaryText }}</p>
|
||||||
|
|
||||||
|
<div v-if="bestRow" class="best">
|
||||||
|
<span class="bestLabel">Best value</span>
|
||||||
|
<span class="bestName">{{ bestRow.name }}</span>
|
||||||
|
<span class="bestMaths">
|
||||||
|
{{ gbp(bestRow.room_price) }} stay +
|
||||||
|
{{ gbp(bestRow.transport_total) }} travel =
|
||||||
|
<strong>{{ gbp(bestRow.total) }}</strong>
|
||||||
|
</span>
|
||||||
|
<a
|
||||||
|
class="bookLink"
|
||||||
|
:href="bestRow.url"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>Book →</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p v-if="!result.rows.length" class="note">
|
||||||
|
No hotels with availability matched that search.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div v-else class="tableWrap">
|
||||||
|
<table class="results">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="num">#</th>
|
||||||
|
<th class="num">Total</th>
|
||||||
|
<th class="num">Stay</th>
|
||||||
|
<th class="num">Travel</th>
|
||||||
|
<th class="num">Mins</th>
|
||||||
|
<th>Hotel</th>
|
||||||
|
<th>Route (cheapest acceptable)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<template v-for="(r, i) in result.rows" :key="r.code">
|
||||||
|
<tr :class="{ best: r === bestRow, unpriced: r.total === null }">
|
||||||
|
<td class="num">{{ i + 1 }}</td>
|
||||||
|
<td class="num total">{{ gbp(r.total) }}</td>
|
||||||
|
<td class="num">{{ gbp(r.room_price) }}</td>
|
||||||
|
<td class="num">{{ gbp(r.transport_total) }}</td>
|
||||||
|
<td class="num">{{ r.travel_minutes ?? "" }}</td>
|
||||||
|
<td>
|
||||||
|
<a
|
||||||
|
:href="r.url"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
class="hotelLink"
|
||||||
|
>{{ r.name }}</a
|
||||||
|
>
|
||||||
|
<span v-if="r.low_availability" class="lowTag"
|
||||||
|
>low availability</span
|
||||||
|
>
|
||||||
|
</td>
|
||||||
|
<td class="route">{{ r.route }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="showFaster(r)" class="fasterRow">
|
||||||
|
<td colspan="6"></td>
|
||||||
|
<td class="route">
|
||||||
|
faster: {{ r.fastest_minutes }} min for
|
||||||
|
{{ gbp(r.fastest_total) }} return via
|
||||||
|
{{ r.fastest_route }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<details class="help">
|
||||||
|
<summary>Notes</summary>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Stay price is Travelodge's cheapest room(s) for the
|
||||||
|
whole stay and all rooms.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Transport is the TfL adult pay-as-you-go single each
|
||||||
|
way, multiplied by adults. The return is assumed
|
||||||
|
off-peak (next day).
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Children 10 and under travel free on TfL; 11–15s pay
|
||||||
|
child fares with a Zip card (not included).
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
The Railcard's 1/3 off applies to off-peak Tube and
|
||||||
|
rail fares only, and only when the Railcard is linked
|
||||||
|
to an Oyster card (not contactless).
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Bus fares are flat and never discounted. Prices are
|
||||||
|
rounded to 5p. Everything is an estimate: check the
|
||||||
|
booking page and TfL before paying.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</details>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.panel {
|
||||||
|
border: 1px solid var(--color-quaternary);
|
||||||
|
background: rgba(4, 8, 15, 0.55);
|
||||||
|
padding: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panelTitle {
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
font-size: 1.4rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cachedTag {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: var(--color-muted);
|
||||||
|
border: 1px solid var(--color-quaternary);
|
||||||
|
padding: 0 0.4rem;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.configGrid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 0.6rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.configGrid label {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.configGrid input,
|
||||||
|
.configGrid select {
|
||||||
|
background: var(--color-surface-deep);
|
||||||
|
border: 1px solid var(--color-quaternary);
|
||||||
|
color: #e5f4ee;
|
||||||
|
padding: 0.35rem 0.5rem;
|
||||||
|
font-family: monospace;
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
.configGrid input:focus,
|
||||||
|
.configGrid select:focus {
|
||||||
|
outline: 1px solid var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 0.35rem 1.1rem;
|
||||||
|
border: 1px solid var(--color-primary);
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
background 0.15s ease,
|
||||||
|
color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:hover:enabled {
|
||||||
|
background: var(--color-primary);
|
||||||
|
color: var(--color-surface-deep);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn:disabled {
|
||||||
|
opacity: 0.35;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusChip {
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
padding: 0.1rem 0.6rem;
|
||||||
|
border: 1px solid currentColor;
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusChip.searching {
|
||||||
|
color: #ffd166;
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusChip.done {
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.statusChip.error {
|
||||||
|
color: var(--color-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stepCounter {
|
||||||
|
font-family: monospace;
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.note {
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorBox {
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
border: 1px solid var(--color-tertiary);
|
||||||
|
color: var(--color-tertiary);
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary {
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.best {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 0.75rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
border: 1px solid var(--color-primary);
|
||||||
|
padding: 0.5rem 0.75rem;
|
||||||
|
margin-bottom: 0.9rem;
|
||||||
|
background: rgba(85, 255, 187, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bestLabel {
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bestName {
|
||||||
|
color: #e5f4ee;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bestMaths {
|
||||||
|
font-family: monospace;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bestMaths strong {
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookLink,
|
||||||
|
.hotelLink {
|
||||||
|
color: var(--color-primary);
|
||||||
|
text-decoration: none;
|
||||||
|
transition: color 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookLink {
|
||||||
|
margin-left: auto;
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookLink:hover,
|
||||||
|
.hotelLink:hover {
|
||||||
|
color: var(--color-tertiary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableWrap {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #e5f4ee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results th {
|
||||||
|
text-align: left;
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
font-weight: normal;
|
||||||
|
border-bottom: 1px solid var(--color-quaternary);
|
||||||
|
padding: 0.3rem 0.5rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results td {
|
||||||
|
padding: 0.3rem 0.5rem;
|
||||||
|
border-bottom: 1px solid rgba(2, 73, 66, 0.4);
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results .num {
|
||||||
|
text-align: right;
|
||||||
|
font-family: monospace;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results .total {
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.results tr.best td {
|
||||||
|
background: rgba(85, 255, 187, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.results tr.unpriced td {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.results .route {
|
||||||
|
color: var(--color-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fasterRow td {
|
||||||
|
border-bottom: 1px solid rgba(2, 73, 66, 0.4);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
opacity: 0.75;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fasterRow td:first-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lowTag {
|
||||||
|
margin-left: 0.4rem;
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: var(--color-tertiary);
|
||||||
|
border: 1px solid currentColor;
|
||||||
|
padding: 0 0.3rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help {
|
||||||
|
margin-top: 0.9rem;
|
||||||
|
color: var(--color-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help summary {
|
||||||
|
cursor: pointer;
|
||||||
|
color: var(--color-primary);
|
||||||
|
font-family: var(--font-heading);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help ul {
|
||||||
|
list-style: disc;
|
||||||
|
padding-left: 1.4rem;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.configGrid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bookLink {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -60,10 +60,9 @@ onMounted(fetchFile);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main class="items-center flex flex-col">
|
<main class="items-center flex flex-col">
|
||||||
<div class="background" />
|
|
||||||
<div
|
<div
|
||||||
v-if="file"
|
v-if="file"
|
||||||
class="a4page-portrait border-primary-1 flex flex-col relative overflow-scroll gap-1 bg-bg_primary"
|
class="page-a4 border-primary-1 flex flex-col relative overflow-scroll gap-1 bg-surface"
|
||||||
>
|
>
|
||||||
<h1>{{ filename }}</h1>
|
<h1>{{ filename }}</h1>
|
||||||
<small>{{ last_edited }}</small>
|
<small>{{ last_edited }}</small>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export default defineConfig({
|
|||||||
"/api": "http://localhost:8080",
|
"/api": "http://localhost:8080",
|
||||||
"/gitea": "http://localhost:3000",
|
"/gitea": "http://localhost:3000",
|
||||||
"/radio": "http://localhost:8000",
|
"/radio": "http://localhost:8000",
|
||||||
"/searxng": "http://localhost:8080",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user