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: New tab ui changes #33228

Merged
merged 33 commits into from May 15, 2024
Merged

feat: New tab ui changes #33228

merged 33 commits into from May 15, 2024

Conversation

albinAppsmith
Copy link
Collaborator

@albinAppsmith albinAppsmith commented May 7, 2024

Description

Added new design of New Query/Js tab design.

Fixes #33116

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9084312304
Commit: 48223f4
Cypress dashboard url: Click here!

Communication

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

  • Yes
  • No

Copy link
Contributor

coderabbitai bot commented May 7, 2024

Walkthrough

Walkthrough

The recent updates to the IDE module's EditorPane involve refining import statements, enhancing route configurations, and improving description rendering logic. Specifically, hooks.tsx in both the Query and JS directories received modifications to streamline imports, adjust route paths, and optimize conditional logic.

Changes

Files Change Summary
.../EditorPane/Query/hooks.tsx - Replaced individual React hooks imports with a single React import.
- Updated import statement for ListItemProps to include Tag and specify the type.
- Adjusted route configuration for ListQuery component.
- Enhanced description rendering logic in useAddQueryListItems.
.../EditorPane/JS/hooks.ts - Updated route configuration in useJSSegmentRoutes to include additional paths.
- Optimized early return condition in useJSAdd function.
.../Regression/ClientSide/IDE/IDE_Add_Pane_Interactions_spec.ts - Modified closeAddView() calls to include PagePaneSegment argument.
.../support/Pages/IDE/AddView.ts - Added addPane locator and adjusted visibility check in assertInAddView.
.../support/Pages/IDE/LeftPane.ts - Added imports for PagePaneSegment and FileTabs.
- Modified closeAddView method to accept a segment parameter.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Render add button as an active tab (#33116)
Adjust route configurations for ListJS and ListQuery components (#33116)
Optimize conditional logic in useJSAdd function (#33116)

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between ea658d0 and 48223f4.
Files selected for processing (1)
  • app/client/cypress/support/Pages/EntityExplorer.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Pages/EntityExplorer.ts

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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.

@github-actions github-actions bot added IDE Navigation Issues/feature requests related to IDE navigation, and context switching New Developers Pod Issues that new developers face while exploring the IDE Task A simple Todo labels May 7, 2024
@albinAppsmith albinAppsmith added the ok-to-test Required label for CI label May 7, 2024
@github-actions github-actions bot added the Enhancement New feature or request label May 7, 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: 4

Out of diff range and nitpick comments (1)
app/client/src/pages/Editor/IDE/EditorTabs/AddButton.tsx (1)

22-32: Review the use of isIconButton and kind properties on the Button.

The isIconButton and kind="secondary" properties are used here. Ensure that these settings align with the design specifications for buttons in this context. It's important that the visual representation matches the intended design, especially in a UI-focused update.

Comment on lines +12 to +14
if (segmentMode === EditorEntityTabState.Add) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider handling the EditorEntityTabState.Add state outside of the AddButton component.

The current implementation returns null when segmentMode is EditorEntityTabState.Add, which might be better handled by the parent component deciding not to render AddButton at all. This would keep the AddButton component's responsibility focused solely on its own rendering and behavior.

Comment on lines +15 to +21
if (isJSLoading) {
return (
<Flex px="spaces-2">
<Spinner size="md" />
</Flex>
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure accessibility and loading state representation.

While displaying a spinner during loading is good, consider adding an aria-busy="true" attribute to the button or a relevant container when isJSLoading is true. This improves accessibility by informing screen reader users that the content is being loaded.

app/client/src/pages/Editor/IDE/EditorTabs/FileTabs.tsx Outdated Show resolved Hide resolved
app/client/src/pages/Editor/IDE/EditorTabs/FileTabs.tsx Outdated Show resolved Hide resolved
@albinAppsmith
Copy link
Collaborator Author

/build-deploy-preview skip-test=true

Copy link

github-actions bot commented May 7, 2024

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

Copy link

github-actions bot commented May 7, 2024

Deploy-Preview-URL: https://ce-33228.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: 2

app/client/src/pages/Editor/IDE/EditorPane/Query/Add.tsx Outdated Show resolved Hide resolved
app/client/src/pages/Editor/IDE/EditorPane/JS/Add.tsx Outdated Show resolved Hide resolved
@albinAppsmith
Copy link
Collaborator Author

/build-deploy-preview skip-test=true

Copy link

github-actions bot commented May 9, 2024

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

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 9, 2024
Copy link

github-actions bot commented May 9, 2024

Deploy-Preview-URL: https://ce-33228.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: 1

Out of diff range and nitpick comments (2)
app/client/src/pages/Editor/IDE/EditorPane/JS/JSRender.test.tsx (2)

Line range hint 72-91: Ensure consistency in test descriptions and expected outcomes.

The test description for "Renders Fullscreen Add in Blank State" should clearly state the expected behavior and outcomes, especially since this test seems to focus on the new tab functionality. Consider revising the description to better reflect the test's purpose.


269-278: Ensure accurate test setup for split screen scenarios.

In the test "Renders JS add routes in Split Screen", consider adding more detailed setup to explicitly simulate the split screen environment, ensuring that the test accurately reflects the user interaction in such a scenario.

Comment on lines +231 to +251
const { container, getAllByText, getByTestId, getByText } = render(
<Route path={BUILDER_PATH}>
<IDE />
</Route>,
{
url: "/app/applicationSlug/pageSlug-page_id/edit/jsObjects/js_id3/add",
initialState: state,
featureFlags: FeatureFlags,
},
);

// There will be 2 JSObject3 text (editor tab and Editor form)
expect(getAllByText("JSObject3").length).toEqual(2);
// Tabs active state
expect(
getByTestId("t--ide-tab-JSObject3").classList.contains("active"),
).toBe(false);
// Check if the form is rendered
expect(container.querySelector(".js-editor-tab")).not.toBeNull();
// Check if the code and settings tabs is visible
getByRole("tab", { name: /code/i });
getByRole("tab", { name: /settings/i });
// Check if run button is visible
getByRole("button", { name: /run/i });
// Check js object is not rendered. Instead new tab should render
expect(container.querySelector(".js-editor-tab")).toBeNull();
// Check is new tab is visible
getByText("New JS");
Copy link
Contributor

Choose a reason for hiding this comment

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

Check for potential issues with tab state management.

In the test "Renders JS add routes in Full Screen", the assertion on line 248 checks if the tab for "JSObject3" is not active, which contradicts the expected behavior of treating new tabs as active. This might indicate a problem with how the tab state is managed or a misunderstanding in the test's intent. Please verify this behavior.

@albinAppsmith
Copy link
Collaborator Author

/build-deploy-preview skip-test=true

@albinAppsmith albinAppsmith removed the ok-to-test Required label for CI label May 10, 2024
@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 13, 2024
@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 13, 2024
Copy link
Member

@hetunandu hetunandu left a comment

Choose a reason for hiding this comment

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

We need to find better code structures to avoid over complicating the implementation and ensuring more scalability

@@ -112,12 +114,20 @@ export class LeftPane {
this.addView.assertInAddView();
}

public closeAddView() {
this.addView.closeAddView();
public closeAddView(segment: PagePaneSegment) {
Copy link
Member

Choose a reason for hiding this comment

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

This argument here is an anti-pattern. If we are seeing that the closing of the add view is different based on segments, it should be added as behaviours or exposed via sub classes

if (segmentMode === EditorEntityTabState.Add) {
const url = getJSUrl(currentEntityInfo, false);
history.push(url);
return useCallback(
Copy link
Member

Choose a reason for hiding this comment

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

Passing a boolean argument here adds more complication to an already complicated hook. I strongly believe we need to refactor this to be more explicit

@@ -24,7 +24,7 @@ const BlankState: React.FC = () => {
buttonText={createMessage(EDITOR_PANE_TEXTS.js_add_button)}
description={createMessage(EDITOR_PANE_TEXTS.js_blank_state_description)}
icon={"js-square-v3"}
onClick={canCreateActions ? addButtonClickHandler : undefined}
onClick={canCreateActions ? () => addButtonClickHandler(true) : undefined}
Copy link
Member

Choose a reason for hiding this comment

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

eg: It is confusing to know what true means here

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 14, 2024
@albinAppsmith
Copy link
Collaborator Author

/build-deploy-preview skip-test=true

Copy link

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

Copy link

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

@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 14, 2024
@albinAppsmith albinAppsmith added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 14, 2024
@albinAppsmith albinAppsmith merged commit f13309e into release May 15, 2024
82 checks passed
@albinAppsmith albinAppsmith deleted the add-tabs-ui branch May 15, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request IDE Navigation Issues/feature requests related to IDE navigation, and context switching New Developers Pod Issues that new developers face while exploring the IDE ok-to-test Required label for CI Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] - Tabs add - New tab like UI
2 participants