Files
HealthLog/src/lib/command-palette/synonyms.ts
T
Marc-André Bombeck 715b733164 feat(shell): add a command palette for pages, settings, modules and actions
Cmd/Ctrl+K or the search control at the end of the top bar opens a
combobox over a client-side index built from the lists the navigation
already renders: pages, Insights pages, every Settings section and card
(deep-linked by a new anchor prop on SettingsCardHeader), the Appearance
sub-pages, module switches and a few actions. Entries follow the module
map, the Coach capability, the admin role and a shared record's grant;
inside somebody else's record no cards, switches or backup are offered.

Ranking is prefix, then word start, then substring, then a small edit
distance, then subsequence, with a short multilingual synonym list. The
empty state shows recent places (per account, in localStorage) and the
main actions. The palette is its own lazily loaded chunk; the top bar
shows a search field where it has room and a magnifier otherwise. The
module switch mutation moves into a shared hook used by the Modules hub
and the palette.
2026-10-09 16:35:21 +02:00

98 lines
4.3 KiB
TypeScript

/**
* Extra words people search with, per palette entry id, for the cases where
* the title in the reader's language is not the word they type: an English
* term in a German interface, an abbreviation, the device rather than the
* metric. Matched one tier below the title (`rank.ts`).
*
* Kept small on purpose. Every title is already searchable in its own
* language; an entry here earns its place by a word that title cannot carry.
* Only pages that exist are listed: there is no calf or other limb
* circumference page, so no synonym points at one.
*/
export const PALETTE_SYNONYMS: Readonly<Record<string, ReadonlyArray<string>>> =
{
// ── Pages ──
"nav:/": ["home", "start", "overview", "übersicht", "today", "heute"],
"nav:/measurements": ["values", "werte", "readings", "messwerte"],
"nav:/medications": [
"meds",
"pills",
"tablets",
"drugs",
"medikamente",
"tabletten",
"arzneimittel",
],
"nav:/labs": ["blood test", "bloodwork", "blutwerte", "labor", "labwerte"],
"nav:/checkups": ["preventive", "vorsorge", "screening", "reminders"],
"nav:/coach": ["chat", "ai", "ki", "assistant", "assistent"],
"nav:/documents": ["pdf", "scan", "befunde", "arztbrief", "letters"],
"nav:/timeline": ["history", "verlauf", "lebenslauf", "chronik"],
"nav:/illness": ["sick", "krank", "krankheit", "symptoms"],
"nav:/vaccinations": ["vaccine", "impfung", "impfpass", "shots"],
"nav:/mood": ["stimmung", "feelings", "gefühle", "journal"],
"nav:/cycle": ["period", "menstruation", "periode", "zyklus"],
"nav:/notifications": ["alerts", "benachrichtigungen", "inbox"],
// ── Insights ──
"insights:weight": ["weight", "gewicht", "kg", "scale", "waage"],
"insights:blood-pressure": [
"bp",
"rr",
"blood pressure",
"blutdruck",
"hypertension",
"systolic",
"diastolic",
],
"insights:pulse": ["heart rate", "herzfrequenz", "hr", "puls", "bpm"],
"insights:resting-pulse": ["resting heart rate", "ruhepuls", "rhr"],
"insights:hrv": ["heart rate variability", "herzfrequenzvariabilität"],
"insights:sleep": ["sleep", "schlaf", "nacht", "night"],
"insights:steps": ["steps", "schritte", "walking", "gehen"],
"insights:blood-glucose": [
"glucose",
"sugar",
"blutzucker",
"zucker",
"cgm",
"diabetes",
],
"insights:body-fat": ["fat", "körperfett", "kfa"],
"insights:oxygen": ["spo2", "sauerstoff", "oxygen", "o2"],
"insights:body-temperature": ["fever", "fieber", "temperatur"],
"insights:cardio-fitness": ["vo2", "vo2max", "fitness"],
"insights:workouts": ["training", "sport", "exercise", "workouts"],
"insights:mood": ["stimmung", "mood"],
"insights:waist": ["waist", "taille", "bauchumfang", "umfang"],
"insights:daylight": ["sun", "sonne", "tageslicht", "outdoors"],
// ── Settings ──
"settings:security#passkeys": [
"passkey",
"webauthn",
"face id",
"touch id",
],
"settings:security#two-factor": ["2fa", "totp", "mfa", "authenticator"],
"settings:security#password": ["passwort", "kennwort"],
"settings:export#full-backup": ["backup", "sicherung", "datensicherung"],
"settings:export#import-apple-health": ["healthkit", "iphone", "import"],
"settings:integrations#apple-health": ["healthkit", "iphone"],
"settings:integrations#withings": ["scale", "waage"],
"settings:integrations#channels": ["telegram", "ntfy", "push", "email"],
"settings:privacy#delete-data": ["delete", "löschen", "gdpr", "dsgvo"],
"settings:advanced#delete-account": ["delete account", "konto löschen"],
"settings:ai#ai-provider": ["openai", "anthropic", "ollama", "llm", "key"],
"settings:api#api-tokens": ["token", "api key", "bearer"],
"settings:modules": ["features", "funktionen", "module"],
"settings:account": ["profil", "profile", "name", "email"],
// ── Actions ──
"action:capture": ["add", "new", "log", "neu", "eintragen", "erfassen"],
"action:today": ["today", "heute", "day", "tag"],
"action:backup": ["backup", "sicherung", "export"],
"action:coach": ["chat", "ai", "ki", "ask", "fragen"],
"action:shortcuts": ["keyboard", "tastatur", "hotkeys", "shortcuts"],
};