File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -33,23 +33,18 @@ export default function BreadcrumbBarForBlockId({
3333 const [ searchParams ] = useSearchParams ( )
3434 const s = searchParams . toString ( ) . length === 0 ? "" : "&" + searchParams
3535 const onClick = useCallback (
36- ( ) =>
37- navigate (
38- `?detail&type=block&id=${ id . replace ( / \. O u t p u t o f P r o g r a m $ / , "" ) } ${ s } ${ hash } ` ,
39- ) ,
36+ ( ) => navigate ( `?detail&type=block&id=${ id } ${ s } ${ hash } ` ) ,
4037 [ id , hash , s , navigate ] ,
4138 )
4239
4340 // Notes:
44- // 1) in "compact" mode, don't show Text.3.If.1; instead show Text.If
45- // 2) also always strip of initial Text.
46- // 3) always simplify the presentation of the final output
47- const crumbs = (
48- isCompact
49- ? id . replace ( / ( t e x t | e m p t y | i f ) \. \d + / g, "$1" ) . replace ( / ^ t e x t \. / , "" )
50- : id
51- )
52- . replace ( / ^ .* ( O u t p u t o f P r o g r a m ) $ / , "$1" )
41+ // 1) in compact mode, don't show "Text.3.If.1"; instead show "Text.If"
42+ // 2) also in compact mode, always strip of initial "Text."
43+ // 3) replace ids within dots (i.e. roots) with "Output of Program"
44+ const crumbs = id
45+ . replace ( / ^ [ ^ . ] + $ / , "Output of Program" )
46+ . replace ( / ( t e x t | e m p t y | i f ) \. \d + / g, ( p0 , p1 ) => ( isCompact ? p1 : p0 ) )
47+ . replace ( / ^ t e x t \. / , ( p0 ) => ( isCompact ? "" : p0 ) )
5348 . split ( / \. / )
5449
5550 if ( def ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function result(block: import("../../pdl_ast").PdlBlock) {
1717 if ( hasResult ( block ) && hasTimingInformation ( block ) ) {
1818 return [
1919 {
20- id : block . id + ".Output of Program ",
20+ id : block . id ?? " ",
2121 depth : 0 ,
2222 parent : null ,
2323 block,
@@ -72,7 +72,9 @@ export default function computeModel(block: import("../../pdl_ast").PdlBlock) {
7272 return [ ]
7373 } )
7474 . filter ( removeFluff )
75- . sort ( ( a , b ) => a . id . localeCompare ( b . id ) )
75+ . sort ( ( a , b ) => ( ! / \. / . test ( a . id ) ? 1 : a . id . localeCompare ( b . id ) ) )
76+ // ^^^ re: the regexp test, we want to place the "final output"
77+ // (i.e. blocks without a "." in their id) at the end
7678
7779 const numbering = masonry . reduce (
7880 ( N , node , idx ) => {
You can’t perform that action at this time.
0 commit comments