release v2026.05.13.1: player + Discover hotfix #44
@@ -46,6 +46,22 @@ fun LoginScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Box(modifier = Modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
|
LoginForm(
|
||||||
|
state = state,
|
||||||
|
onUsernameChange = viewModel::setUsername,
|
||||||
|
onPasswordChange = viewModel::setPassword,
|
||||||
|
onSubmit = viewModel::submit,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun LoginForm(
|
||||||
|
state: LoginFormState,
|
||||||
|
onUsernameChange: (String) -> Unit,
|
||||||
|
onPasswordChange: (String) -> Unit,
|
||||||
|
onSubmit: () -> Unit,
|
||||||
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
@@ -60,7 +76,7 @@ fun LoginScreen(
|
|||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = state.username,
|
value = state.username,
|
||||||
onValueChange = viewModel::setUsername,
|
onValueChange = onUsernameChange,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
label = { Text("Username") },
|
label = { Text("Username") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
@@ -72,7 +88,7 @@ fun LoginScreen(
|
|||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = state.password,
|
value = state.password,
|
||||||
onValueChange = viewModel::setPassword,
|
onValueChange = onPasswordChange,
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
label = { Text("Password") },
|
label = { Text("Password") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
@@ -82,17 +98,23 @@ fun LoginScreen(
|
|||||||
keyboardType = KeyboardType.Password,
|
keyboardType = KeyboardType.Password,
|
||||||
imeAction = ImeAction.Done,
|
imeAction = ImeAction.Done,
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(onDone = { viewModel.submit() }),
|
keyboardActions = KeyboardActions(onDone = { onSubmit() }),
|
||||||
)
|
)
|
||||||
if (state.errorMessage != null) {
|
if (state.errorMessage != null) {
|
||||||
Text(
|
Text(
|
||||||
text = state.errorMessage.orEmpty(),
|
text = state.errorMessage,
|
||||||
color = MaterialTheme.colorScheme.error,
|
color = MaterialTheme.colorScheme.error,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
SubmitButton(state = state, onSubmit = onSubmit)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SubmitButton(state: LoginFormState, onSubmit: () -> Unit) {
|
||||||
Button(
|
Button(
|
||||||
onClick = viewModel::submit,
|
onClick = onSubmit,
|
||||||
enabled = !state.isSubmitting &&
|
enabled = !state.isSubmitting &&
|
||||||
state.username.isNotBlank() &&
|
state.username.isNotBlank() &&
|
||||||
state.password.isNotBlank(),
|
state.password.isNotBlank(),
|
||||||
@@ -109,5 +131,3 @@ fun LoginScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user