Skip to content

Commit

Permalink
Improve UX
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Dec 16, 2022
1 parent 257e203 commit c02cc4a
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,26 @@ class CategoryPickerItemsFlow @Inject constructor(
category = mapCategoryUiAct(item.category),
selected = item.category.id.toString() == selectedCategory?.id,
)
is CategoryListItem.ParentCategory -> CategoryPickerItemUi.ParentCategory(
parent = SelectableCategoryUi(
category = mapCategoryUiAct(item.parent),
selected = item.parent.id.toString() == selectedCategory?.id,
),
expanded = expandedParent?.id == item.parent.id.toString() ||
item.children.any { it.id.toString() == selectedCategory?.id },
children = item.children.map {
SelectableCategoryUi(
category = mapCategoryUiAct(it),
selected = it.id.toString() == selectedCategory?.id,
)
is CategoryListItem.ParentCategory -> {
val hasSelectedChild = item.children.any {
it.id.toString() == selectedCategory?.id
}
)
CategoryPickerItemUi.ParentCategory(
parent = SelectableCategoryUi(
category = mapCategoryUiAct(item.parent),
selected = item.parent.id.toString() == selectedCategory?.id ||
hasSelectedChild,
),
expanded = expandedParent?.id == item.parent.id.toString() ||
hasSelectedChild,
children = item.children.map {
SelectableCategoryUi(
category = mapCategoryUiAct(it),
selected = it.id.toString() == selectedCategory?.id,
)
}
)
}
}
}
}.map { data ->
Expand Down

0 comments on commit c02cc4a

Please sign in to comment.