diff --git a/app/src/main/java/chat/revolt/composables/screens/chat/drawer/ChannelSideDrawer.kt b/app/src/main/java/chat/revolt/composables/screens/chat/drawer/ChannelSideDrawer.kt index cd358b2b..a1e6a23f 100644 --- a/app/src/main/java/chat/revolt/composables/screens/chat/drawer/ChannelSideDrawer.kt +++ b/app/src/main/java/chat/revolt/composables/screens/chat/drawer/ChannelSideDrawer.kt @@ -83,6 +83,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.compose.ui.window.Dialog import androidx.navigation.NavController import chat.revolt.R import chat.revolt.api.REVOLT_FILES @@ -110,6 +111,7 @@ import chat.revolt.composables.screens.chat.ChannelIcon import chat.revolt.internals.Platform import chat.revolt.screens.chat.ChatRouterDestination import chat.revolt.screens.chat.LocalIsConnected +import chat.revolt.screens.chat.dialogs.InviteDialog import chat.revolt.screens.chat.dialogs.safety.ReportServerDialog import chat.revolt.sheets.ChannelContextSheet import kotlinx.coroutines.launch @@ -200,6 +202,7 @@ fun ChannelSideDrawer( var showLeaveConfirmation by remember { mutableStateOf(null) } var leaveSilently by remember { mutableStateOf(false) } var showReportServerDialog by remember { mutableStateOf(null) } + var showInviteDialog by remember { mutableStateOf(null) } if (channelContextSheetTarget != null) { val channelContextSheetState = rememberModalBottomSheetState() @@ -312,6 +315,29 @@ fun ChannelSideDrawer( ) } + showInviteDialog?.let { serverId -> + val server = RevoltAPI.serverCache[serverId] + val channelId = server?.channels?.firstOrNull() + if (channelId != null) { + Dialog( + onDismissRequest = { + showInviteDialog = null + } + ) { + InviteDialog( + channelId = channelId, + onDismissRequest = { + showInviteDialog = null + } + ) + } + } else { + // No channels available, dismiss + showInviteDialog = null + serverContextMenuTarget = null + } + } + Row(modifier.fillMaxSize()) { LazyColumn( Modifier.width(64.dp), @@ -497,7 +523,6 @@ fun ChannelSideDrawer( } } - // Server context dropdown menu DropdownMenu( expanded = serverContextMenuTarget == serverInList.id, onDismissRequest = { serverContextMenuTarget = null } @@ -520,30 +545,13 @@ fun ChannelSideDrawer( } ) - DropdownMenuItem( - text = { Text("Notification options (TODO)") }, - onClick = { - // TODO: Implement notification options - serverContextMenuTarget = null - }, - leadingIcon = { - Icon( - painter = painterResource(R.drawable.icn_notification_settings_24dp), - contentDescription = null - ) - }, - trailingIcon = { - Icon( - painter = painterResource(R.drawable.icn_keyboard_arrow_right_24dp), - contentDescription = null - ) - } - ) DropdownMenuItem( - text = { Text("Create invite TODO") }, + text = { Text("Create invite") }, onClick = { - // TODO: Implement create invite + serverInList.id?.let { serverId -> + showInviteDialog = serverId + } serverContextMenuTarget = null }, leadingIcon = { @@ -554,20 +562,6 @@ fun ChannelSideDrawer( } ) - DropdownMenuItem( - text = { Text("Edit identity TODO") }, - onClick = { - // TODO: Implement edit identity - serverContextMenuTarget = null - }, - leadingIcon = { - Icon( - painter = painterResource(R.drawable.icn_edit_24dp), - contentDescription = null - ) - } - ) - DropdownMenuItem( text = { Text(stringResource(R.string.server_context_sheet_actions_copy_id)) }, onClick = { @@ -592,9 +586,8 @@ fun ChannelSideDrawer( } ) - HorizontalDivider() - if (serverInList.owner != RevoltAPI.selfId) { + HorizontalDivider() DropdownMenuItem( text = { Text( diff --git a/revite b/revite new file mode 160000 index 00000000..92e84309 --- /dev/null +++ b/revite @@ -0,0 +1 @@ +Subproject commit 92e84309ec82b0afc309f74847332bf6241522ea