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

feat: update /database explorer; enhance ColoredBadgeFormat with options.className; introduce ListSkeleton component #422

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

duyet
Copy link
Owner

@duyet duyet commented Nov 17, 2024

Summary by Sourcery

Update the database explorer UI, enhance the ColoredBadgeFormat and LinkFormat components with customizable class names, and introduce a new ListSkeleton component. Update dependencies in package.json and add tests for new class name options.

New Features:

  • Introduce a new ListSkeleton component for rendering skeleton loaders in a list format.

Enhancements:

  • Enhance the ColoredBadgeFormat component to accept an options.className for custom styling.
  • Enhance the LinkFormat component to support custom class names through options.className.

Build:

  • Update dependencies in package.json, including @radix-ui/react-tooltip and lucide-react.

Tests:

  • Add tests for the options.className feature in both LinkFormat and ColoredBadgeFormat components.

…ions.className`; introduce ListSkeleton component
Copy link

vercel bot commented Nov 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clickhouse-monitoring ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 17, 2024 5:53pm

Copy link
Contributor

sourcery-ai bot commented Nov 17, 2024

Reviewer's Guide by Sourcery

This PR introduces several UI enhancements and component updates, focusing on improving the database explorer interface, adding styling options to components, and introducing a new skeleton component. The changes include sidebar styling improvements, new className options for formatting components, and various visual refinements.

Class diagram for updated ColoredBadgeFormat and LinkFormat components

classDiagram
    class ColoredBadgeFormat {
        +ColoredBadgeOptions options
        +render()
    }
    class LinkFormat {
        +LinkProps options
        +render()
    }
    class ColoredBadgeOptions {
        +string className
    }
    class LinkProps {
        +string className
    }
    ColoredBadgeFormat --> ColoredBadgeOptions
    LinkFormat --> LinkProps
Loading

Class diagram for new ListSkeleton component

classDiagram
    class ListSkeleton {
        +int nrows
        +string className
        +render()
    }
Loading

File-Level Changes

Change Details Files
Enhanced the database explorer sidebar with new styling and improved layout
  • Added new sidebar color theme variables for light and dark modes
  • Improved sidebar layout with flex container and better spacing
  • Redesigned database count badge with new styling
  • Updated ResizablePanel configuration for better responsiveness
app/[host]/database/[database]/@nav/nav.tsx
app/[host]/database/[database]/layout.tsx
app/globals.css
Added className support to formatting components for better customization
  • Added className option to ColoredBadgeFormat component
  • Enhanced LinkFormat to support custom className prop
  • Updated type definitions to include new className options
  • Added tests for className functionality
components/data-table/cells/colored-badge-format.tsx
components/data-table/cells/link-format.tsx
components/data-table/cells/colored-badge-format.cy.tsx
components/data-table/cells/link-format.cy.tsx
types/column-format.ts
Introduced new ListSkeleton component and updated loading states
  • Created new ListSkeleton component for list loading states
  • Updated database explorer loading state to use ListSkeleton
  • Added customization options for number of rows and className
components/skeleton.tsx
app/[host]/database/[database]/@nav/loading.tsx
Updated dependencies and configuration
  • Updated lucide-react to version 0.460.0
  • Updated @radix-ui/react-tooltip to version 1.1.4
  • Reformatted tailwind configuration file
package.json
yarn.lock
tailwind.config.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2024

Bundle Report

Changes will increase total bundle size by 2.13kB (0.03%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
clickhouse-monitoring-bundle-server-cjs 2.4MB 1.2kB (0.05%) ⬆️
clickhouse-monitoring-bundle-client-array-push 3.64MB 926 bytes (0.03%) ⬆️

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @duyet - I've reviewed your changes - here's some feedback:

Overall Comments:

  • In tailwind.config.js, center: 'true' should be center: true - it should be a boolean value, not a string
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

},
},
container: {
center: 'true',
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (bug_risk): The container center property should be a boolean true, not the string 'true'

Using a string instead of a boolean could cause unexpected behavior in the Tailwind configuration. Change this to boolean true.

@@ -75,4 +75,62 @@ describe('<LinkFormat />', () => {
cy.get('a').should('have.attr', 'href', 'https://duyet.net/item/789')
cy.contains('Non-string Href').should('be.visible')
})

describe('options.className', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider refactoring the test cases to use a parametrized test structure with test.each

The className tests can be simplified using a parametrized approach while maintaining distinct test cases. Here's how:

describe('options.className', () => {
  test.each([
    {
      name: 'applies custom className from options',
      className: 'custom-class text-red-500',
      assertions: (cy: Cypress.Chainable) => {
        cy.get('a')
          .should('have.class', 'custom-class')
          .and('have.class', 'text-red-500');
      }
    },
    {
      name: 'merges custom className with default classes',
      className: 'custom-class',
      assertions: (cy: Cypress.Chainable) => {
        cy.get('a')
          .should('have.class', 'group')
          .and('have.class', 'flex')
          .and('have.class', 'custom-class');
      }
    },
    {
      name: 'applies custom className from options with override',
      className: 'text-red-300 text-red-400 text-red-500',
      assertions: (cy: Cypress.Chainable) => {
        cy.get('a')
          .should('not.have.class', 'text-red-300')
          .and('not.have.class', 'text-red-400')
          .and('have.class', 'text-red-500');
      }
    }
  ])('$name', ({ className, assertions }) => {
    const row = { index: 0 } as Row<any>;
    const data = [{ id: '123' }];
    const value = 'Test Value';
    const options = { href: '/item/[id]', className };

    cy.mount(<LinkFormat row={row} data={data} value={value} options={options} />);
    assertions(cy);
  });
});

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.34%. Comparing base (73902fb) to head (e50c92e).
Report is 8 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #422   +/-   ##
=======================================
  Coverage   78.34%   78.34%           
=======================================
  Files           5        5           
  Lines         157      157           
  Branches       58       58           
=======================================
  Hits          123      123           
  Misses         31       31           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@duyet duyet merged commit ec82462 into main Nov 18, 2024
22 checks passed
@duyet duyet deleted the feat/new-table-expolerer branch November 18, 2024 02:14
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