chore: Refactoring editor header (#28128)

## Description

Refactoring editor header component

#### PR fixes following issue(s)
Fixes [#26163](https://github.com/appsmithorg/appsmith/issues/26163)

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

## Testing

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [x] Cypress

## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
Ankita Kinger 2023-10-17 11:06:03 +05:30 committed by GitHub
parent d48ac4fd81
commit b9c9389ade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 20 deletions

View File

@ -6,8 +6,7 @@ import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
import { APPLICATIONS_URL } from "constants/routes";
import type { MenuItemData } from "./NavigationMenuItem";
import { MenuTypes } from "./NavigationMenuItem";
import { useCallback } from "react";
import { MenuTypes } from "./types";
import { getExportAppAPIRoute } from "@appsmith/constants/ApiConstants";
import {
@ -50,11 +49,11 @@ export const GetNavigationMenuData = ({
currentApplication?.userPermissions ?? [],
PERMISSION_TYPE.MANAGE_APPLICATION,
);
const openExternalLink = useCallback((link: string) => {
const openExternalLink = (link: string) => {
if (link) {
window.open(link, "_blank");
}
}, []);
};
const exportAppAsJSON = () => {
const id = `t--export-app-link`;

View File

@ -12,14 +12,7 @@ import type { noop } from "lodash";
import type { CommonComponentProps } from "design-system-old";
import AnalyticsUtil from "utils/AnalyticsUtil";
import styled from "styled-components";
export enum MenuTypes {
MENU = "menu",
PARENT = "parent",
RECONFIRM = "re-confirm",
MENU_DIVIDER = "menu divider",
}
import { MenuTypes } from "./types";
export interface MenuItemData {
text: string;
@ -35,12 +28,6 @@ export interface MenuItemData {
style?: React.CSSProperties;
}
const ReconfirmMenuItem = styled(MenuItem)`
.ads-v2-text {
color: var(--ads-v2-color-fg-error);
}
`;
type NavigationMenuItemProps = CommonComponentProps & {
menuItemData: MenuItemData;
setIsPopoverOpen: typeof noop;
@ -124,13 +111,13 @@ export function NavigationMenuItem({
);
case MenuTypes.RECONFIRM:
return (
<ReconfirmMenuItem
<MenuItem
className="error-menuitem"
data-testid={`t--editor-menu-${kebabCase(text)}`}
onClick={(e) => handleReconfirmClick(e, menuItemData)}
>
{confirm.text}
</ReconfirmMenuItem>
</MenuItem>
);
case MenuTypes.MENU_DIVIDER:
return <MenuSeparator />;

View File

@ -0,0 +1,6 @@
export enum MenuTypes {
MENU = "menu",
PARENT = "parent",
RECONFIRM = "re-confirm",
MENU_DIVIDER = "menu divider",
}