Skip to content

Commit

Permalink
Show delta on the left of the sample app UI to align timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
stoyicker committed Nov 18, 2023
1 parent 0c1f247 commit 02d5348
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions samples/shared/src/commonMain/kotlin/root/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 02d5348

Please sign in to comment.