Skip to content

Feature/transactions screen#32

Open
Ahmedsayed0895 wants to merge 60 commits into
developfrom
feature/Transactions-Screen
Open

Feature/transactions screen#32
Ahmedsayed0895 wants to merge 60 commits into
developfrom
feature/Transactions-Screen

Conversation

@Ahmedsayed0895

Copy link
Copy Markdown
Member

Feat: Implement Transaction Screen

Demo

money++.mp4

Key Features

  • Transaction List: Displays transactions `.
  • Type Filter: Instant switching between All, Income, and Expense without extra network calls.
  • Date Filter: fetch data by specific month/year.
  • Category Filter: fetch data by one or multiple category.
  • UI States & Animations:
    • Added Shimmer Effect for initial loading.
    • Smooth transitions .

Related issues:

@YoussefmSaber YoussefmSaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, but check the comments and take in consideration

Comment thread composeApp/src/commonMain/kotlin/com/moneyplusplus/money/App.kt
Comment on lines +5 to +7
class GetCategoriesUseCase(private val repository: CategoryRepository) {
suspend operator fun invoke() = repository.getCategories()
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the use of this usecase it's just a wrapper, no need for it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the effect and intent can you referre to this pr, that shows how are we going to use our architecture and code base

#3

Comment on lines +115 to +132
transactions: List<TransactionUiModel>,
currentState: TransactionUiState.ContentState,
selectedTransactionType: TransactionUiState.TransactionTypeFilter,
date: LocalDate,
listState: LazyListState,
onDateClick: () -> Unit,
onFilterClick: () -> Unit,
allCategories: List<CategoryUiModel>,
selectedCategoryIds: List<String>,
showCategoriesFilterBottomSheet: Boolean,
showDatePickerDialog: Boolean,
onApplyFilterClick: (List<String>) -> Unit,
onDismissCategorySheet: () -> Unit,
onTransactionTypeClick: (TransactionUiState.TransactionTypeFilter) -> Unit,
onAddTransactionClick: () -> Unit,
onDateSelected: (LocalDate) -> Unit,
onDatePickerDialogDismiss: () -> Unit,
modifier: Modifier = Modifier,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why all of this, just pass the state, and the viewModel intent and call them inside the code, no need for such thing

Comment on lines +228 to +233
fadeInSpec = tween(300, easing = EaseInExpo),
fadeOutSpec = tween(300, easing = EaseOutExpo),
placementSpec = spring(
dampingRatio = Spring.DampingRatioLowBouncy,
stiffness = Spring.StiffnessLow
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for animations, i have already made an animations for our project, you can find it inside the design_system module -> theme -> animations

Comment on lines +78 to +104
tryExecute(
block = { getTransactionsUseCase(filter) },
onStart = {
updateState { copy(isLoading = true, isError = false) }
},
onSuccess = { transactions ->
val allTransactions = transactions.map { it.toUiModel() }
updateState {
copy(
allTransactions = allTransactions,
isLoading = false,
isError = false
)
}
applyLocalFilters(newListToFilter = allTransactions)
},
onError = { error ->
updateState {
copy(
isLoading = false,
isError = true,
errorMessage = error.message
)
}
sendEffect(TransactionEffect.ShowSnackbarError(error.message ?: "Unknown Error"))
}
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split each function inside the tryExecute to a seperate function, take a look on other prs, we all using this structure, and when call the functions inside the tryExecute call them in order
onStart,
block,
onSuccess,
onError

Comment on lines +108 to +122
tryExecute(
block = { getCategoriesUseCase() },
onSuccess = { categories ->
updateState {
copy(
categories = categories.map { category ->
category.toUiModel()
},
)
}
},
onError = { error ->
sendEffect(TransactionEffect.ShowSnackbarError(error.message ?: "Unknown Error"))
}
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants