1717package io.shubham0204.smollmandroid.ui.screens.chat
1818
1919import android.widget.Toast
20+ import androidx.compose.foundation.layout.Spacer
21+ import androidx.compose.foundation.layout.fillMaxWidth
22+ import androidx.compose.foundation.layout.height
2023import androidx.compose.material.icons.Icons
2124import androidx.compose.material.icons.automirrored.filled.ShortText
2225import androidx.compose.material.icons.filled.Assistant
2326import androidx.compose.material.icons.filled.Clear
2427import androidx.compose.material.icons.filled.Delete
2528import androidx.compose.material.icons.filled.Folder
29+ import androidx.compose.material.icons.filled.Memory
2630import androidx.compose.material.icons.filled.Settings
2731import androidx.compose.material3.DropdownMenu
2832import androidx.compose.material3.DropdownMenuItem
33+ import androidx.compose.material3.HorizontalDivider
2934import androidx.compose.material3.Icon
35+ import androidx.compose.material3.MaterialTheme
3036import androidx.compose.material3.Text
3137import androidx.compose.runtime.Composable
3238import androidx.compose.runtime.getValue
39+ import androidx.compose.ui.Modifier
3340import androidx.compose.ui.platform.LocalContext
3441import androidx.compose.ui.res.stringResource
42+ import androidx.compose.ui.unit.dp
3543import androidx.lifecycle.compose.collectAsStateWithLifecycle
3644import io.shubham0204.smollmandroid.R
3745import io.shubham0204.smollmandroid.ui.components.createAlertDialog
@@ -42,46 +50,39 @@ fun ChatMoreOptionsPopup(
4250 onEditChatSettingsClick : () -> Unit ,
4351) {
4452 val expanded by viewModel.showMoreOptionsPopupState.collectAsStateWithLifecycle()
53+ val showRAMUsageLabel by viewModel.showRAMUsageLabel.collectAsStateWithLifecycle()
4554 val context = LocalContext .current
4655 DropdownMenu (
4756 expanded = expanded,
4857 onDismissRequest = { viewModel.hideMoreOptionsPopup() },
4958 ) {
5059 DropdownMenuItem (
5160 leadingIcon = { Icon (Icons .Default .Settings , contentDescription = " Edit Chat Name" ) },
52- text = { Text (stringResource(R .string.chat_options_edit_settings)) },
61+ text = { Text (stringResource(R .string.chat_options_edit_settings), style = MaterialTheme .typography.labelMedium ) },
5362 onClick = {
5463 onEditChatSettingsClick()
5564 viewModel.hideMoreOptionsPopup()
5665 },
5766 )
5867 DropdownMenuItem (
5968 leadingIcon = { Icon (Icons .Default .Folder , contentDescription = " Change Folder" ) },
60- text = { Text (stringResource(R .string.chat_options_change_folder)) },
69+ text = { Text (stringResource(R .string.chat_options_change_folder), style = MaterialTheme .typography.labelMedium ) },
6170 onClick = {
6271 viewModel.showChangeFolderDialog()
6372 viewModel.hideMoreOptionsPopup()
6473 },
6574 )
6675 DropdownMenuItem (
6776 leadingIcon = { Icon (Icons .Default .Assistant , contentDescription = " Change Model" ) },
68- text = { Text (stringResource(R .string.chat_options_change_model)) },
77+ text = { Text (stringResource(R .string.chat_options_change_model), style = MaterialTheme .typography.labelMedium ) },
6978 onClick = {
7079 viewModel.showSelectModelListDialog()
7180 viewModel.hideMoreOptionsPopup()
7281 },
7382 )
74- DropdownMenuItem (
75- leadingIcon = { Icon (Icons .AutoMirrored .Filled .ShortText , contentDescription = " Context Usage" ) },
76- text = { Text (stringResource(R .string.chat_options_ctx_length_usage)) },
77- onClick = {
78- viewModel.showContextLengthUsageDialog()
79- viewModel.hideMoreOptionsPopup()
80- },
81- )
8283 DropdownMenuItem (
8384 leadingIcon = { Icon (Icons .Default .Delete , contentDescription = " Delete Chat" ) },
84- text = { Text (stringResource(R .string.dialog_title_delete_chat)) },
85+ text = { Text (stringResource(R .string.dialog_title_delete_chat), style = MaterialTheme .typography.labelMedium ) },
8586 onClick = {
8687 viewModel.currChatState.value?.let { chat ->
8788 createAlertDialog(
@@ -106,7 +107,7 @@ fun ChatMoreOptionsPopup(
106107 )
107108 DropdownMenuItem (
108109 leadingIcon = { Icon (Icons .Default .Clear , contentDescription = " Clear Chat Messages" ) },
109- text = { Text (stringResource(R .string.chat_options_clear_messages)) },
110+ text = { Text (stringResource(R .string.chat_options_clear_messages), style = MaterialTheme .typography.labelMedium ) },
110111 onClick = {
111112 viewModel.currChatState.value?.let { chat ->
112113 createAlertDialog(
@@ -129,5 +130,29 @@ fun ChatMoreOptionsPopup(
129130 viewModel.hideMoreOptionsPopup()
130131 },
131132 )
133+ Spacer (modifier = Modifier .height(4 .dp))
134+ HorizontalDivider (modifier = Modifier .fillMaxWidth())
135+ Spacer (modifier = Modifier .height(4 .dp))
136+ DropdownMenuItem (
137+ leadingIcon = { Icon (Icons .AutoMirrored .Filled .ShortText , contentDescription = " Context Usage" ) },
138+ text = { Text (stringResource(R .string.chat_options_ctx_length_usage), style = MaterialTheme .typography.labelMedium) },
139+ onClick = {
140+ viewModel.showContextLengthUsageDialog()
141+ viewModel.hideMoreOptionsPopup()
142+ },
143+ )
144+ DropdownMenuItem (
145+ leadingIcon = { Icon (Icons .Default .Memory , contentDescription = " RAM Usage" ) },
146+ text = {
147+ Text (
148+ if (showRAMUsageLabel) " Hide RAM usage" else " Show RAM usage" ,
149+ style = MaterialTheme .typography.labelMedium,
150+ )
151+ },
152+ onClick = {
153+ viewModel.toggleRAMUsageLabelVisibility()
154+ viewModel.hideMoreOptionsPopup()
155+ },
156+ )
132157 }
133158}
0 commit comments