Skip to content

Conversation

zouawen
Copy link
Contributor

@zouawen zouawen commented Oct 7, 2025

Description

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Checklist

ℹ️ Check all checkboxes - this will indicate that you have done everything in accordance with the rules in CONTRIBUTING.

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs:dev command.
  • Run the tests with pnpm test.
  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • New Features

    • Added option to enable a sticky navigation bar in Preferences, with quick toggle in the drawer and visual pin indicator.
  • UI/Style

    • Improved active state styling for segmented tabs for clearer selection.
    • Adjusted outlines, padding, and spacing in segmented controls and tab indicator for tighter visuals.
    • Updated Preferences drawer header styling (compact, borderless) and ensured reset action remains accessible.
  • Localization

    • Added English and Chinese labels for enabling/disabling the sticky preferences navigation bar.

Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: 87a061e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds a new boolean preference enableStickyPreferencesNavigationBar, wires it into the preferences drawer via a model and UI controls (Pin/PinOff), applies sticky behavior to the segmented tabs header, updates segmented/tab styles, and introduces related i18n strings. Minor presentational tweaks in theme preview and tabs indicator.

Changes

Cohort / File(s) Summary
Preferences config and types
packages/@core/preferences/src/config.ts, packages/@core/preferences/src/types.ts
Added boolean flag enableStickyPreferencesNavigationBar to defaultPreferences.app and to AppPreferences interface.
Preferences drawer integration
packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue
Introduced model appEnableStickyPreferencesNavigationBar, added toggle UI with Pin/PinOff, conditional sticky class and scoped style for sticky header, minor header style update, ensured reset handler wiring.
Segmented tabs components
packages/@core/ui-kit/shadcn-ui/src/components/segmented/segmented.vue, packages/@core/ui-kit/shadcn-ui/src/components/segmented/tabs-indicator.vue
Added activeClass helper for active tab styling; applied dynamic classes to TabsTrigger; adjusted outline classes; tweaked indicator padding from pr-1 to pr-0.5.
Theme preview styling
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue
Adjusted margin/padding (mx-10→mx-9, px-10→px-9) and z-index/order for icon element (z-10→z-1, reordered classes).
Localization
packages/locales/src/langs/en-US/preferences.json, packages/locales/src/langs/zh-CN/preferences.json
Added strings for enabling/disabling sticky preferences navigation bar (en-US and zh-CN).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Drawer as PreferencesDrawer
  participant Model as Model: appEnableStickyPreferencesNavigationBar
  participant UI as Segmented Tabs Header
  participant CSS as Sticky Styles

  User->>Drawer: Click Pin/PinOff toggle
  Drawer->>Model: update(value)
  Note right of Model: boolean flag reflects user choice
  Model-->>Drawer: v-model change
  Drawer->>UI: Apply sticky class conditionally
  UI->>CSS: Sticky positioning activated
  CSS-->>User: Header stays fixed during scroll

  alt Enabled
    Note over UI,CSS: Sticky header active
  else Disabled
    Note over UI,CSS: Normal, non-sticky header
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • mynetfan
  • anncwb
  • jinmao88
  • vince292007

Poem

A hop, a pin, a sticky bar—how neat!
I flip the tabs and keep my seat.
With Segments bold and headers tight,
My prefs don’t drift when scroll takes flight.
Carrot-click, I set the tone—
A snug UI a bun can own. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description remains as the unmodified template with placeholder comments and multiple contradictory type-of-change selections, so it does not provide any actual summary, context, or rationale for the changes. Please replace the template comments with a clear summary of what was changed and why, select only the relevant type(s) of change, and provide any necessary context or documentation links to fulfill the required description template.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the main feature addition—an optional sticky effect for the preferences navigation bar—and notes related style refinements, making it specific and informative for reviewers scanning the change history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

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

Copy link
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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/@core/ui-kit/shadcn-ui/src/components/segmented/segmented.vue (1)

39-41: Consider adding explicit return type annotation.

The activeClass helper correctly returns active styling classes. For improved type safety, consider adding an explicit return type annotation.

Apply this diff:

-function activeClass(tab: string): string[] {
+function activeClass(tab: string): string[] {
   return tab === activeTab.value ? ['!font-bold', 'text-primary'] : [];
 }

Note: The suggested diff shows the same signature, but emphasizes that the return type string[] is already present. If it's missing in the actual code, add it.

packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue (1)

482-488: Clarify the magic number offset value.

The sticky positioning uses top: -12px, which appears to be a magic number. Consider documenting why this specific offset is needed or using a CSS variable for maintainability.

If the offset compensates for specific padding/margin, consider adding a comment:

 <style scoped>
 :deep(.sticky-tabs-header [role='tablist']) {
   position: sticky;
+  /* Offset to account for drawer content padding */
   top: -12px;
   z-index: 10;
 }
 </style>

Additionally, verify that z-index: 10 doesn't conflict with other elements in the drawer (e.g., the reset button badge uses z-index: 10 on line 259).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce161e and 87a061e.

📒 Files selected for processing (8)
  • packages/@core/preferences/src/config.ts (1 hunks)
  • packages/@core/preferences/src/types.ts (1 hunks)
  • packages/@core/ui-kit/shadcn-ui/src/components/segmented/segmented.vue (1 hunks)
  • packages/@core/ui-kit/shadcn-ui/src/components/segmented/tabs-indicator.vue (1 hunks)
  • packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue (1 hunks)
  • packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue (4 hunks)
  • packages/locales/src/langs/en-US/preferences.json (1 hunks)
  • packages/locales/src/langs/zh-CN/preferences.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Check (windows-latest)
  • GitHub Check: Check (ubuntu-latest)
  • GitHub Check: post-update (windows-latest)
  • GitHub Check: post-update (ubuntu-latest)
🔇 Additional comments (13)
packages/effects/layouts/src/widgets/preferences/blocks/theme/builtin.vue (2)

137-137: LGTM! Spacing refinement looks good.

The margin and padding adjustments from mx-10/px-10 to mx-9/px-9 subtly refine the spacing for the theme preview blocks.

Also applies to: 141-141


144-144: Verify z-index reduction in built-in theme preview
The UserRoundPen icon’s z-index was changed from z-10 to non-standard z-1; confirm this doesn’t cause the icon to be hidden behind other elements in the preview.

packages/@core/preferences/src/types.ts (1)

62-65: LGTM! New property added correctly.

The enableStickyPreferencesNavigationBar boolean property is properly defined with a descriptive JSDoc comment and positioned logically after enableRefreshToken.

packages/locales/src/langs/zh-CN/preferences.json (1)

4-5: LGTM! Localization keys added correctly.

The new Chinese translations for enabling/disabling the sticky preferences navigation bar are clear and appropriately positioned.

packages/@core/ui-kit/shadcn-ui/src/components/segmented/tabs-indicator.vue (1)

26-26: LGTM! Padding refinement looks good.

The adjustment from pr-1 to pr-0.5 subtly refines the right padding for the tabs indicator, aligning with the overall styling improvements in this PR.

packages/@core/preferences/src/config.ts (1)

25-25: LGTM! Default value set appropriately.

The new enableStickyPreferencesNavigationBar property defaults to true, enabling the sticky navigation bar by default. This provides the enhanced navigation experience out of the box while remaining user-configurable via the preferences UI.

packages/locales/src/langs/en-US/preferences.json (1)

4-5: LGTM! English translations added correctly.

The new locale keys for enabling/disabling the sticky preferences navigation bar are clear and properly formatted, matching the structure of the Chinese translations.

packages/@core/ui-kit/shadcn-ui/src/components/segmented/segmented.vue (1)

46-49: LGTM! Active tab styling enhancement looks good.

The addition of the activeClass helper and its binding to TabsTrigger effectively provides visual feedback for the active tab. The outline classes on TabsList enhance the overall segmented control appearance.

Also applies to: 52-56

packages/effects/layouts/src/widgets/preferences/preferences-drawer.vue (5)

19-19: LGTM! Icon imports added correctly.

The Pin and PinOff icons are properly imported for the sticky navigation bar toggle feature.


72-74: LGTM! Model declaration is correct.

The appEnableStickyPreferencesNavigationBar model is properly defined using defineModel<boolean>, maintaining consistency with other preference models in the component.


247-247: LGTM! Border removal improves visual consistency.

Removing the border (!border-0) from the Drawer header creates a cleaner appearance for the compact layout.


255-281: LGTM! Toggle UI implementation is intuitive.

The sticky navigation bar toggle with icon swap (PinOff when enabled, Pin when disabled) and dynamic tooltip text provides clear user feedback. The implementation correctly binds to the model and updates the state on click.


285-292: LGTM! Conditional sticky class binding is correct.

The sticky-tabs-header class is conditionally applied to VbenSegmented based on the appEnableStickyPreferencesNavigationBar state, enabling the sticky behavior when the feature is enabled.

@jinmao88 jinmao88 merged commit 59097e2 into vbenjs:main Oct 13, 2025
26 of 30 checks passed
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.

2 participants