mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-20 05:56:53 +00:00
4346d7f2c1
A help icon on every screen opens a panel with the screen's overview, its sub-screens, task guides with a framed picture per step, search across guides and the wiki, and a switch to any other screen's help. Guides exist for the dashboard, Vacay, Atlas, Collections, Journey (list, journal, studio), Settings (all tabs), Admin (all tabs) and the trip frame; the trip's own screens are in progress. Pictures are produced by Playwright (client/e2e/help), texts in all 23 languages.
15 lines
563 B
TypeScript
15 lines
563 B
TypeScript
import { useLocation } from 'react-router'
|
|
|
|
/**
|
|
* A screen's route ready to follow. A trip screen's route carries `:id`, which
|
|
* only the address of the trip the reader is on can fill in; browsed from
|
|
* elsewhere, such a screen has no way in and the button stays away.
|
|
*/
|
|
export function useScreenRoute(route: string | undefined): string | null {
|
|
const { pathname } = useLocation()
|
|
if (!route) return null
|
|
if (!route.includes(':id')) return route
|
|
const match = /^\/trips\/(\d+)/.exec(pathname)
|
|
return match ? route.replace(':id', match[1]) : null
|
|
}
|