(trail: WireTrail)
| 115 | |
| 116 | /** Hover text: the whole walk, in order, with its arrows. */ |
| 117 | export function trailTitle(trail: WireTrail): string { |
| 118 | const path = trail.hops |
| 119 | .map((hop, index) => (index === 0 ? hop.name : `${arrow(hop)} ${hop.name}`)) |
| 120 | .join(' '); |
| 121 | const when = trail.updatedAt ? ` — saved ${trail.updatedAt.slice(0, 10)}` : ''; |
| 122 | return `${path}${when}`; |
| 123 | } |
| 124 | |
| 125 | function arrow(hop: WireTrailHop): string { |
| 126 | return hop.dir === 'up' ? '←' : hop.dir === 'down' ? '→' : '·'; |
no test coverage detected