(step: WireStep, project: ProjectKind = 'app')
| 262 | |
| 263 | /** The second line: what the step is, then where it is. */ |
| 264 | export function stepSub(step: WireStep, project: ProjectKind = 'app'): string { |
| 265 | const file = step.node ? step.node.file.slice(step.node.file.lastIndexOf('/') + 1) : ''; |
| 266 | switch (step.kind) { |
| 267 | case 'screen': |
| 268 | return step.sub; |
| 269 | case 'trigger': |
| 270 | // The event before the file: `onPress · <Button> · index.tsx`. |
| 271 | return step.trigger ? `${triggerWords(step.trigger)} · ${file}` : `handler · ${file}`; |
| 272 | case 'bridge': |
| 273 | // An endpoint the code crosses to says its handler, as an endpoint box does. |
| 274 | if (step.screen) return step.sub; |
| 275 | return `${project === 'app' ? 'native' : project === 'web' ? 'server' : 'another tier'} · ${file}`; |
| 276 | case 'event': |
| 277 | return `${step.label} · ${file}`; |
| 278 | case 'store': |
| 279 | return `${project === 'api' ? 'data' : 'store'} · ${file}`; |
| 280 | case 'effect': |
| 281 | return step.sub; |
| 282 | default: |
| 283 | // The anchor: its file, at the size of a box; the panel prints the whole path. |
| 284 | return step.node && step.sub === step.node.file ? file : step.sub; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | /* ------------------------------------------------------------- decisions -- */ |
| 289 |
no test coverage detected