1+ import { parseDuration } from '@douglasneuroinformatics/libjs' ;
12import { Card , Heading } from '@douglasneuroinformatics/libui/components' ;
23import { useTranslation } from '@douglasneuroinformatics/libui/hooks' ;
34import type { ReleaseInfo } from '@opendatacapture/schemas/setup' ;
@@ -63,6 +64,12 @@ export const AboutPage = () => {
6364
6465 const { isGatewayEnabled } = setupStateQuery . data ;
6566
67+ const translateUptime = ( uptime : number ) => {
68+ let { days, hours, minutes, seconds } = parseDuration ( uptime * 1000 ) ;
69+ hours += days * 24 ;
70+ return [ hours , minutes , seconds ] . map ( ( value ) => ( value < 10 ? '0' + value : value ) ) . join ( ':' ) ;
71+ } ;
72+
6673 const translateReleaseInfo = ( release : ReleaseInfo ) => {
6774 const translatedReleaseInfo = {
6875 [ t ( translations . buildType ) ] : t ( translations . buildTypes [ release . type ] ) ,
@@ -85,7 +92,7 @@ export const AboutPage = () => {
8592 gatewayInfo [ t ( translations . status ) ] = gatewayHealthData . status . toString ( ) ;
8693 if ( gatewayHealthData . ok ) {
8794 Object . assign ( gatewayInfo , translateReleaseInfo ( gatewayHealthData . release ) , {
88- [ t ( translations . uptime ) ] : gatewayHealthData . uptime
95+ [ t ( translations . uptime ) ] : translateUptime ( gatewayHealthData . uptime )
8996 } ) ;
9097 }
9198 return gatewayInfo ;
@@ -120,7 +127,7 @@ export const AboutPage = () => {
120127 < InfoBlock
121128 items = { {
122129 ...translateReleaseInfo ( setupStateQuery . data . release ) ,
123- [ t ( translations . uptime ) ] : setupStateQuery . data . uptime . toString ( )
130+ [ t ( translations . uptime ) ] : translateUptime ( setupStateQuery . data . uptime )
124131 } }
125132 label = { t ( {
126133 en : 'Core API' ,
0 commit comments