After a commit text is cleared and buttons is now enabled only when there are staged changes

This commit is contained in:
Abdelilah El Aissaoui 2021-09-26 14:08:03 +02:00
parent 04a9fc2c25
commit b2a93cd339

View File

@ -47,7 +47,7 @@ fun UncommitedChanges(
var commitMessage by remember { mutableStateOf("") } var commitMessage by remember { mutableStateOf("") }
Column { Column {
AnimatedVisibility ( AnimatedVisibility(
visible = stageStatus is StageStatus.Loading, visible = stageStatus is StageStatus.Loading,
enter = fadeIn(), enter = fadeIn(),
exit = fadeOut(), exit = fadeOut(),
@ -109,8 +109,9 @@ fun UncommitedChanges(
.fillMaxWidth(), .fillMaxWidth(),
onClick = { onClick = {
gitManager.commit(commitMessage) gitManager.commit(commitMessage)
commitMessage = ""
}, },
enabled = commitMessage.isNotEmpty(), enabled = commitMessage.isNotEmpty() && staged.isNotEmpty(),
shape = RectangleShape, shape = RectangleShape,
) { ) {
Text("Commit") Text("Commit")
@ -129,7 +130,7 @@ private fun EntriesList(
onDiffEntrySelected: (DiffEntry) -> Unit, onDiffEntrySelected: (DiffEntry) -> Unit,
onDiffEntryOptionSelected: (DiffEntry) -> Unit, onDiffEntryOptionSelected: (DiffEntry) -> Unit,
) { ) {
Card ( Card(
modifier = modifier modifier = modifier
) { ) {
Column { Column {