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: Update JS Editor Run designs #36998

Merged
merged 12 commits into from
Oct 23, 2024
12 changes: 11 additions & 1 deletion app/client/src/assets/icons/menu/js-function.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import type { JSActionDropdownOption } from "../types";
import { RUN_BUTTON_DEFAULTS, testLocators } from "../constants";
import { createMessage, NO_JS_FUNCTION_TO_RUN } from "ee/constants/messages";
import { MenuTitle } from "./MenuTitle";

interface Props {
disabled: boolean;
Expand All @@ -33,16 +34,21 @@ interface Props {
*
*/
export const JSFunctionRun = (props: Props) => {
const { onSelect } = props;

const isActionRedesignEnabled = useFeatureFlag(
FEATURE_FLAG.release_actions_redesign_enabled,
);

// Callback function to handle function selection from the dropdown menu
const onFunctionSelect = useCallback((option: JSActionDropdownOption) => {
if (props.onSelect) {
props.onSelect(option.value);
}
}, []);
const onFunctionSelect = useCallback(
(option: JSActionDropdownOption) => {
if (onSelect) {
onSelect(option.value);
}
},
[onSelect],
);

if (!isActionRedesignEnabled) {
return <OldJSFunctionRun {...props} />;
Expand All @@ -58,7 +64,7 @@ export const JSFunctionRun = (props: Props) => {
isDisabled={props.disabled}
kind="tertiary"
size="sm"
startIcon=""
startIcon="js-function"
>
{props.selected.label}
</Button>
Expand All @@ -70,7 +76,7 @@ export const JSFunctionRun = (props: Props) => {
onSelect={() => onFunctionSelect(option)}
hetunandu marked this conversation as resolved.
Show resolved Hide resolved
size="sm"
>
{option.label}
<MenuTitle>{option.label}</MenuTitle>
</MenuItem>
))}
</MenuContent>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import styled from "styled-components";
import { Text } from "@appsmith/ads";

export const MenuTitle = styled(Text)`
hetunandu marked this conversation as resolved.
Show resolved Hide resolved
--button-font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
max-width: 30ch;
`;
Loading