refactor(theme): centralize colors and typography in AppColors and AppTypography
- Replaced hardcoded color values in `LightColorScheme` and `DarkColorScheme` with `AppColors`. - Updated `AppTypography` references in `AppMaterialTypography`. - Upgraded Kotlin, Compose Multiplatform, and Ktor to latest versions in `libs.versions.toml`. - Added `uiToolingPreview` dependency in `meldestelle-portal` build script. - Refactored config loading to include `RequestInit`. Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
parent
2eb88430f1
commit
ac3bfcad3c
|
|
@ -1,56 +1,47 @@
|
|||
package at.mocode.frontend.core.designsystem.theme
|
||||
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
import androidx.compose.material3.Shapes
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
// --- 1. Farben (Palette) ---
|
||||
// wir definieren eine professionelle, kontrastreiche Palette.
|
||||
// Blau steht für Aktion/Information, Grau für Struktur.
|
||||
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
primary = Color(0xFF0052CC), // Enterprise Blue (stark)
|
||||
onPrimary = Color.White,
|
||||
primaryContainer = Color(0xFFDEEBFF),
|
||||
onPrimaryContainer = Color(0xFF0052CC),
|
||||
primary = AppColors.Primary,
|
||||
onPrimary = AppColors.OnPrimary,
|
||||
primaryContainer = AppColors.PrimaryContainer,
|
||||
onPrimaryContainer = AppColors.OnPrimaryContainer,
|
||||
|
||||
secondary = Color(0xFF2684FF), // Helleres Blau für Akzente
|
||||
onSecondary = Color.White,
|
||||
secondary = AppColors.Secondary,
|
||||
onSecondary = AppColors.OnSecondary,
|
||||
|
||||
background = Color(0xFFF4F5F7), // Helles Grau (nicht hartes Weiß)
|
||||
surface = Color.White,
|
||||
onBackground = Color(0xFF172B4D), // Fast Schwarz (besser lesbar als #000)
|
||||
onSurface = Color(0xFF172B4D),
|
||||
background = AppColors.BackgroundLight,
|
||||
surface = AppColors.SurfaceLight,
|
||||
onBackground = AppColors.OnBackgroundLight,
|
||||
onSurface = AppColors.OnBackgroundLight,
|
||||
|
||||
error = Color(0xFFDE350B),
|
||||
onError = Color.White
|
||||
error = AppColors.Error,
|
||||
onError = AppColors.OnError
|
||||
)
|
||||
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Color(0xFF4C9AFF), // Helleres Blau auf Dunkel
|
||||
onPrimary = Color(0xFF091E42),
|
||||
primaryContainer = Color(0xFF0052CC),
|
||||
onPrimaryContainer = Color.White,
|
||||
primary = AppColors.Secondary, // Helleres Blau auf Dunkel
|
||||
onPrimary = AppColors.BackgroundDark,
|
||||
primaryContainer = AppColors.Primary,
|
||||
onPrimaryContainer = AppColors.OnPrimary,
|
||||
|
||||
secondary = Color(0xFF2684FF),
|
||||
onSecondary = Color.White,
|
||||
secondary = AppColors.Secondary,
|
||||
onSecondary = AppColors.OnSecondary,
|
||||
|
||||
background = Color(0xFF1E1E1E), // Dunkles Grau (angenehmer als #000)
|
||||
surface = Color(0xFF2C2C2C), // Panels heben sich leicht ab
|
||||
onBackground = Color(0xFFEBECF0),
|
||||
onSurface = Color(0xFFEBECF0),
|
||||
background = AppColors.BackgroundDark,
|
||||
surface = AppColors.SurfaceDark,
|
||||
onBackground = AppColors.OnBackgroundDark,
|
||||
onSurface = AppColors.OnBackgroundDark,
|
||||
|
||||
error = Color(0xFFFF5630),
|
||||
onError = Color.Black
|
||||
error = AppColors.Error,
|
||||
onError = AppColors.OnError
|
||||
)
|
||||
|
||||
// --- 2. Formen (Shapes) ---
|
||||
|
|
@ -63,31 +54,11 @@ private val AppShapes = Shapes(
|
|||
|
||||
// --- 3. Typografie ---
|
||||
// wir setzen auf klare Hierarchie.
|
||||
private val AppTypography = Typography(
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp
|
||||
),
|
||||
titleMedium = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp
|
||||
),
|
||||
bodyMedium = TextStyle( // Standard Text
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp
|
||||
),
|
||||
labelSmall = TextStyle( // Für dichte Tabellen/Labels
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp
|
||||
)
|
||||
private val AppMaterialTypography = Typography(
|
||||
titleLarge = AppTypography.TitleLarge,
|
||||
titleMedium = AppTypography.TitleMedium,
|
||||
bodyMedium = AppTypography.BodyMedium,
|
||||
labelSmall = AppTypography.LabelSmall
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
|
@ -100,7 +71,7 @@ fun AppTheme(
|
|||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
shapes = AppShapes,
|
||||
typography = AppTypography,
|
||||
typography = AppMaterialTypography,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import androidx.compose.ui.unit.dp
|
|||
|
||||
/**
|
||||
* Zentrale Definition für Abstände und Größen.
|
||||
* Warum? Damit wir nicht überall "Magic Numbers" (z.B. 13.dp) haben.
|
||||
* Warum? Damit wir nicht überall "Magic Numbers" (z. B. 13.dp) haben.
|
||||
* Wenn wir den Abstand global ändern wollen, machen wir das nur hier.
|
||||
*/
|
||||
object Dimens {
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ kotlin {
|
|||
implementation(compose.ui)
|
||||
implementation(compose.components.resources)
|
||||
implementation(compose.materialIconsExtended)
|
||||
implementation(compose.components.uiToolingPreview)
|
||||
|
||||
// Bundles
|
||||
implementation(libs.bundles.kmp.common) // Coroutines, Serialization, DateTime
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import kotlinx.browser.window
|
|||
import kotlinx.coroutines.await
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.w3c.fetch.RequestInit
|
||||
|
||||
private val AppJson = Json { ignoreUnknownKeys = true }
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ data class AppConfig(
|
|||
suspend fun loadAppConfig(): AppConfig {
|
||||
return try {
|
||||
// ?_nocache erzwingt einen SW-bypassing Request (SW sieht andere URL → Cache-Miss → Netzwerk)
|
||||
val response = window.fetch("/config.json?_nocache=1").await()
|
||||
val response = window.fetch("/config.json?_nocache=1", RequestInit()).await()
|
||||
if (!response.ok) {
|
||||
console.warn("[Config] Failed to load config.json, falling back to globalThis")
|
||||
return fallbackFromGlobal()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
# === FRONTEND & KMP CORE ===
|
||||
# ==============================================================================
|
||||
# Kotlin & Tooling
|
||||
kotlin = "2.3.0"
|
||||
kotlin = "2.3.20"
|
||||
ksp = "2.3.4"
|
||||
|
||||
# KotlinX (Core Libraries)
|
||||
|
|
@ -17,14 +17,14 @@ kotlinx-datetime = "0.7.1"
|
|||
|
||||
# UI: Compose Multiplatform
|
||||
# Aligned with Kotlin 2.3.0
|
||||
composeMultiplatform = "1.10.0"
|
||||
composeMultiplatform = "1.11.0-alpha04"
|
||||
composeHotReload = "1.0.0"
|
||||
androidx-lifecycle = "2.9.6"
|
||||
uiDesktop = "1.7.0"
|
||||
|
||||
# Network: Ktor (Client & Server)
|
||||
# Align with Kotlin 2.3.0 – upgrade to 3.4.0 (runtime OpenAPI + lifecycle improvements)
|
||||
ktor = "3.4.0"
|
||||
ktor = "3.4.1"
|
||||
|
||||
# Dependency Injection
|
||||
koin = "4.1.1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user