feat: sort servers alphabetically by id
we don't fetch user ordering yet
This commit is contained in:
parent
306d436ee1
commit
b72def4d43
|
|
@ -115,49 +115,51 @@ fun ChatRouterScreen(topNav: NavController, viewModel: ChatRouterViewModel = vie
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
RevoltAPI.serverCache.values.forEach { server ->
|
RevoltAPI.serverCache.values
|
||||||
if (server.name == null) return@forEach
|
.sortedBy { it.id }
|
||||||
|
.forEach { server ->
|
||||||
|
if (server.name == null) return@forEach
|
||||||
|
|
||||||
if (server.icon != null) {
|
if (server.icon != null) {
|
||||||
RemoteImage(
|
RemoteImage(
|
||||||
url = "$REVOLT_FILES/icons/${server.icon.id!!}/server.png?max_side=256",
|
url = "$REVOLT_FILES/icons/${server.icon.id!!}/server.png?max_side=256",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.clickable {
|
.clickable {
|
||||||
viewModel.navigateToServer(
|
viewModel.navigateToServer(
|
||||||
server.id!!,
|
server.id!!,
|
||||||
navController
|
navController
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
description = "${server.name}"
|
description = "${server.name}"
|
||||||
)
|
|
||||||
} else {
|
|
||||||
// return a placeholder icon, currently the first letter of the server name in a circle
|
|
||||||
Box(
|
|
||||||
contentAlignment = Alignment.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.padding(8.dp)
|
|
||||||
.size(48.dp)
|
|
||||||
.clip(CircleShape)
|
|
||||||
.background(MaterialTheme.colorScheme.surfaceVariant)
|
|
||||||
.clickable {
|
|
||||||
viewModel.navigateToServer(
|
|
||||||
server.id!!,
|
|
||||||
navController
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = server.name.first().toString(),
|
|
||||||
fontSize = 20.sp,
|
|
||||||
fontWeight = FontWeight.SemiBold,
|
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
// return a placeholder icon, currently the first letter of the server name in a circle
|
||||||
|
Box(
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(8.dp)
|
||||||
|
.size(48.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(MaterialTheme.colorScheme.surfaceVariant)
|
||||||
|
.clickable {
|
||||||
|
viewModel.navigateToServer(
|
||||||
|
server.id!!,
|
||||||
|
navController
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = server.name.first().toString(),
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
color = MaterialTheme.colorScheme.onSurface
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Crossfade(targetState = viewModel.currentServer) {
|
Crossfade(targetState = viewModel.currentServer) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue