Merge pull request #18
* MP-19 Refactoring: Einführung der "Registry" & "Masterdata" Trennung … * MP-19 Refactoring: Frontend Tabula Rasa * MP-19 Refactoring: Frontend Tabula Rasa * refactoring: * MP-20 fix(docker/clients): include `:domains` module in web/desktop b… * MP-20 fix(web-app build): resolve JS compile error and add dev/prod b… * MP-20 fix(web-app): remove vendor.js reference and harden JS bootstra… * MP-20 fixing: clients * MP-20 fixing: clients
This commit is contained in:
@@ -1,57 +1,59 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.composeMultiplatform)
|
||||
alias(libs.plugins.composeCompiler)
|
||||
alias(libs.plugins.kotlinSerialization)
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.composeMultiplatform)
|
||||
alias(libs.plugins.composeCompiler)
|
||||
alias(libs.plugins.kotlinSerialization)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
val enableWasm = providers.gradleProperty("enableWasm").orNull == "true"
|
||||
val enableWasm = providers.gradleProperty("enableWasm").orNull == "true"
|
||||
|
||||
jvmToolchain(21)
|
||||
jvmToolchain(21)
|
||||
|
||||
jvm()
|
||||
js(IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
jvm()
|
||||
js(IR) {
|
||||
browser()
|
||||
// nodejs()
|
||||
binaries.executable()
|
||||
}
|
||||
|
||||
// WASM, nur wenn explizit aktiviert
|
||||
if (enableWasm) {
|
||||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
||||
wasmJs {
|
||||
browser()
|
||||
binaries.executable()
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain.dependencies {
|
||||
// Shared module dependency
|
||||
implementation(project(":clients:shared"))
|
||||
|
||||
// Compose dependencies
|
||||
implementation(compose.runtime)
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.material3)
|
||||
implementation(compose.ui)
|
||||
implementation(compose.components.resources)
|
||||
|
||||
// Coroutines
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
|
||||
// Serialization
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
|
||||
// DateTime
|
||||
implementation(libs.kotlinx.datetime)
|
||||
}
|
||||
|
||||
// WASM, nur wenn explizit aktiviert
|
||||
if (enableWasm) {
|
||||
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
||||
wasmJs {
|
||||
browser()
|
||||
}
|
||||
jsMain.dependencies {
|
||||
// JS-specific UI dependencies if needed
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain.dependencies {
|
||||
// Shared module dependency
|
||||
implementation(project(":clients:shared"))
|
||||
|
||||
// Compose dependencies
|
||||
implementation(compose.runtime)
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.material3)
|
||||
implementation(compose.ui)
|
||||
implementation(compose.components.resources)
|
||||
|
||||
// Coroutines
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
|
||||
// Serialization
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
|
||||
// DateTime
|
||||
implementation(libs.kotlinx.datetime)
|
||||
}
|
||||
|
||||
jsMain.dependencies {
|
||||
// JS-specific UI dependencies if needed
|
||||
}
|
||||
|
||||
jvmMain.dependencies {
|
||||
// JVM-specific UI dependencies if needed
|
||||
}
|
||||
jvmMain.dependencies {
|
||||
// JVM-specific UI dependencies if needed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -12,18 +12,18 @@ import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun AppFooter() {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant)
|
||||
.padding(16.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "© 2025 Meldestelle - Built with Kotlin Multiplatform",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surfaceVariant)
|
||||
.padding(16.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "© 2025 Meldestelle - Built with Kotlin Multiplatform",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+61
-61
@@ -7,68 +7,68 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AppHeader(
|
||||
title: String,
|
||||
onNavigateToPing: (() -> Unit)? = null,
|
||||
onNavigateToLogin: (() -> Unit)? = null,
|
||||
onLogout: (() -> Unit)? = null,
|
||||
isAuthenticated: Boolean = false,
|
||||
username: String? = null,
|
||||
userPermissions: List<String> = emptyList()
|
||||
title: String,
|
||||
onNavigateToPing: (() -> Unit)? = null,
|
||||
onNavigateToLogin: (() -> Unit)? = null,
|
||||
onLogout: (() -> Unit)? = null,
|
||||
isAuthenticated: Boolean = false,
|
||||
username: String? = null,
|
||||
userPermissions: List<String> = emptyList()
|
||||
) {
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
actions = {
|
||||
// Ping Service button
|
||||
onNavigateToPing?.let { navigateAction ->
|
||||
TextButton(
|
||||
onClick = navigateAction
|
||||
) {
|
||||
Text("Ping Service")
|
||||
}
|
||||
}
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
actions = {
|
||||
// Ping Service button
|
||||
onNavigateToPing?.let { navigateAction ->
|
||||
TextButton(
|
||||
onClick = navigateAction
|
||||
) {
|
||||
Text("Ping Service")
|
||||
}
|
||||
}
|
||||
|
||||
// Authentication buttons
|
||||
if (isAuthenticated) {
|
||||
// Show username with admin indicator if user has delete permissions
|
||||
username?.let { user ->
|
||||
val isAdmin = userPermissions.any { it.contains("DELETE") }
|
||||
Text(
|
||||
text = if (isAdmin) "👑 Hallo, $user (Admin)" else "Hallo, $user",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = if (isAdmin)
|
||||
MaterialTheme.colorScheme.tertiary
|
||||
else
|
||||
MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
onLogout?.let { logoutAction ->
|
||||
TextButton(
|
||||
onClick = logoutAction
|
||||
) {
|
||||
Text("Abmelden")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Show login button
|
||||
onNavigateToLogin?.let { loginAction ->
|
||||
TextButton(
|
||||
onClick = loginAction
|
||||
) {
|
||||
Text("Anmelden")
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||
titleContentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
actionIconContentColor = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
// Authentication buttons
|
||||
if (isAuthenticated) {
|
||||
// Show username with admin indicator if user has delete permissions
|
||||
username?.let { user ->
|
||||
val isAdmin = userPermissions.any { it.contains("DELETE") }
|
||||
Text(
|
||||
text = if (isAdmin) "👑 Hallo, $user (Admin)" else "Hallo, $user",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = if (isAdmin)
|
||||
MaterialTheme.colorScheme.tertiary
|
||||
else
|
||||
MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
}
|
||||
onLogout?.let { logoutAction ->
|
||||
TextButton(
|
||||
onClick = logoutAction
|
||||
) {
|
||||
Text("Abmelden")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Show login button
|
||||
onNavigateToLogin?.let { loginAction ->
|
||||
TextButton(
|
||||
onClick = loginAction
|
||||
) {
|
||||
Text("Anmelden")
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||
titleContentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
actionIconContentColor = MaterialTheme.colorScheme.onPrimaryContainer
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
+14
-14
@@ -10,19 +10,19 @@ import androidx.compose.ui.Modifier
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AppScaffold(
|
||||
header: @Composable () -> Unit = {
|
||||
AppHeader(title = "Meldestelle")
|
||||
},
|
||||
content: @Composable (PaddingValues) -> Unit,
|
||||
footer: @Composable () -> Unit = {
|
||||
AppFooter()
|
||||
},
|
||||
header: @Composable () -> Unit = {
|
||||
AppHeader(title = "Meldestelle")
|
||||
},
|
||||
content: @Composable (PaddingValues) -> Unit,
|
||||
footer: @Composable () -> Unit = {
|
||||
AppFooter()
|
||||
},
|
||||
) {
|
||||
Scaffold(
|
||||
topBar = header,
|
||||
bottomBar = footer,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) { paddingValues ->
|
||||
content(paddingValues)
|
||||
}
|
||||
Scaffold(
|
||||
topBar = header,
|
||||
bottomBar = footer,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) { paddingValues ->
|
||||
content(paddingValues)
|
||||
}
|
||||
}
|
||||
|
||||
+71
-71
@@ -9,101 +9,101 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
enum class LoadingSize {
|
||||
SMALL, MEDIUM, LARGE
|
||||
SMALL, MEDIUM, LARGE
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LoadingIndicator(
|
||||
modifier: Modifier = Modifier,
|
||||
size: LoadingSize = LoadingSize.MEDIUM,
|
||||
message: String? = null
|
||||
modifier: Modifier = Modifier,
|
||||
size: LoadingSize = LoadingSize.MEDIUM,
|
||||
message: String? = null
|
||||
) {
|
||||
val indicatorSize = when (size) {
|
||||
LoadingSize.SMALL -> 24.dp
|
||||
LoadingSize.MEDIUM -> 32.dp
|
||||
LoadingSize.LARGE -> 48.dp
|
||||
}
|
||||
val indicatorSize = when (size) {
|
||||
LoadingSize.SMALL -> 24.dp
|
||||
LoadingSize.MEDIUM -> 32.dp
|
||||
LoadingSize.LARGE -> 48.dp
|
||||
}
|
||||
|
||||
val strokeWidth = when (size) {
|
||||
LoadingSize.SMALL -> 2.dp
|
||||
LoadingSize.MEDIUM -> 3.dp
|
||||
LoadingSize.LARGE -> 4.dp
|
||||
}
|
||||
val strokeWidth = when (size) {
|
||||
LoadingSize.SMALL -> 2.dp
|
||||
LoadingSize.MEDIUM -> 3.dp
|
||||
LoadingSize.LARGE -> 4.dp
|
||||
}
|
||||
|
||||
Column(
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(indicatorSize),
|
||||
strokeWidth = strokeWidth
|
||||
)
|
||||
Column(
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(indicatorSize),
|
||||
strokeWidth = strokeWidth
|
||||
)
|
||||
|
||||
if (message != null) {
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(
|
||||
text = message,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
if (message != null) {
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(
|
||||
text = message,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun FullScreenLoading(
|
||||
message: String = "Loading...",
|
||||
modifier: Modifier = Modifier
|
||||
message: String = "Loading...",
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
LoadingIndicator(
|
||||
size = LoadingSize.LARGE,
|
||||
message = message
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
LoadingIndicator(
|
||||
size = LoadingSize.LARGE,
|
||||
message = message
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun InlineLoading(
|
||||
message: String? = null,
|
||||
modifier: Modifier = Modifier
|
||||
message: String? = null,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center
|
||||
) {
|
||||
LoadingIndicator(
|
||||
size = LoadingSize.SMALL,
|
||||
message = message
|
||||
)
|
||||
}
|
||||
Row(
|
||||
modifier = modifier.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center
|
||||
) {
|
||||
LoadingIndicator(
|
||||
size = LoadingSize.SMALL,
|
||||
message = message
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LinearLoadingIndicator(
|
||||
modifier: Modifier = Modifier,
|
||||
message: String? = null
|
||||
modifier: Modifier = Modifier,
|
||||
message: String? = null
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
LinearProgressIndicator(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Column(
|
||||
modifier = modifier,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
LinearProgressIndicator(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
if (message != null) {
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = message,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
if (message != null) {
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = message,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+89
-90
@@ -1,125 +1,124 @@
|
||||
package at.mocode.clients.shared.commonui.components
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
enum class ButtonVariant {
|
||||
PRIMARY, SECONDARY, OUTLINE, TEXT
|
||||
PRIMARY, SECONDARY, OUTLINE, TEXT
|
||||
}
|
||||
|
||||
enum class ButtonSize {
|
||||
SMALL, MEDIUM, LARGE
|
||||
SMALL, MEDIUM, LARGE
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MeldestelleButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
variant: ButtonVariant = ButtonVariant.PRIMARY,
|
||||
size: ButtonSize = ButtonSize.MEDIUM,
|
||||
enabled: Boolean = true,
|
||||
isLoading: Boolean = false,
|
||||
fullWidth: Boolean = false
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
variant: ButtonVariant = ButtonVariant.PRIMARY,
|
||||
size: ButtonSize = ButtonSize.MEDIUM,
|
||||
enabled: Boolean = true,
|
||||
isLoading: Boolean = false,
|
||||
fullWidth: Boolean = false
|
||||
) {
|
||||
val buttonModifier = modifier.then(
|
||||
if (fullWidth) Modifier.fillMaxWidth() else Modifier
|
||||
).then(
|
||||
when (size) {
|
||||
ButtonSize.SMALL -> Modifier.height(32.dp)
|
||||
ButtonSize.MEDIUM -> Modifier.height(40.dp)
|
||||
ButtonSize.LARGE -> Modifier.height(48.dp)
|
||||
}
|
||||
)
|
||||
|
||||
when (variant) {
|
||||
ButtonVariant.PRIMARY -> Button(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
|
||||
ButtonVariant.SECONDARY -> FilledTonalButton(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
|
||||
ButtonVariant.OUTLINE -> OutlinedButton(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
|
||||
ButtonVariant.TEXT -> TextButton(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
val buttonModifier = modifier.then(
|
||||
if (fullWidth) Modifier.fillMaxWidth() else Modifier
|
||||
).then(
|
||||
when (size) {
|
||||
ButtonSize.SMALL -> Modifier.height(32.dp)
|
||||
ButtonSize.MEDIUM -> Modifier.height(40.dp)
|
||||
ButtonSize.LARGE -> Modifier.height(48.dp)
|
||||
}
|
||||
)
|
||||
|
||||
when (variant) {
|
||||
ButtonVariant.PRIMARY -> Button(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
|
||||
ButtonVariant.SECONDARY -> FilledTonalButton(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
|
||||
ButtonVariant.OUTLINE -> OutlinedButton(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
|
||||
ButtonVariant.TEXT -> TextButton(
|
||||
onClick = onClick,
|
||||
modifier = buttonModifier,
|
||||
enabled = enabled && !isLoading
|
||||
) {
|
||||
ButtonContent(text = text, isLoading = isLoading)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ButtonContent(
|
||||
text: String,
|
||||
isLoading: Boolean
|
||||
text: String,
|
||||
isLoading: Boolean
|
||||
) {
|
||||
if (isLoading) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.padding(2.dp),
|
||||
strokeWidth = 2.dp
|
||||
)
|
||||
} else {
|
||||
Text(text)
|
||||
}
|
||||
if (isLoading) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.padding(2.dp),
|
||||
strokeWidth = 2.dp
|
||||
)
|
||||
} else {
|
||||
Text(text)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun PrimaryButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
isLoading: Boolean = false,
|
||||
fullWidth: Boolean = false
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
isLoading: Boolean = false,
|
||||
fullWidth: Boolean = false
|
||||
) = MeldestelleButton(
|
||||
text = text,
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
variant = ButtonVariant.PRIMARY,
|
||||
enabled = enabled,
|
||||
isLoading = isLoading,
|
||||
fullWidth = fullWidth
|
||||
text = text,
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
variant = ButtonVariant.PRIMARY,
|
||||
enabled = enabled,
|
||||
isLoading = isLoading,
|
||||
fullWidth = fullWidth
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun SecondaryButton(
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
isLoading: Boolean = false,
|
||||
fullWidth: Boolean = false
|
||||
text: String,
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
enabled: Boolean = true,
|
||||
isLoading: Boolean = false,
|
||||
fullWidth: Boolean = false
|
||||
) = MeldestelleButton(
|
||||
text = text,
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
variant = ButtonVariant.SECONDARY,
|
||||
enabled = enabled,
|
||||
isLoading = isLoading,
|
||||
fullWidth = fullWidth
|
||||
text = text,
|
||||
onClick = onClick,
|
||||
modifier = modifier,
|
||||
variant = ButtonVariant.SECONDARY,
|
||||
enabled = enabled,
|
||||
isLoading = isLoading,
|
||||
fullWidth = fullWidth
|
||||
)
|
||||
|
||||
+149
-148
@@ -17,176 +17,177 @@ import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun MeldestelleTextField(
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String? = null,
|
||||
placeholder: String? = null,
|
||||
leadingIcon: ImageVector? = null,
|
||||
trailingIcon: ImageVector? = null,
|
||||
onTrailingIconClick: (() -> Unit)? = null,
|
||||
isError: Boolean = false,
|
||||
errorMessage: String? = null,
|
||||
helperText: String? = null,
|
||||
enabled: Boolean = true,
|
||||
readOnly: Boolean = false,
|
||||
singleLine: Boolean = true,
|
||||
maxLines: Int = Int.MAX_VALUE,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
imeAction: ImeAction = ImeAction.Default,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default,
|
||||
visualTransformation: VisualTransformation = VisualTransformation.None
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String? = null,
|
||||
placeholder: String? = null,
|
||||
leadingIcon: ImageVector? = null,
|
||||
trailingIcon: ImageVector? = null,
|
||||
onTrailingIconClick: (() -> Unit)? = null,
|
||||
isError: Boolean = false,
|
||||
errorMessage: String? = null,
|
||||
helperText: String? = null,
|
||||
enabled: Boolean = true,
|
||||
readOnly: Boolean = false,
|
||||
singleLine: Boolean = true,
|
||||
maxLines: Int = Int.MAX_VALUE,
|
||||
keyboardType: KeyboardType = KeyboardType.Text,
|
||||
imeAction: ImeAction = ImeAction.Default,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default,
|
||||
visualTransformation: VisualTransformation = VisualTransformation.None
|
||||
) {
|
||||
Column(modifier = modifier) {
|
||||
OutlinedTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
label = label?.let { { Text(it) } },
|
||||
placeholder = placeholder?.let { { Text(it) } },
|
||||
leadingIcon = leadingIcon?.let { icon ->
|
||||
{ Icon(imageVector = icon, contentDescription = null) }
|
||||
},
|
||||
trailingIcon = if (trailingIcon != null) {
|
||||
{
|
||||
IconButton(
|
||||
onClick = onTrailingIconClick ?: {}
|
||||
) {
|
||||
Icon(imageVector = trailingIcon, contentDescription = null)
|
||||
}
|
||||
}
|
||||
} else null,
|
||||
isError = isError,
|
||||
enabled = enabled,
|
||||
readOnly = readOnly,
|
||||
singleLine = singleLine,
|
||||
maxLines = maxLines,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = keyboardType,
|
||||
imeAction = imeAction
|
||||
),
|
||||
keyboardActions = keyboardActions,
|
||||
visualTransformation = visualTransformation
|
||||
)
|
||||
|
||||
// Error or helper text
|
||||
when {
|
||||
isError && errorMessage != null -> {
|
||||
Text(
|
||||
text = errorMessage,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(start = 16.dp, top = 4.dp)
|
||||
)
|
||||
}
|
||||
helperText != null -> {
|
||||
Text(
|
||||
text = helperText,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(start = 16.dp, top = 4.dp)
|
||||
)
|
||||
}
|
||||
Column(modifier = modifier) {
|
||||
OutlinedTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
label = label?.let { { Text(it) } },
|
||||
placeholder = placeholder?.let { { Text(it) } },
|
||||
leadingIcon = leadingIcon?.let { icon ->
|
||||
{ Icon(imageVector = icon, contentDescription = null) }
|
||||
},
|
||||
trailingIcon = if (trailingIcon != null) {
|
||||
{
|
||||
IconButton(
|
||||
onClick = onTrailingIconClick ?: {}
|
||||
) {
|
||||
Icon(imageVector = trailingIcon, contentDescription = null)
|
||||
}
|
||||
}
|
||||
} else null,
|
||||
isError = isError,
|
||||
enabled = enabled,
|
||||
readOnly = readOnly,
|
||||
singleLine = singleLine,
|
||||
maxLines = maxLines,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = keyboardType,
|
||||
imeAction = imeAction
|
||||
),
|
||||
keyboardActions = keyboardActions,
|
||||
visualTransformation = visualTransformation
|
||||
)
|
||||
|
||||
// Error or helper text
|
||||
when {
|
||||
isError && errorMessage != null -> {
|
||||
Text(
|
||||
text = errorMessage,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(start = 16.dp, top = 4.dp)
|
||||
)
|
||||
}
|
||||
|
||||
helperText != null -> {
|
||||
Text(
|
||||
text = helperText,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
modifier = Modifier.padding(start = 16.dp, top = 4.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MeldestellePasswordField(
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String = "Password",
|
||||
placeholder: String? = null,
|
||||
isError: Boolean = false,
|
||||
errorMessage: String? = null,
|
||||
helperText: String? = null,
|
||||
enabled: Boolean = true,
|
||||
imeAction: ImeAction = ImeAction.Done,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String = "Password",
|
||||
placeholder: String? = null,
|
||||
isError: Boolean = false,
|
||||
errorMessage: String? = null,
|
||||
helperText: String? = null,
|
||||
enabled: Boolean = true,
|
||||
imeAction: ImeAction = ImeAction.Done,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default
|
||||
) {
|
||||
var passwordVisible by remember { mutableStateOf(false) }
|
||||
var passwordVisible by remember { mutableStateOf(false) }
|
||||
|
||||
MeldestelleTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = modifier,
|
||||
label = label,
|
||||
placeholder = placeholder,
|
||||
trailingIcon = if (passwordVisible) {
|
||||
// You would need to import the actual icon from Material Icons
|
||||
null // Placeholder for visibility off icon
|
||||
} else {
|
||||
null // Placeholder for visibility on icon
|
||||
},
|
||||
onTrailingIconClick = { passwordVisible = !passwordVisible },
|
||||
isError = isError,
|
||||
errorMessage = errorMessage,
|
||||
helperText = helperText,
|
||||
enabled = enabled,
|
||||
keyboardType = KeyboardType.Password,
|
||||
imeAction = imeAction,
|
||||
keyboardActions = keyboardActions,
|
||||
visualTransformation = if (passwordVisible) {
|
||||
VisualTransformation.None
|
||||
} else {
|
||||
PasswordVisualTransformation()
|
||||
}
|
||||
)
|
||||
MeldestelleTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = modifier,
|
||||
label = label,
|
||||
placeholder = placeholder,
|
||||
trailingIcon = if (passwordVisible) {
|
||||
// You would need to import the actual icon from Material Icons
|
||||
null // Placeholder for visibility off icon
|
||||
} else {
|
||||
null // Placeholder for visibility on icon
|
||||
},
|
||||
onTrailingIconClick = { passwordVisible = !passwordVisible },
|
||||
isError = isError,
|
||||
errorMessage = errorMessage,
|
||||
helperText = helperText,
|
||||
enabled = enabled,
|
||||
keyboardType = KeyboardType.Password,
|
||||
imeAction = imeAction,
|
||||
keyboardActions = keyboardActions,
|
||||
visualTransformation = if (passwordVisible) {
|
||||
VisualTransformation.None
|
||||
} else {
|
||||
PasswordVisualTransformation()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun MeldestelleEmailField(
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String = "Email",
|
||||
placeholder: String? = null,
|
||||
isError: Boolean = false,
|
||||
errorMessage: String? = null,
|
||||
helperText: String? = null,
|
||||
enabled: Boolean = true,
|
||||
imeAction: ImeAction = ImeAction.Next,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String = "Email",
|
||||
placeholder: String? = null,
|
||||
isError: Boolean = false,
|
||||
errorMessage: String? = null,
|
||||
helperText: String? = null,
|
||||
enabled: Boolean = true,
|
||||
imeAction: ImeAction = ImeAction.Next,
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default
|
||||
) {
|
||||
MeldestelleTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = modifier,
|
||||
label = label,
|
||||
placeholder = placeholder,
|
||||
isError = isError,
|
||||
errorMessage = errorMessage,
|
||||
helperText = helperText,
|
||||
enabled = enabled,
|
||||
keyboardType = KeyboardType.Email,
|
||||
imeAction = imeAction,
|
||||
keyboardActions = keyboardActions
|
||||
)
|
||||
MeldestelleTextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
modifier = modifier,
|
||||
label = label,
|
||||
placeholder = placeholder,
|
||||
isError = isError,
|
||||
errorMessage = errorMessage,
|
||||
helperText = helperText,
|
||||
enabled = enabled,
|
||||
keyboardType = KeyboardType.Email,
|
||||
imeAction = imeAction,
|
||||
keyboardActions = keyboardActions
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Form validation utilities
|
||||
*/
|
||||
object FormValidation {
|
||||
fun validateEmail(email: String): String? {
|
||||
return when {
|
||||
email.isEmpty() -> "Email is required"
|
||||
!email.contains("@") -> "Invalid email format"
|
||||
!email.matches(Regex("^[A-Za-z0-9+_.-]+@([A-Za-z0-9.-]+\\.[A-Za-z]{2,})$")) -> "Invalid email format"
|
||||
else -> null
|
||||
}
|
||||
fun validateEmail(email: String): String? {
|
||||
return when {
|
||||
email.isEmpty() -> "Email is required"
|
||||
!email.contains("@") -> "Invalid email format"
|
||||
!email.matches(Regex("^[A-Za-z0-9+_.-]+@([A-Za-z0-9.-]+\\.[A-Za-z]{2,})$")) -> "Invalid email format"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun validatePassword(password: String): String? {
|
||||
return when {
|
||||
password.isEmpty() -> "Password is required"
|
||||
password.length < 6 -> "Password must be at least 6 characters"
|
||||
else -> null
|
||||
}
|
||||
fun validatePassword(password: String): String? {
|
||||
return when {
|
||||
password.isEmpty() -> "Password is required"
|
||||
password.length < 6 -> "Password must be at least 6 characters"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun validateRequired(value: String, fieldName: String): String? {
|
||||
return if (value.isEmpty()) "$fieldName is required" else null
|
||||
}
|
||||
fun validateRequired(value: String, fieldName: String): String? {
|
||||
return if (value.isEmpty()) "$fieldName is required" else null
|
||||
}
|
||||
}
|
||||
|
||||
+3
-177
@@ -1,179 +1,5 @@
|
||||
package at.mocode.clients.shared.commonui.components
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import at.mocode.clients.shared.presentation.state.Notification
|
||||
import at.mocode.clients.shared.presentation.state.NotificationType
|
||||
|
||||
@Composable
|
||||
fun NotificationCard(
|
||||
notification: Notification,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val backgroundColor = when (notification.type) {
|
||||
NotificationType.SUCCESS -> Color(0xFF4CAF50).copy(alpha = 0.1f)
|
||||
NotificationType.ERROR -> Color(0xFFF44336).copy(alpha = 0.1f)
|
||||
NotificationType.WARNING -> Color(0xFFFF9800).copy(alpha = 0.1f)
|
||||
NotificationType.INFO -> Color(0xFF2196F3).copy(alpha = 0.1f)
|
||||
}
|
||||
|
||||
val borderColor = when (notification.type) {
|
||||
NotificationType.SUCCESS -> Color(0xFF4CAF50)
|
||||
NotificationType.ERROR -> Color(0xFFF44336)
|
||||
NotificationType.WARNING -> Color(0xFFFF9800)
|
||||
NotificationType.INFO -> Color(0xFF2196F3)
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(containerColor = backgroundColor),
|
||||
shape = RoundedCornerShape(8.dp),
|
||||
border = androidx.compose.foundation.BorderStroke(1.dp, borderColor)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.Top
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = notification.title,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
|
||||
if (notification.message.isNotBlank()) {
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text(
|
||||
text = notification.message,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = notification.timestamp,
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = onDismiss,
|
||||
modifier = Modifier.size(24.dp)
|
||||
) {
|
||||
Text("×", style = MaterialTheme.typography.titleMedium)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NotificationList(
|
||||
notifications: List<Notification>,
|
||||
onDismissNotification: (String) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier,
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
notifications.forEach { notification ->
|
||||
NotificationCard(
|
||||
notification = notification,
|
||||
onDismiss = { onDismissNotification(notification.id) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SnackbarNotification(
|
||||
notification: Notification,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val backgroundColor = when (notification.type) {
|
||||
NotificationType.SUCCESS -> Color(0xFF4CAF50)
|
||||
NotificationType.ERROR -> Color(0xFFF44336)
|
||||
NotificationType.WARNING -> Color(0xFFFF9800)
|
||||
NotificationType.INFO -> Color(0xFF2196F3)
|
||||
}
|
||||
|
||||
Snackbar(
|
||||
modifier = modifier,
|
||||
containerColor = backgroundColor,
|
||||
contentColor = Color.White,
|
||||
action = {
|
||||
TextButton(
|
||||
onClick = onDismiss,
|
||||
colors = ButtonDefaults.textButtonColors(
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text("Dismiss")
|
||||
}
|
||||
}
|
||||
) {
|
||||
Column {
|
||||
Text(
|
||||
text = notification.title,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
if (notification.message.isNotBlank()) {
|
||||
Text(
|
||||
text = notification.message,
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ToastNotification(
|
||||
message: String,
|
||||
type: NotificationType = NotificationType.INFO,
|
||||
visible: Boolean,
|
||||
onDismiss: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
if (visible) {
|
||||
LaunchedEffect(Unit) {
|
||||
kotlinx.coroutines.delay(3000) // Auto dismiss after 3 seconds
|
||||
onDismiss()
|
||||
}
|
||||
|
||||
val backgroundColor = when (type) {
|
||||
NotificationType.SUCCESS -> Color(0xFF4CAF50)
|
||||
NotificationType.ERROR -> Color(0xFFF44336)
|
||||
NotificationType.WARNING -> Color(0xFFFF9800)
|
||||
NotificationType.INFO -> Color(0xFF2196F3)
|
||||
}
|
||||
|
||||
Card(
|
||||
modifier = modifier,
|
||||
colors = CardDefaults.cardColors(containerColor = backgroundColor),
|
||||
shape = RoundedCornerShape(24.dp)
|
||||
) {
|
||||
Text(
|
||||
text = message,
|
||||
color = Color.White,
|
||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Legacy notification components removed due to dependency on old presentation layer.
|
||||
// Intentionally left empty as part of cleanup. You can safely delete this file
|
||||
// if no modules import it anymore.
|
||||
|
||||
-232
@@ -1,232 +0,0 @@
|
||||
package at.mocode.clients.shared.commonui.layout
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import at.mocode.clients.shared.commonui.components.*
|
||||
import at.mocode.clients.shared.commonui.screens.LoginScreenContainer
|
||||
import at.mocode.clients.shared.presentation.state.AppState
|
||||
import at.mocode.clients.shared.presentation.actions.AppAction
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun MainLayout(
|
||||
appState: AppState,
|
||||
onDispatchAction: (AppAction) -> Unit,
|
||||
onNavigateTo: (String) -> Unit,
|
||||
content: @Composable () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
var showUserMenu by remember { mutableStateOf(false) }
|
||||
|
||||
Scaffold(
|
||||
modifier = modifier,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = "Meldestelle",
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
actions = {
|
||||
// Notifications
|
||||
if (appState.ui.notifications.isNotEmpty()) {
|
||||
BadgedBox(
|
||||
badge = {
|
||||
Badge(
|
||||
contentColor = MaterialTheme.colorScheme.onError,
|
||||
containerColor = MaterialTheme.colorScheme.error
|
||||
) {
|
||||
Text(appState.ui.notifications.size.toString())
|
||||
}
|
||||
}
|
||||
) {
|
||||
IconButton(
|
||||
onClick = { onNavigateTo("/notifications") }
|
||||
) {
|
||||
Text("🔔")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IconButton(
|
||||
onClick = { onNavigateTo("/notifications") }
|
||||
) {
|
||||
Text("🔔")
|
||||
}
|
||||
}
|
||||
|
||||
// Theme toggle
|
||||
IconButton(
|
||||
onClick = { onDispatchAction(AppAction.UI.ToggleDarkMode) }
|
||||
) {
|
||||
Text(if (appState.ui.isDarkMode) "☀️" else "🌙")
|
||||
}
|
||||
|
||||
// User menu
|
||||
Box {
|
||||
IconButton(
|
||||
onClick = { showUserMenu = true }
|
||||
) {
|
||||
Text("👤")
|
||||
}
|
||||
|
||||
DropdownMenu(
|
||||
expanded = showUserMenu,
|
||||
onDismissRequest = { showUserMenu = false }
|
||||
) {
|
||||
DropdownMenuItem(
|
||||
text = {
|
||||
Column {
|
||||
Text(
|
||||
text = appState.auth.user?.firstName ?: "User",
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
Text(
|
||||
text = appState.auth.user?.email ?: "",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
},
|
||||
onClick = {
|
||||
showUserMenu = false
|
||||
onNavigateTo("/profile")
|
||||
}
|
||||
)
|
||||
|
||||
HorizontalDivider()
|
||||
|
||||
DropdownMenuItem(
|
||||
text = { Text("Settings") },
|
||||
onClick = {
|
||||
showUserMenu = false
|
||||
onNavigateTo("/settings")
|
||||
}
|
||||
)
|
||||
|
||||
DropdownMenuItem(
|
||||
text = { Text("Help") },
|
||||
onClick = {
|
||||
showUserMenu = false
|
||||
onNavigateTo("/help")
|
||||
}
|
||||
)
|
||||
|
||||
HorizontalDivider()
|
||||
|
||||
DropdownMenuItem(
|
||||
text = {
|
||||
Text(
|
||||
text = "Logout",
|
||||
color = MaterialTheme.colorScheme.error
|
||||
)
|
||||
},
|
||||
onClick = {
|
||||
showUserMenu = false
|
||||
onDispatchAction(AppAction.Auth.Logout)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
},
|
||||
bottomBar = {
|
||||
if (appState.ui.notifications.isNotEmpty()) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
color = MaterialTheme.colorScheme.surfaceVariant
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = "${appState.ui.notifications.size} notification(s)",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
TextButton(
|
||||
onClick = { onNavigateTo("/notifications") }
|
||||
) {
|
||||
Text("View All")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
) { paddingValues ->
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(paddingValues)
|
||||
) {
|
||||
// Loading overlay
|
||||
if (appState.ui.isLoading) {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
FullScreenLoading("Loading...")
|
||||
}
|
||||
} else {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AuthenticatedLayout(
|
||||
appState: AppState,
|
||||
onDispatchAction: (AppAction) -> Unit,
|
||||
onNavigateTo: (String) -> Unit,
|
||||
content: @Composable () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
if (appState.auth.isAuthenticated) {
|
||||
MainLayout(
|
||||
appState = appState,
|
||||
onDispatchAction = onDispatchAction,
|
||||
onNavigateTo = onNavigateTo,
|
||||
content = content,
|
||||
modifier = modifier
|
||||
)
|
||||
} else {
|
||||
// Show login screen if not authenticated
|
||||
LoginScreenContainer(
|
||||
authState = appState.auth,
|
||||
onDispatchAction = onDispatchAction,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ResponsiveLayout(
|
||||
appState: AppState,
|
||||
onDispatchAction: (AppAction) -> Unit,
|
||||
onNavigateTo: (String) -> Unit,
|
||||
content: @Composable (Boolean) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
// Simple responsive design - could be enhanced with actual screen size detection
|
||||
val isCompact = remember { mutableStateOf(false) }
|
||||
|
||||
AuthenticatedLayout(
|
||||
appState = appState,
|
||||
onDispatchAction = onDispatchAction,
|
||||
onNavigateTo = onNavigateTo,
|
||||
content = { content(isCompact.value) },
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
-250
@@ -1,250 +0,0 @@
|
||||
package at.mocode.clients.shared.commonui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import at.mocode.clients.shared.commonui.components.*
|
||||
import at.mocode.clients.shared.presentation.state.AppState
|
||||
import at.mocode.clients.shared.presentation.actions.AppAction
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun DashboardScreen(
|
||||
appState: AppState,
|
||||
onDispatchAction: (AppAction) -> Unit,
|
||||
onNavigateTo: (String) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val scrollState = rememberScrollState()
|
||||
val user = appState.auth.user
|
||||
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.verticalScroll(scrollState)
|
||||
.padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
// Welcome Header
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer
|
||||
)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(24.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Welcome back, ${user?.firstName ?: "User"}!",
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = "Here's what's happening in your Meldestelle dashboard",
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = MaterialTheme.colorScheme.onPrimaryContainer.copy(alpha = 0.7f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Quick Actions
|
||||
Text(
|
||||
text = "Quick Actions",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
PrimaryButton(
|
||||
text = "New Report",
|
||||
onClick = { onNavigateTo("/reports/new") },
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
SecondaryButton(
|
||||
text = "View Reports",
|
||||
onClick = { onNavigateTo("/reports") },
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
|
||||
// Statistics Cards
|
||||
Text(
|
||||
text = "Overview",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
StatisticCard(
|
||||
title = "Total Reports",
|
||||
value = "142",
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
StatisticCard(
|
||||
title = "Open Issues",
|
||||
value = "23",
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
StatisticCard(
|
||||
title = "Resolved",
|
||||
value = "119",
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
StatisticCard(
|
||||
title = "This Month",
|
||||
value = "18",
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
|
||||
// Recent Activity
|
||||
Text(
|
||||
text = "Recent Activity",
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
ActivityItem(
|
||||
title = "Report #1234 updated",
|
||||
subtitle = "Status changed to 'In Progress'",
|
||||
timestamp = "2 hours ago"
|
||||
)
|
||||
HorizontalDivider()
|
||||
ActivityItem(
|
||||
title = "New report submitted",
|
||||
subtitle = "Report #1235 - Urgent priority",
|
||||
timestamp = "4 hours ago"
|
||||
)
|
||||
HorizontalDivider()
|
||||
ActivityItem(
|
||||
title = "Report #1230 resolved",
|
||||
subtitle = "Issue successfully closed",
|
||||
timestamp = "1 day ago"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Connection Status
|
||||
if (!appState.network.isOnline) {
|
||||
Card(
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.errorContainer
|
||||
)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = "⚠️",
|
||||
style = MaterialTheme.typography.titleLarge
|
||||
)
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
Column {
|
||||
Text(
|
||||
text = "Offline Mode",
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
Text(
|
||||
text = "Some features may be limited",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun StatisticCard(
|
||||
title: String,
|
||||
value: String,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Card(
|
||||
modifier = modifier,
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceVariant
|
||||
)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = value,
|
||||
style = MaterialTheme.typography.headlineLarge,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ActivityItem(
|
||||
title: String,
|
||||
subtitle: String,
|
||||
timestamp: String,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.titleSmall,
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
Text(
|
||||
text = subtitle,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
Text(
|
||||
text = timestamp,
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f)
|
||||
)
|
||||
}
|
||||
}
|
||||
-198
@@ -1,198 +0,0 @@
|
||||
package at.mocode.clients.shared.commonui.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusDirection
|
||||
import androidx.compose.ui.platform.LocalFocusManager
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import at.mocode.clients.shared.commonui.components.*
|
||||
import at.mocode.clients.shared.presentation.actions.AppAction
|
||||
import at.mocode.clients.shared.presentation.state.AuthState
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun LoginScreen(
|
||||
authState: AuthState,
|
||||
onLoginClick: (String, String) -> Unit,
|
||||
onNavigateToRegister: () -> Unit = {},
|
||||
onForgotPassword: () -> Unit = {},
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
var username by remember { mutableStateOf("") }
|
||||
var password by remember { mutableStateOf("") }
|
||||
var usernameError by remember { mutableStateOf<String?>(null) }
|
||||
var passwordError by remember { mutableStateOf<String?>(null) }
|
||||
|
||||
val focusManager = LocalFocusManager.current
|
||||
|
||||
// Validate form
|
||||
val isFormValid = username.isNotBlank() && password.isNotBlank() &&
|
||||
usernameError == null && passwordError == null
|
||||
|
||||
fun validateUsername(value: String) {
|
||||
usernameError = FormValidation.validateRequired(value, "Username")
|
||||
}
|
||||
|
||||
fun validatePassword(value: String) {
|
||||
passwordError = FormValidation.validatePassword(value)
|
||||
}
|
||||
|
||||
fun handleLogin() {
|
||||
validateUsername(username)
|
||||
validatePassword(password)
|
||||
|
||||
if (isFormValid) {
|
||||
onLoginClick(username.trim(), password)
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(24.dp),
|
||||
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||
) {
|
||||
// Header
|
||||
Text(
|
||||
text = "Meldestelle",
|
||||
style = MaterialTheme.typography.headlineLarge,
|
||||
fontWeight = FontWeight.Bold,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Text(
|
||||
text = "Sign in to your account",
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
// Username Field
|
||||
MeldestelleTextField(
|
||||
value = username,
|
||||
onValueChange = {
|
||||
username = it
|
||||
if (usernameError != null) validateUsername(it)
|
||||
},
|
||||
label = "Username",
|
||||
placeholder = "Enter your username",
|
||||
isError = usernameError != null,
|
||||
errorMessage = usernameError,
|
||||
enabled = !authState.isLoading,
|
||||
imeAction = ImeAction.Next,
|
||||
keyboardActions = KeyboardActions(
|
||||
onNext = { focusManager.moveFocus(FocusDirection.Down) }
|
||||
)
|
||||
)
|
||||
|
||||
// Password Field
|
||||
MeldestellePasswordField(
|
||||
value = password,
|
||||
onValueChange = {
|
||||
password = it
|
||||
if (passwordError != null) validatePassword(it)
|
||||
},
|
||||
label = "Password",
|
||||
placeholder = "Enter your password",
|
||||
isError = passwordError != null,
|
||||
errorMessage = passwordError,
|
||||
enabled = !authState.isLoading,
|
||||
imeAction = ImeAction.Done,
|
||||
keyboardActions = KeyboardActions(
|
||||
onDone = {
|
||||
focusManager.clearFocus()
|
||||
if (isFormValid) handleLogin()
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Error display
|
||||
authState.error?.let { errorMessage ->
|
||||
Text(
|
||||
text = errorMessage,
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
// Login Button
|
||||
PrimaryButton(
|
||||
text = "Sign In",
|
||||
onClick = ::handleLogin,
|
||||
enabled = isFormValid && !authState.isLoading,
|
||||
isLoading = authState.isLoading,
|
||||
fullWidth = true
|
||||
)
|
||||
|
||||
// Forgot Password
|
||||
TextButton(
|
||||
onClick = onForgotPassword,
|
||||
enabled = !authState.isLoading
|
||||
) {
|
||||
Text("Forgot Password?")
|
||||
}
|
||||
|
||||
HorizontalDivider()
|
||||
|
||||
// Register Link
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = "Don't have an account?",
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
Spacer(modifier = Modifier.width(4.dp))
|
||||
TextButton(
|
||||
onClick = onNavigateToRegister,
|
||||
enabled = !authState.isLoading
|
||||
) {
|
||||
Text("Sign Up")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun LoginScreenContainer(
|
||||
authState: AuthState,
|
||||
onDispatchAction: (AppAction) -> Unit,
|
||||
onNavigateToRegister: () -> Unit = {},
|
||||
onForgotPassword: () -> Unit = {},
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
LoginScreen(
|
||||
authState = authState,
|
||||
onLoginClick = { username, password ->
|
||||
onDispatchAction(AppAction.Auth.LoginStart(username, password))
|
||||
},
|
||||
onNavigateToRegister = onNavigateToRegister,
|
||||
onForgotPassword = onForgotPassword,
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
+29
-29
@@ -8,42 +8,42 @@ import androidx.compose.ui.graphics.Color
|
||||
|
||||
// Define custom colors for the app
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Color(0xFF1976D2),
|
||||
onPrimary = Color.White,
|
||||
primaryContainer = Color(0xFFBBDEFB),
|
||||
onPrimaryContainer = Color(0xFF0D47A1),
|
||||
secondary = Color(0xFF03DAC6),
|
||||
onSecondary = Color.Black,
|
||||
tertiary = Color(0xFF03A9F4),
|
||||
background = Color(0xFFFAFAFA),
|
||||
surface = Color.White,
|
||||
onBackground = Color(0xFF1C1B1F),
|
||||
onSurface = Color(0xFF1C1B1F)
|
||||
primary = Color(0xFF1976D2),
|
||||
onPrimary = Color.White,
|
||||
primaryContainer = Color(0xFFBBDEFB),
|
||||
onPrimaryContainer = Color(0xFF0D47A1),
|
||||
secondary = Color(0xFF03DAC6),
|
||||
onSecondary = Color.Black,
|
||||
tertiary = Color(0xFF03A9F4),
|
||||
background = Color(0xFFFAFAFA),
|
||||
surface = Color.White,
|
||||
onBackground = Color(0xFF1C1B1F),
|
||||
onSurface = Color(0xFF1C1B1F)
|
||||
)
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Color(0xFF90CAF9),
|
||||
onPrimary = Color(0xFF0D47A1),
|
||||
primaryContainer = Color(0xFF1565C0),
|
||||
onPrimaryContainer = Color(0xFFBBDEFB),
|
||||
secondary = Color(0xFF03DAC6),
|
||||
onSecondary = Color.Black,
|
||||
tertiary = Color(0xFF03A9F4),
|
||||
background = Color(0xFF121212),
|
||||
surface = Color(0xFF1E1E1E),
|
||||
onBackground = Color(0xFFE0E0E0),
|
||||
onSurface = Color(0xFFE0E0E0)
|
||||
primary = Color(0xFF90CAF9),
|
||||
onPrimary = Color(0xFF0D47A1),
|
||||
primaryContainer = Color(0xFF1565C0),
|
||||
onPrimaryContainer = Color(0xFFBBDEFB),
|
||||
secondary = Color(0xFF03DAC6),
|
||||
onSecondary = Color.Black,
|
||||
tertiary = Color(0xFF03A9F4),
|
||||
background = Color(0xFF121212),
|
||||
surface = Color(0xFF1E1E1E),
|
||||
onBackground = Color(0xFFE0E0E0),
|
||||
onSurface = Color(0xFFE0E0E0)
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun AppTheme(
|
||||
darkTheme: Boolean = false, // For now, we'll default to light theme
|
||||
content: @Composable () -> Unit
|
||||
darkTheme: Boolean = false, // For now, we'll default to light theme
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme
|
||||
val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme
|
||||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
content = content
|
||||
)
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user