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

chore: Moving navigation header to Explorer templates in ADS #38131

Merged
merged 9 commits into from
Dec 18, 2024

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Dec 12, 2024

Description

Moving navigation header to Explorer templates in ADS

Fixes #37614 #37612 #37611

Automation

/ok-to-test tags="@tag.IDE, @tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12380719410
Commit: 440da6d
Cypress dashboard.
Tags: @tag.IDE, @tag.Sanity
Spec:


Tue, 17 Dec 2024 21:00:53 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a new SegmentSwitcher component for enhanced segment navigation.
    • Added EditorSegments component for rendering a segmented control interface.
  • Improvements
    • Replaced the SegmentedHeader with SegmentSwitcher in the explorer pane for improved user experience.
    • Updated the header component to use the new NavigationHeader for better segment management.
    • Enhanced hover interactions and simplified separator logic within the segmented control.
  • Exports
    • New exports for EditorSegments and SegmentSwitcher components to facilitate usage across modules.
    • Added new documentation for the EditorSegments component to provide usage guidelines and examples.

Copy link
Contributor

coderabbitai bot commented Dec 12, 2024

Walkthrough

The changes in this pull request primarily involve the replacement of the SegmentedHeader component with a new SegmentSwitcher component, which utilizes the EditorSegments component for rendering segmented controls. The SegmentedHeader has been updated to use the NavigationHeader from the @appsmith/ads library. Additionally, a new EditorSegments component has been introduced, which encapsulates the segmented control logic. The overall structure of the affected components remains consistent, with modifications focused on enhancing the segmented control functionality.

Changes

File Change Summary
app/client/src/pages/Editor/IDE/EditorPane/components/SegmentedHeader.tsx Replaced SegmentedControl with NavigationHeader, updated props handling for segment changes.
app/client/packages/design-system/ads/src/Templates/EntityExplorer/index.ts Added export for EditorSegments component.
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx Introduced new EditorSegments component for rendering segmented controls.
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/index.tsx Added export for EditorSegments component.
app/client/src/pages/Editor/IDE/EditorPane/Explorer.tsx Updated import from SegmentedHeader to SegmentSwitcher.
app/client/src/pages/Editor/IDE/EditorPane/components/SegmentSwitcher.tsx Introduced new SegmentSwitcher component for managing segment navigation.
app/client/packages/design-system/ads/src/SegmentedControl/SegmentedControl.styles.tsx Added hover effect for unselected segments and simplified separator logic.
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.styles.ts Introduced new styled component Container for layout of EditorSegments.
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.types.ts Added EditorSegmentsProps interface for prop type definitions.
app/client/src/pages/Editor/IDE/hooks.ts Introduced useEditorType and useParentEntityInfo hooks, updated useSegmentNavigation.

Assessment against linked issues

Objective Addressed Explanation
Update the existing Segmented Control component in ADS to have a hover state (#37614) The changes implement a hover state for unselected segments.

Suggested labels

Enhancement, Templates Product

Suggested reviewers

  • alex-golovanov

🎉 In the realm of code, a switch was made,
From SegmentedHeader to SegmentSwitcher displayed.
With EditorSegments now in the mix,
Navigating segments is a new fix!
A dance of components, a seamless flow,
In the land of code, watch the features grow! 🌟


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@github-actions github-actions bot added IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product Task A simple Todo skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Dec 12, 2024
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: 1

🧹 Outside diff range and nitpick comments (2)
app/client/packages/design-system/ads/src/Templates/EntityExplorer/NavigationHeader/NavigationHeader.tsx (2)

16-20: Consider using CSS custom properties for the max-width value.

The hard-coded max-width value could be moved to a design token for better maintainability.

const Container = styled(Flex)`
  #editor-pane-segment-control {
-    max-width: 247px;
+    max-width: var(--ads-v2-spaces-segment-control-width, 247px);
  }
`;

34-39: Consider adding aria-label for accessibility.

The SegmentedControl could benefit from an accessibility label.

<SegmentedControl
  id="editor-pane-segment-control"
+ aria-label="Editor pane navigation"
  onChange={onSegmentChange}
  options={options}
  value={selectedSegment}
/>
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 749f11b and 8741101.

📒 Files selected for processing (3)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/NavigationHeader/NavigationHeader.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/NavigationHeader/index.tsx (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/SegmentedHeader.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/NavigationHeader/index.tsx
🔇 Additional comments (2)
app/client/src/pages/Editor/IDE/EditorPane/components/SegmentedHeader.tsx (1)

12-29: Clean implementation of NavigationHeader.

The migration to NavigationHeader maintains the existing functionality while simplifying the component structure. Props are correctly passed and the options array is well-structured.

app/client/packages/design-system/ads/src/Templates/EntityExplorer/NavigationHeader/NavigationHeader.tsx (1)

26-33: Well-structured container with design system tokens.

Good use of design system tokens for spacing, background color, and layout properties.

@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@ankitakinger ankitakinger added the ok-to-test Required label for CI label Dec 12, 2024
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12303042761.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38131.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-38131.dp.appsmith.com

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 and nitpick comments (3)
app/client/src/pages/Editor/IDE/EditorPane/components/SegmentSwitcher.tsx (1)

7-31: Consider adding error handling for segment changes

The component looks well-structured, but it might benefit from error handling in case the segment change fails.

 const SegmentSwitcher = () => {
   const { segment } = useCurrentEditorState();
-  const { onSegmentChange } = useSegmentNavigation();
+  const { onSegmentChange: handleSegmentChange } = useSegmentNavigation();
+  
+  const onSegmentChange = (value: string) => {
+    try {
+      handleSegmentChange(value);
+    } catch (error) {
+      // Handle or log error
+      console.error('Failed to change segment:', error);
+    }
+  };
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx (2)

9-14: Consider using a more specific type for selectedSegment

The selectedSegment prop is typed as string, but it seems to be constrained to specific values from EditorEntityTab.

 interface Props {
-  selectedSegment: string;
+  selectedSegment: EditorEntityTab;
-  onSegmentChange: (value: string) => void;
+  onSegmentChange: (value: EditorEntityTab) => void;
   options: SegmentedControlOption[];
   children?: React.ReactNode | React.ReactNode[];
 }

16-20: Consider extracting magic number to a constant

The max-width value of 247px should be defined as a constant for better maintainability.

+const SEGMENT_CONTROL_MAX_WIDTH = 247;
+
 const Container = styled(Flex)`
   #editor-pane-segment-control {
-    max-width: 247px;
+    max-width: ${SEGMENT_CONTROL_MAX_WIDTH}px;
   }
 `;
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c42363 and 61beadb.

📒 Files selected for processing (5)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/index.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/index.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/Explorer.tsx (2 hunks)
  • app/client/src/pages/Editor/IDE/EditorPane/components/SegmentSwitcher.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/index.ts
🔇 Additional comments (1)
app/client/src/pages/Editor/IDE/EditorPane/Explorer.tsx (1)

44-44: LGTM! Clean implementation of the segment switcher

The replacement of SegmentedHeader with SegmentSwitcher is well-integrated with the existing routing logic.

hetunandu
hetunandu previously approved these changes Dec 16, 2024
Copy link
Contributor

@alex-golovanov alex-golovanov left a comment

Choose a reason for hiding this comment

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

We're missing a story for EditorSemgents component.

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: 2

🧹 Nitpick comments (2)
app/client/packages/design-system/ads/src/SegmentedControl/SegmentedControl.styles.tsx (1)

Line range hint 84-92: Consider simplifying the complex selector

The selector for the separator is becoming quite complex with multiple :not() conditions. Consider breaking this down into separate CSS classes or using a more maintainable approach.

Here's a suggested refactor that uses a class-based approach:

-  &:not(:hover):not(:last-child):not([data-selected="true"]):not(
-      :has(+ [data-selected="true"])
-    ):after {
+  &:after {
     content: "";
     position: absolute;
     right: 0;
     width: 1px;
     height: 16px;
     background-color: var(--ads-v2-colors-control-field-default-border);
+    display: none;
   }
+
+  &:not(:last-child):not([data-selected="true"]):not(:hover):not(:has(+ [data-selected="true"])):after {
+    display: block;
+  }
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.types.ts (1)

3-8: LGTM! Consider adding JSDoc comments

The interface is well-structured with clear prop types. The props follow React's controlled component pattern with selectedSegment and onSegmentChange.

Consider adding JSDoc comments to document the interface and its props:

+/**
+ * Props for the EditorSegments component
+ */
 export interface EditorSegmentsProps {
+  /** Currently selected segment value */
   selectedSegment: string;
+  /** Callback fired when segment selection changes */
   onSegmentChange: (value: string) => void;
+  /** Available segment options */
   options: SegmentedControlOption[];
+  /** Optional child elements to render */
   children?: React.ReactNode | React.ReactNode[];
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61beadb and 6ef24d5.

📒 Files selected for processing (5)
  • app/client/packages/design-system/ads/src/SegmentedControl/SegmentedControl.styles.tsx (2 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.styles.ts (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.types.ts (1 hunks)
  • app/client/src/pages/Editor/IDE/hooks.ts (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.styles.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx
🔇 Additional comments (3)
app/client/packages/design-system/ads/src/SegmentedControl/SegmentedControl.styles.tsx (1)

58-60: LGTM: Clean hover state implementation

The hover state implementation follows the design system's color tokens and maintains consistency with the existing patterns.

app/client/src/pages/Editor/IDE/hooks.ts (2)

77-89: LGTM! Consistent URL construction pattern

The URL construction is consistently updated across all segments (QUERIES, JS, UI) using the new baseParentEntityId parameter.


30-31: Verify enterprise edition hook availability

The new imports are from enterprise edition modules. Let's ensure these hooks are properly exported and available.

Copy link
Contributor

@alex-golovanov alex-golovanov left a comment

Choose a reason for hiding this comment

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

We're missing a story for EditorSemgents component.

Still missing a story. Like I've mentioned in parallel PR - developing components for ADS must be done using Storybook.. Not only it gives a convenient development environment, but also serves as a catalogue for other developers.

@ankitakinger

@ankitakinger
Copy link
Contributor Author

@alex-golovanov
This is a conversation that I and Hetu had on our 1:1, sorry we should have posted about the same on channel later. But it made sense to me that we should have stories as a whole Entity Explorer variations that we can have. Similar to different variations in Miro board:
https://miro.com/app/board/uXjVL_l_VM8=/?moveToWidget=3458764608339172510&cot=14

Also, for this component specifically as well, it doesn't make sense to have a story, as it might create more confusion with SegmentedControl story, as there are very minute differences, which are specific to Entity Explorer.

@ankitakinger ankitakinger added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Dec 16, 2024
@alex-golovanov
Copy link
Contributor

@alex-golovanov This is a conversation that I and Hetu had on our 1:1, sorry we should have posted about the same on channel later. But it made sense to me that we should have stories as a whole Entity Explorer variations that we can have. Similar to different variations in Miro board: https://miro.com/app/board/uXjVL_l_VM8=/?moveToWidget=3458764608339172510&cot=14

Also, for this component specifically as well, it doesn't make sense to have a story, as it might create more confusion with SegmentedControl story, as there are very minute differences, which are specific to Entity Explorer.

Your conversation with Hetu does not make much difference, if a component is created in ADS it needs a story. My objective reasoning is in a comment above, please do not dismiss it with a simple "it does not make any sense".

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)
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.stories.tsx (1)

12-15: Document the reason for ESLint disable

While the template implementation is correct, please add a comment explaining why the ESLint rule needs to be disabled here.

-// eslint-disable-next-line react/function-component-definition
+// eslint-disable-next-line react/function-component-definition
+// This is a Storybook template function, not a React component
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.mdx (1)

7-14: Fix typo and enhance documentation clarity

There's a duplicate "is" in the first sentence. Also, consider structuring the constraints as a list for better readability.

-Editor Segments is is built on top of the ADS component
+Editor Segments is built on top of the ADS component

Constraints:
- Max-width: 247px
- Extra padding around segments
🧰 Tools
🪛 LanguageTool

[duplication] ~9-~9: Possible typo: you repeated a word
Context: ... /> # Editor Segments Editor Segments is is built on top of the ADS component - Seg...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~11-~11: Usually, there’s no comma before “if”.
Context: ...ccept children to add more UI controls, if needed. These will be placed on the rig...

(IF_NO_COMMA)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef24d5 and 9aec1c0.

📒 Files selected for processing (4)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.mdx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.stories.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx (1 hunks)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx
🧰 Additional context used
🪛 LanguageTool
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.mdx

[duplication] ~9-~9: Possible typo: you repeated a word
Context: ... /> # Editor Segments Editor Segments is is built on top of the ADS component - Seg...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~11-~11: Usually, there’s no comma before “if”.
Context: ...ccept children to add more UI controls, if needed. These will be placed on the rig...

(IF_NO_COMMA)

🔇 Additional comments (7)
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/index.tsx (1)

1-2: LGTM! Verify referenced modules.

The barrel file pattern is correctly implemented.

Let's verify the referenced modules and check for potential circular dependencies:

✅ Verification successful

✅ Barrel exports are correctly implemented and safe

Both referenced modules exist and there are no circular dependencies:

  • EditorSegments.tsx exports the component
  • EditorSegments.types.ts exists for type definitions
  • No circular imports detected
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of referenced modules and check for circular dependencies

# Check if the referenced modules exist
fd -e ts -e tsx "EditorSegments\.(tsx|ts)" "app/client/packages/design-system/ads/src/Templates/EntityExplorer"

# Check for potential circular dependencies
rg -l "from.*EditorSegments/index" "app/client/packages/design-system/ads/src/Templates/EntityExplorer"

Length of output: 316


Script:

#!/bin/bash
# Check for the types file existence
fd -e ts "EditorSegments\.types\.ts" "app/client/packages/design-system/ads/src/Templates/EntityExplorer"

# Check content of EditorSegments.tsx to verify exports
rg -A 5 "^export" "app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx"

# Look for any imports of index in EditorSegments.tsx to check circular deps
rg "from.*index" "app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.tsx"

Length of output: 479

app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.stories.tsx (4)

1-10: LGTM: Story configuration follows best practices

The imports and story configuration are well-structured and follow Storybook conventions.


17-39: LGTM: Comprehensive default story setup

The default story effectively demonstrates the component's features including labels, icons, and disabled states.


41-79: LGTM: Good coverage of component variants

The stories effectively demonstrate different component configurations with icons-only and labels-only variants.


81-101: LGTM: Good demonstration of component extensibility

The story effectively shows how to extend the component with children elements. However, let's verify that the Button component is consistently styled across the design system.

✅ Verification successful

The previous search didn't provide enough context. Let's try to find the Button component's implementation and its styling patterns in the design system.


LGTM: Button implementation follows design system patterns

The Button component usage in the story is consistent with the design system's implementation. The kind="secondary" and isIconButton props are properly supported in the core Button component, and the styling is handled through the StyledButton component. Other stories in the codebase use similar patterns for secondary buttons.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for consistent Button styling across the design system
ast-grep --pattern 'const Button = $$$' 

Length of output: 88252


Script:

#!/bin/bash
# Let's check for Button component usage and styling in the design system
rg -A 5 "Button.*kind=\"secondary\"" app/client/packages/design-system/

Length of output: 2168


Script:

#!/bin/bash
# Search for Button component's implementation in the design system
ast-grep --pattern 'const Button = $$$' app/client/packages/design-system/

Length of output: 7332


Script:

#!/bin/bash
# Look for Button's style definitions
rg -A 5 "StyledButton" app/client/packages/design-system/

Length of output: 7404

app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.mdx (2)

1-5: LGTM: Documentation setup follows standards

The MDX configuration and imports are properly structured.


15-25: LGTM: Well-structured documentation with clear examples

The anatomy section and examples effectively demonstrate the component's usage patterns.

@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12369811259.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38131.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-38131.dp.appsmith.com

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)
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.stories.tsx (2)

12-15: Simplify template implementation

The template function can be more concise by using an implicit return.

-const Template = (args: EditorSegmentsProps) => {
-  return <EditorSegments {...args}>{args.children}</EditorSegments>;
-};
+const Template = (args: EditorSegmentsProps) => (
+  <EditorSegments {...args}>{args.children}</EditorSegments>
+);

81-101: Document isFullWidth prop usage

Consider adding a comment explaining when and why the isFullWidth prop should be used, as it affects the component's layout behavior.

 EditorSegmentsStoryWithChildren.args = {
   options: [
     // ...
   ],
   defaultValue: "queries",
+  // Use isFullWidth when the component needs to span the entire container width
+  // Useful when adding children that need consistent spacing
   isFullWidth: true,
   children: <Button isIconButton kind="secondary" startIcon="plus" />,
 };
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9aec1c0 and 440da6d.

📒 Files selected for processing (1)
  • app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.stories.tsx (1 hunks)
🔇 Additional comments (4)
app/client/packages/design-system/ads/src/Templates/EntityExplorer/EditorSegments/EditorSegments.stories.tsx (4)

7-10: Update story title structure

The story title structure should be "ADS/Templates/EntityExplorer/EditorSegments" to maintain consistency with the folder path.

-  title: "ADS/Templates/Entity Explorer/Editor Segments",
+  title: "ADS/Templates/EntityExplorer/EditorSegments",

17-39: LGTM! Well-structured default story

Good demonstration of all component features including labels, icons, and disabled state.


61-79: LGTM! Clear demonstration of label-only variant

The story effectively shows the component's flexibility in handling different content types.


41-59: Consider adding ARIA labels for icon-only segments

When using icons without labels, ensure screen readers can properly announce the segments.

@ankitakinger ankitakinger merged commit 495f139 into release Dec 18, 2024
52 checks passed
@ankitakinger ankitakinger deleted the chore/segmented-header-ads branch December 18, 2024 05:56
NandanAnantharamu pushed a commit that referenced this pull request Dec 27, 2024
## Description

Moving navigation header to Explorer templates in ADS

Fixes [#37614](#37614)
[#37612](#37612)
[#37611](#37611)

## Automation

/ok-to-test tags="@tag.IDE, @tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12380719410>
> Commit: 440da6d
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12380719410&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE, @tag.Sanity`
> Spec:
> <hr>Tue, 17 Dec 2024 21:00:53 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new `SegmentSwitcher` component for enhanced segment
navigation.
- Added `EditorSegments` component for rendering a segmented control
interface.
- **Improvements**
- Replaced the `SegmentedHeader` with `SegmentSwitcher` in the explorer
pane for improved user experience.
- Updated the header component to use the new `NavigationHeader` for
better segment management.
- Enhanced hover interactions and simplified separator logic within the
segmented control.
- **Exports**
- New exports for `EditorSegments` and `SegmentSwitcher` components to
facilitate usage across modules.
- Added new documentation for the `EditorSegments` component to provide
usage guidelines and examples.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE Pod Issues that new developers face while exploring the IDE IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the existing Segmented Control component in ADS to have a hover state
3 participants