chore(turnier-feature): remove unused ViewModels and UI components

- Removed `AbteilungViewModel`, `BewerbAnlegenViewModel`, `BewerbViewModel`, and `CreateBewerbWizardScreen`.
- Cleaned up related imports and unused domain models.
This commit is contained in:
2026-04-13 14:38:12 +02:00
parent 5c7ba28b1e
commit f719764914
65 changed files with 989 additions and 157 deletions
@@ -0,0 +1,40 @@
package at.mocode.frontend.features.verein.data
import at.mocode.frontend.features.verein.domain.Verein
import at.mocode.frontend.features.verein.domain.VereinRepository
import at.mocode.frontend.features.verein.domain.VereinStatus
class FakeVereinRepository : VereinRepository {
private val vereine = mutableListOf(
Verein(
id = "v1",
name = "URFV Neumarkt am Wallersee",
oepsNr = "4221",
ort = "Neumarkt/M.",
plz = "4221",
status = VereinStatus.AKTIV
),
Verein(
id = "v2",
name = "URC St. Georgen",
oepsNr = "1234",
ort = "St. Georgen",
plz = "5113",
status = VereinStatus.AKTIV
)
)
override suspend fun getVereine(): Result<List<Verein>> = Result.success(vereine.toList())
override suspend fun saveVerein(verein: Verein): Result<Verein> {
val index = vereine.indexOfFirst { it.id == verein.id }
if (index >= 0) {
vereine[index] = verein
} else {
val newVerein = verein.copy(id = "new_${vereine.size + 1}")
vereine.add(newVerein)
return Result.success(newVerein)
}
return Result.success(verein)
}
}
@@ -20,6 +20,7 @@ data class VereinUiState(
val selectedVerein: Verein? = null,
val isEditing: Boolean = false,
val isLoading: Boolean = false,
val error: String? = null,
val editName: String = "",
val editLangname: String = "",
val editOepsNr: String = "",
@@ -45,21 +46,31 @@ open class VereinViewModel(
}
fun loadVereine() {
uiState = uiState.copy(isLoading = true)
uiState = uiState.copy(isLoading = true, error = null)
viewModelScope.launch {
repository.getVereine()
.onSuccess { vereine ->
uiState = uiState.copy(
allVereine = vereine,
searchResults = vereine,
isLoading = false
)
filterResults()
}
.onFailure {
uiState = uiState.copy(isLoading = false)
// Error handling could be added here
}
try {
repository.getVereine()
.onSuccess { vereine ->
uiState = uiState.copy(
allVereine = vereine,
searchResults = vereine,
isLoading = false,
error = null
)
filterResults()
}
.onFailure {
uiState = uiState.copy(
isLoading = false,
error = "Fehler beim Laden der Vereine: ${it.message ?: "Unbekannter Fehler"}"
)
}
} catch (e: Exception) {
uiState = uiState.copy(
isLoading = false,
error = "Kritischer Fehler: ${e.message}"
)
}
}
}
@@ -120,7 +131,7 @@ open class VereinViewModel(
}
fun onSave() {
uiState = uiState.copy(isLoading = true)
uiState = uiState.copy(isLoading = true, error = null)
val verein = (uiState.selectedVerein ?: Verein(
id = "",
name = uiState.editName
@@ -136,11 +147,14 @@ open class VereinViewModel(
viewModelScope.launch {
repository.saveVerein(verein)
.onSuccess {
uiState = uiState.copy(isEditing = false, isLoading = false)
uiState = uiState.copy(isEditing = false, isLoading = false, error = null)
loadVereine()
}
.onFailure {
uiState = uiState.copy(isLoading = false)
uiState = uiState.copy(
isLoading = false,
error = "Fehler beim Speichern des Vereins: ${it.message ?: "Unbekannter Fehler"}"
)
}
}
}
@@ -1,12 +1,13 @@
package at.mocode.frontend.features.verein.di
import at.mocode.frontend.features.verein.data.KtorVereinRepository
import at.mocode.frontend.features.verein.data.FakeVereinRepository
import at.mocode.frontend.features.verein.domain.VereinRepository
import at.mocode.frontend.features.verein.presentation.VereinViewModel
import org.koin.core.module.dsl.viewModelOf
import org.koin.dsl.module
val vereinFeatureModule = module {
single<VereinRepository> { KtorVereinRepository(get()) }
// Desktop-App nutzt im Startup-Mode bevorzugt das Fake-Repository
single<VereinRepository> { FakeVereinRepository() }
viewModelOf(::VereinViewModel)
}