Skip to content

Conversation

@domonkosadam
Copy link
Contributor

refs: CLX-3253
affects: Horizon
release note: none

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

📊 Code Coverage Report

✅ Student

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

✅ Teacher

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

✅ Pandautils

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

📈 Overall Average

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

@inst-danger
Copy link
Contributor

Student Install Page

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.

PR Review Summary

This PR refactors the dashboard widget system to consolidate pagination state management and improve the visual consistency of widget cards. The changes move pagination display logic from individual widgets to a centralized DashboardWidgetCard component.

✅ Positive Aspects

  • Good architectural improvement: Centralizing pagination state in DashboardWidgetPageState reduces code duplication and makes the pagination pattern consistent across all widgets
  • Separation of concerns: Moving pagination display logic from ViewModels to the UI layer is a cleaner separation
  • Code consolidation: The refactoring eliminates the DashboardAnnouncementBannerCardError component and reuses the generic DashboardWidgetCardError, reducing maintenance burden
  • Loading state improvement: Using DashboardPaginatedWidgetCardState.Loading as a companion object provides a clean way to represent loading states
  • Text overflow handling: Adding maxLines and TextOverflow.Ellipsis prevents UI breaking with long text
  • Consistent styling: The header state consolidation (DashboardPaginatedWidgetCardHeaderState) provides better type safety with Color instead of StatusChipColor

⚠️ Issues Found

  • Non-exhaustive when expression in DashboardScreen.kt:230 - Removing the else branch could lead to silent failures if the pager index is out of range
  • Padding removal in DashboardPaginatedWidgetCard.kt:106 - Verify this is intentional and matches design specs
  • Visual breaking change in DashboardWidgetCard.kt:96-120 - The header layout order changed from Title-Icon to Icon-Title; ensure this matches design and update tests
  • Required parameter awkwardness in DashboardWidgetCardError.kt:50 - pageState is required even for non-paginated contexts, consider making it optional
  • Source text truncation in DashboardPaginatedWidgetCard.kt:130 - 1 line maxLines for source might be too restrictive for long course/institution names

🔍 Testing Recommendations

  1. Test with extremely long course/institution names to verify text truncation behavior
  2. Verify pagination numbers display correctly (1-indexed) across all widgets
  3. Test error states for both paginated and non-paginated widgets
  4. Verify accessibility with screen readers, especially with the header layout changes
  5. Update screenshot/UI tests for the visual changes
  6. Test edge cases with 1, 2, and 3+ pages in the horizontal pager

📝 Minor Suggestions

  • Consider adding kdoc comments to DashboardWidgetPageState explaining the 1-indexed convention
  • The useMinWidth parameter in several places might benefit from a more descriptive name
  • Consider consistent ordering of optional parameters across similar functions

Overall, this is a solid refactoring that improves code maintainability. The main concerns are around ensuring visual regressions are caught and handling edge cases in the pagination logic.

else -> {

}
}
Copy link

Choose a reason for hiding this comment

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

The else branch was removed from the when expression, but this makes the when non-exhaustive. If the pager ever has more than 3 pages or an invalid index, this could lead to silent failures. Consider either keeping the empty else branch for safety, or adding a check/comment explaining why indices 0-2 are guaranteed.

item = state.items[index],
item = item,
isLoading = state.isLoading,
modifier = Modifier
Copy link

Choose a reason for hiding this comment

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

The hardcoded padding removal here (from 24.dp horizontal padding) changes the visual alignment of the content. Please verify this was intentional and consistent with the design. The DashboardWidgetCard wrapper should be handling padding consistently.

Text(
text = stringResource(
R.string.dashboardAnnouncementBannerFrom,
source
Copy link

Choose a reason for hiding this comment

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

Good improvement! Adding maxLines and overflow prevents text overflow issues. However, consider if 1 line is sufficient for course names which can be long. Might want to test with real data to ensure it doesn't truncate too aggressively.

@DrawableRes iconRes: Int,
widgetColor: Color,
useMinWidth: Boolean,
pageState: DashboardWidgetPageState,
Copy link

Choose a reason for hiding this comment

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

The new pageState parameter is required, but for error states where there's no pagination context (like single widgets), passing DashboardWidgetPageState.Empty feels awkward. Consider making this parameter optional with a default value of null or DashboardWidgetPageState.Empty.

@inst-danger
Copy link
Contributor

Student Install Page

@inst-danger
Copy link
Contributor

Student Install Page

Copy link
Contributor

@andrasmaczak andrasmaczak left a comment

Choose a reason for hiding this comment

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

If title is too long, pages text looks like this, otherwise looks good.

Screenshot_20251114_145154

@domonkosadam domonkosadam merged commit 285773c into master Nov 17, 2025
22 checks passed
@domonkosadam domonkosadam deleted the CLX-3253-Dashboard-widgets-improvements branch November 17, 2025 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants