added calendar icon and wire up availability sheet#91
Conversation
📝 WalkthroughWalkthroughThe changes add a calendar availability feature to the profile screen by introducing a new calendar icon button, wiring it to a ViewModel handler that displays a bottom-sheet for availability selection using GridSelectionType.PROPOSAL, and adding a Preview composable for testing. Changes
Sequence DiagramsequenceDiagram
actor User
participant ProfileScreen
participant ProfileViewModel
participant RootNavigationSheetRepository
participant BottomSheet
User->>ProfileScreen: Taps calendar icon (rightIcon)
ProfileScreen->>ProfileViewModel: onRightPressed() / onCalendarPressed()
ProfileViewModel->>RootNavigationSheetRepository: showBottomSheet(RootSheet.Availability)
RootNavigationSheetRepository->>BottomSheet: Display with GridSelectionType.PROPOSAL
BottomSheet->>User: Show availability selection interface
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
app/src/main/java/com/cornellappdev/resell/android/viewmodel/main/ProfileViewModel.kt (1)
38-38: Remove temporary inline comment in constructor.At Line 38,
// add thislooks like a transient PR note and should be removed before merge.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/main/java/com/cornellappdev/resell/android/viewmodel/main/ProfileViewModel.kt` at line 38, Remove the transient inline comment "// add this" from the constructor field declaration for rootNavigationSheetRepository in ProfileViewModel (the private val rootNavigationSheetRepository: RootNavigationSheetRepository line); keep the field declaration unchanged otherwise so the constructor and class compile without the PR note.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@app/src/main/java/com/cornellappdev/resell/android/ui/screens/main/ProfileScreen.kt`:
- Around line 45-48: ProfileHeader is using a hardcoded contentDescription
"search" for the right icon causing the calendar button in ProfileScreen (where
rightIcon = R.drawable.ic_calendar and onRightPressed =
profileViewModel.onCalendarPressed) to be announced incorrectly; update
ProfileHeader to accept a configurable contentDescription parameter (e.g.,
rightIconContentDescription) and use it instead of the hardcoded string, then
pass a calendar-specific string (or string resource like "Availability") from
ProfileScreen when constructing ProfileHeader so the right icon is accessible
and correctly labeled.
In
`@app/src/main/java/com/cornellappdev/resell/android/viewmodel/main/ProfileViewModel.kt`:
- Around line 93-102: The Availability sheet opened in onCalendarPressed uses
RootSheet.Availability with callback = { /* TODO */ }, leaving the Propose
action as a no-op; replace this no-op with a real handler that accepts the
selected times, e.g. validate/format the times, persist them to the chosen layer
(call your ProfileRepository.updateAvailability(...) or update local ViewModel
state), close the sheet via rootNavigationSheetRepository.dismissBottomSheet()
and surface success/error to the UI, or if you cannot implement persistence yet,
disable or hide the primary button on RootSheet.Availability until a proper
callback is provided.
---
Nitpick comments:
In
`@app/src/main/java/com/cornellappdev/resell/android/viewmodel/main/ProfileViewModel.kt`:
- Line 38: Remove the transient inline comment "// add this" from the
constructor field declaration for rootNavigationSheetRepository in
ProfileViewModel (the private val rootNavigationSheetRepository:
RootNavigationSheetRepository line); keep the field declaration unchanged
otherwise so the constructor and class compile without the PR note.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c0bd5ff7-8f8d-437d-b35f-135f9e4c357e
📒 Files selected for processing (3)
app/src/main/java/com/cornellappdev/resell/android/ui/screens/main/ProfileScreen.ktapp/src/main/java/com/cornellappdev/resell/android/viewmodel/main/ProfileViewModel.ktapp/src/main/res/drawable/ic_calendar.xml
| rightIcon = R.drawable.ic_calendar, | ||
| onTabSelected = { profileViewModel.onTabSelected(it) }, | ||
| onRightPressed = { profileViewModel.onSettingsPressed() }, | ||
| ) | ||
| onLeftPressed = { profileViewModel.onSettingsPressed() }, | ||
| onRightPressed = { profileViewModel.onCalendarPressed() }, |
There was a problem hiding this comment.
Calendar button is likely announced with the wrong accessibility label.
With rightIcon = R.drawable.ic_calendar at Line 45, the current ProfileHeader implementation (see app/src/main/java/com/cornellappdev/resell/android/ui/components/profile/ProfileHeader.kt:73-88) still uses a hardcoded contentDescription = "search" for the right icon. This is an accessibility defect for screen-reader users.
Consider making icon descriptions configurable from ProfileScreen or updating ProfileHeader to use calendar-specific text in this path.
Suggested direction
- Icon(
- painter = painterResource(id = rightIcon),
- contentDescription = "search",
+ Icon(
+ painter = painterResource(id = rightIcon),
+ contentDescription = rightIconContentDescription,
modifier = Modifier
.size(25.dp)
.clickableNoIndication { onRightPressed() }
)Then pass "Availability" (or a string resource) from ProfileScreen.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@app/src/main/java/com/cornellappdev/resell/android/ui/screens/main/ProfileScreen.kt`
around lines 45 - 48, ProfileHeader is using a hardcoded contentDescription
"search" for the right icon causing the calendar button in ProfileScreen (where
rightIcon = R.drawable.ic_calendar and onRightPressed =
profileViewModel.onCalendarPressed) to be announced incorrectly; update
ProfileHeader to accept a configurable contentDescription parameter (e.g.,
rightIconContentDescription) and use it instead of the hardcoded string, then
pass a calendar-specific string (or string resource like "Availability") from
ProfileScreen when constructing ProfileHeader so the right icon is accessible
and correctly labeled.
| fun onCalendarPressed() { | ||
| rootNavigationSheetRepository.showBottomSheet( | ||
| RootSheet.Availability( | ||
| buttonString = "Propose", | ||
| title = "Availability", | ||
| description = "Propose a time to meet", | ||
| initialTimes = listOf(), | ||
| gridSelectionType = GridSelectionType.PROPOSAL, | ||
| callback = { /* TODO: handle selected times */ } | ||
| ) |
There was a problem hiding this comment.
Propose action is wired to a no-op callback.
At Line 101, the availability sheet’s primary action currently does nothing (callback = { /* TODO... */ }). This creates a dead-end flow after user selection. Please either implement handling of selected times now or hide/disable this action until behavior is ready.
Would you like me to draft a concrete callback implementation once you confirm the intended persistence path (local state vs API update)?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@app/src/main/java/com/cornellappdev/resell/android/viewmodel/main/ProfileViewModel.kt`
around lines 93 - 102, The Availability sheet opened in onCalendarPressed uses
RootSheet.Availability with callback = { /* TODO */ }, leaving the Propose
action as a no-op; replace this no-op with a real handler that accepts the
selected times, e.g. validate/format the times, persist them to the chosen layer
(call your ProfileRepository.updateAvailability(...) or update local ViewModel
state), close the sheet via rootNavigationSheetRepository.dismissBottomSheet()
and surface success/error to the UI, or if you cannot implement persistence yet,
disable or hide the primary button on RootSheet.Availability until a proper
callback is provided.
AndrewCheung360
left a comment
There was a problem hiding this comment.
So far LGTM, remember to address the coderabbit comments as well (eg. reply and/or resolve if it doesn't make sense or you fix it)
Overview
Added the calendar icon to the profile screen header and wired it up to open the availability bottom sheet.
Changes Made
ic_calendar.xmldrawable with the new icon exported from Figma.onCalendarPressed()toProfileViewModel, which callsRootNavigationSheetRepository.showBottomSheet()with aRootSheet.Availability.RootNavigationSheetRepositoryintoProfileViewModel.onRightPressedonProfileHeaderinProfileScreento callprofileViewModel.onCalendarPressed().Test Coverage
Verified the new calendar icon renders correctly in the
ProfileScreenPreviewCompose preview and in the emulator. Was unable to fully test the bottom sheet flow end-to-end because the sign-in flow is currently broken on my setup, so the availability sheet trigger has not been verified on a running app.Screenshots
Calendar icon in profile header
Summary by CodeRabbit
Release Notes
New Features
UI/Style