TW-2942: Refactor connection status handling in chat components#2943
TW-2942: Refactor connection status handling in chat components#2943
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe PR refactors how the connection status UI is composed and surfaced: Possibly related PRs
Suggested reviewers
🚥 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 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 |
|
This PR has been deployed to https://linagora.github.io/twake-on-matrix/2943 |
02ed6bb to
576320a
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
lib/widgets/connection_status_header.dart (1)
72-90: Consider simplifying the nested ternary.The nested ternary on lines 77-80 is functional but slightly hard to read. A minor readability improvement would be to use a local variable.
♻️ Optional refactor for readability
child: hide - ? (widget.connectedWidget != null - ? widget.connectedWidget! - : const SizedBox.shrink()) + ? widget.connectedWidget ?? const SizedBox.shrink() : Text(🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@lib/widgets/connection_status_header.dart` around lines 72 - 90, Replace the nested ternary inside the AnimatedSwitcher child with a clearly named local variable to improve readability: compute a Widget (e.g., childWidget) by using hide ? (widget.connectedWidget ?? const SizedBox.shrink()) : Text(status.toLocalizedString(context), key: ValueKey(status.status), maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.labelMedium?.copyWith(color: LinagoraSysColors.material().secondary)), then pass that variable into AnimatedSwitcher; this keeps the logic identical while avoiding the nested ternary in the child property.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@assets/l10n/intl_en.arb`:
- Line 3144: Remove the unused localization key "updating" from the intl_en.arb
resource (or, if it's intentionally reserved for a near-term change, add a short
comment/TODO elsewhere documenting its planned use and create a follow-up PR);
specifically, delete the "updating": "Updating..." entry from the ARB file (or
confirm and document its intended consumer so reviewers know it’s deliberate).
In `@lib/utils/localized_exception_extension.dart`:
- Around line 47-48: The fallback localized message in the toLocalizedString
extension is incorrect: change the return value used for unknown/unhandled
exceptions from L10n.of(context)!.waitingForResponse back to the original error
fallback L10n.of(context)!.oopsSomethingWentWrong (and keep the
Logs().w('Something went wrong: ', this); call). Locate the toLocalizedString
implementation in localized_exception_extension.dart and replace the
waitingForResponse fallback with oopsSomethingWentWrong so error displays in
SnackBar (chat.dart) and other UI (story_view.dart,
public_room_bottom_sheet.dart) show the correct “something went wrong” message.
---
Nitpick comments:
In `@lib/widgets/connection_status_header.dart`:
- Around line 72-90: Replace the nested ternary inside the AnimatedSwitcher
child with a clearly named local variable to improve readability: compute a
Widget (e.g., childWidget) by using hide ? (widget.connectedWidget ?? const
SizedBox.shrink()) : Text(status.toLocalizedString(context), key:
ValueKey(status.status), maxLines: 1, overflow: TextOverflow.ellipsis, style:
Theme.of(context).textTheme.labelMedium?.copyWith(color:
LinagoraSysColors.material().secondary)), then pass that variable into
AnimatedSwitcher; this keeps the logic identical while avoiding the nested
ternary in the child property.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 362e5cd1-57e8-451b-89a2-8d62439f2205
📒 Files selected for processing (9)
assets/l10n/intl_en.arblib/pages/chat/chat_app_bar_title.dartlib/pages/chat/chat_view_body.dartlib/pages/chat_list/chat_list_body_view.dartlib/pages/chat_list/chat_list_header.dartlib/utils/localized_exception_extension.dartlib/widgets/app_bars/twake_app_bar.dartlib/widgets/connection_status_header.dartlib/widgets/twake_components/twake_header.dart
💤 Files with no reviewable changes (2)
- lib/pages/chat/chat_view_body.dart
- lib/pages/chat_list/chat_list_body_view.dart
Ticket
Related issue
Resolved
Attach screenshots or videos demonstrating the changes
Summary by CodeRabbit
Improvements
Localization