File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed
Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @relayprotocol/relay-kit-ui ' : patch
3+ ---
4+
5+ Improved fill time display on success screen
Original file line number Diff line number Diff line change 11import { type Execute , RelayClient } from '@relayprotocol/relay-sdk'
22import { type RelayTransaction } from '../types/index.js'
3- import { relativeTime } from './time.js'
3+ import { formatSeconds } from './time.js'
44
55export const extractFromChain = (
66 transaction ?: RelayTransaction | null ,
@@ -42,11 +42,7 @@ export const calculateFillTime = (transaction?: RelayTransaction | null) => {
4242 fillTime = '-'
4343 seconds = 0
4444 } else if ( seconds > 60 ) {
45- fillTime = `${ relativeTime (
46- txEndTimestamp * 1000 ,
47- txStartTimestamp * 1000 ,
48- true
49- ) } `
45+ fillTime = formatSeconds ( seconds )
5046 } else {
5147 fillTime = `${ seconds } s`
5248 }
Original file line number Diff line number Diff line change @@ -20,11 +20,13 @@ export const formatSeconds = (seconds: number): string => {
2020 const m = Math . floor ( ( seconds % 3600 ) / 60 )
2121 const s = Math . floor ( seconds % 60 )
2222
23- const dDisplay = d > 0 ? d + ( d == 1 ? ' d' : 'd ' ) : ''
24- const hDisplay = h > 0 ? h + ( h == 1 ? ' h' : 'h ' ) : ''
25- const mDisplay = m > 0 ? m + ( m == 1 ? ' m' : 'm ' ) : ''
26- const sDisplay = s > 0 ? s + ( s == 1 ? ' s' : 's ' ) : ''
27- return `${ dDisplay } ${ hDisplay } ${ mDisplay } ${ sDisplay } ` . trim ( )
23+ const parts : string [ ] = [ ]
24+ if ( d > 0 ) parts . push ( `${ d } d` )
25+ if ( h > 0 ) parts . push ( `${ h } h` )
26+ if ( m > 0 ) parts . push ( `${ m } m` )
27+ if ( s > 0 ) parts . push ( `${ s } s` )
28+
29+ return parts . join ( ' ' )
2830}
2931
3032export const get15MinuteInterval = ( ) => {
You can’t perform that action at this time.
0 commit comments