Skip to content

hooks/useDisplayPath

import { … } from 'zidane-ui'ui/src/hooks/useDisplayPath.tsx

Components#

PathDisplayProviderComponent#

Gives the components below each host's home folder.

TypeScript
function PathDisplayProvider(props: PathDisplayProviderProps): Element
Parameters
NameTypeDescription
propsPathDisplayProviderProps

The homes and the children.

Element
PathDisplayProvider props
NameTypeDescription
children?ReactNode

The components that show paths.

homesReadonly<Record<string, string | undefined>>

Each host's home folder, by host id ('local': this computer).

ui/src/hooks/useDisplayPath.tsx:54

PathDisplayScopeComponent#

Names the host of the paths below that don't name one: a server session's transcript shows its paths with the server's home folder.

TypeScript
function PathDisplayScope(props: PathDisplayScopeProps): Element
Parameters
NameTypeDescription
propsPathDisplayScopeProps

The hostId and the children.

Element
PathDisplayScope props
NameTypeDescription
children?ReactNode

The components that show paths.

hostId?string | null

The host the paths below are on (HostView.id). Absent or null: this computer.

ui/src/hooks/useDisplayPath.tsx:79

Functions#

useDisplayPathFunction#

The nearest PathDisplayProvider's display; without one, paths show in full.

TypeScript
function useDisplayPath(): PathDisplay

ui/src/hooks/useDisplayPath.tsx:87

Interfaces#

PathDisplayInterface#

Shows paths with their machine's home folder as ~.

TypeScript
interface PathDisplay
PathDisplay properties
NameTypeDescription
path(path: string, hostId?: string | null) => string

A path: a leading home folder becomes ~. hostId absent or null: the scope's host, else this computer.

text(text: string, hostId?: string | null) => string

A line holding paths (in /Users/ada/x): each home folder that starts a path becomes ~.

ui/src/hooks/useDisplayPath.tsx:26

PathDisplayProviderPropsInterface#

Props for PathDisplayProvider.

TypeScript
interface PathDisplayProviderProps
PathDisplayProviderProps properties
NameTypeDescription
children?ReactNode

The components that show paths.

homesReadonly<Record<string, string | undefined>>

Each host's home folder, by host id ('local': this computer).

ui/src/hooks/useDisplayPath.tsx:42

PathDisplayScopePropsInterface#

Props for PathDisplayScope.

TypeScript
interface PathDisplayScopeProps
PathDisplayScopeProps properties
NameTypeDescription
children?ReactNode

The components that show paths.

hostId?string | null

The host the paths below are on (HostView.id). Absent or null: this computer.

ui/src/hooks/useDisplayPath.tsx:66