MainActivity Test
This commit is contained in:
parent
4b6a44f3b1
commit
3dec997d41
@ -149,7 +149,13 @@ fun NotebookApp(viewModel: NotebookViewModel) {
|
||||
}
|
||||
}
|
||||
when (selectedTabIndex) {
|
||||
0 -> StudioScreen(viewModel)
|
||||
0 -> StudioScreen(
|
||||
viewModel = viewModel,
|
||||
onNotebookClick = { notebookId ->
|
||||
println("📱 Navigasi ke notebook ID: $notebookId")
|
||||
selectedNotebookId = notebookId
|
||||
}
|
||||
)
|
||||
1 -> ChatScreen(viewModel)
|
||||
2 -> SourcesScreen(viewModel)
|
||||
}
|
||||
@ -159,7 +165,7 @@ fun NotebookApp(viewModel: NotebookViewModel) {
|
||||
|
||||
// === STUDIO SCREEN (UPDATED) ===
|
||||
@Composable
|
||||
fun StudioScreen(viewModel: NotebookViewModel) {
|
||||
fun StudioScreen(viewModel: NotebookViewModel, onNotebookClick: (Int) -> Unit) {
|
||||
val notebooks by viewModel.notebooks.collectAsState()
|
||||
var showCreateDialog by remember { mutableStateOf(false) }
|
||||
|
||||
@ -199,8 +205,14 @@ fun StudioScreen(viewModel: NotebookViewModel) {
|
||||
items(notebooks) { notebook ->
|
||||
NotebookCard(
|
||||
notebook = notebook,
|
||||
onClick = { /* TODO: Buka notebook */ },
|
||||
onDelete = { viewModel.deleteNotebook(notebook) }
|
||||
onClick = {
|
||||
println("🟢 onClick triggered untuk notebook ID: ${notebook.id}")
|
||||
onNotebookClick(notebook.id)
|
||||
},
|
||||
onDelete = {
|
||||
println("🔴 Delete triggered untuk notebook ID: ${notebook.id}")
|
||||
viewModel.deleteNotebook(notebook)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -248,7 +260,10 @@ fun NotebookCard(
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable(onClick = onClick),
|
||||
.clickable {
|
||||
println("🔵 Notebook diklik: ID=${notebook.id}, Title=${notebook.title}")
|
||||
onClick()
|
||||
},
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = Color(0xFFF8F9FA))
|
||||
) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user