This commit is contained in:
Alex Yong 2025-09-30 10:57:15 -04:00 committed by GitHub
commit f931d6a7a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 51 additions and 6 deletions

View File

@ -98,7 +98,9 @@ import chat.revolt.composables.generic.presenceFromStatus
import chat.revolt.composables.screens.chat.ChannelIcon
import chat.revolt.screens.chat.ChatRouterDestination
import chat.revolt.screens.chat.LocalIsConnected
import chat.revolt.screens.chat.dialogs.safety.ReportServerDialog
import chat.revolt.sheets.ChannelContextSheet
import chat.revolt.sheets.ServerContextSheet
import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@ -183,6 +185,10 @@ fun ChannelSideDrawer(
}.sortedBy { it.id }))
var channelContextSheetTarget by remember { mutableStateOf<String?>(null) }
var serverContextSheetTarget by remember { mutableStateOf<String?>(null) }
var showReportServer by remember { mutableStateOf(false) }
var reportServerTarget by remember { mutableStateOf("") }
if (channelContextSheetTarget != null) {
val channelContextSheetState = rememberModalBottomSheetState()
@ -203,6 +209,29 @@ fun ChannelSideDrawer(
}
}
if (serverContextSheetTarget != null) {
val serverContextSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
ModalBottomSheet(
sheetState = serverContextSheetState,
onDismissRequest = {
serverContextSheetTarget = null
}
) {
ServerContextSheet(
serverId = serverContextSheetTarget!!,
onReportServer = {
reportServerTarget = serverContextSheetTarget!!
showReportServer = true
},
onHideSheet = {
serverContextSheetState.hide()
serverContextSheetTarget = null
}
)
}
}
val scope = rememberCoroutineScope()
Row(modifier.fillMaxSize()) {
@ -355,12 +384,19 @@ fun ChannelSideDrawer(
Modifier
.padding(8.dp)
.clip(CircleShape)
.clickable {
serverInList.id?.let { srvId -> navigateToServer(srvId) }
scope.launch {
drawerState?.close()
.combinedClickable(
onClick = {
serverInList.id?.let { srvId -> navigateToServer(srvId) }
scope.launch {
drawerState?.close()
}
},
onLongClick = {
serverInList.id?.let { srvId ->
serverContextSheetTarget = srvId
}
}
}) {
)) {
val icon = serverInList.icon?.id?.let { iconId ->
"$REVOLT_FILES/icons/$iconId"
}
@ -594,6 +630,15 @@ fun ChannelSideDrawer(
}
}
}
if (showReportServer) {
ReportServerDialog(
onDismiss = {
showReportServer = false
},
serverId = reportServerTarget
)
}
}
@Composable
@ -1085,4 +1130,4 @@ fun DMOrGroupItem(
}
}
}
}
}