mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 14:32:46 +02:00
Fix relay icons when using complete ui
This commit is contained in:
@@ -65,6 +65,7 @@ fun BasicRelaySetupInfoClickableRow(
|
|||||||
iconUrlFromRelayInfoDoc ?: item.briefInfo.favIcon,
|
iconUrlFromRelayInfoDoc ?: item.briefInfo.favIcon,
|
||||||
loadProfilePicture,
|
loadProfilePicture,
|
||||||
loadRobohash,
|
loadRobohash,
|
||||||
|
item.relayStat.pingInMs,
|
||||||
MaterialTheme.colorScheme.largeRelayIconModifier,
|
MaterialTheme.colorScheme.largeRelayIconModifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -322,6 +322,7 @@ fun ClickableRelayItem(
|
|||||||
iconUrlFromRelayInfoDoc ?: item.briefInfo.favIcon,
|
iconUrlFromRelayInfoDoc ?: item.briefInfo.favIcon,
|
||||||
loadProfilePicture,
|
loadProfilePicture,
|
||||||
loadRobohash,
|
loadRobohash,
|
||||||
|
item.relayStat.pingInMs,
|
||||||
MaterialTheme.colorScheme.largeRelayIconModifier,
|
MaterialTheme.colorScheme.largeRelayIconModifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -93,6 +93,7 @@ fun Kind3RelaySetupInfoProposalRow(
|
|||||||
iconUrlFromRelayInfoDoc ?: item.briefInfo.favIcon,
|
iconUrlFromRelayInfoDoc ?: item.briefInfo.favIcon,
|
||||||
loadProfilePicture,
|
loadProfilePicture,
|
||||||
loadRobohash,
|
loadRobohash,
|
||||||
|
item.relayStat.pingInMs,
|
||||||
MaterialTheme.colorScheme.largeRelayIconModifier,
|
MaterialTheme.colorScheme.largeRelayIconModifier,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -135,6 +135,7 @@ fun RelayInformationDialog(
|
|||||||
iconUrl = relayInfo.icon ?: relayBriefInfo.favIcon,
|
iconUrl = relayInfo.icon ?: relayBriefInfo.favIcon,
|
||||||
loadProfilePicture = accountViewModel.settings.showProfilePictures.value,
|
loadProfilePicture = accountViewModel.settings.showProfilePictures.value,
|
||||||
loadRobohash = accountViewModel.settings.featureSet != FeatureSetType.PERFORMANCE,
|
loadRobohash = accountViewModel.settings.featureSet != FeatureSetType.PERFORMANCE,
|
||||||
|
RelayStats.get(url = relayBriefInfo.url).pingInMs,
|
||||||
iconModifier = MaterialTheme.colorScheme.largeRelayIconModifier,
|
iconModifier = MaterialTheme.colorScheme.largeRelayIconModifier,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -62,8 +62,6 @@ import com.vitorpamplona.amethyst.ui.theme.StdStartPadding
|
|||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import com.vitorpamplona.amethyst.ui.theme.relayIconModifier
|
import com.vitorpamplona.amethyst.ui.theme.relayIconModifier
|
||||||
import com.vitorpamplona.ammolite.relays.RelayBriefInfoCache
|
import com.vitorpamplona.ammolite.relays.RelayBriefInfoCache
|
||||||
import com.vitorpamplona.ammolite.relays.RelayStats
|
|
||||||
import com.vitorpamplona.quartz.encoders.RelayUrlFormatter
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
public fun RelayBadgesHorizontal(
|
public fun RelayBadgesHorizontal(
|
||||||
@@ -189,6 +187,7 @@ fun RenderRelay(
|
|||||||
displayUrl = relay.displayUrl,
|
displayUrl = relay.displayUrl,
|
||||||
iconUrl = relayInfo?.icon ?: relay.favIcon,
|
iconUrl = relayInfo?.icon ?: relay.favIcon,
|
||||||
loadProfilePicture = accountViewModel.settings.showProfilePictures.value,
|
loadProfilePicture = accountViewModel.settings.showProfilePictures.value,
|
||||||
|
pingInMs = 0,
|
||||||
loadRobohash = accountViewModel.settings.featureSet != FeatureSetType.PERFORMANCE,
|
loadRobohash = accountViewModel.settings.featureSet != FeatureSetType.PERFORMANCE,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -200,6 +199,7 @@ fun RenderRelayIcon(
|
|||||||
iconUrl: String?,
|
iconUrl: String?,
|
||||||
loadProfilePicture: Boolean,
|
loadProfilePicture: Boolean,
|
||||||
loadRobohash: Boolean,
|
loadRobohash: Boolean,
|
||||||
|
pingInMs: Long,
|
||||||
iconModifier: Modifier = MaterialTheme.colorScheme.relayIconModifier,
|
iconModifier: Modifier = MaterialTheme.colorScheme.relayIconModifier,
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
@@ -214,31 +214,31 @@ fun RenderRelayIcon(
|
|||||||
loadProfilePicture = loadProfilePicture,
|
loadProfilePicture = loadProfilePicture,
|
||||||
loadRobohash = loadRobohash,
|
loadRobohash = loadRobohash,
|
||||||
)
|
)
|
||||||
|
if (pingInMs > 0) {
|
||||||
Box(
|
Box(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.background(
|
.background(
|
||||||
Color.Gray,
|
Color.Gray,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
val pingInMs = RelayStats.get(RelayUrlFormatter.normalize(displayUrl)).pingInMs
|
Text(
|
||||||
Text(
|
modifier = Modifier.padding(4.dp),
|
||||||
modifier = Modifier.padding(4.dp),
|
style =
|
||||||
style =
|
TextStyle(
|
||||||
TextStyle(
|
color =
|
||||||
color =
|
if (pingInMs <= 150) {
|
||||||
if (pingInMs <= 150) {
|
Color.Green
|
||||||
Color.Green
|
} else if (pingInMs <= 300) {
|
||||||
} else if (pingInMs <= 300) {
|
Color.Yellow
|
||||||
Color.Yellow
|
} else {
|
||||||
} else {
|
Color.Red
|
||||||
Color.Red
|
},
|
||||||
},
|
),
|
||||||
),
|
text = "$pingInMs",
|
||||||
text = "$pingInMs",
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user