Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: page spinner is styled incorrectly when scrolling #4163

Merged
merged 3 commits into from
Aug 15, 2024
Merged

Conversation

anncwb
Copy link
Collaborator

@anncwb anncwb commented Aug 15, 2024

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

    • Introduced automatic changelog generation capability within the documentation.
    • Added a new useContentStyle composable for responsive overlay management.
    • Implemented a new LayoutContentSpinner component for enhanced loading state visualization.
  • Bug Fixes

    • Corrected import paths to ensure proper module loading in the configuration.
  • Documentation

    • Improved formatting consistency in theme customization documentation.
  • Refactor

    • Streamlined content management by removing legacy loading state indicators.
  • Style

    • Enhanced UI structure by incorporating Card components for clipboard functionality.

@anncwb anncwb requested review from vince292007 and a team as code owners August 15, 2024 13:27
Copy link

changeset-bot bot commented Aug 15, 2024

⚠️ No Changeset found

Latest commit: 2c98865

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 Aug 15, 2024

Caution

Review failed

The head commit changed during the review from e84f929 to 2c98865.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

Outside diff range, codebase verification and nitpick comments (1)
packages/effects/layouts/src/basic/content/content-spinner.vue (1)

4-4: Correct the Import Path for VbenSpinner

The VbenSpinner component is exported from packages/@core/ui-kit/shadcn-ui/src/components/spinner/index.ts, but the import path in content-spinner.vue is @vben-core/shadcn-ui, which appears incorrect. Please update the import path to match the actual export location.

  • File: packages/effects/layouts/src/basic/content/content-spinner.vue
  • Current Import Path: @vben-core/shadcn-ui
  • Suggested Import Path: @core/ui-kit/shadcn-ui or ensure that the alias @vben-core/shadcn-ui correctly maps to the export location.
Analysis chain

Verify Import Path for Spinner Component.

Ensure the VbenSpinner component is correctly imported from @vben-core/shadcn-ui. Verify the component's existence and compatibility.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and correct import path of `VbenSpinner`.

# Test: Check if `VbenSpinner` is correctly exported from the specified package.
ast-grep --lang typescript --pattern 'export const VbenSpinner = $_' | rg '@vben-core/shadcn-ui'

Length of output: 96


Script:

#!/bin/bash
# Search for the export of VbenSpinner in the repository
rg 'VbenSpinner' -t js -t ts -A 3

Length of output: 1447

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 187f946 and 2c98865.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (18)
  • docs/.vitepress/config.mts (2 hunks)
  • docs/.vitepress/theme/index.ts (2 hunks)
  • docs/package.json (1 hunks)
  • docs/src/guide/in-depth/theme.md (3 hunks)
  • internal/vite-config/src/plugins/index.ts (1 hunks)
  • packages/@core/base/shared/src/constants/globals.ts (1 hunks)
  • packages/@core/base/shared/src/utils/dom.test.ts (1 hunks)
  • packages/@core/base/shared/src/utils/dom.ts (2 hunks)
  • packages/@core/composables/src/index.ts (1 hunks)
  • packages/@core/composables/src/use-content-style.ts (1 hunks)
  • packages/@core/ui-kit/layout-ui/src/components/layout-content.vue (3 hunks)
  • packages/@core/ui-kit/layout-ui/src/vben-layout.vue (1 hunks)
  • packages/effects/layouts/src/basic/content/content-spinner.vue (1 hunks)
  • packages/effects/layouts/src/basic/content/content.vue (2 hunks)
  • packages/effects/layouts/src/basic/content/index.ts (1 hunks)
  • packages/effects/layouts/src/basic/layout.vue (2 hunks)
  • playground/src/views/demos/features/clipboard/index.vue (1 hunks)
  • playground/src/views/demos/features/full-screen/index.vue (1 hunks)
Files skipped from review due to trivial changes (4)
  • docs/src/guide/in-depth/theme.md
  • internal/vite-config/src/plugins/index.ts
  • packages/effects/layouts/src/basic/content/content.vue
  • playground/src/views/demos/features/full-screen/index.vue
Additional comments not posted (24)
packages/effects/layouts/src/basic/content/index.ts (1)

2-2: Export addition looks good.

The addition of LayoutContentSpinner as an export is straightforward and aligns with the PR's objectives to enhance layout capabilities.

packages/@core/composables/src/index.ts (1)

1-1: Verify the change from use-content-height to use-content-style.

Ensure that the replacement of use-content-height with use-content-style is intentional and that all dependent code is updated accordingly.

Verification successful

Change Verified: use-content-height replaced by use-content-style.

The export of use-content-style is correctly implemented, and use-content-height is no longer present in the codebase, confirming the change is intentional and complete.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `use-content-style` and ensure `use-content-height` is no longer in use.

# Test: Search for the usage of `use-content-style`. Expect: Occurrences of the new composable.
rg --type javascript -A 5 $'use-content-style'

# Test: Ensure `use-content-height` is not used anymore. Expect: No occurrences.
rg --type javascript -A 5 $'use-content-height'

Length of output: 162


Script:

#!/bin/bash
# Description: Verify the usage of `use-content-style` and ensure `use-content-height` is no longer in use.

# Test: Search for the usage of `use-content-style`. Expect: Occurrences of the new composable.
rg 'use-content-style' --glob '*.js' -A 5

# Test: Ensure `use-content-height` is not used anymore. Expect: No occurrences.
rg 'use-content-height' --glob '*.js' -A 5

Length of output: 382


Script:

#!/bin/bash
# Description: Verify the usage of `use-content-style` and ensure `use-content-height` is no longer in use.

# Test: Search for the usage of `use-content-style`. Expect: Occurrences of the new composable.
rg 'use-content-style' -A 5

# Test: Ensure `use-content-height` is not used anymore. Expect: No occurrences.
rg 'use-content-height' -A 5

Length of output: 445

packages/@core/base/shared/src/constants/globals.ts (1)

6-6: Addition of CSS variable constant looks good.

The new CSS_VARIABLE_LAYOUT_CONTENT_WIDTH constant complements the existing layout height variable, enhancing layout flexibility.

docs/package.json (1)

14-14: Dependency Addition: Ensure Compatibility.

The addition of @nolebase/vitepress-plugin-git-changelog to devDependencies suggests improved changelog capabilities. Ensure this addition is compatible with existing dependencies and doesn't introduce conflicts.

packages/effects/layouts/src/basic/content/content-spinner.vue (3)

2-2: Ensure Correct Usage of Type Imports.

The import of CSSProperties from vue is correct for typing props. Ensure it is used consistently across the project.


10-10: Validate Prop Definition.

The overlayStyle prop is defined with type CSSProperties. Ensure this prop is correctly used in the template and that the type aligns with the expected usage.


6-6: Check Composable Functionality.

The useContentSpinner composable is imported and destructured for spinning. Ensure this composable is correctly implemented and provides the expected functionality.

Verification successful

Composable Functionality Verified

The useContentSpinner composable is correctly implemented and exported as a named export in use-content-spinner.ts. It is used appropriately in content-spinner.vue, where spinning is destructured. No issues found with the implementation.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of `useContentSpinner`.

# Test: Check if `useContentSpinner` is correctly defined and exported.
ast-grep --lang typescript --pattern 'export function useContentSpinner() { $$$ }'

Length of output: 84


Script:

#!/bin/bash
# Search for the definition of `useContentSpinner` in the codebase, considering both named and default exports.
rg 'useContentSpinner' -A 5

# Check for any default export of a function named `useContentSpinner`.
ast-grep --lang typescript --pattern 'export default function useContentSpinner() { $$$ }'

Length of output: 1835

playground/src/views/demos/features/clipboard/index.vue (2)

7-7: Ensure Proper Integration of Card Component.

The Card component from ant-design-vue is newly imported. Verify its correct usage and integration within the template.


15-23: Verify Layout Enhancements.

The UI structure now uses a Card component for better organization. Ensure these changes improve the visual layout without altering clipboard functionality.

docs/.vitepress/theme/index.ts (1)

4-4: Integration of NolebaseGitChangelogPlugin looks good!

The plugin is correctly imported and used within the enhanceApp function. Ensure that the plugin is functioning as expected in the application.

To verify the integration, check if the plugin is correctly registered and utilized within the app.

Also applies to: 13-13, 19-19

packages/@core/base/shared/src/utils/dom.ts (1)

1-8: Refactor to getElementVisibleRect is well-implemented!

The function now returns a detailed visibility rectangle, enhancing its utility. Ensure that all usages of the previous getElementVisibleHeight function are updated to use the new function.

To verify the function's usage, check for calls to getElementVisibleRect and ensure they are correctly updated.

Also applies to: 14-52

Verification successful

Verification Successful: Usage of getElementVisibleRect is Correct

The function getElementVisibleRect is appropriately used across the codebase, with no remaining references to the deprecated getElementVisibleHeight. The transition to the new function has been implemented correctly.

  • getElementVisibleRect is used in:
    • packages/@core/composables/src/use-content-style.ts
    • packages/@core/base/shared/src/utils/dom.test.ts

No issues were found regarding the usage of the new function.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of getElementVisibleRect.

# Test: Ensure all references to the function are updated. Expect: No references to `getElementVisibleHeight`.
rg --type typescript 'getElementVisibleRect'

Length of output: 79


Script:

#!/bin/bash
# Description: Verify the usage of getElementVisibleRect and check for any remaining references to getElementVisibleHeight.

# Search for references to the new function getElementVisibleRect in TypeScript files.
rg --type ts 'getElementVisibleRect'

# Search for any remaining references to the old function getElementVisibleHeight in TypeScript files.
rg --type ts 'getElementVisibleHeight'

Length of output: 1171

packages/@core/ui-kit/layout-ui/src/components/layout-content.vue (1)

7-7: Update to use useContentStyle and overlayStyle is effective!

The changes enhance the component's flexibility by allowing overlay styles to be customized. Ensure that overlayStyle is correctly utilized in the application.

To verify the usage of overlayStyle, check for its application in the component's template.

Also applies to: 27-27, 56-58

Verification successful

To verify the usage of overlayStyle, I'll adjust the search to target .vue files directly.


overlayStyle is correctly utilized in the component's template.

The overlayStyle is applied in the layout-content.vue component, confirming its intended usage as per the review comment.

  • packages/@core/ui-kit/layout-ui/src/components/layout-content.vue: <slot :overlay-style="overlayStyle" name="overlay"></slot>
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of overlayStyle in the component.

# Test: Ensure overlayStyle is correctly applied. Expect: Usage of `overlayStyle` in the component's template.
rg --type vue 'overlayStyle'

Length of output: 56


Script:

#!/bin/bash
# Description: Verify the usage of overlayStyle in the component.

# Test: Ensure overlayStyle is correctly applied. Expect: Usage of `overlayStyle` in the component's template.
rg 'overlayStyle' --glob '*.vue'

Length of output: 1270

packages/@core/composables/src/use-content-style.ts (3)

1-2: Consider Import Optimization.

The imports from 'vue' and '@vueuse/core' are well-organized. However, ensure that all imported functions are necessary for the current implementation to avoid unused imports.


52-55: Ensure Comprehensive Return Values.

The function returns contentElement, overlayStyle, and visibleDomRect. Verify that these values are used effectively in the consuming components or functions.


16-52: Review the use of ResizeObserver.

The use of ResizeObserver with a debounced function is a good practice for performance optimization. Ensure that the observer is properly disconnected when the component is unmounted to prevent memory leaks.

packages/@core/base/shared/src/utils/dom.test.ts (4)

1-15: Ensure Mock Consistency.

The use of mocks for viewport dimensions is appropriate. Ensure that these mocks are consistent with the actual application environment to avoid discrepancies in test results.


18-38: Comprehensive Default Rect Tests.

The test cases for undefined and null elements are comprehensive and ensure that the function handles edge cases correctly.


40-102: Validate Partial Visibility Logic.

The tests for elements partially off-screen at the top and right are well-constructed. Ensure that the logic aligns with the expected behavior in all application scenarios.


106-123: Test Completeness for Off-Screen Elements.

The test for completely off-screen elements is complete and ensures that the function returns expected results.

packages/effects/layouts/src/basic/layout.vue (2)

19-19: Verify Import Usage.

The LayoutContentSpinner is newly imported. Ensure that it is used correctly in the template and that its functionality is fully tested.


300-305: Ensure Correct Spinner Integration.

The conditional rendering of LayoutContentSpinner based on preferences.transition.loading is a good practice. Verify that the spinner's visibility is correctly managed across different loading states.

docs/.vitepress/config.mts (2)

5-8: Imports for changelog generation look good.

The imports for GitChangelog and GitChangelogMarkdownSection are correctly added and are used later in the configuration.


105-110: Changelog plugin configuration is correct.

The plugins array now includes GitChangelog and GitChangelogMarkdownSection, which are configured correctly to enhance the documentation process.

packages/@core/ui-kit/layout-ui/src/vben-layout.vue (1)

523-525: New overlay slot is well-implemented.

The addition of a new overlay slot with a scoped prop overlayStyle enhances the flexibility of the component without affecting existing functionality.

@anncwb anncwb merged commit debb32d into main Aug 15, 2024
25 of 30 checks passed
@anncwb anncwb deleted the perf/awesome branch August 15, 2024 13:48
@anncwb anncwb added the bug Something isn't working label Aug 15, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant