Add Python FastAPI service, cheap hotels page, and Tailwind theme refactor
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:
2026-09-08 00:06:04 +01:00
co-authored by Claude Fable 5.1
parent d777ea4b7d
commit 152f60ee32
66 changed files with 2209 additions and 1020 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<main class="flex flex-col items-center">
<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>
<RouterLink to="/" class="bdr-2">
+3 -32
View File
@@ -62,7 +62,7 @@ function print() {
<style scoped>
.cv-root {
background: white;
background: var(--color-paper);
}
.cv-selector {
@@ -74,30 +74,8 @@ function print() {
justify-content: center;
gap: 0.5rem;
padding: 0.5rem;
background: white;
border-bottom: 1px solid #ddd;
}
.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;
background: var(--color-paper);
border-bottom: 1px solid var(--color-line);
}
.cv-print-btn {
@@ -105,7 +83,6 @@ function print() {
}
.cv-jobs-btn {
text-decoration: none;
margin-left: auto;
}
@@ -125,12 +102,6 @@ function print() {
opacity: 0;
transform: translateY(-6px);
}
@media print {
.no-print {
display: none !important;
}
}
</style>
<style src="./cv-shared.css"></style>
+2 -2
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-between">
<div class="cv-page justify-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<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="a4page gap-10">
<div class="cv-page gap-10">
<section>
<h2>Experience</h2>
<Project>
+2 -2
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-between">
<div class="cv-page justify-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<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="a4page gap-10">
<div class="cv-page gap-10">
<section>
<h2>Experience</h2>
<Project>
+1 -1
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-between">
<div class="cv-page justify-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<h1 class="name">Adam French</h1>
+2 -2
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-between">
<div class="cv-page justify-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<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="a4page gap-10">
<div class="cv-page gap-10">
<section>
<h2>Experience</h2>
<Project>
+1 -1
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page place-content-between">
<div class="cv-page place-content-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<h1 class="name">Adam French</h1>
+1 -1
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-between">
<div class="cv-page justify-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<h1 class="name">Adam French</h1>
+2 -2
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-around">
<div class="cv-page justify-around">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<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="a4page justify-around">
<div class="cv-page justify-around">
<section>
<h2>Secondary Education</h2>
<div
+2 -2
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<div class="no-print w-full h-20"></div>
<div class="a4page justify-between">
<div class="cv-page justify-between">
<section>
<div class="flex flex-col sm:flex-row sm:justify-between">
<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="a4page gap-10">
<div class="cv-page gap-10">
<section>
<h2>Experience</h2>
<Project>
+2 -2
View File
@@ -5,7 +5,7 @@ import Project from "./Project.vue";
<template>
<main class="cv-template">
<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">
<h1 class="name">Adam French</h1>
<div class="contact-details">
@@ -147,7 +147,7 @@ import Project from "./Project.vue";
<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">
<section class="flex-1">
<h2>
+47 -111
View File
@@ -254,14 +254,14 @@ function copyToClipboard(text) {
function statusClass(status) {
const map = {
Applied: "status-applied",
Screening: "status-screening",
Interview: "status-interview",
Offer: "status-offer",
Rejected: "status-rejected",
Withdrawn: "status-withdrawn",
Applied: "bg-blue-100 text-blue-800",
Screening: "bg-yellow-100 text-yellow-800",
Interview: "bg-violet-100 text-violet-800",
Offer: "bg-green-100 text-green-800",
Rejected: "bg-red-100 text-red-800",
Withdrawn: "bg-gray-100 text-gray-500",
};
return map[status] ?? "";
return map[status] ?? "bg-gray-200 text-gray-700";
}
onMounted(() => {
@@ -278,7 +278,7 @@ onMounted(() => {
<h2 class="ja-heading">Job Applications</h2>
</div>
<button
class="ja-btn"
class="cv-btn"
@click="exportCsv"
:disabled="!applications.length"
>
@@ -299,17 +299,17 @@ onMounted(() => {
<span class="ja-ref-label">{{ ref.label }}</span>
<span class="ja-ref-value" :title="ref.value">{{ ref.value }}</span>
<button
class="ja-btn ja-btn-sm"
class="cv-btn cv-btn-sm"
@click="copyToClipboard(ref.value)"
title="Copy"
>
Copy
</button>
<button class="ja-btn ja-btn-sm" @click="startRefEdit(ref)">
<button class="cv-btn cv-btn-sm" @click="startRefEdit(ref)">
Edit
</button>
<button
class="ja-btn ja-btn-sm ja-btn-danger"
class="cv-btn cv-btn-sm cv-btn-danger"
@click="deleteReference(ref.id)"
>
Delete
@@ -335,12 +335,12 @@ onMounted(() => {
placeholder="Value"
/>
<button
class="ja-btn ja-btn-sm ja-btn-primary"
class="cv-btn cv-btn-sm cv-btn-primary"
@click="saveRefEdit(ref.id)"
>
Save
</button>
<button class="ja-btn ja-btn-sm" @click="cancelRefEdit">
<button class="cv-btn cv-btn-sm" @click="cancelRefEdit">
Cancel
</button>
</template>
@@ -367,7 +367,7 @@ onMounted(() => {
placeholder="Value *"
required
/>
<button type="submit" class="ja-btn ja-btn-primary">Add</button>
<button type="submit" class="cv-btn cv-btn-primary">Add</button>
</form>
</div>
@@ -411,7 +411,7 @@ onMounted(() => {
class="ja-input ja-textarea"
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>
</form>
@@ -451,11 +451,11 @@ onMounted(() => {
<td>{{ app.appliedAt ? app.appliedAt.substring(0, 10) : "—" }}</td>
<td class="ja-notes-cell">{{ app.notes ?? "" }}</td>
<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
</button>
<button
class="ja-btn ja-btn-sm ja-btn-danger"
class="cv-btn cv-btn-sm cv-btn-danger"
@click="deleteApplication(app.id)"
>
Delete
@@ -510,12 +510,12 @@ onMounted(() => {
</td>
<td class="ja-actions">
<button
class="ja-btn ja-btn-sm ja-btn-primary"
class="cv-btn cv-btn-sm cv-btn-primary"
@click="saveEdit(app.id)"
>
Save
</button>
<button class="ja-btn ja-btn-sm" @click="cancelEdit">
<button class="cv-btn cv-btn-sm" @click="cancelEdit">
Cancel
</button>
</td>
@@ -528,10 +528,11 @@ onMounted(() => {
</template>
<style scoped>
/* Colours are the paper palette from CVLayout.vue; buttons are .cv-btn from there too. */
.ja-root {
padding: 1.5rem;
border-top: 2px solid #333;
background: #fafafa;
border-top: 2px solid var(--color-ink-soft);
background: var(--color-paper-tint);
}
.ja-header {
@@ -549,21 +550,21 @@ onMounted(() => {
.ja-back {
font-size: 0.85rem;
color: #555;
color: var(--color-ink-muted);
text-decoration: none;
}
.ja-back:hover {
color: #111;
color: var(--color-ink);
}
.ja-heading {
font-size: 1.1rem;
font-weight: 600;
margin: 0;
color: #333;
color: var(--color-ink-soft);
}
/* Forms */
.ja-form {
display: flex;
flex-direction: column;
@@ -579,17 +580,17 @@ onMounted(() => {
.ja-input {
padding: 0.35rem 0.6rem;
border: 1px solid #ccc;
border: 1px solid var(--color-line);
border-radius: 4px;
font-size: 0.85rem;
background: white;
background: var(--color-paper);
flex: 1;
min-width: 120px;
}
.ja-input:focus {
outline: none;
border-color: #555;
border-color: var(--color-ink-muted);
}
.ja-select {
@@ -608,47 +609,7 @@ onMounted(() => {
min-width: 0;
}
.ja-btn {
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;
}
/* Applications table */
.ja-table {
width: 100%;
border-collapse: collapse;
@@ -659,18 +620,18 @@ onMounted(() => {
.ja-table td {
text-align: left;
padding: 0.45rem 0.6rem;
border-bottom: 1px solid #e0e0e0;
border-bottom: 1px solid var(--color-line-soft);
vertical-align: middle;
}
.ja-table th {
font-weight: 600;
color: #555;
background: #f0f0f0;
color: var(--color-ink-muted);
background: var(--color-paper-shade);
}
.ja-table tr:hover td {
background: #f5f5f5;
background: var(--color-paper-shade);
}
.ja-edit-row td {
@@ -691,7 +652,7 @@ onMounted(() => {
}
.ja-link {
color: #0066cc;
color: var(--color-ink-link);
text-decoration: none;
}
@@ -699,59 +660,34 @@ onMounted(() => {
text-decoration: underline;
}
/* Status pill; colour classes come from statusClass() */
.ja-badge {
display: inline-block;
padding: 0.15rem 0.5rem;
border-radius: 10px;
font-size: 0.78rem;
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 {
color: #888;
color: var(--color-ink-faint);
font-size: 0.9rem;
}
/* Quick-reference box */
.ja-ref-section {
margin-bottom: 1.5rem;
padding: 1rem;
border: 1px solid #e0e0e0;
border: 1px solid var(--color-line-soft);
border-radius: 6px;
background: #fff;
background: var(--color-paper);
}
.ja-ref-heading {
font-size: 1rem;
font-weight: 600;
margin: 0 0 0.75rem 0;
color: #333;
margin-bottom: 0.75rem;
color: var(--color-ink-soft);
}
.ja-ref-category {
@@ -761,9 +697,9 @@ onMounted(() => {
.ja-ref-cat-label {
font-size: 0.85rem;
font-weight: 600;
color: #555;
color: var(--color-ink-muted);
text-transform: capitalize;
margin: 0 0 0.35rem 0;
margin-bottom: 0.35rem;
}
.ja-ref-item {
@@ -776,13 +712,13 @@ onMounted(() => {
.ja-ref-label {
font-size: 0.85rem;
font-weight: 500;
color: #333;
color: var(--color-ink-soft);
min-width: 80px;
}
.ja-ref-value {
font-size: 0.85rem;
color: #555;
color: var(--color-ink-muted);
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
@@ -791,7 +727,7 @@ onMounted(() => {
.ja-ref-empty {
font-size: 0.8rem;
color: #999;
color: var(--color-ink-faint);
margin: 0.2rem 0;
}
+130 -136
View File
@@ -1,214 +1,208 @@
/*
* Shared styles for CV templates.
* 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>.
* Shared styles for the CV templates (src/views/CV/CV*.vue).
*
* @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 {
/* Color palette — overrides global :root vars within CV scope */
--primary: black;
--secondary: #000088;
--tertiary: #ff0000;
--quaternary: #cccccc;
--background: white;
--color-primary: black;
--color-secondary: #000088; /* links, table text */
--color-tertiary: #ff0000; /* link hover, table rules */
--color-quaternary: #cccccc; /* table header background */
--color-surface: white;
/* Fonts */
--font-heading: big_noodle_titling;
--font-text: CreatoDisplay;
/* Variation hooks — defaults match Hospitality/Frontend/Backend/Temp */
--cv-page-padding: 8mm;
--cv-line-height: 1.4;
--cv-page-gap: 0;
--cv-name-size: 3.1em;
--cv-heading-size: 2.1em;
--cv-subheading-size: 1.7em;
--cv-subsubheading-size: 1.4em;
--cv-text-size: 1em;
--cv-small-size: 1em;
--cv-list-size: 0.92em;
--cv-heading-transform: capitalize;
--cv-heading-margin: 0;
--cv-page-padding: 8mm;
--cv-line-height: 1.4;
--cv-page-gap: 0;
--cv-name-size: 3.1em;
--cv-heading-size: 2.1em;
--cv-subheading-size: 1.7em;
--cv-subsubheading-size: 1.4em;
--cv-text-size: 1em;
--cv-small-size: 1em;
--cv-list-size: 0.92em;
--cv-heading-transform: capitalize;
--cv-heading-margin: 0;
}
.cv-template main {
padding: 0;
display: flex;
flex-direction: column;
height: fit-content;
background-color: var(--background);
padding: 0;
display: flex;
flex-direction: column;
height: fit-content;
background-color: var(--color-surface);
}
.cv-template .a4page {
width: 210mm;
height: 297mm;
padding: var(--cv-page-padding);
line-height: var(--cv-line-height);
gap: var(--cv-page-gap);
box-sizing: border-box;
background-color: var(--background);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
border: 1px solid var(--primary);
overflow: hidden;
margin: auto auto;
display: flex;
flex-direction: column;
font-family: var(--font-text);
/* One A4 sheet */
.cv-template .cv-page {
width: 210mm;
height: 297mm;
padding: var(--cv-page-padding);
line-height: var(--cv-line-height);
gap: var(--cv-page-gap);
box-sizing: border-box;
background-color: var(--color-surface);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
border: 1px solid var(--color-primary);
overflow: hidden;
margin: auto auto;
display: flex;
flex-direction: column;
font-family: var(--font-body);
}
/* Typography */
.cv-template .name {
font-size: var(--cv-name-size);
font-size: var(--cv-name-size);
}
.cv-template h1,
.cv-template h2,
.cv-template h3,
.cv-template h4 {
margin: var(--cv-heading-margin);
color: var(--primary);
font-family: var(--font-heading);
text-transform: var(--cv-heading-transform);
margin: var(--cv-heading-margin);
color: var(--color-primary);
font-family: var(--font-heading);
text-transform: var(--cv-heading-transform);
}
.cv-template h1 {
font-size: var(--cv-heading-size);
font-size: var(--cv-heading-size);
}
.cv-template h2 {
border-bottom: 1px solid var(--primary);
margin-bottom: 2px;
font-size: var(--cv-subheading-size);
}
.cv-template h3 {
font-size: var(--cv-subsubheading-size);
border-bottom: 1px solid var(--color-primary);
margin-bottom: 2px;
font-size: var(--cv-subheading-size);
}
.cv-template h3,
.cv-template h4 {
font-size: var(--cv-subsubheading-size);
font-size: var(--cv-subsubheading-size);
}
.cv-template p {
margin-bottom: 0.2em;
color: var(--primary);
font-size: var(--cv-text-size);
margin-bottom: 0.2em;
color: var(--color-primary);
font-size: var(--cv-text-size);
}
.cv-template a {
background-color: transparent;
color: var(--secondary);
font-family: inherit;
background-color: transparent;
color: var(--color-secondary);
font-family: inherit;
}
.cv-template a:hover {
color: var(--tertiary);
color: var(--color-tertiary);
}
.cv-template small {
font-size: var(--cv-small-size);
color: var(--primary);
font-size: var(--cv-small-size);
color: var(--color-primary);
}
.cv-template ul {
font-size: var(--cv-list-size);
margin: 0;
padding-left: 1.2em;
font-size: var(--cv-list-size);
margin: 0;
padding-left: 1.2em;
}
.cv-template li {
font-size: var(--cv-list-size);
color: var(--primary);
list-style: disc;
font-size: var(--cv-list-size);
color: var(--color-primary);
list-style: disc;
}
/* Grids */
.cv-template .skills-grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 0.3em 1em;
margin-bottom: 0.2em;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 0.3em 1em;
margin-bottom: 0.2em;
}
.cv-template .grades-grid {
display: grid;
grid-template-columns: repeat(2, auto 1fr);
column-gap: 0.5em;
row-gap: 0.1em;
font-size: var(--cv-text-size);
color: var(--primary);
margin: 0.15em 0;
display: grid;
grid-template-columns: repeat(2, auto 1fr);
column-gap: 0.5em;
row-gap: 0.1em;
font-size: var(--cv-text-size);
color: var(--color-primary);
margin: 0.15em 0;
}
.cv-template .grades-grid > span:nth-child(4n + 2),
.cv-template .grades-grid > span:nth-child(4n) {
font-weight: 600;
padding-right: 1.5em;
}
@media (max-width: 640px) {
.cv-template .grades-grid {
grid-template-columns: auto 1fr;
}
font-weight: 600;
padding-right: 1.5em;
}
/* Tables */
.cv-template table {
color: var(--secondary);
border-collapse: collapse;
border: 1px solid black;
color: var(--color-secondary);
border-collapse: collapse;
border: 1px solid black;
}
.cv-template td {
color: var(--secondary);
border-top: 1px solid var(--tertiary);
padding: 1px 10px;
font-size: var(--cv-text-size);
text-align: left;
color: var(--color-secondary);
border-top: 1px solid var(--color-tertiary);
padding: 1px 10px;
font-size: var(--cv-text-size);
text-align: left;
}
.cv-template th {
color: var(--secondary);
border: 2px solid var(--tertiary);
padding: 1px 0 1px 7px;
font-family: var(--font-heading);
font-size: var(--cv-subsubheading-size);
background-color: var(--quaternary);
text-align: left;
color: var(--color-secondary);
border: 2px solid var(--color-tertiary);
padding: 1px 0 1px 7px;
font-family: var(--font-heading);
font-size: var(--cv-subsubheading-size);
background-color: var(--color-quaternary);
text-align: left;
}
/* Phone */
@media (max-width: 640px) {
.cv-template .a4page {
width: 100%;
height: auto;
overflow: visible;
box-shadow: none;
border: none;
}
.cv-template .cv-page {
width: 100%;
height: auto;
overflow: visible;
box-shadow: none;
border: none;
}
.cv-template .skills-grid {
grid-template-columns: 1fr;
}
.cv-template .skills-grid {
grid-template-columns: 1fr;
}
.cv-template .grades-grid {
grid-template-columns: auto 1fr;
}
}
/* Print: one sheet per page */
@page {
size: A4;
margin: 0;
size: A4;
margin: 0;
}
@media print {
.cv-template .no-print {
display: none !important;
}
.cv-template .cv-page {
margin: 0;
border: none;
box-shadow: none;
break-after: page;
}
.cv-template .a4page {
margin: 0;
border: none;
box-shadow: none;
break-after: page;
}
.cv-template .a4page:last-of-type {
break-after: auto;
}
.cv-template .cv-page:last-of-type {
break-after: auto;
}
}
+7 -7
View File
@@ -11,13 +11,13 @@ import ManageRadio from "./ManageRadio.vue";
<template>
<main class="justify-center flex flex-row w-full h-full">
<div class="bdr-1 flex flex-col">
<CreateUser class="bdr-2 bg-bg_primary" />
<CreatePost class="bdr-2 bg-bg_primary" />
<CreateFavorite class="bdr-2 bg-bg_primary" />
<CreateActivity class="bdr-2 bg-bg_primary" />
<CreateRowing class="bdr-2 bg-bg_primary" />
<ManageUsers class="bdr-2 bg-bg_primary" />
<ManageRadio class="bdr-2 bg-bg_primary" />
<CreateUser class="bdr-2 bg-surface" />
<CreatePost class="bdr-2 bg-surface" />
<CreateFavorite class="bdr-2 bg-surface" />
<CreateActivity class="bdr-2 bg-surface" />
<CreateRowing class="bdr-2 bg-surface" />
<ManageUsers class="bdr-2 bg-surface" />
<ManageRadio class="bdr-2 bg-surface" />
</div>
</main>
</template>
+29 -29
View File
@@ -730,14 +730,14 @@ onBeforeUnmount(() => {
<style scoped>
.panel {
border: 1px solid var(--quaternary);
border: 1px solid var(--color-quaternary);
background: rgba(4, 8, 15, 0.55);
padding: 0.9rem;
}
.panelTitle {
color: var(--primary);
font-family: var(--font_heading);
color: var(--color-primary);
font-family: var(--font-heading);
font-size: 1.4rem;
margin-bottom: 0.5rem;
}
@@ -751,11 +751,11 @@ onBeforeUnmount(() => {
}
.statusChip {
font-family: var(--font_heading);
font-family: var(--font-heading);
letter-spacing: 0.05em;
padding: 0.1rem 0.6rem;
border: 1px solid currentColor;
color: var(--primary);
color: var(--color-primary);
}
.statusChip.paused {
@@ -763,21 +763,21 @@ onBeforeUnmount(() => {
}
.statusChip.accepted {
color: var(--secondary);
color: var(--color-secondary);
}
.statusChip.rejected,
.statusChip.error {
color: var(--tertiary);
color: var(--color-tertiary);
}
.stepCounter {
font-family: monospace;
color: var(--portal_grey);
color: var(--color-muted);
}
.terminalNote {
color: var(--portal_grey);
color: var(--color-muted);
font-size: 0.85rem;
}
@@ -791,9 +791,9 @@ onBeforeUnmount(() => {
.btn {
padding: 0.35rem 1.1rem;
border: 1px solid var(--primary);
color: var(--primary);
font-family: var(--font_heading);
border: 1px solid var(--color-primary);
color: var(--color-primary);
font-family: var(--font-heading);
letter-spacing: 0.05em;
cursor: pointer;
transition:
@@ -802,8 +802,8 @@ onBeforeUnmount(() => {
}
.btn:hover:enabled {
background: var(--primary);
color: var(--bg_secondary);
background: var(--color-primary);
color: var(--color-surface-deep);
}
.btn:disabled {
@@ -815,12 +815,12 @@ onBeforeUnmount(() => {
display: flex;
align-items: center;
gap: 0.4rem;
color: var(--portal_grey);
color: var(--color-muted);
font-size: 0.9rem;
}
.speedLabel input[type="range"] {
accent-color: var(--primary);
accent-color: var(--color-primary);
width: 8rem;
}
@@ -831,17 +831,17 @@ onBeforeUnmount(() => {
.presetSelect {
margin-left: auto;
background: var(--bg_secondary);
color: var(--primary);
border: 1px solid var(--quaternary);
background: var(--color-surface-deep);
color: var(--color-primary);
border: 1px solid var(--color-quaternary);
padding: 0.3rem 0.5rem;
}
.errorBox {
margin-top: 0.75rem;
padding: 0.5rem 0.75rem;
border: 1px solid var(--tertiary);
color: var(--tertiary);
border: 1px solid var(--color-tertiary);
color: var(--color-tertiary);
font-family: monospace;
font-size: 0.9rem;
}
@@ -865,7 +865,7 @@ onBeforeUnmount(() => {
display: flex;
flex-direction: column;
gap: 0.2rem;
color: var(--portal_grey);
color: var(--color-muted);
font-size: 0.85rem;
}
@@ -876,8 +876,8 @@ onBeforeUnmount(() => {
.configGrid input,
.configGrid textarea,
.derivedGrid input {
background: var(--bg_secondary);
border: 1px solid var(--quaternary);
background: var(--color-surface-deep);
border: 1px solid var(--color-quaternary);
color: #e5f4ee;
padding: 0.35rem 0.5rem;
font-family: monospace;
@@ -888,24 +888,24 @@ onBeforeUnmount(() => {
}
.derivedGrid input {
color: var(--portal_grey);
color: var(--color-muted);
}
.configGrid input:focus,
.configGrid textarea:focus {
outline: 1px solid var(--primary);
outline: 1px solid var(--color-primary);
}
.help {
margin-top: 0.9rem;
color: var(--portal_grey);
color: var(--color-muted);
font-size: 0.9rem;
}
.help summary {
cursor: pointer;
color: var(--primary);
font-family: var(--font_heading);
color: var(--color-primary);
font-family: var(--font-heading);
letter-spacing: 0.05em;
}
+3 -12
View File
@@ -2,15 +2,14 @@
import { computed, ref, defineAsyncComponent } from "vue";
import LinkTable from "@/components/util/LinkTable.vue";
import Header from "@/components/text/Header.vue";
import CreateToggle from "@/components/input/CreateToggle.vue";
import { useHomeDataStore } from "@/stores/homeData";
import { useAuthStore } from "@/stores/auth";
const CreateBookmark = defineAsyncComponent(
() => import("@/views/admin/CreateBookmark.vue"),
);
const homeData = useHomeDataStore();
const authStore = useAuthStore();
const showCreate = ref(false);
@@ -27,16 +26,8 @@ const groupedBookmarks = computed(() => {
<template>
<div class="bookmarks-wrapper">
<Header class="text-left">
<span class="flex items-center justify-between w-full">
{{ showCreate ? "Create Bookmark" : "Bookmarks" }}
<button
v-if="authStore.user.admin"
class="text-sm px-1"
@click="showCreate = !showCreate"
>
{{ showCreate ? "x" : "+" }}
</button>
</span>
{{ showCreate ? "Create Bookmark" : "Bookmarks" }}
<template #action><CreateToggle v-model="showCreate" /></template>
</Header>
<CreateBookmark
v-if="showCreate"
+3 -12
View File
@@ -2,33 +2,24 @@
import AutoScroll from "@/components/util/AutoScroll.vue";
import LinkTable from "@/components/util/LinkTable.vue";
import Header from "@/components/text/Header.vue";
import CreateToggle from "@/components/input/CreateToggle.vue";
import { ref, defineAsyncComponent } from "vue";
import { useActivityStore } from "@/stores/activity";
import { useAuthStore } from "@/stores/auth";
const CreateActivity = defineAsyncComponent(
() => import("@/views/admin/CreateActivity.vue"),
);
const activityStore = useActivityStore();
const authStore = useAuthStore();
const showCreate = ref(false);
</script>
<template>
<div class="flex flex-col items-center">
<Header>
<span class="flex items-center justify-between w-full">
{{ showCreate ? "Create Activity" : "Consumption" }}
<button
v-if="authStore.user.admin"
class="text-sm px-1"
@click="showCreate = !showCreate"
>
{{ showCreate ? "x" : "+" }}
</button>
</span>
{{ showCreate ? "Create Activity" : "Consumption" }}
<template #action><CreateToggle v-model="showCreate" /></template>
</Header>
<CreateActivity
v-if="showCreate"
+3 -12
View File
@@ -1,34 +1,25 @@
<script setup>
import Header from "@/components/text/Header.vue";
import CreateToggle from "@/components/input/CreateToggle.vue";
import LinkTable from "@/components/util/LinkTable.vue";
import AutoScroll from "@/components/util/AutoScroll.vue";
import { ref, defineAsyncComponent } from "vue";
import { useFavoritesStore } from "@/stores/favorites";
import { useAuthStore } from "@/stores/auth";
const CreateFavorite = defineAsyncComponent(
() => import("@/views/admin/CreateFavorite.vue"),
);
const favoritesStore = useFavoritesStore();
const authStore = useAuthStore();
const showCreate = ref(false);
</script>
<template>
<div class="flex flex-col items-center">
<Header>
<span class="flex items-center justify-between w-full">
{{ showCreate ? "Create Favorite" : "favs" }}
<button
v-if="authStore.user.admin"
class="text-sm px-1"
@click="showCreate = !showCreate"
>
{{ showCreate ? "x" : "+" }}
</button>
</span>
{{ showCreate ? "Create Favorite" : "favs" }}
<template #action><CreateToggle v-model="showCreate" /></template>
</Header>
<CreateFavorite
v-if="showCreate"
+3 -10
View File
@@ -2,6 +2,7 @@
import Button from "@/components/input/Button.vue";
import Markdown from "@/components/util/Markdown.vue";
import Header from "@/components/text/Header.vue";
import CreateToggle from "@/components/input/CreateToggle.vue";
import { ref, computed, defineAsyncComponent } from "vue";
import { useAuthStore } from "@/stores/auth";
@@ -45,16 +46,8 @@ function deletePost() {
<template>
<div class="flex flex-col flex-1 min-h-0">
<Header>
<span class="flex items-center justify-between w-full">
{{ showCreate ? "Create Post" : post.title }}
<button
v-if="authStore.user.admin"
class="text-sm px-1"
@click="showCreate = !showCreate"
>
{{ showCreate ? "x" : "+" }}
</button>
</span>
{{ showCreate ? "Create Post" : post.title }}
<template #action><CreateToggle v-model="showCreate" /></template>
</Header>
<CreatePost
v-if="showCreate"
+21 -30
View File
@@ -1,8 +1,8 @@
<script setup>
import { ref, computed, defineAsyncComponent } from "vue";
import Header from "@/components/text/Header.vue";
import CreateToggle from "@/components/input/CreateToggle.vue";
import { useHomeDataStore } from "@/stores/homeData";
import { useAuthStore } from "@/stores/auth";
import { storeToRefs } from "pinia";
const CreateRowing = defineAsyncComponent(
@@ -10,7 +10,6 @@ const CreateRowing = defineAsyncComponent(
);
const store = useHomeDataStore();
const authStore = useAuthStore();
const { loaded, error, rowingSessions } = storeToRefs(store);
const showCreate = ref(false);
@@ -21,9 +20,9 @@ const metric = ref("distance");
const hovered = ref(null);
const METRICS = [
{ key: "distance", label: "Distance (m)", color: "#55ffbb" },
{ key: "timePer500m", label: "Pace /500m", color: "#ff579a" },
{ key: "calories", label: "Calories", color: "#62ff57" },
{ key: "distance", label: "Distance (m)", color: "var(--color-primary)" },
{ key: "timePer500m", label: "Pace /500m", color: "var(--color-tertiary)" },
{ key: "calories", label: "Calories", color: "var(--color-secondary)" },
];
const activeMetric = computed(() =>
@@ -117,16 +116,8 @@ function formatValue(key, val) {
<template>
<div class="flex flex-col h-full overflow-hidden">
<Header>
<span class="flex items-center justify-between w-full">
{{ showCreate ? "Upload Rowing" : "Rowing" }}
<button
v-if="authStore.user.admin"
class="text-sm px-1"
@click="showCreate = !showCreate"
>
{{ showCreate ? "x" : "+" }}
</button>
</span>
{{ showCreate ? "Upload Rowing" : "Rowing" }}
<template #action><CreateToggle v-model="showCreate" /></template>
</Header>
<CreateRowing
@@ -150,7 +141,7 @@ function formatValue(key, val) {
class="metric-btn text-xs px-2 py-0.5 font-heading border"
:style="{
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',
}"
@click="metric = m.key"
@@ -176,7 +167,7 @@ function formatValue(key, val) {
:y1="yl.y"
:x2="W - PR"
:y2="yl.y"
stroke="var(--quaternary)"
stroke="var(--color-quaternary)"
stroke-width="0.5"
/>
@@ -220,8 +211,8 @@ function formatValue(key, val) {
:y="yl.y + 3"
text-anchor="end"
font-size="10"
fill="var(--primary)"
font-family="var(--font_heading)"
fill="var(--color-primary)"
font-family="var(--font-heading)"
>
{{ yl.label }}
</text>
@@ -234,8 +225,8 @@ function formatValue(key, val) {
:y="H - 4"
text-anchor="middle"
font-size="10"
fill="var(--primary)"
font-family="var(--font_heading)"
fill="var(--color-primary)"
font-family="var(--font-heading)"
>
{{ xl.label }}
</text>
@@ -246,7 +237,7 @@ function formatValue(key, val) {
:y1="PT"
:x2="PL"
:y2="PT + PLOT_H"
stroke="var(--primary)"
stroke="var(--color-primary)"
stroke-width="0.5"
/>
<line
@@ -254,7 +245,7 @@ function formatValue(key, val) {
:y1="PT + PLOT_H"
:x2="W - PR"
:y2="PT + PLOT_H"
stroke="var(--primary)"
stroke="var(--color-primary)"
stroke-width="0.5"
/>
@@ -265,7 +256,7 @@ function formatValue(key, val) {
:y="points[hovered].y - 20"
width="82"
height="32"
fill="var(--bg_primary)"
fill="var(--color-surface)"
:stroke="activeMetric.color"
stroke-width="0.5"
rx="1"
@@ -274,8 +265,8 @@ function formatValue(key, val) {
:x="Math.min(points[hovered].x + 7, W - 82)"
:y="points[hovered].y - 6"
font-size="12"
fill="var(--secondary)"
font-family="var(--font_heading)"
fill="var(--color-secondary)"
font-family="var(--font-heading)"
>
{{
points[hovered].date.toLocaleDateString("en-GB", {
@@ -290,7 +281,7 @@ function formatValue(key, val) {
:y="points[hovered].y + 8"
font-size="14"
:fill="activeMetric.color"
font-family="var(--font_heading)"
font-family="var(--font-heading)"
>
{{ formatValue(metric, points[hovered].value) }}
</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 flex-col items-center">
<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
>
</div>
@@ -312,7 +303,7 @@ function formatValue(key, val) {
rows.reduce((s, r) => s + r.distance, 0).toLocaleString()
}}m</span
>
<span class="text-quaternary" style="font-size: 0.6rem"
<span class="text-quaternary text-[0.6rem]"
>total dist</span
>
</div>
@@ -322,7 +313,7 @@ function formatValue(key, val) {
rows.reduce((s, r) => s + r.timePer500m, 0) / (rows.length || 1),
)
}}</span>
<span class="text-quaternary" style="font-size: 0.6rem"
<span class="text-quaternary text-[0.6rem]"
>avg pace</span
>
</div>
+26 -53
View File
@@ -2,14 +2,10 @@
import Timer from "@/components/util/Timer.vue";
import Time from "@/components/util/Time.vue";
import Radio from "@/components/util/Radio.vue";
import Elle from "@/components/elle/Elle.vue";
import Chat from "@/components/util/Chat.vue";
import MusicPlayer from "@/components/util/MusicPlayer.vue";
import CommitHistory from "@/components/util/CommitHistory.vue";
import Intro from "./Intro.vue";
import Intro2 from "./Intro2.vue";
import BadApple from "./BadApple.vue";
import Miku from "./Miku.vue";
import Stamps from "./Stamps.vue";
import Listening from "./Listening.vue";
@@ -17,7 +13,6 @@ import Links from "./Links.vue";
import Feed from "./Feed.vue";
import Collage from "./Collage.vue";
import Favorites from "./Favorites.vue";
// import Gym from "./Gym.vue";
import Gym2 from "./Gym2.vue";
import Consumption from "./Consumption.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">
<div class="outerWrap flex flex-row">
<div class="sidebar">
<Time class="time-sidebar sidebar-cell" />
<Timer class="timer-sidebar sidebar-cell" />
<Radio class="radio-sidebar sidebar-cell" />
<CommitHistory class="commits-sidebar flex-1 sidebar-cell" />
<!-- <Elle class="flex-1" /> -->
<!-- <MusicPlayer /> -->
<Time class="time-sidebar cell" />
<Timer class="timer-sidebar cell" />
<Radio class="radio-sidebar cell" />
<CommitHistory class="commits-sidebar flex-1 cell" />
<img
src="/img/memes/fire-woman.gif"
alt=""
@@ -44,26 +36,23 @@ import Bookmarks from "./Bookmarks.vue";
loading="lazy"
/>
</div>
<div class="a4page-portrait homeGrid relative bdr-1 border-quaternary">
<!-- <Intro class="intro" /> -->
<Intro2 class="intro grid-cell" />
<!-- <BadApple class="intro" /> -->
<Listening class="listening grid-cell" />
<Stamps class="stamps grid-cell" />
<Feed class="feed grid-cell" />
<Links class="links grid-cell" />
<Collage class="collage grid-cell" />
<Consumption class="consumption grid-cell" />
<Favorites class="favorites grid-cell" />
<!-- <Gym class="gym" /> -->
<Gym2 class="gym grid-cell" />
<div class="page-a4 homeGrid relative bdr-1 border-quaternary">
<Intro2 class="intro cell" />
<Listening class="listening cell" />
<Stamps class="stamps cell" />
<Feed class="feed cell" />
<Links class="links cell" />
<Collage class="collage cell" />
<Consumption class="consumption cell" />
<Favorites class="favorites cell" />
<Gym2 class="gym cell" />
</div>
<div class="sidebar">
<Steam class="steam-sidebar sidebar-cell" />
<Bookmarks class="bookmarks-sidebar sidebar-cell" />
<Chat class="chat-sidebar flex-1 min-h-0 chat-home sidebar-cell" />
<Steam class="steam-sidebar cell" />
<Bookmarks class="bookmarks-sidebar cell" />
<Chat class="chat-sidebar flex-1 min-h-0 chat-home cell" />
<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>
@@ -71,13 +60,13 @@ import Bookmarks from "./Bookmarks.vue";
</template>
<style scoped>
.grid-cell {
background-color: var(--bg_primary);
border-width: 2px;
border-style: solid;
border-color: var(--quaternary);
/* Every widget, in the grid or a sidebar */
.cell {
background-color: var(--color-surface);
border: 2px solid var(--color-quaternary);
}
/* Grid placement — see grid-template-areas in .homeGrid below */
.intro {
grid-area: intro;
}
@@ -106,13 +95,6 @@ import Bookmarks from "./Bookmarks.vue";
grid-area: favorites;
}
.sidebar-cell {
background-color: var(--bg_primary);
border-width: 2px;
border-style: solid;
border-color: var(--quaternary);
}
.sidebar {
margin: 0;
flex: 1;
@@ -128,6 +110,7 @@ import Bookmarks from "./Bookmarks.vue";
gap: 10px;
}
/* Desktop: 10x10 grid on the A4 sheet */
.homeGrid {
display: grid;
gap: 5px;
@@ -154,6 +137,7 @@ import Bookmarks from "./Bookmarks.vue";
height: 15rem;
}
/* Tablet: sidebars stack below the sheet */
@media (max-width: 1360px) {
.outerWrap {
flex-direction: column;
@@ -197,14 +181,9 @@ import Bookmarks from "./Bookmarks.vue";
.timer-sidebar {
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) {
.homeGrid {
border-image: none;
@@ -234,10 +213,4 @@ import Bookmarks from "./Bookmarks.vue";
display: none;
}
}
.bg-random {
background-color: var(--bg_primary);
background-image: url("/img/miku/miku2.gif");
background-size: 10px 10px;
}
</style>
+1
View File
@@ -7,6 +7,7 @@ const site_links = [
{ name: "CV", link: "/cv" },
{ name: "Bookmarks", link: "/bookmarks" },
{ name: "Shrines", link: "/shrines" },
{ name: "Hotels", link: "/hotels" },
{ name: "Admin", link: "/admin" },
];
-15
View File
@@ -87,19 +87,4 @@ p {
width: 100%;
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>
-15
View File
@@ -108,21 +108,6 @@ p {
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) {
.steam-wrapper {
height: auto;
+1 -1
View File
@@ -14,7 +14,7 @@ const videoSources = [
<template>
<main class="items-center flex flex-col">
<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>
<Link href="https://wiki.teamfortress.com/wiki/Demoman">The goat</Link>
+1 -1
View File
@@ -5,7 +5,7 @@ import Wip from "@/components/util/Wip.vue";
<template>
<main class="items-center flex flex-col">
<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 />
</div>
+1 -1
View File
@@ -5,7 +5,7 @@ import Wip from "@/components/util/Wip.vue";
<template>
<main class="items-center flex flex-col">
<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 />
</div>
+1 -2
View File
@@ -10,9 +10,8 @@ const shrine_links = [
<template>
<main class="items-center flex flex-col">
<div class="background" />
<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" />
</div>
@@ -5,7 +5,7 @@ import Wip from "@/components/util/Wip.vue";
<template>
<main class="items-center flex flex-col">
<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 />
</div>
+793
View File
@@ -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 &amp; 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>
+1 -2
View File
@@ -60,10 +60,9 @@ onMounted(fetchFile);
<template>
<main class="items-center flex flex-col">
<div class="background" />
<div
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>
<small>{{ last_edited }}</small>