Modules
Help center
Search with highlighting, topics, articles with steps and tips, feedback and a contact page with suggestions.
The help center (/help, /help/[slug], /help/contact) lives in useHelpCenter() over mocks/help.mock.ts, which only holds ids and metadata: articles with author, optional extras per section (tip, steps) and an action route, plus updates, popular searches, support channels, tickets and uptime. The copy is UI text in locales/<code>/help.json (s<n>.heading|text|tip|step<i>, action).
Files
File | Role |
|---|---|
pages/help/index.vue | The index and the results view. |
pages/help/[slug].vue | An article; 404 when it does not exist. |
pages/help/contact.vue | The contact form, tickets and uptime. |
composables/useHelpCenter.ts | Articles, topics, search and support data. |
utils/help.ts | Excerpts, ranking, neighbours and uptime, unit tested. |
components/pages/help/ | HelpHero, HelpTopicCard, HelpContactCard. |
Rules
Pure functions in utils/, unit tested in tests/unit/. Statuses and segments are derived from the stored data, never stored themselves.
snippet()
An excerpt around the match.
snippet(text: string, term: string, radius = SNIPPET_RADIUS): string
rankByOverlap()
Suggestions while typing.
rankByOverlap(query: string, items: T[], text: (item: T) => string, limit = 3): T[]
uptimePercent()
Uptime.
uptimePercent(days: UptimeDay[]): number
splitMatch()
Highlighting.
splitMatch(text: string, term: string): TextPart[]
How it works
- The index starts with
HelpHero: search with the/hotkey synced to?q=, popular searches and the system status. - With a query or
?topic=it becomes the results view: aBaseSectionNavof topics with counts, matches highlighted withBaseTextMatchand excerpts fromsnippet(). Otherwise it showsHelpTopicCards, popular articles with the FAQ, what’s new andHelpContactCard. - Articles show
BaseStepList, tips, a deep-link button,BaseFeedbackPrompt(asks why on “No”), previous and next and an aside withBaseTableOfContents, copy link, the topic’s articles and contact. /help/contactsuggests articles while typing, sends a demo request and lists tickets and uptime (BaseMiniBars).
Add an article
Add its metadata (id, topic, author, sections, optional extras and action) to mocks/help.mock.ts and its copy to locales/<code>/help.json in every language. Search, topics, previous and next and the table of contents pick it up.