@@ -18,6 +18,22 @@ import { formatDateTime } from '@/lib/dateFormat';
1818
1919const STATUS_FILTERS = [ '' , 'planned' , 'active' , 'paused' , 'completed' , 'aborted' ] as const ;
2020
21+ const STATUS_LABEL_KEYS : Record < Exclude < ( typeof STATUS_FILTERS ) [ number ] , '' > , string > = {
22+ planned : 'journey.status.planned' ,
23+ active : 'journey.status.active' ,
24+ paused : 'journey.status.paused' ,
25+ completed : 'journey.status.completed' ,
26+ aborted : 'journey.status.aborted' ,
27+ } ;
28+
29+ const STATUS_LABEL_DEFAULTS : Record < Exclude < ( typeof STATUS_FILTERS ) [ number ] , '' > , string > = {
30+ planned : 'Planned' ,
31+ active : 'Active' ,
32+ paused : 'Paused' ,
33+ completed : 'Completed' ,
34+ aborted : 'Aborted' ,
35+ } ;
36+
2137function statusVariant ( status : JourneyStatus ) {
2238 switch ( status ) {
2339 case 'active' :
@@ -94,6 +110,9 @@ export function JourneyPanel({ vehicleId }: { vehicleId: number | null }) {
94110 const create = useCreateJourney ( ) ;
95111 const transition = useTransitionJourney ( ) ;
96112
113+ const statusLabel = ( status : JourneyStatus ) =>
114+ t ( STATUS_LABEL_KEYS [ status ] , STATUS_LABEL_DEFAULTS [ status ] ) ;
115+
97116 const submitCreate = ( event : FormEvent ) => {
98117 event . preventDefault ( ) ;
99118 if ( vehicleId == null || ! draft . name . trim ( ) ) return ;
@@ -134,7 +153,9 @@ export function JourneyPanel({ vehicleId }: { vehicleId: number | null }) {
134153 {
135154 key : 'status' ,
136155 header : t ( 'journey.col.status' , 'Status' ) ,
137- render : ( row ) => < Badge variant = { statusVariant ( row . status ) } > { row . status } </ Badge > ,
156+ render : ( row ) => (
157+ < Badge variant = { statusVariant ( row . status ) } > { statusLabel ( row . status ) } </ Badge >
158+ ) ,
138159 } ,
139160 {
140161 key : 'plan' ,
@@ -184,7 +205,7 @@ export function JourneyPanel({ vehicleId }: { vehicleId: number | null }) {
184205 value = { statusFilter }
185206 options = { STATUS_FILTERS . map ( ( s ) => ( {
186207 value : s ,
187- label : s === '' ? t ( 'journey.filter.all' , 'All' ) : s ,
208+ label : s === '' ? t ( 'journey.filter.all' , 'All' ) : statusLabel ( s ) ,
188209 } ) ) }
189210 onChange = { ( event ) => setStatusFilter ( event . target . value ) }
190211 />
@@ -259,7 +280,7 @@ export function JourneyPanel({ vehicleId }: { vehicleId: number | null }) {
259280
260281 < GlassPanel className = "p-4 sm:p-5" >
261282 < PanelTitle className = "mb-1 flex items-center gap-2" >
262- < Icons . flag className = "h-4 w-4 text-cyan-300 " aria-hidden = "true" />
283+ < Icons . flag className = "h-4 w-4" aria-hidden = "true" />
263284 { detail ? detail . session . name : t ( 'journey.detail.title' , 'Journey detail' ) }
264285 </ PanelTitle >
265286 { detailQuery . isLoading || detail == null ? (
@@ -276,7 +297,9 @@ export function JourneyPanel({ vehicleId }: { vehicleId: number | null }) {
276297 ) : (
277298 < div className = "space-y-4" >
278299 < div className = "flex flex-wrap items-center gap-2" >
279- < Badge variant = { statusVariant ( detail . session . status ) } > { detail . session . status } </ Badge >
300+ < Badge variant = { statusVariant ( detail . session . status ) } >
301+ { statusLabel ( detail . session . status ) }
302+ </ Badge >
280303 { detail . next_statuses . map ( ( next ) => {
281304 const action = transitionAction ( next , detail . session . status ) ;
282305 return (
@@ -295,7 +318,7 @@ export function JourneyPanel({ vehicleId }: { vehicleId: number | null }) {
295318 </ div >
296319 < div >
297320 < Text as = "p" variant = "label" className = "mb-2 flex items-center gap-2" >
298- < Icons . package className = "h-4 w-4 text-[var(--text-muted)] " aria-hidden = "true" />
321+ < Icons . package className = "h-4 w-4" aria-hidden = "true" />
299322 { t ( 'journey.plans.title' , 'Plan versions' ) }
300323 </ Text >
301324 { detail . plans . length === 0 ? (
0 commit comments