Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions frontend/src/ide/editor/no-code-toolbar/no-code-toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,18 @@
min-width: 16px;
height: 16px;
}

/* Custom dropdown menu for "More" button */
.no-code-toolbar-more-menu {
max-height: 400px;
overflow-y: auto;
background-color: var(--modal-bg);
border: 1px solid var(--border-color-3);
border-radius: 8px;
padding: 4px 0;
}

.no-code-toolbar-more-item {
padding: 0;
margin: 0;
}
33 changes: 18 additions & 15 deletions frontend/src/ide/editor/no-code-toolbar/no-code-toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,26 +435,29 @@ const NoCodeToolbar = memo(function NoCodeToolbar({
};
}, [items, calculateVisibleItems, debouncedCalculate]);

// Create dropdown menu items from hidden items
const dropdownMenu = useMemo(
() => ({
items: hiddenItems.map((item) => {
const freshItem = items.find((i) => i.key === item.key);
return {
key: item.key,
label: freshItem?.label ?? item.label,
};
}),
}),
[hiddenItems, items]
);

// Create a set of hidden item keys for quick lookup
const hiddenItemKeys = useMemo(
() => new Set(hiddenItems.map((item) => item.key)),
[hiddenItems]
);

// Render function for the "More" dropdown - memoized to avoid unnecessary re-renders
const renderMoreDropdown = useCallback(
() => (
<div className="no-code-toolbar-more-menu">
{hiddenItems.map((item) => {
const freshItem = items.find((i) => i.key === item.key);
return (
<div key={item.key} className="no-code-toolbar-more-item">
{freshItem?.label ?? item.label}
</div>
);
})}
</div>
),
[hiddenItems, items]
);

return (
<div className="no-code-toolbar-wrapper">
<div className="no-code-toolbar-content" ref={containerRef}>
Expand All @@ -472,7 +475,7 @@ const NoCodeToolbar = memo(function NoCodeToolbar({
{hasOverflow && (
<div className="toolbar-item toolbar-more-item">
<Dropdown
menu={dropdownMenu}
dropdownRender={renderMoreDropdown}
trigger={["click"]}
placement="bottomRight"
overlayClassName="no-code-toolbar-dropdown"
Expand Down
Loading