Refactor: Extract hardcoded "todo" to constant in KanbanScreen (#190)
- Extracted the hardcoded string "todo" to a `DEFAULT_COLUMN` constant in `KanbanScreen.kt` to improve code health and readability. - Replaced the hardcoded string literal in the `viewModel.createTask` call with the new constant.
This commit is contained in:
1 file changed
+3
-1
@@ -48,6 +48,8 @@ import com.m57.hermescontrol.ui.common.ErrorState
|
|||||||
import com.m57.hermescontrol.ui.common.HermesScaffold
|
import com.m57.hermescontrol.ui.common.HermesScaffold
|
||||||
import com.m57.hermescontrol.ui.common.LoadingState
|
import com.m57.hermescontrol.ui.common.LoadingState
|
||||||
|
|
||||||
|
private const val DEFAULT_COLUMN = "todo"
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun KanbanScreen(
|
fun KanbanScreen(
|
||||||
@@ -185,7 +187,7 @@ fun KanbanScreen(
|
|||||||
AddTaskDialog(
|
AddTaskDialog(
|
||||||
onDismiss = { showAddTaskDialog = false },
|
onDismiss = { showAddTaskDialog = false },
|
||||||
onConfirm = { title, desc ->
|
onConfirm = { title, desc ->
|
||||||
viewModel.createTask(title, desc, state.columns.firstOrNull()?.name ?: "todo")
|
viewModel.createTask(title, desc, state.columns.firstOrNull()?.name ?: DEFAULT_COLUMN)
|
||||||
showAddTaskDialog = false
|
showAddTaskDialog = false
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user