MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / stepSub

Function stepSub

ui/src/lib/steps-model.ts:264–286  ·  view source on GitHub ↗
(step: WireStep, project: ProjectKind = 'app')

Source from the content-addressed store, hash-verified

262
263/** The second line: what the step is, then where it is. */
264export 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

Callers 3

buildOrderModelFunction · 0.90
buildStepsModelFunction · 0.85

Calls 1

triggerWordsFunction · 0.85

Tested by

no test coverage detected