From 4c53b26fa90ac55af15575ecedf5b2516d428191 Mon Sep 17 00:00:00 2001 From: Jorge Antonio Diaz-Benito Soriano Date: Sat, 18 Nov 2023 17:20:51 +0100 Subject: [PATCH] Show delta on the left of the sample app UI to align timestamps --- .../src/commonMain/kotlin/root/MainScreen.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/samples/shared/src/commonMain/kotlin/root/MainScreen.kt b/samples/shared/src/commonMain/kotlin/root/MainScreen.kt index a1a5645d..a4bc4626 100644 --- a/samples/shared/src/commonMain/kotlin/root/MainScreen.kt +++ b/samples/shared/src/commonMain/kotlin/root/MainScreen.kt @@ -43,16 +43,14 @@ fun MainScreen(mainViewModel: MainViewModel) { horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier.fillMaxWidth(), ) { - Text("Net=", style = textStyle) val synchronizedEpoch = state.synchronizedEpoch - Text( - if (synchronizedEpoch == null) { - "Not yet available" - } else { - "${synchronizedEpoch.epochToString} (δ=${synchronizedEpoch - state.localEpoch})" - }, - style = textStyle, - ) + val deltaString = if (synchronizedEpoch == null) { + "N/A" + } else { + synchronizedEpoch - state.localEpoch + } + Text("Net (δ=$deltaString)=", style = textStyle) + Text(synchronizedEpoch?.epochToString ?: "Not yet available", style = textStyle) } Row( verticalAlignment = Alignment.CenterVertically,