Skip to content

Move tab UI helpers into view layer and remove unused models#1161

Merged
GT-610 merged 2 commits into
mainfrom
p2-code-quality-cleanup
May 4, 2026
Merged

Move tab UI helpers into view layer and remove unused models#1161
GT-610 merged 2 commits into
mainfrom
p2-code-quality-cleanup

Conversation

@GT-610
Copy link
Copy Markdown
Collaborator

@GT-610 GT-610 commented May 4, 2026

Summary

  • Move AppTab page and navigation helper logic out of the model into view/page/home_tab.dart
  • Simplify AppTab parsing and keep the enum focused on stored values only
  • Rename the macOS menu bar helper into the view layer and streamline its callbacks
  • Remove unused model/provider/page files that are no longer referenced
  • Update home and settings pages to use the new tab helper extension

Testing

  • Not run (not requested)

Summary by CodeRabbit

  • Removed Features

    • Removed ping utility page
    • Removed snippet results page
    • Removed legacy package-manager helper and provider convenience layer
  • User Interface

    • Enhanced tab navigation with explicit page and navigation item mappings
    • Updated macOS menu bar behavior and About/Settings flow
  • Chores

    • Refactored internal architecture and code organization

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7534257f-ee0a-4203-bfcc-5f67965de2af

📥 Commits

Reviewing files that changed from the base of the PR and between 78d45bb and 3715559.

📒 Files selected for processing (2)
  • lib/view/page/home.dart
  • lib/view/page/home_tab.dart
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/view/page/home_tab.dart

📝 Walkthrough

Walkthrough

This PR removes several files and refactors navigation and menu wiring: deletes lib/data/model/pkg/manager.dart, lib/data/provider/providers.dart, lib/view/page/ping.dart, and lib/view/page/snippet/result.dart; adds an AppTabViewX extension in lib/view/page/home_tab.dart to map tabs to pages and navigation items; tightens types and callback signatures in lib/view/page/macos_menu_bar.dart; updates imports and passes the destination callback into MacOSMenuBarManager.buildMenuBar; and replaces a functional tab-parser with an explicit loop in lib/data/model/app/tab.dart.

Possibly related PRs

Suggested reviewers

  • lollipopkit
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: moving tab UI helpers into the view layer and removing unused models, which is reflected throughout the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch p2-code-quality-cleanup

Review rate limit: 3/5 reviews remaining, refill in 16 minutes and 36 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested a review from lollipopkit May 4, 2026 06:23
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
lib/view/page/home_tab.dart (1)

32-36: 💤 Low value

Snippet tab uses the same icon for both selected and unselected states.

Unlike other tabs which use distinct icons (e.g., bx_server/bxs_server, terminal_outlined/terminal, folder_open/folder), the snippet tab uses Icons.code for both states. Consider using Icons.code_outlined or similar for the unselected state to maintain visual consistency.

♻️ Suggested fix
       AppTab.snippet => NavigationDestination(
-        icon: const Icon(Icons.code),
+        icon: const Icon(Icons.code_outlined),
         label: libL10n.snippet,
         selectedIcon: const Icon(Icons.code),
       ),

Apply the same change to navRailDestination at lines 57-61.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/view/page/home_tab.dart` around lines 32 - 36, AppTab.snippet's
NavigationDestination uses the same Icon(Icons.code) for both selected and
unselected states; change the unselected icon to a distinct outlined variant
(e.g., Icons.code_outlined) in the NavigationDestination for AppTab.snippet and
make the same change in the corresponding navRailDestination block so the
unselected/selected icons mirror the pattern used by other tabs.
lib/view/page/home.dart (1)

163-170: 💤 Low value

Consider passing _onDestinationSelected directly.

The wrapper callback is unnecessary since _onDestinationSelected already matches the expected void Function(int) signature.

♻️ Suggested simplification
     if (Platform.isMacOS) {
       return PlatformMenuBar(
-        menus: MacOSMenuBarManager.buildMenuBar(context, (int index) {
-          _onDestinationSelected(index);
-        }),
+        menus: MacOSMenuBarManager.buildMenuBar(context, _onDestinationSelected),
         child: mainContent,
       );
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/view/page/home.dart` around lines 163 - 170, The anonymous wrapper around
_onDestinationSelected is redundant; update the PlatformMenuBar call to pass the
function directly by replacing the inline closure in
MacOSMenuBarManager.buildMenuBar with _onDestinationSelected (which already
matches void Function(int)), leaving PlatformMenuBar and mainContent unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/view/page/home_tab.dart`:
- Around line 32-36: AppTab.snippet's NavigationDestination uses the same
Icon(Icons.code) for both selected and unselected states; change the unselected
icon to a distinct outlined variant (e.g., Icons.code_outlined) in the
NavigationDestination for AppTab.snippet and make the same change in the
corresponding navRailDestination block so the unselected/selected icons mirror
the pattern used by other tabs.

In `@lib/view/page/home.dart`:
- Around line 163-170: The anonymous wrapper around _onDestinationSelected is
redundant; update the PlatformMenuBar call to pass the function directly by
replacing the inline closure in MacOSMenuBarManager.buildMenuBar with
_onDestinationSelected (which already matches void Function(int)), leaving
PlatformMenuBar and mainContent unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 260e1a8e-d344-4cc6-a180-51a9ad9ec71e

📥 Commits

Reviewing files that changed from the base of the PR and between c50bee8 and 78d45bb.

📒 Files selected for processing (9)
  • lib/data/model/app/tab.dart
  • lib/data/model/pkg/manager.dart
  • lib/data/provider/providers.dart
  • lib/view/page/home.dart
  • lib/view/page/home_tab.dart
  • lib/view/page/macos_menu_bar.dart
  • lib/view/page/ping.dart
  • lib/view/page/setting/entries/home_tabs.dart
  • lib/view/page/snippet/result.dart
💤 Files with no reviewable changes (4)
  • lib/view/page/ping.dart
  • lib/data/model/pkg/manager.dart
  • lib/data/provider/providers.dart
  • lib/view/page/snippet/result.dart

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 4, 2026
@GT-610 GT-610 merged commit 7f63316 into main May 4, 2026
3 checks passed
@GT-610 GT-610 deleted the p2-code-quality-cleanup branch May 4, 2026 06:33
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.

1 participant