Apis benerin pitur

This commit is contained in:
202310715082 FAZRI ABDURRAHMAN 2025-11-12 17:36:17 +07:00
parent 6420bda378
commit 18926eb3e2

View File

@ -60,6 +60,7 @@ fun NotebookApp() {
var showGoogleAppsMenu by remember { mutableStateOf(false) } var showGoogleAppsMenu by remember { mutableStateOf(false) }
var showSettingsMenu by remember { mutableStateOf(false) } var showSettingsMenu by remember { mutableStateOf(false) }
var showAccountScreen by remember { mutableStateOf(false) } var showAccountScreen by remember { mutableStateOf(false) }
var chatInput by remember { mutableStateOf("") } // [BARU] State diangkat ke sini
if (showAccountScreen) { if (showAccountScreen) {
AccountScreen(onDismiss = { showAccountScreen = false }) AccountScreen(onDismiss = { showAccountScreen = false })
@ -70,7 +71,6 @@ fun NotebookApp() {
TopAppBar( TopAppBar(
title = { Text("NoteBook") }, title = { Text("NoteBook") },
actions = { actions = {
// [DIHAPUS] Tombol Share
Box { Box {
IconButton(onClick = { showSettingsMenu = true }) { IconButton(onClick = { showSettingsMenu = true }) {
Icon(Icons.Filled.Settings, contentDescription = "Settings") Icon(Icons.Filled.Settings, contentDescription = "Settings")
@ -96,6 +96,24 @@ fun NotebookApp() {
Spacer(modifier = Modifier.width(8.dp)) Spacer(modifier = Modifier.width(8.dp))
} }
) )
},
// [DIUBAH] Bottom bar sekarang menjadi bagian dari Scaffold utama
bottomBar = {
if (selectedTabIndex == 1) { // Hanya tampil jika tab "Chat" aktif
BottomAppBar {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = 8.dp)) {
OutlinedTextField(
value = chatInput,
onValueChange = { chatInput = it },
placeholder = { Text("Message...") },
modifier = Modifier.weight(1f)
)
IconButton(onClick = { /* Kirim pesan, TODO */ }) {
Icon(Icons.AutoMirrored.Filled.Send, contentDescription = "Send")
}
}
}
}
} }
) { innerPadding -> ) { innerPadding ->
Column(modifier = Modifier.padding(innerPadding)) { Column(modifier = Modifier.padding(innerPadding)) {
@ -428,16 +446,12 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
DropdownMenuItem( DropdownMenuItem(
text = { Text("Perpustakaan Foto") }, text = { Text("Perpustakaan Foto") },
onClick = { onClick = {
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo)) photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
showUploadMenu = false showUploadMenu = false
}, },
leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) } leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) }
) )
DropdownMenuItem( // [DIHAPUS] Opsi Ambil Video
text = { Text("Ambil Video") },
onClick = { /* TODO: Implement Camera Launcher */ showUploadMenu = false },
leadingIcon = { Icon(Icons.Default.PhotoCamera, contentDescription = null) }
)
DropdownMenuItem( DropdownMenuItem(
text = { Text("Pilih File") }, text = { Text("Pilih File") },
onClick = { onClick = {
@ -480,50 +494,32 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun ChatScreen() { fun ChatScreen() {
// [DIUBAH] Scaffold dan state teks sudah tidak ada di sini lagi
var showAddSourcesSheet by remember { mutableStateOf(false) } var showAddSourcesSheet by remember { mutableStateOf(false) }
if (showAddSourcesSheet) { if (showAddSourcesSheet) {
AddSourcesSheet(onDismiss = { showAddSourcesSheet = false }) AddSourcesSheet(onDismiss = { showAddSourcesSheet = false })
} }
Scaffold( Column(
bottomBar = { modifier = Modifier
BottomAppBar { .fillMaxSize(),
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = 8.dp)) { verticalArrangement = Arrangement.Center,
OutlinedTextField( horizontalAlignment = Alignment.CenterHorizontally
value = "", ) {
onValueChange = {}, Icon(
placeholder = { Text("Upload a source to get started") }, Icons.Filled.Upload,
modifier = Modifier.weight(1f) contentDescription = "Upload",
) modifier = Modifier.size(48.dp)
IconButton(onClick = { /* do something */ }) { )
Icon(Icons.AutoMirrored.Filled.Send, contentDescription = "Send") Text(
} text = "Add a source to get started",
} style = MaterialTheme.typography.headlineSmall,
} textAlign = TextAlign.Center
} )
) { innerPadding -> Spacer(modifier = Modifier.height(16.dp))
Column( Button(onClick = { showAddSourcesSheet = true }) {
modifier = Modifier Text("Upload a source")
.padding(innerPadding)
.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
Icons.Filled.Upload,
contentDescription = "Upload",
modifier = Modifier.size(48.dp)
)
Text(
text = "Add a source to get started",
style = MaterialTheme.typography.headlineSmall,
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.height(16.dp))
Button(onClick = { showAddSourcesSheet = true }) {
Text("Upload a source")
}
} }
} }
} }
@ -559,16 +555,12 @@ fun StudioScreen() {
DropdownMenuItem( DropdownMenuItem(
text = { Text("Perpustakaan Foto") }, text = { Text("Perpustakaan Foto") },
onClick = { onClick = {
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo)) photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) // Hanya gambar
showUploadMenu = false showUploadMenu = false
}, },
leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) } leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) }
) )
DropdownMenuItem( // [DIHAPUS] Opsi Ambil Video
text = { Text("Ambil Video") },
onClick = { /* TODO: Implement Camera Launcher */ showUploadMenu = false },
leadingIcon = { Icon(Icons.Default.PhotoCamera, contentDescription = null) }
)
DropdownMenuItem( DropdownMenuItem(
text = { Text("Pilih File") }, text = { Text("Pilih File") },
onClick = { onClick = {