From 1967dff5c38e3a142fabcc69216a5f6e3f7d578b Mon Sep 17 00:00:00 2001 From: gabriel20xx Date: Tue, 11 Nov 2025 20:51:59 +0100 Subject: [PATCH] Revert "feat: improve layout in MainApp and SettingsScreen for better content visibility and user experience" This reverts commit 498e8bcc06e67da956055e98b8bcf1d654853da0. Revert animation changes --- .../collabtable/app/ui/navigation/MainApp.kt | 9 +- .../app/ui/screens/SettingsScreen.kt | 205 ++++++++++-------- 2 files changed, 110 insertions(+), 104 deletions(-) diff --git a/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/navigation/MainApp.kt b/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/navigation/MainApp.kt index e868311..6f61c4b 100644 --- a/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/navigation/MainApp.kt +++ b/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/navigation/MainApp.kt @@ -4,7 +4,6 @@ import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.Settings @@ -107,13 +106,7 @@ fun MainApp() { } }, ) { innerPadding -> - // Apply the innerPadding from the Scaffold so content is not obscured by the bottom navigation bar. - Surface( - modifier = Modifier - .fillMaxSize() - .padding(innerPadding), - color = MaterialTheme.colorScheme.background, - ) { + Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { NavHost( navController = navController, startDestination = Routes.Tables, diff --git a/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/screens/SettingsScreen.kt b/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/screens/SettingsScreen.kt index 32c2add..1839a55 100644 --- a/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/screens/SettingsScreen.kt +++ b/CollabTableAndroid/app/src/main/java/com/collabtable/app/ui/screens/SettingsScreen.kt @@ -133,6 +133,11 @@ fun SettingsScreen( topBar = { TopAppBar( title = { Text(stringResource(R.string.settings)) }, + navigationIcon = { + IconButton(onClick = onNavigateBack) { + Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back") + } + }, actions = { ConnectionStatusAction(prefs = preferencesManager) }, @@ -317,7 +322,110 @@ fun SettingsScreen( } } - // Notifications section (moved inside the main scroll column so it doesn't overlay other content) + // Diagnostics / Logs + Text( + text = "Diagnostics", + style = MaterialTheme.typography.titleMedium, + ) + Card( + modifier = Modifier.fillMaxWidth(), + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), + ) { + Column( + modifier = Modifier.padding(12.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + Text( + text = "View application logs", + style = MaterialTheme.typography.labelSmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Button(onClick = onNavigateToLogs, modifier = Modifier.fillMaxWidth()) { + Icon(Icons.AutoMirrored.Filled.List, contentDescription = null) + Spacer(modifier = Modifier.width(8.dp)) + Text("Open Logs") + } + } + } + + // Leave Server section + Text( + text = "Leave Server", + style = MaterialTheme.typography.titleMedium, + ) + Card( + modifier = Modifier.fillMaxWidth(), + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), + ) { + Column( + modifier = Modifier.padding(12.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + // Warning/info text appears above the action button + Text( + text = "Leaving removes local data", + style = MaterialTheme.typography.labelLarge, + color = MaterialTheme.colorScheme.onSurface, + ) + Text( + text = "Disconnects and clears local database", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Text( + text = "Clears stored server URL and password", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Text( + text = "Deletes all local data (tables, fields, items)", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + Text( + text = "Returns to server setup screen", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + ) + + // Action button placed after the information for better UX + Button( + onClick = { showLeaveDialog = true }, + modifier = Modifier.fillMaxWidth(), + enabled = !isLeaving, + colors = + ButtonDefaults.buttonColors( + containerColor = MaterialTheme.colorScheme.error, + contentColor = MaterialTheme.colorScheme.onError, + ), + ) { + if (isLeaving) { + CircularProgressIndicator( + modifier = Modifier.size(16.dp), + color = MaterialTheme.colorScheme.onError, + strokeWidth = 2.dp, + ) + Spacer(modifier = Modifier.width(8.dp)) + Text("Leaving...") + } else { + Text("Leave Server") + } + } + } + } + + + } + + // Notifications section (placed after main content but before dialogs) + Column( + modifier = + Modifier + .fillMaxWidth() + .padding(padding) + .padding(16.dp), + verticalArrangement = Arrangement.spacedBy(16.dp), + ) { Text( text = "Notifications", style = MaterialTheme.typography.titleMedium, @@ -415,103 +523,8 @@ fun SettingsScreen( ) } } - - // Diagnostics / Logs - Text( - text = "Diagnostics", - style = MaterialTheme.typography.titleMedium, - ) - Card( - modifier = Modifier.fillMaxWidth(), - colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), - ) { - Column( - modifier = Modifier.padding(12.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), - ) { - Text( - text = "View application logs", - style = MaterialTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - Button(onClick = onNavigateToLogs, modifier = Modifier.fillMaxWidth()) { - Icon(Icons.AutoMirrored.Filled.List, contentDescription = null) - Spacer(modifier = Modifier.width(8.dp)) - Text("Open Logs") - } - } - } - - // Leave Server section - Text( - text = "Leave Server", - style = MaterialTheme.typography.titleMedium, - ) - Card( - modifier = Modifier.fillMaxWidth(), - colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceVariant), - ) { - Column( - modifier = Modifier.padding(12.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), - ) { - // Warning/info text appears above the action button - Text( - text = "Leaving removes local data", - style = MaterialTheme.typography.labelLarge, - color = MaterialTheme.colorScheme.onSurface, - ) - Text( - text = "Disconnects and clears local database", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - Text( - text = "Clears stored server URL and password", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - Text( - text = "Deletes all local data (tables, fields, items)", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - Text( - text = "Returns to server setup screen", - style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - - // Action button placed after the information for better UX - Button( - onClick = { showLeaveDialog = true }, - modifier = Modifier.fillMaxWidth(), - enabled = !isLeaving, - colors = - ButtonDefaults.buttonColors( - containerColor = MaterialTheme.colorScheme.error, - contentColor = MaterialTheme.colorScheme.onError, - ), - ) { - if (isLeaving) { - CircularProgressIndicator( - modifier = Modifier.size(16.dp), - color = MaterialTheme.colorScheme.onError, - strokeWidth = 2.dp, - ) - Spacer(modifier = Modifier.width(8.dp)) - Text("Leaving...") - } else { - Text("Leave Server") - } - } - } - } - - } - if (showLeaveDialog) { AlertDialog( onDismissRequest = { showLeaveDialog = false },