File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66 import { type Route } from ' @trainstatus/client' ;
77
8- // TODO: combine w and h into size
98 const {
109 route,
1110 link,
2928 // TODO: maybe differentiate between planned alerts, station notices, etc
3029 return alerts .value ?.alerts_by_route .has (route .id ) ?? false ;
3130 });
31+
32+ // TODO: apply this bus prefix thing to map
33+ // Make mta bus prefix smaller than rest of short name
34+ const route_short_name_parts = $derived .by (() => {
35+ const short_name = route .short_name ?? ' ' ;
36+
37+ if (route .data .source !== ' mta_bus' ) {
38+ return {
39+ prefix: ' ' ,
40+ rest: short_name
41+ };
42+ }
43+
44+ const match = short_name .match (/ ^ ([A-Za-z ] + )(. * )$ / );
45+
46+ if (! match || match [2 ].length === 0 ) {
47+ return {
48+ prefix: ' ' ,
49+ rest: short_name
50+ };
51+ }
52+
53+ return {
54+ prefix: match [1 ],
55+ rest: match [2 ]
56+ };
57+ });
3258 </script >
3359
3460<!-- {#snippet alert_icon()}
4975 if (link ) open_modal ({ type: ' route' , ... route });
5076 }}
5177 >
52- {route .short_name }
78+ <span class =" bus-short-name" >
79+ {#if route_short_name_parts .prefix }
80+ <span class ="bus-short-name-prefix" >{route_short_name_parts .prefix }</span >
81+ {/if }
82+ <span >{route_short_name_parts .rest }</span >
83+ </span >
5384
5485 <!-- {@render alert_icon()} -->
5586 </div >
77108 svg {
78109 transform : translateZ (0 );
79110 }
111+
112+ .bus-short-name {
113+ display : inline-flex ;
114+ align-items : baseline ;
115+ }
116+
117+ .bus-short-name-prefix {
118+ font-size : 0.8em ;
119+ line-height : 1 ;
120+ margin-right : 1px ;
121+ }
80122 </style >
You can’t perform that action at this time.
0 commit comments