chore: integriere Turnier-Wizard und ZNS-Importer in Veranstaltungsscreen, implementiere Profil-Onboarding und aktualisiere Modulabhängigkeiten
Signed-off-by: StefanMoCoAt <stefan.mo.co@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@ kotlin {
|
||||
implementation(projects.frontend.core.localDb)
|
||||
implementation(projects.frontend.core.auth)
|
||||
implementation(projects.frontend.core.domain)
|
||||
implementation(projects.frontend.features.znsImportFeature)
|
||||
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.runtime)
|
||||
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
package at.mocode.frontend.features.profile.presentation
|
||||
|
||||
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.frontend.core.designsystem.components.MsTextField
|
||||
|
||||
@Composable
|
||||
fun ProfileOnboardingWizard(
|
||||
viewModel: ProfileViewModel,
|
||||
onFinish: () -> Unit
|
||||
) {
|
||||
var currentStep by remember { mutableStateOf(1) }
|
||||
var satznummer by remember { mutableStateOf("") }
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(24.dp)
|
||||
.verticalScroll(rememberScrollState()),
|
||||
verticalArrangement = Arrangement.spacedBy(24.dp)
|
||||
) {
|
||||
Text(
|
||||
"Willkommen bei Meldestelle",
|
||||
style = MaterialTheme.typography.headlineMedium,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
|
||||
LinearProgressIndicator(
|
||||
progress = { currentStep / 3f },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
when (currentStep) {
|
||||
1 -> Step1ManualInput(satznummer, { satznummer = it }, onNext = { currentStep = 2 })
|
||||
2 -> Step2Confirm(satznummer, onBack = { currentStep = 1 }, onNext = {
|
||||
viewModel.linkToZns(satznummer)
|
||||
currentStep = 3
|
||||
})
|
||||
|
||||
3 -> Step3Complete(viewModel, onFinish = onFinish)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Step1ManualInput(
|
||||
satznummer: String,
|
||||
onSatznummerChange: (String) -> Unit,
|
||||
onNext: () -> Unit
|
||||
) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
Text("Schritt 1: Wer bist du?", style = MaterialTheme.typography.titleLarge)
|
||||
Text("Bitte gib deine ZNS-Satznummer ein.")
|
||||
|
||||
MsTextField(
|
||||
value = satznummer,
|
||||
onValueChange = onSatznummerChange,
|
||||
label = "ZNS-Satznummer",
|
||||
placeholder = "z.B. 1234567",
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = onNext,
|
||||
enabled = satznummer.length >= 5,
|
||||
modifier = Modifier.align(Alignment.End)
|
||||
) {
|
||||
Text("Weiter")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Step2Confirm(
|
||||
satznummer: String,
|
||||
onBack: () -> Unit,
|
||||
onNext: () -> Unit
|
||||
) {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
Text("Schritt 2: Bestätigung", style = MaterialTheme.typography.titleLarge)
|
||||
|
||||
Card(modifier = Modifier.fillMaxWidth()) {
|
||||
Column(Modifier.padding(16.dp)) {
|
||||
Text("Satznummer: $satznummer", fontWeight = FontWeight.Bold)
|
||||
Text("Die Daten werden nun mit dem Identity-Service verknüpft.")
|
||||
}
|
||||
}
|
||||
|
||||
Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
|
||||
TextButton(onClick = onBack) { Text("Zurück") }
|
||||
Button(onClick = onNext) { Text("Verknüpfen") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Step3Complete(
|
||||
viewModel: ProfileViewModel,
|
||||
onFinish: () -> Unit
|
||||
) {
|
||||
var email by remember { mutableStateOf("") }
|
||||
|
||||
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
Text("Schritt 3: Abschluss", style = MaterialTheme.typography.titleLarge)
|
||||
|
||||
MsTextField(
|
||||
value = email,
|
||||
onValueChange = { email = it },
|
||||
label = "Kontakt-Email",
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
viewModel.updateProfile(null, email)
|
||||
onFinish()
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text("Onboarding abschließen")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user