diff --git a/packages/react-ui/src/app/builder/sidebar-header.tsx b/packages/react-ui/src/app/builder/sidebar-header.tsx index aea3ea645d3..715d3128beb 100644 --- a/packages/react-ui/src/app/builder/sidebar-header.tsx +++ b/packages/react-ui/src/app/builder/sidebar-header.tsx @@ -9,7 +9,7 @@ type SidebarHeaderProps = { }; const SidebarHeader = ({ children, onClose }: SidebarHeaderProps) => { return ( -
+
{children}
- - {!isDisabled && ( - - {isNext ? t('Next step') : t('Previous step')} - - )} - - ); -}; - const EditableStepName: React.FC = ({ selectedBranchIndex, displayName, @@ -92,107 +27,58 @@ const EditableStepName: React.FC = ({ isEditingStepOrBranchName, setIsEditingStepOrBranchName, setSelectedBranchIndex, - stepMetadata, }) => { - const isPieceStep = - stepMetadata?.type === FlowActionType.PIECE || - stepMetadata?.type === FlowTriggerType.PIECE; - const pieceVersion = isPieceStep - ? (stepMetadata as PieceStepMetadata)?.pieceVersion - : undefined; - return ( -
-
- - -
- -
-
- {stepMetadata && ( - -
-
- {stepMetadata.displayName} - {stepMetadata.actionOrTriggerOrAgentDisplayName && ( - - {' > '} - {stepMetadata.actionOrTriggerOrAgentDisplayName} - - )} -
- {stepMetadata.actionOrTriggerOrAgentDescription && ( -
- {stepMetadata.actionOrTriggerOrAgentDescription} -
- )} - {pieceVersion &&
v{pieceVersion}
} -
-
- )} -
-
- {isNil(selectedBranchIndex) ? ( - { - if (value) { - setDisplayName(value); - } - }} - readonly={readonly} - value={displayName} - tooltipContent={readonly ? '' : t('Edit Step Name')} - isEditing={isEditingStepOrBranchName} - setIsEditing={setIsEditingStepOrBranchName} - /> - ) : ( - <> -
{ - e.stopPropagation(); - setSelectedBranchIndex(null); - }} - > - {displayName} -
- / - { - if (value) { - setBranchName(value); - } - }} - readonly={readonly} - value={branchName} - tooltipContent={readonly ? '' : t('Edit Branch Name')} - isEditing={isEditingStepOrBranchName} - setIsEditing={setIsEditingStepOrBranchName} - /> - - )} - {!isEditingStepOrBranchName && !readonly && ( - { - setIsEditingStepOrBranchName(true); - }} - /> - )} -
-
- - -
-
-
+ <> + {isNil(selectedBranchIndex) ? ( + { + if (value) { + setDisplayName(value); + } + }} + readonly={readonly} + value={displayName} + tooltipContent={readonly ? '' : t('Edit Step Name')} + isEditing={isEditingStepOrBranchName} + setIsEditing={setIsEditingStepOrBranchName} + /> + ) : ( + <> +
{ + e.stopPropagation(); + setSelectedBranchIndex(null); + }} + > + {displayName} +
+ / + { + if (value) { + setBranchName(value); + } + }} + readonly={readonly} + value={branchName} + tooltipContent={readonly ? '' : t('Edit Branch Name')} + isEditing={isEditingStepOrBranchName} + setIsEditing={setIsEditingStepOrBranchName} + /> + + )} + {!isEditingStepOrBranchName && !readonly && ( + { + setIsEditingStepOrBranchName(true); + }} + /> + )} + ); }; diff --git a/packages/react-ui/src/app/builder/step-settings/index.tsx b/packages/react-ui/src/app/builder/step-settings/index.tsx index 283bc460715..542eefaadc4 100644 --- a/packages/react-ui/src/app/builder/step-settings/index.tsx +++ b/packages/react-ui/src/app/builder/step-settings/index.tsx @@ -11,6 +11,7 @@ import { ResizablePanelGroup, } from '@/components/ui/resizable-panel'; import { ScrollArea } from '@/components/ui/scroll-area'; +import { Separator } from '@/components/ui/separator'; import { pieceSelectorUtils } from '@/features/pieces/lib/piece-selector-utils'; import { stepsHooks } from '@/features/pieces/lib/steps-hooks'; import { projectCollectionUtils } from '@/hooks/project-collection'; @@ -38,6 +39,7 @@ import { LoopsSettings } from './loops-settings'; import { PieceSettings } from './piece-settings'; import { useResizableVerticalPanelsContext } from './resizable-vertical-panels-context'; import { RouterSettings } from './router-settings'; +import { StepInfo } from './step-info'; import { useStepSettingsContext } from './step-settings-context'; const StepSettingsContainer = () => { @@ -190,17 +192,20 @@ const StepSettingsContainer = () => { setSelectedBranchIndex={setSelectedBranchIndex} isEditingStepOrBranchName={isEditingStepOrBranchName} setIsEditingStepOrBranchName={setIsEditingStepOrBranchName} - stepMetadata={stepMetadata} > -
+
+ +
+ {stepMetadata && } +
= ({ step }) => { return (
-
- {!isNil(stepMetadata?.displayName) ? ( - <> - - {stepMetadata.displayName} + {!isNil(actionOrTriggerDisplayName) ? ( + + + {actionOrTriggerDisplayName} - {actionOrTriggerDisplayName && ( - <> - - - - {actionOrTriggerDisplayName} - - - - )} - + ) : ( )} @@ -105,6 +81,7 @@ const StepInfo: React.FC = ({ step }) => {
)}
+
); diff --git a/packages/react-ui/src/app/components/sidebar/dashboard/index.tsx b/packages/react-ui/src/app/components/sidebar/dashboard/index.tsx index 869bec17083..922ec765d6e 100644 --- a/packages/react-ui/src/app/components/sidebar/dashboard/index.tsx +++ b/packages/react-ui/src/app/components/sidebar/dashboard/index.tsx @@ -1,7 +1,6 @@ -import { useVirtualizer } from '@tanstack/react-virtual'; import { t } from 'i18next'; import { Search, Plus, LineChart, Trophy, Compass } from 'lucide-react'; -import { useState, useMemo, useRef, useEffect, useCallback } from 'react'; +import { useState, useMemo, useEffect, useCallback } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { useDebounce } from 'use-debounce'; @@ -30,6 +29,7 @@ import { TooltipContent, TooltipTrigger, } from '@/components/ui/tooltip'; +import { VirtualizedScrollArea } from '@/components/ui/virtualized-scroll-area'; import { templatesTelemetryApi } from '@/features/templates/lib/templates-telemetry-api'; import { platformHooks } from '@/hooks/platform-hooks'; import { projectCollectionUtils } from '@/hooks/project-collection'; @@ -39,7 +39,6 @@ import { isNil, PlatformRole, ProjectType, - ProjectWithLimits, TeamProjectsLimit, TemplateTelemetryEventType, } from '@activepieces/shared'; @@ -60,7 +59,6 @@ export function ProjectDashboardSidebar() { const [debouncedSearchQuery] = useDebounce(searchQuery, 300); const [searchOpen, setSearchOpen] = useState(false); const navigate = useNavigate(); - const projectsScrollRef = useRef(null); const { data: currentUser } = userHooks.useCurrentUser(); const { platform } = platformHooks.useCurrentPlatform(); @@ -115,45 +113,13 @@ export function ProjectDashboardSidebar() { [navigate], ); - // Virtual scrolling setup const ITEM_HEIGHT = state === 'collapsed' ? 40 : 44; - - const rowVirtualizer = useVirtualizer({ - count: displayProjects.length, - getScrollElement: () => projectsScrollRef.current, - estimateSize: useCallback(() => ITEM_HEIGHT, [ITEM_HEIGHT]), - overscan: 10, - getItemKey: useCallback( - (index: number) => displayProjects[index]?.id ?? index, - [displayProjects], - ), - }); - - const virtualItems = rowVirtualizer.getVirtualItems(); - - const renderProjectItem = useCallback( - (project: ProjectWithLimits) => { - return ( - - ); - }, - [location.pathname, handleProjectSelect], - ); - const permissionFilter = (link: SidebarGeneralItemType) => { if (link.type === 'link') { return isNil(link.hasPermission) || link.hasPermission; } return true; }; - const handleExploreClick = useCallback(() => { templatesTelemetryApi.sendEvent({ eventType: TemplateTelemetryEventType.EXPLORE_VIEW, @@ -198,7 +164,7 @@ export function ProjectDashboardSidebar() { return ( !embedState.hideSideNav && ( - + @@ -212,7 +178,7 @@ export function ProjectDashboardSidebar() { - +
{t('Projects')}
@@ -298,45 +264,45 @@ export function ProjectDashboardSidebar() {
{ e.stopPropagation(); }} > - {displayProjects.length > 0 ? ( - - {virtualItems.map((virtualItem) => { - const project = displayProjects[virtualItem.index]; - return ( - - {renderProjectItem(project)} +
+ {displayProjects.length > 0 ? ( + ITEM_HEIGHT} + getItemKey={(index) => displayProjects[index]?.id ?? index} + overscan={10} + renderItem={(project) => ( + + - ); - })} - - ) : ( - isSearchMode && ( -
- {state === 'expanded' && t('No projects found.')} -
- ) - )} + )} + /> + ) : ( + isSearchMode && ( +
+ {state === 'expanded' && t('No projects found.')} +
+ ) + )} +