Added Previews

This commit is contained in:
dankito 2024-08-27 12:24:19 +02:00
parent 6d35b9c64f
commit 3bc87946c0
3 changed files with 38 additions and 14 deletions

View File

@ -194,18 +194,4 @@ fun getTanMediumDisplayName(tanMedium: net.codinux.banking.client.model.tan.TanM
}
return tanMedium.mediumName ?: ""
}
@Preview
@Composable
fun EnterTanDialogPreview() {
val tanMethod = TanMethod("photoTan", TanMethodType.photoTan, "910", 6, AllowedTanFormat.Numeric)
val tanImage = TanImage("image/png", "")
val customer = CustomerAccountViewInfo("10010010", "Ihr krasser Login Name", "Phantasie Bank")
val tanChallenge = TanChallenge(TanChallengeType.Image, ActionRequiringTan.GetAccountInfo, "Geben Sie die TAN ein", tanMethod.identifier, listOf(tanMethod), null, emptyList(), tanImage, null, customer)
EnterTanDialog(TanChallengeReceived(tanChallenge, { })) { }
}

View File

@ -0,0 +1,24 @@
package net.codinux.banking.ui.dialogs
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.runtime.Composable
import net.codinux.banking.client.model.CustomerAccountViewInfo
import net.codinux.banking.client.model.tan.*
import net.codinux.banking.ui.model.TanChallengeReceived
@Preview
@Composable
fun EnterTanDialogPreview() {
// val tanMethod = TanMethod("photoTan", TanMethodType.photoTan, "910", 6, AllowedTanFormat.Numeric)
// val tanImage = TanImage("image/png", "")
//
// val customer = CustomerAccountViewInfo("10010010", "Ihr krasser Login Name", "Phantasie Bank")
//
// val tanChallenge = TanChallenge(TanChallengeType.Image, ActionRequiringTan.GetAccountInfo, "Geben Sie die TAN ein", tanMethod.identifier, listOf(tanMethod), null, emptyList(), tanImage, null, customer)
val tanMethods = listOf(TanMethod("Zeig mich an", TanMethodType.AppTan, "902"))
val customer = CustomerAccountViewInfo("12345678", "SupiDupiNutzer", "Abzockbank")
val tanChallenge = TanChallenge(TanChallengeType.EnterTan, ActionRequiringTan.GetAccountInfo, "Geben Sie die TAN ein", tanMethods.first().identifier, tanMethods, customer = customer)
EnterTanDialog(TanChallengeReceived(tanChallenge) { }) { }
}

View File

@ -1,5 +1,7 @@
package net.codinux.banking.ui
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
@ -8,7 +10,11 @@ import app.cash.sqldelight.async.coroutines.synchronous
import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver
import bankmeister.composeapp.generated.resources.AppIcon_svg
import bankmeister.composeapp.generated.resources.Res
import kotlinx.datetime.LocalDate
import net.codinux.banking.client.model.AccountTransaction
import net.codinux.banking.client.model.Amount
import net.codinux.banking.dataaccess.BankmeisterDb
import net.codinux.banking.dataaccess.InMemoryBankingRepository
import net.codinux.banking.ui.config.DI
import net.codinux.log.Log
import org.jetbrains.compose.resources.painterResource
@ -28,4 +34,12 @@ fun main() = application {
App()
}
}
@Preview
@Composable
fun AppPreview() {
DI.setRepository(InMemoryBankingRepository(listOf(AccountTransaction(Amount("12.34"), "EUR", "Lohn", LocalDate(2024, 7, 5), LocalDate(2024, 6, 15), "Dein Boss"))))
App()
}