Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/AppNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ const items = [
<!--
NuxtLinkLocale adds the language prefix and sets aria-current on the active page.
The active page differs by weight and a bar, not by colour alone.
Little padding on phones: five names have to fit into 320 px.
-->
<NuxtLinkLocale
:to="item.to"
class="focus-inset flex min-h-nav items-center justify-center border-t-4 border-transparent px-3 text-sm text-muted current:border-accent current:font-strong current:text-accent md:border-t-0 md:border-b-4"
class="focus-inset flex min-h-nav items-center justify-center border-t-4 border-transparent px-1 text-sm text-muted current:border-accent current:font-strong current:text-accent md:border-t-0 md:border-b-4 md:px-3"
>
{{ t(item.label) }}
</NuxtLinkLocale>
Expand Down
40 changes: 40 additions & 0 deletions components/LandingActions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<script setup lang="ts">
// What a visitor can do on the start page: register or sign in, or open the dashboard.
const { t } = useI18n()
const session = useSessionStore()

// The server cannot know the session, so it renders the signed-out links.
// "onMounted" runs only in the browser, which then asks for the session.
onMounted(() => session.init())
</script>

<template>
<!--
Two columns in every state: two links side by side, or one across both.
So the page does not move when the session turns out to be signed in.
-->
<div class="grid w-full max-w-form grid-cols-2 gap-3">
<NuxtLinkLocale
v-if="session.isSignedIn"
to="/dashboard"
class="col-span-2 flex min-h-touch items-center justify-center rounded-md border border-accent bg-accent px-3 font-strong text-on-accent"
>
{{ t('landing.dashboard') }}
</NuxtLinkLocale>
<template v-else>
<!-- Both links have a border, so they are equally high. -->
<NuxtLinkLocale
to="/register"
class="flex min-h-touch items-center justify-center rounded-md border border-accent bg-accent px-3 font-strong text-on-accent"
>
{{ t('landing.register') }}
</NuxtLinkLocale>
<NuxtLinkLocale
to="/login"
class="flex min-h-touch items-center justify-center rounded-md border border-field bg-surface px-3 font-strong"
>
{{ t('landing.signIn') }}
</NuxtLinkLocale>
</template>
</div>
</template>
15 changes: 15 additions & 0 deletions components/LandingFeature.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script setup lang="ts">
// One thing the app does, explained on the start page.
const props = defineProps<{
title: string
text: string
}>()
</script>

<template>
<div class="flex h-full flex-col gap-2 rounded-lg border border-line bg-surface p-4">
<!-- break-words and hyphens-auto: long words must fit on narrow screens. -->
<h2 class="text-xl break-words hyphens-auto">{{ props.title }}</h2>
<p class="text-muted">{{ props.text }}</p>
</div>
</template>
3 changes: 2 additions & 1 deletion components/SessionControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ const session = useSessionStore()
>
{{ t('auth.signIn') }}
</NuxtLinkLocale>
<!-- px-2, like the link: with more room the header breaks into two lines at 320 px. -->
<button
v-else-if="session.isSignedIn"
type="button"
class="min-h-touch rounded-md border border-field px-3 text-sm font-strong"
class="min-h-touch rounded-md border border-field px-2 text-sm font-strong"
@click="session.signOut()"
>
{{ t('auth.signOut') }}
Expand Down
8 changes: 6 additions & 2 deletions docs/BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
- **F4 Dates** (list, add, mark done, delete, category filter; cards on all screen sizes): done (PR #18).
- **F4/F5 Dates table:** Lastenheft F4 asks for an interactive table. A desktop table view with sorting (`sort` and `order` exist in the API) comes later.
- **F7/F8 Dashboard** (countdown, dates created per month, category totals): done (PR #19).
- **F6 Location** (save and delete the own location, distance and midpoint, link to OpenStreetMap; no map):
claimed by `Filionus`, branch `feat/location`, in progress.
- **F6 Location** (save and delete the own location, distance and midpoint, link to OpenStreetMap; no map): done (PR #20).
- **Landing page** (start page `/`, `/en`, `/nl` with register and sign-in; "frontend prompt F10", not requirement F10):
claimed by `Filionus`, branch `feat/landing`, in progress.
- **Landing page, still open:** logo and illustrations from the designer (the page uses a text wordmark so far).
SEO beyond title and description: `hreflang` and canonical links, sitemap, `robots.txt`, Open Graph with a preview
image and structured data. Most of these need a fixed base URL.
- **F6 Map view, open requirement (Must):** Lastenheft F6 asks for a map view of both partners' locations, and the
course brief asks for geo information. F6 is not fulfilled until the map exists. The map library (Leaflet or
MapLibre) is still to be chosen.
Expand Down
83 changes: 74 additions & 9 deletions i18n/__tests__/persistence.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { fileURLToPath } from 'node:url'
import { fetch, setup } from '@nuxt/test-utils/e2e'
import { Window } from 'happy-dom'
import { describe, expect, test } from 'vitest'

// Builds the app once and sends real HTTP requests to it.
Expand Down Expand Up @@ -79,17 +80,81 @@ describe('returning visit', () => {
})
})

// What the server has to send for each language.
const landingPages = [
{
path: '/',
language: 'de-DE',
prefix: '',
title: 'Planer für die Fernbeziehung · Ons',
description: 'Ons ist die Web-App für Paare in einer Fernbeziehung: Dates gemeinsam planen, '
+ 'Entfernung und Mittelpunkt sehen, Countdown bis zum nächsten Date.',
heading: 'Euer Planer für die Fernbeziehung',
actions: ['Registrieren', 'Anmelden'],
features: ['Dates gemeinsam planen', 'Wissen, wie weit es ist', 'Der Countdown läuft'],
},
{
path: '/en',
language: 'en-GB',
prefix: '/en',
title: 'Planner for long-distance couples · Ons',
description: 'Ons is the web app for long-distance couples: plan dates together, see the distance '
+ 'and midpoint, and count down to your next date.',
heading: 'Your planner for a long-distance relationship',
actions: ['Register', 'Sign in'],
features: ['Plan dates together', 'Know how far it is', 'The countdown is on'],
},
{
path: '/nl',
language: 'nl-NL',
prefix: '/nl',
title: 'Planner voor een relatie op afstand · Ons',
description: 'Ons is de webapp voor stellen met een relatie op afstand: samen dates plannen, '
+ 'afstand en middelpunt zien, aftellen tot de volgende date.',
heading: 'Jullie planner voor een relatie op afstand',
actions: ['Registreren', 'Inloggen'],
features: ['Samen dates plannen', 'Weten hoe ver het is', 'Het aftellen is begonnen'],
},
]

// Reads the HTML the way a search engine would, without running any script.
function parse(html: string) {
const window = new Window()
return new window.DOMParser().parseFromString(html, 'text/html')
}

describe('the landing page', () => {
test.each([
['/', 'de-DE', 'Start'],
['/en', 'en-GB', 'Home'],
['/nl', 'nl-NL', 'Home'],
])('%s is rendered on the server in %s', async (path, language, heading) => {
const response = await visit(path, { saved: language.slice(0, 2) })
test.each(landingPages)('$path is rendered on the server in $language', async (expected) => {
const response = await visit(expected.path, { saved: expected.language.slice(0, 2) })
const page = parse(response.body)
const texts = (selector: string) => [...page.querySelectorAll(selector)].map(node => node.textContent.trim())

expect(response.status).toBe(200)
expect(response.body).toContain(`lang="${language}"`)
expect(response.body).toMatch(new RegExp(`<h1[^>]*>${heading}</h1>`))
expect(response.body).toContain(`<title>${heading} · Ons</title>`)
expect(page.documentElement.getAttribute('lang')).toBe(expected.language)
expect(page.title).toBe(expected.title)
expect(texts('h1')).toEqual([expected.heading])
expect(texts('main h2')).toEqual(expected.features)

// The server cannot know the session, so it always offers registering and signing in.
expect(texts('main a')).toEqual(expected.actions)
expect([...page.querySelectorAll('main a')].map(link => link.getAttribute('href')))
.toEqual([`${expected.prefix}/register`, `${expected.prefix}/login`])
})

test.each(landingPages)('$path describes itself for search engines', async (expected) => {
const response = await visit(expected.path, { saved: expected.language.slice(0, 2) })

const descriptions = parse(response.body).querySelectorAll('meta[name="description"]')

expect(descriptions).toHaveLength(1)
expect(descriptions[0]!.getAttribute('content')).toBe(expected.description)
expect(expected.description.length).toBeLessThanOrEqual(160)
})

test('no longer links to the health check', async () => {
const response = await visit('/', { saved: 'de' })

expect(response.body).not.toContain('/api/health')
})

test('contains no SEO link tags yet, because those need a fixed base URL (F10)', async () => {
Expand Down
29 changes: 24 additions & 5 deletions i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
"comingSoon": "Diese Seite folgt bald."
},
"pages": {
"home": {
"title": "Start",
"intro": "Euer gemeinsamer Planer für die Fernbeziehung.",
"backendStatus": "Backend-Status"
},
"dates": {
"title": "Dates"
},
Expand Down Expand Up @@ -232,6 +227,30 @@
"done": "Standort gelöscht."
}
},
"landing": {
"title": "Planer für die Fernbeziehung",
"description": "Ons ist die Web-App für Paare in einer Fernbeziehung: Dates gemeinsam planen, Entfernung und Mittelpunkt sehen, Countdown bis zum nächsten Date.",
"heading": "Euer Planer für die Fernbeziehung",
"subline": "Für Paare, die weit voneinander entfernt leben: Plant eure Dates gemeinsam und behaltet im Blick, wann das nächste ansteht.",
"register": "Registrieren",
"signIn": "Anmelden",
"dashboard": "Zur Übersicht",
"pairing": "Eine Person erstellt euren Bereich, die andere tritt mit einem Einladungscode bei.",
"features": {
"dates": {
"title": "Dates gemeinsam planen",
"text": "Sammelt eure Ideen in einer gemeinsamen Liste, ordnet sie Kategorien zu und hakt ab, was ihr erlebt habt."
},
"distance": {
"title": "Wissen, wie weit es ist",
"text": "Speichert eure Standorte und seht, wie viele Kilometer zwischen euch liegen und wo die Mitte ist. Den eigenen Standort könnt ihr jederzeit löschen."
},
"countdown": {
"title": "Der Countdown läuft",
"text": "Die Übersicht zeigt, wie viele Tage und Stunden es noch bis zu eurem nächsten Date mit Termin sind."
}
}
},
"errors": {
"unexpected": "Etwas ist schiefgelaufen. Bitte versuche es erneut.",
"network": "Keine Verbindung zum Server. Prüfe deine Internetverbindung und versuche es erneut.",
Expand Down
29 changes: 24 additions & 5 deletions i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
"comingSoon": "This page is coming soon."
},
"pages": {
"home": {
"title": "Home",
"intro": "Your shared planner for a long-distance relationship.",
"backendStatus": "Backend status"
},
"dates": {
"title": "Dates"
},
Expand Down Expand Up @@ -232,6 +227,30 @@
"done": "Location deleted."
}
},
"landing": {
"title": "Planner for long-distance couples",
"description": "Ons is the web app for long-distance couples: plan dates together, see the distance and midpoint, and count down to your next date.",
"heading": "Your planner for a long-distance relationship",
"subline": "For couples who live far apart: plan your dates together and always know when the next one is coming up.",
"register": "Register",
"signIn": "Sign in",
"dashboard": "Go to overview",
"pairing": "One of you creates your space, the other joins with an invite code.",
"features": {
"dates": {
"title": "Plan dates together",
"text": "Collect your ideas in a shared list, sort them into categories and tick off what you have done together."
},
"distance": {
"title": "Know how far it is",
"text": "Save your locations and see how many kilometres lie between you and where the middle is. You can delete your own location at any time."
},
"countdown": {
"title": "The countdown is on",
"text": "Your overview shows how many days and hours are left until your next date with a set time."
}
}
},
"errors": {
"unexpected": "Something went wrong. Please try again.",
"network": "The server cannot be reached. Check your internet connection and try again.",
Expand Down
29 changes: 24 additions & 5 deletions i18n/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
"comingSoon": "Deze pagina volgt binnenkort."
},
"pages": {
"home": {
"title": "Home",
"intro": "Jullie gezamenlijke planner voor een langeafstandsrelatie.",
"backendStatus": "Backendstatus"
},
"dates": {
"title": "Dates"
},
Expand Down Expand Up @@ -232,6 +227,30 @@
"done": "Locatie verwijderd."
}
},
"landing": {
"title": "Planner voor een relatie op afstand",
"description": "Ons is de webapp voor stellen met een relatie op afstand: samen dates plannen, afstand en middelpunt zien, aftellen tot de volgende date.",
"heading": "Jullie planner voor een relatie op afstand",
"subline": "Voor stellen die ver van elkaar wonen: plan samen jullie dates en weet altijd wanneer de volgende eraan komt.",
"register": "Registreren",
"signIn": "Inloggen",
"dashboard": "Naar het overzicht",
"pairing": "De een maakt jullie ruimte aan, de ander doet mee met een uitnodigingscode.",
"features": {
"dates": {
"title": "Samen dates plannen",
"text": "Verzamel jullie ideeën in een gedeelde lijst, geef ze een categorie en vink af wat jullie samen hebben gedaan."
},
"distance": {
"title": "Weten hoe ver het is",
"text": "Sla jullie locaties op en zie hoeveel kilometer er tussen jullie ligt en waar het midden is. Je eigen locatie kun je altijd verwijderen."
},
"countdown": {
"title": "Het aftellen is begonnen",
"text": "Het overzicht toont hoeveel dagen en uren het nog is tot jullie volgende date met een afgesproken tijd."
}
}
},
"errors": {
"unexpected": "Er is iets misgegaan. Probeer het opnieuw.",
"network": "De server is niet bereikbaar. Controleer je internetverbinding en probeer het opnieuw.",
Expand Down
Loading