feat(help): rewrite the help center for v5 with a Tours section, new pictures in every language, and fix the tour planner bugs it surfaced

Every help screen checked against the v5 redesign. Tours is documented for
the first time, as a screen of its own with twelve screens under it, and
notifications get help of their own. All pictures are taken again on a
realistic demo trip, with short loops where a still cannot show the motion.
The English is plain and every language is written naturally rather than
word for word.

The switcher shows two levels at most, a screen's overview lists its
sub-screens as cards above its guides, each wiki page is linked once, and
the help sidebar is wider.

Fixes found along the way: Save to Collection keeps a tour's route, a track
dropped on the places column opens the Tours import, tour Share on desktop,
the unsaved tour draft lives on the account, a route click no longer adds
an end point, Trip places leaves the trip's tours out, Escape closes a
stage's day menu, confirms before destructive deletes, DWD warnings sharing
one id kept apart, a booking's date moves with it, and smaller fixes across
notifications, bookings, the day plan, stays, Atlas, Collections, Vacay and
the admin screens.
This commit is contained in:
Maurice
2026-10-22 22:29:35 +02:00
parent 98f7549ac5
commit 31859651d7
2517 changed files with 160592 additions and 60094 deletions
+2 -39
View File
@@ -76,6 +76,7 @@ import {
import { getSocketId } from './websocket'
import { probeNow } from '../sync/connectivity'
import { downloadBlob } from '../utils/fileDownload'
import { translateRateLimit } from './rateLimitMessage'
/**
* Validate a response payload against its @trek/shared Zod schema — but only in
@@ -112,45 +113,6 @@ function checkInDev<T>(schema: z.ZodTypeAny, data: T, label: string): T {
}
return data
}
const RATE_LIMIT_MESSAGES: Record<string, string> = {
en: 'Too many attempts. Please try again later.',
de: 'Zu viele Versuche. Bitte versuchen Sie es später erneut.',
es: 'Demasiados intentos. Inténtelo de nuevo más tarde.',
et: 'Liiga palju katseid. Palun proovi hiljem uuesti.',
fr: 'Trop de tentatives. Veuillez réessayer plus tard.',
hu: 'Túl sok próbálkozás. Kérjük, próbálja újra később.',
nl: 'Te veel pogingen. Probeer het later opnieuw.',
br: 'Muitas tentativas. Tente novamente mais tarde.',
cs: 'Příliš mnoho pokusů. Zkuste to prosím znovu.',
sk: 'Príliš veľa pokusov. Skúste to prosím neskôr.',
pl: 'Zbyt wiele prób. Spróbuj ponownie później.',
ru: 'Слишком много попыток. Попробуйте позже.',
zh: '尝试次数过多,请稍后再试。',
'zh-TW': '嘗試次數過多,請稍後再試。',
it: 'Troppi tentativi. Riprova più tardi.',
tr: 'Çok fazla deneme. Lütfen daha sonra tekrar deneyin.',
ar: 'محاولات كثيرة جدًا. يرجى المحاولة لاحقًا.',
az: 'Həddindən çox cəhd edildi. Bir az sonra yenidən cəhd edin.',
id: 'Terlalu banyak percobaan. Coba lagi nanti.',
ja: '試行回数が多すぎます。時間をおいて再度お試しください。',
ko: '시도 횟수가 너무 많습니다. 잠시 후 다시 시도해 주세요.',
th: 'พยายามหลายครั้งเกินไป โปรดลองอีกครั้งภายหลัง',
uk: 'Занадто багато спроб. Спробуйте пізніше.',
sv: 'För många försök. Prova igen senare.',
ca: 'Massa intents. Torneu-ho a provar més tard.',
gr: 'Πάρα πολλές προσπάθειες. Δοκιμάστε ξανά αργότερα.',
vi: 'Quá nhiều lần thử. Vui lòng thử lại sau.',
}
function translateRateLimit(): string {
const fallback = RATE_LIMIT_MESSAGES['en']!
try {
const lang = localStorage.getItem('app_language') || localStorage.getItem('app_language_server') || 'en'
return RATE_LIMIT_MESSAGES[lang] ?? fallback
} catch {
return fallback
}
}
export const apiClient: AxiosInstance = axios.create({
baseURL: '/api',
@@ -602,6 +564,7 @@ export const adminApi = {
updateUser: (id: number, data: Record<string, unknown>) => apiClient.put(`/admin/users/${id}`, data).then(r => r.data),
deleteUser: (id: number) => apiClient.delete(`/admin/users/${id}`).then(r => r.data),
resetUserPasskeys: (id: number) => apiClient.delete(`/admin/users/${id}/passkeys`).then(r => r.data),
resetUserMfa: (id: number) => apiClient.delete(`/admin/users/${id}/mfa`).then(r => r.data),
stats: () => apiClient.get('/admin/stats').then(r => r.data),
saveDemoBaseline: () => apiClient.post('/admin/save-demo-baseline').then(r => r.data),
getOidc: () => apiClient.get('/admin/oidc').then(r => r.data),
+31
View File
@@ -0,0 +1,31 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import { translateRateLimit } from './rateLimitMessage';
describe('translateRateLimit', () => {
afterEach(() => {
localStorage.clear();
vi.restoreAllMocks();
});
it('uses the language the user picked', () => {
localStorage.setItem('app_language', 'de');
expect(translateRateLimit()).toBe('Zu viele Versuche. Bitte versuchen Sie es später erneut.');
});
it('falls back to the server default language when the user picked none', () => {
localStorage.setItem('app_language_server', 'fr');
expect(translateRateLimit()).toBe('Trop de tentatives. Veuillez réessayer plus tard.');
});
it('answers in English for an unknown language', () => {
localStorage.setItem('app_language', 'xx');
expect(translateRateLimit()).toBe('Too many attempts. Please try again later.');
});
it('answers in English when storage cannot be read', () => {
vi.spyOn(Storage.prototype, 'getItem').mockImplementation(() => {
throw new Error('blocked');
});
expect(translateRateLimit()).toBe('Too many attempts. Please try again later.');
});
});
+44
View File
@@ -0,0 +1,44 @@
/**
* The 429 message the axios interceptor shows instead of the server's English
* text. It reads the language straight from storage because the interceptor runs
* outside React and cannot reach the translation context.
*/
const RATE_LIMIT_MESSAGES: Record<string, string> = {
en: 'Too many attempts. Please try again later.',
de: 'Zu viele Versuche. Bitte versuchen Sie es später erneut.',
es: 'Demasiados intentos. Inténtelo de nuevo más tarde.',
et: 'Liiga palju katseid. Palun proovi hiljem uuesti.',
fr: 'Trop de tentatives. Veuillez réessayer plus tard.',
hu: 'Túl sok próbálkozás. Kérjük, próbálja újra később.',
nl: 'Te veel pogingen. Probeer het later opnieuw.',
br: 'Muitas tentativas. Tente novamente mais tarde.',
cs: 'Příliš mnoho pokusů. Zkuste to prosím znovu.',
sk: 'Príliš veľa pokusov. Skúste to prosím neskôr.',
pl: 'Zbyt wiele prób. Spróbuj ponownie później.',
ru: 'Слишком много попыток. Попробуйте позже.',
zh: '尝试次数过多,请稍后再试。',
'zh-TW': '嘗試次數過多,請稍後再試。',
it: 'Troppi tentativi. Riprova più tardi.',
tr: 'Çok fazla deneme. Lütfen daha sonra tekrar deneyin.',
ar: 'محاولات كثيرة جدًا. يرجى المحاولة لاحقًا.',
az: 'Həddindən çox cəhd edildi. Bir az sonra yenidən cəhd edin.',
id: 'Terlalu banyak percobaan. Coba lagi nanti.',
ja: '試行回数が多すぎます。時間をおいて再度お試しください。',
ko: '시도 횟수가 너무 많습니다. 잠시 후 다시 시도해 주세요.',
th: 'พยายามหลายครั้งเกินไป โปรดลองอีกครั้งภายหลัง',
uk: 'Занадто багато спроб. Спробуйте пізніше.',
sv: 'För många försök. Prova igen senare.',
ca: 'Massa intents. Torneu-ho a provar més tard.',
gr: 'Πάρα πολλές προσπάθειες. Δοκιμάστε ξανά αργότερα.',
vi: 'Quá nhiều lần thử. Vui lòng thử lại sau.',
};
export function translateRateLimit(): string {
const fallback = RATE_LIMIT_MESSAGES['en']!;
try {
const lang = localStorage.getItem('app_language') || localStorage.getItem('app_language_server') || 'en';
return RATE_LIMIT_MESSAGES[lang] ?? fallback;
} catch {
return fallback;
}
}
+16
View File
@@ -0,0 +1,16 @@
import type { TourDraftPutRequest, TourDraftResponse } from '@trek/shared';
import apiClient from './client';
/** Where the signed-in user's planner draft of a trip lives; a write queued offline replays to the same path. */
export function tourDraftPath(tripId: number | string): string {
return `/trips/${tripId}/tour-draft`;
}
/** The Tours planner's unsaved draft on the account, one per user and trip. */
export const tourDraftsApi = {
read: (tripId: number | string): Promise<TourDraftResponse> =>
apiClient.get(tourDraftPath(tripId)).then((r) => r.data),
keep: (tripId: number | string, body: TourDraftPutRequest): Promise<TourDraftResponse> =>
apiClient.put(tourDraftPath(tripId), body).then((r) => r.data),
forget: (tripId: number | string): Promise<void> => apiClient.delete(tourDraftPath(tripId)).then(() => undefined),
};