Conversation
# Conflicts: # README.md # images/screenshot.png
# Conflicts: # README.md
Co-authored-by: Ali-Bagherifam ali.bagherifam@gmail.com Co-authored-by: Hamid-Mahmoodi shr.mahmoodi@gmail.com
Feature update readme
Added the option to set the initial selected date
Reviewer's Guide by SourceryThis pull request introduces a new parameter to the HeroDatePicker composable function, Sequence diagram for date initialization flowsequenceDiagram
participant C as Client
participant H as HeroDatePicker
participant S as ShamsiDatePickerUtil
C->>H: Create with selectedDate
H->>S: gregorianToPersian(selectedDate)
S-->>H: Return Shamsi date
H->>H: Initialize state with Shamsi date
H-->>C: onSelectedDateChange callback
Class diagram for HeroDatePicker composable function changesclassDiagram
class HeroDatePicker {
+HeroDatePicker(modifier: Modifier)
+HeroDatePicker(selectedDate: Date)
+HeroDatePicker(selectableYearRange: Iterable<Int>)
+HeroDatePicker(isSelectFromFutureEnable: Boolean)
+HeroDatePicker(textStyle: TextStyle)
+HeroDatePicker(onSelectedDateChange: (SelectedDate) -> Unit)
}
note for HeroDatePicker "New selectedDate parameter added"
class SelectedDate {
+year: Int
+month: Int
+day: Int
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Here's the code health analysis summary for commits Analysis Summary
|
There was a problem hiding this comment.
Hey @hamid97m - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| val selectedDateShamsi = ShamsiDatePickerUtill() | ||
| selectedDateShamsi.gregorianToPersian(selectedDate) | ||
|
|
||
| LaunchedEffect(Unit) { |
There was a problem hiding this comment.
issue: LaunchedEffect should depend on selectedDate to handle parameter updates properly.
Currently, changes to selectedDate won't trigger an update of the initial selection. Change Unit to selectedDate to ensure the effect runs when the parameter changes.
| @Composable | ||
| fun HeroDatePicker( | ||
| modifier: Modifier = Modifier, | ||
| selectedDate: Date = Date(System.currentTimeMillis()), |
There was a problem hiding this comment.
issue: Add validation for selectedDate against isSelectFromFutureEnable constraint.
If isSelectFromFutureEnable is false but selectedDate is in the future, this creates an inconsistent state. Consider adding validation at the start of the composable.
Summary by Sourcery
Add a
selectedDateparameter toHeroDatePickerto set the initial selected date.New Features:
HeroDatePicker.Tests:
selectedDateparameter.