Skip to content

Conversation

@hermannakos
Copy link
Collaborator

Summary

Implements the Welcome Widget for the Student app dashboard with time-based personalized greetings and motivational messages.

Key Features:

  • Time-based greetings (Morning 4am-12pm, Afternoon 12pm-5pm, Evening 5pm-9pm, Night 9pm-4am)
  • Personalized with user's first name
  • 88 motivational messages (52 generic + 36 time-specific)
  • Pull-to-refresh updates greeting and message
  • Full TalkBack accessibility support
  • Comprehensive unit test coverage (37 tests)

Architecture:

  • Implemented in pandautils for cross-app reusability
  • MVVM with Use Cases pattern
  • Hilt dependency injection
  • Testable design with TimeProvider abstraction

Test Plan

  1. Log in to the Student app
  2. Navigate to Dashboard
  3. Verify Welcome Widget displays with time-appropriate greeting and user's first name
  4. Pull down to refresh the dashboard
  5. Verify the motivational message changes
  6. Test at different times of day to verify greeting changes:
    • 4am-12pm: "Good morning"
    • 12pm-5pm: "Good afternoon"
    • 5pm-9pm: "Good evening"
    • 9pm-4am: "Good night"
  7. Enable TalkBack and verify widget is accessible
  8. Run unit tests: ./gradle/gradlew -p apps :pandautils:testDebugUnitTest --tests "com.instructure.pandautils.features.dashboard.widget.welcome.*"

refs: MBL-19455
affects: Student
release note: Added personalized welcome widget with time-based greetings and motivational messages

Checklist

  • Unit tests added and passing (37 tests, 4 test suites)
  • Dark/light mode compatible (uses theme colors)
  • Accessibility support (TalkBack content descriptions)
  • Tablet/landscape layout responsive
  • Deployed and manually tested on device

hermannakos and others added 3 commits November 19, 2025 13:42
- Add time-based greeting logic (Morning/Afternoon/Evening/Night)
- Implement personalized greetings with user's first name
- Add 88 motivational messages (52 generic + 36 time-specific)
- Support pull-to-refresh to update greeting and message
- Add TalkBack accessibility support
- Move implementation to pandautils for cross-app reusability
- Use MVVM architecture with Use Cases and Hilt DI

Implements time-of-day detection:
- Morning: before 12pm
- Afternoon: 12pm - 5pm
- Evening: 5pm - 9pm
- Night: after 9pm

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Update time boundaries: Night 9pm-4am, Morning 4am-12pm
- Add comprehensive unit tests for TimeOfDayCalculator
- Add unit tests for GetWelcomeGreetingUseCase (with/without user name)
- Add unit tests for GetWelcomeMessageUseCase (message pool validation)
- All tests passing

Time period definitions:
- Morning: 4am - 12pm
- Afternoon: 12pm - 5pm
- Evening: 5pm - 9pm
- Night: 9pm - 4am (wraps around midnight)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add comprehensive ViewModel tests (9 test cases)
- Test init loads greeting and message correctly
- Test all time periods (morning, afternoon, evening, night)
- Test refresh functionality updates greeting and message
- Test greeting changes when time period changes
- Test multiple refresh calls work correctly
- All tests passing

Test coverage:
- Initial state loading
- Greeting with/without user name
- All 4 time periods
- Refresh mechanism
- State updates on time changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@hermannakos hermannakos changed the title [MBL-19455] Implement Welcome Widget with time-based greetings [MBL-19455][Student] Implement Welcome Widget with time-based greetings Nov 19, 2025
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Welcome Widget Implementation Review

This PR implements a new Welcome Widget feature for the dashboard with personalized greetings and motivational messages. The implementation follows good architectural patterns with proper separation of concerns, dependency injection, and comprehensive test coverage.

✅ Strengths

  • Excellent architecture: Clean separation with use cases, dependency injection via Hilt, and testable components
  • Comprehensive testing: All core components have unit tests with good coverage (TimeOfDayCalculator, ViewModel, and both use cases)
  • Proper dependency injection: TimeProvider abstraction allows for easy testing and follows SOLID principles
  • Good accessibility: Content description properly implemented for screen readers
  • Code organization: Files properly moved to pandautils library for sharing across apps
  • Internationalization: Proper use of string resources with time-appropriate messages

Issues Found

  • Missing newlines at end of files: All 9 new Kotlin files are missing the trailing newline character (see inline comments on each file). This violates Kotlin coding standards and may cause issues with some tools.

🔍 Minor Suggestions

  • Random testability (libs/pandautils/src/main/java/com/instructure/pandautils/features/dashboard/widget/welcome/usecase/GetWelcomeMessageUseCase.kt:43): Consider injecting a Random instance via DI to make the random message selection more testable, though the current test approach of verifying "contains one of expected messages" works fine.

📝 Code Quality Assessment

Architecture: ⭐⭐⭐⭐⭐ Exemplary use of MVVM, use cases, and dependency injection

Testing: ⭐⭐⭐⭐⭐ Comprehensive unit test coverage with proper mocking

Compose: ⭐⭐⭐⭐⭐ Clean composable structure with proper state management and accessibility

Kotlin Style: ⭐⭐⭐⭐ Good, but missing trailing newlines

Performance: ⭐⭐⭐⭐⭐ No performance concerns; lightweight and efficient

Summary

This is a well-crafted implementation with excellent architecture and testing. The main issue is a formatting concern (missing trailing newlines) that should be addressed before merging. Once the newlines are added, this will be ready to merge.

Recommendation: Approve pending the trailing newline fixes.

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

📊 Code Coverage Report

✅ Student

  • PR Coverage: 42.80%
  • Master Coverage: 42.49%
  • Delta: +0.31%

✅ Teacher

  • PR Coverage: 25.44%
  • Master Coverage: 25.44%
  • Delta: +0.00%

✅ Pandautils

  • PR Coverage: 22.61%
  • Master Coverage: 22.57%
  • Delta: +0.05%

📈 Overall Average

  • PR Coverage: 30.29%
  • Master Coverage: 30.17%
  • Delta: +0.12%

@github-actions
Copy link

github-actions bot commented Nov 19, 2025

Student Install Page

@adamNagy56 adamNagy56 self-requested a review November 19, 2025 15:22
Copy link
Contributor

@adamNagy56 adamNagy56 left a comment

Choose a reason for hiding this comment

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

  • I think it would be good to have an automatic refresh on the dashboard after the user changes their username.

…idget

# Conflicts:
#	apps/student/src/main/java/com/instructure/student/features/dashboard/compose/DashboardScreen.kt
#	libs/pandares/src/main/res/values/strings.xml
- Add trailing newline to TimeOfDay.kt
- Add trailing newline to TimeOfDayCalculator.kt
- Add trailing newline to TimeProvider.kt
- Add trailing newline to WelcomeWidget.kt
- Add trailing newline to WelcomeWidgetUiState.kt
- Add trailing newline to WelcomeWidgetViewModel.kt
- Add trailing newline to WelcomeWidgetModule.kt
- Add trailing newline to GetWelcomeGreetingUseCase.kt
- Add trailing newline to GetWelcomeMessageUseCase.kt

Addresses PR review feedback - all Kotlin files should end with a newline per coding standards.
- Add Random parameter to GetWelcomeMessageUseCase constructor
- Provide Random instance via ApplicationModule in pandautils
- Update tests to mock Random and verify exact message selection
- Improves test quality by removing circular logic

Addresses PR review feedback from kristofnemere: tests now verify specific
message selection instead of just checking if result is in the message pool.
@hermannakos hermannakos merged commit 0228abb into master Nov 21, 2025
25 checks passed
@hermannakos hermannakos deleted the MBL-19455-welcome-widget branch November 21, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants