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 showSettingsMenu by remember { mutableStateOf(false) }
var showAccountScreen by remember { mutableStateOf(false) }
var chatInput by remember { mutableStateOf("") } // [BARU] State diangkat ke sini
if (showAccountScreen) {
AccountScreen(onDismiss = { showAccountScreen = false })
@ -70,7 +71,6 @@ fun NotebookApp() {
TopAppBar(
title = { Text("NoteBook") },
actions = {
// [DIHAPUS] Tombol Share
Box {
IconButton(onClick = { showSettingsMenu = true }) {
Icon(Icons.Filled.Settings, contentDescription = "Settings")
@ -96,6 +96,24 @@ fun NotebookApp() {
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 ->
Column(modifier = Modifier.padding(innerPadding)) {
@ -428,27 +446,23 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
DropdownMenuItem(
text = { Text("Perpustakaan Foto") },
onClick = {
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo))
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
showUploadMenu = false
},
leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) }
)
DropdownMenuItem(
text = { Text("Ambil Video") },
onClick = { /* TODO: Implement Camera Launcher */ showUploadMenu = false },
leadingIcon = { Icon(Icons.Default.PhotoCamera, contentDescription = null) }
)
// [DIHAPUS] Opsi Ambil Video
DropdownMenuItem(
text = { Text("Pilih File") },
onClick = {
onClick = {
filePickerLauncher.launch("*/*")
showUploadMenu = false
showUploadMenu = false
},
leadingIcon = { Icon(Icons.Default.Folder, contentDescription = null) }
)
DropdownMenuItem(
text = { Text("Google Drive") },
onClick = {
onClick = {
filePickerLauncher.launch("*/*")
showUploadMenu = false
},
@ -461,12 +475,12 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
Card(modifier = Modifier.fillMaxWidth()) {
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(Icons.Default.CorporateFare, contentDescription = null)
Icon(Icons.Default.CorporateFare, contentDescription = null)
Spacer(modifier = Modifier.width(8.dp))
Text("Google Workspace", fontWeight = FontWeight.Bold)
}
Button(onClick = { /*TODO*/ }) {
Icon(Icons.Default.Cloud, contentDescription = null)
Icon(Icons.Default.Cloud, contentDescription = null)
Spacer(modifier = Modifier.width(4.dp))
Text("Google Drive")
}
@ -480,50 +494,32 @@ fun AddSourcesSheet(onDismiss: () -> Unit) {
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ChatScreen() {
// [DIUBAH] Scaffold dan state teks sudah tidak ada di sini lagi
var showAddSourcesSheet by remember { mutableStateOf(false) }
if (showAddSourcesSheet) {
AddSourcesSheet(onDismiss = { showAddSourcesSheet = false })
}
Scaffold(
bottomBar = {
BottomAppBar {
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.padding(horizontal = 8.dp)) {
OutlinedTextField(
value = "",
onValueChange = {},
placeholder = { Text("Upload a source to get started") },
modifier = Modifier.weight(1f)
)
IconButton(onClick = { /* do something */ }) {
Icon(Icons.AutoMirrored.Filled.Send, contentDescription = "Send")
}
}
}
}
) { innerPadding ->
Column(
modifier = Modifier
.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")
}
Column(
modifier = Modifier
.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")
}
}
}
@ -544,10 +540,10 @@ fun StudioScreen() {
onResult = { uri -> /* Handle URI */ }
)
Column(modifier = Modifier.fillMaxSize().background(Color.White).padding(16.dp)) {
Column(modifier = Modifier.fillMaxSize().background(Color.White).padding(16.dp)) {
Text("Notebook terbaru", style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold, color = Color.Black)
Spacer(modifier = Modifier.height(16.dp))
// Box untuk menjadi anchor bagi DropdownMenu
Box {
NewNotebookCard(onClick = { showUploadMenu = true })
@ -559,16 +555,12 @@ fun StudioScreen() {
DropdownMenuItem(
text = { Text("Perpustakaan Foto") },
onClick = {
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo))
photoPickerLauncher.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) // Hanya gambar
showUploadMenu = false
},
leadingIcon = { Icon(Icons.Default.PhotoLibrary, contentDescription = null) }
)
DropdownMenuItem(
text = { Text("Ambil Video") },
onClick = { /* TODO: Implement Camera Launcher */ showUploadMenu = false },
leadingIcon = { Icon(Icons.Default.PhotoCamera, contentDescription = null) }
)
// [DIHAPUS] Opsi Ambil Video
DropdownMenuItem(
text = { Text("Pilih File") },
onClick = {