@elyx-code/editor-ui 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +109 -0
- package/src/App.tsx +31 -0
- package/src/Router.tsx +115 -0
- package/src/__mocks__/defaultModuleMock.ts +1 -0
- package/src/__mocks__/fileMock.ts +1 -0
- package/src/__mocks__/styleMock.ts +1 -0
- package/src/assets/Clock-11.1s-18px.svg +16 -0
- package/src/assets/Clock-11.1s-28px.svg +16 -0
- package/src/assets/authentication.svg +1 -0
- package/src/assets/canvas-backdrop-0.png +0 -0
- package/src/assets/canvas-backdrop-1.png +0 -0
- package/src/assets/canvas-backdrop-2.png +0 -0
- package/src/assets/canvas-backdrop-3.png +0 -0
- package/src/assets/canvas-backdrop-4.png +0 -0
- package/src/assets/canvas-backdrop-5.png +0 -0
- package/src/assets/canvas-backdrop.png +0 -0
- package/src/assets/checkmark-animation.gif +0 -0
- package/src/assets/checkmark-animation.mp4 +0 -0
- package/src/assets/code-formatting/format-black.svg +6 -0
- package/src/assets/code-formatting/format-dark-grey.svg +6 -0
- package/src/assets/code-formatting/format-light-grey.svg +6 -0
- package/src/assets/code-formatting/format-white.svg +6 -0
- package/src/assets/code-formatting/inline-black.svg +5 -0
- package/src/assets/code-formatting/inline-dark-grey.svg +5 -0
- package/src/assets/code-formatting/inline-light-grey.svg +5 -0
- package/src/assets/code-formatting/inline-white.svg +5 -0
- package/src/assets/contained-logo-full-word.png +0 -0
- package/src/assets/cron-job-color.png +0 -0
- package/src/assets/cron-job.png +0 -0
- package/src/assets/database-table-color.png +0 -0
- package/src/assets/database-table.png +0 -0
- package/src/assets/datatype-icons/black/any.svg +1 -0
- package/src/assets/datatype-icons/black/binary.svg +1 -0
- package/src/assets/datatype-icons/black/boolean.svg +3 -0
- package/src/assets/datatype-icons/black/date-time.svg +3 -0
- package/src/assets/datatype-icons/black/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/black/key-file.svg +1 -0
- package/src/assets/datatype-icons/black/list.svg +3 -0
- package/src/assets/datatype-icons/black/null.svg +3 -0
- package/src/assets/datatype-icons/black/number.svg +13 -0
- package/src/assets/datatype-icons/black/project.svg +12 -0
- package/src/assets/datatype-icons/black/sql-program.svg +2 -0
- package/src/assets/datatype-icons/black/text.svg +3 -0
- package/src/assets/datatype-icons/black/unknown.svg +3 -0
- package/src/assets/datatype-icons/black/uuid.svg +4 -0
- package/src/assets/datatype-icons/black/void.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/any.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/dark-grey/list.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/null.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/number.svg +13 -0
- package/src/assets/datatype-icons/dark-grey/project.svg +12 -0
- package/src/assets/datatype-icons/dark-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/dark-grey/text.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/dark-grey/void.svg +1 -0
- package/src/assets/datatype-icons/light-grey/any.svg +1 -0
- package/src/assets/datatype-icons/light-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/light-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/light-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/light-grey/list.svg +3 -0
- package/src/assets/datatype-icons/light-grey/null.svg +3 -0
- package/src/assets/datatype-icons/light-grey/number.svg +13 -0
- package/src/assets/datatype-icons/light-grey/project.svg +12 -0
- package/src/assets/datatype-icons/light-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/light-grey/text.svg +3 -0
- package/src/assets/datatype-icons/light-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/light-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/light-grey/void.svg +1 -0
- package/src/assets/edit.png +0 -0
- package/src/assets/execution.svg +13 -0
- package/src/assets/favicon.svg +14 -0
- package/src/assets/file-search.svg +1 -0
- package/src/assets/http-endpoint.png +0 -0
- package/src/assets/image-input-placeholder.png +0 -0
- package/src/assets/logo-full-word-white.png +0 -0
- package/src/assets/logo-full-word.png +0 -0
- package/src/assets/password.svg +85 -0
- package/src/assets/pencil.png +0 -0
- package/src/assets/publish-project-rich-icon-2.svg +1 -0
- package/src/assets/publish-project-rich-icon.svg +1 -0
- package/src/assets/relational-database.png +0 -0
- package/src/assets/resources.svg +3 -0
- package/src/assets/resume-icon-14px.png +0 -0
- package/src/assets/server.png +0 -0
- package/src/assets/small-status/checkmark.svg +4 -0
- package/src/assets/small-status/error.svg +4 -0
- package/src/assets/small-status/loading.svg +4 -0
- package/src/assets/small-status/skipped.svg +11 -0
- package/src/assets/sql-connection-config.svg +1 -0
- package/src/assets/sql-row-transformer.svg +1 -0
- package/src/assets/ssl-certificate-config.svg +1 -0
- package/src/assets/sync.svg +1 -0
- package/src/assets/testing-logic-icon.svg +1 -0
- package/src/assets/versions.svg +25 -0
- package/src/assets/visual-programming-icon.svg +1 -0
- package/src/assets/warning-sign-24px.png +0 -0
- package/src/auth/index.ts +318 -0
- package/src/components/DialogLoader.tsx +94 -0
- package/src/components/EntityDialogHeader.tsx +110 -0
- package/src/components/EntityDialogSectionHeader.tsx +214 -0
- package/src/components/GalleryAddExternalIntegrationInfoDialog.tsx +87 -0
- package/src/components/GenerateProjectStartingLogicPromptDialog.tsx +281 -0
- package/src/components/LegacyRouteRedirector.tsx +55 -0
- package/src/components/ProPlanChip.tsx +23 -0
- package/src/components/ReportBugDialog.tsx +412 -0
- package/src/components/RequestIntegrationAccessDialog.tsx +261 -0
- package/src/components/UseTemplateProjectDialog.tsx +193 -0
- package/src/components/WorkspaceLayout.tsx +152 -0
- package/src/components/animated-svg/AnimatedCheckmark.tsx +41 -0
- package/src/components/animated-svg/AnimatedCrossmark.tsx +51 -0
- package/src/components/animated-svg/AnimatedEmailSending.tsx +38 -0
- package/src/components/animated-svg/AnimatedLoading.tsx +72 -0
- package/src/components/animated-svg/animated-svg.css +239 -0
- package/src/components/canvas/Canvas.tsx +16 -0
- package/src/components/canvas/CreateEntityMenu.tsx +2020 -0
- package/src/components/canvas/canvas.css +10 -0
- package/src/components/canvas/create-entity-menu.css +579 -0
- package/src/components/canvas-search/CanvasSearch.tsx +501 -0
- package/src/components/canvas-search/canvas-search.css +126 -0
- package/src/components/canvas-settings-menu/CanvasSettingsMenuButton.tsx +515 -0
- package/src/components/canvas-settings-menu/canvas-settings-menu.css +96 -0
- package/src/components/circular-image-upload/CircularImageUpload.tsx +113 -0
- package/src/components/circular-image-upload/circular-image-upload.css +69 -0
- package/src/components/costs/CostsDialog.tsx +459 -0
- package/src/components/data-type/DataTypeBuilder.tsx +3127 -0
- package/src/components/data-type/data-type-builder.css +45 -0
- package/src/components/dialogs/BetaAcknowledgeDialog.tsx +43 -0
- package/src/components/dialogs/ComplexDataDialog.tsx +458 -0
- package/src/components/dialogs/CronBuilderDialog.tsx +2145 -0
- package/src/components/dialogs/ExternalIntegrationConnections.tsx +565 -0
- package/src/components/dialogs/JsonEditorDialog.tsx +1392 -0
- package/src/components/dialogs/StringEditorDialog.tsx +268 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclaration.tsx +1167 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclarationDialogContent.tsx +128 -0
- package/src/components/dialogs/beta-dialog.css +165 -0
- package/src/components/dialogs/condition/Condition.tsx +431 -0
- package/src/components/dialogs/condition/ConditionDialogContent.tsx +126 -0
- package/src/components/dialogs/definition-entity/DefinitionEntityDialogContent.tsx +973 -0
- package/src/components/dialogs/function-call/FunctionCall.tsx +442 -0
- package/src/components/dialogs/function-call/FunctionCallDialogContent.tsx +126 -0
- package/src/components/dialogs/function-declaration/FunctionDeclaration.tsx +926 -0
- package/src/components/dialogs/function-declaration/FunctionDeclarationDialogContent.tsx +124 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/GeneratingProjectStartingLogicOverlay.tsx +176 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/generating-project-starting-logic-overlay.css +13 -0
- package/src/components/dialogs/global-event/GlobalEvent.tsx +475 -0
- package/src/components/dialogs/global-event/GlobalEventDialogContent.tsx +126 -0
- package/src/components/dialogs/help/HelpDialog.tsx +217 -0
- package/src/components/dialogs/help/HelpDilalogHomeContent.tsx +178 -0
- package/src/components/dialogs/help/help-dialog.css +116 -0
- package/src/components/dialogs/help/help-icon/HelpIconButton.tsx +41 -0
- package/src/components/dialogs/help/help-icon/help-icon.css +9 -0
- package/src/components/dialogs/input-map/InputMap.tsx +635 -0
- package/src/components/dialogs/input-map/InputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/json-editor-dialog.css +4 -0
- package/src/components/dialogs/loop/Loop.tsx +650 -0
- package/src/components/dialogs/loop/LoopDialogContent.tsx +122 -0
- package/src/components/dialogs/operation/Operation.tsx +440 -0
- package/src/components/dialogs/operation/OperationDialogContent.tsx +126 -0
- package/src/components/dialogs/output-map/OutputMap.tsx +536 -0
- package/src/components/dialogs/output-map/OutputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/property/Property.tsx +1490 -0
- package/src/components/dialogs/property/PropertyDialogContent.tsx +106 -0
- package/src/components/dialogs/search-statement/ColumnSelector.tsx +334 -0
- package/src/components/dialogs/search-statement/ConditionBuilder.tsx +750 -0
- package/src/components/dialogs/search-statement/DataAggregationSection.tsx +621 -0
- package/src/components/dialogs/search-statement/DataSourceSelection.tsx +734 -0
- package/src/components/dialogs/search-statement/EntityMetadataSection.tsx +135 -0
- package/src/components/dialogs/search-statement/FilterConditionsSection.tsx +151 -0
- package/src/components/dialogs/search-statement/InlineInputMap.tsx +153 -0
- package/src/components/dialogs/search-statement/LiteralValue.tsx +616 -0
- package/src/components/dialogs/search-statement/MainSourceAndInputsSection.tsx +271 -0
- package/src/components/dialogs/search-statement/NestedSearchStatementBuilder.tsx +170 -0
- package/src/components/dialogs/search-statement/OutputFormatSection.tsx +1779 -0
- package/src/components/dialogs/search-statement/ResultsSection.tsx +344 -0
- package/src/components/dialogs/search-statement/SearchStatementBuilder.tsx +251 -0
- package/src/components/dialogs/search-statement/SearchStatementDialogContent.tsx +398 -0
- package/src/components/dialogs/search-statement/ValueSelector.tsx +766 -0
- package/src/components/dialogs/search-statement/search-statement-context.tsx +1630 -0
- package/src/components/dialogs/search-statement/search-statement-dialog.css +56 -0
- package/src/components/dialogs/search-statement/test.sql +111 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptor.tsx +824 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptorDialogContent.tsx +124 -0
- package/src/components/dialogs/variable-declaration/VariableDeclaration.tsx +836 -0
- package/src/components/dialogs/variable-declaration/VariableDeclarationDialogContent.tsx +106 -0
- package/src/components/dialogs/variable-instance/VariableInstance.tsx +443 -0
- package/src/components/dialogs/variable-instance/VariableInstanceDialogContent.tsx +124 -0
- package/src/components/draggable-entity-card/ArgumentDeclaration.tsx +736 -0
- package/src/components/draggable-entity-card/CollapseEntityButton.tsx +170 -0
- package/src/components/draggable-entity-card/ConditionCard.tsx +1062 -0
- package/src/components/draggable-entity-card/ConnectionDeleteButton.tsx +309 -0
- package/src/components/draggable-entity-card/DataTypeIcon.tsx +624 -0
- package/src/components/draggable-entity-card/DraggableEntityCard.tsx +617 -0
- package/src/components/draggable-entity-card/ErrorMapProperty.tsx +464 -0
- package/src/components/draggable-entity-card/EventCard.tsx +700 -0
- package/src/components/draggable-entity-card/ExecutionInProgressValue.tsx +327 -0
- package/src/components/draggable-entity-card/FunctionDeclarationCard.tsx +819 -0
- package/src/components/draggable-entity-card/InputMapProperty.tsx +1067 -0
- package/src/components/draggable-entity-card/InternalCall.tsx +978 -0
- package/src/components/draggable-entity-card/InternalCallExecutionNode.tsx +643 -0
- package/src/components/draggable-entity-card/LogicScopeCallerNode.tsx +262 -0
- package/src/components/draggable-entity-card/LoopCard.tsx +791 -0
- package/src/components/draggable-entity-card/MainValueInput.tsx +523 -0
- package/src/components/draggable-entity-card/MainValueOutput.tsx +458 -0
- package/src/components/draggable-entity-card/MethodDeclaration.tsx +1088 -0
- package/src/components/draggable-entity-card/NestedCondition.tsx +1025 -0
- package/src/components/draggable-entity-card/OutputMapProperty.tsx +843 -0
- package/src/components/draggable-entity-card/PassthroughEntityCard.tsx +1247 -0
- package/src/components/draggable-entity-card/ReturnedError.tsx +549 -0
- package/src/components/draggable-entity-card/SmallSuccessFailureNodes.tsx +523 -0
- package/src/components/draggable-entity-card/SuccessFailureNodes.tsx +509 -0
- package/src/components/draggable-entity-card/TestEntityButton.tsx +946 -0
- package/src/components/draggable-entity-card/TestMenu.tsx +523 -0
- package/src/components/draggable-entity-card/TestMenuValidationDropdown.tsx +84 -0
- package/src/components/draggable-entity-card/UnreachableMarker.tsx +114 -0
- package/src/components/draggable-entity-card/VariableCard.tsx +1577 -0
- package/src/components/draggable-entity-card/VariableScopeMarker.tsx +117 -0
- package/src/components/draggable-entity-card/collapse-entity-button.css +44 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityCard.tsx +1181 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityIcon.tsx +36 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityProperty.tsx +478 -0
- package/src/components/draggable-entity-card/definition-entity/DynamicFooterActions.tsx +112 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/ExportCredentialsFooterAction.tsx +461 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/RestablishConnectionFooterAction.tsx +199 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/restablish-connection-footer-action.css +85 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/GoogleDriveFilePickerAPIFooterAction.tsx +277 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/google-drive-file-picker-api-footer-action.css +107 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/DatabaseFooterAction.tsx +452 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/database-footer-action.css +86 -0
- package/src/components/draggable-entity-card/definition-entity/definition-entity-card.css +17 -0
- package/src/components/draggable-entity-card/draggable-entity-card.css +1140 -0
- package/src/components/draggable-entity-card/entity-locked-icon/EntityLockedIcon.tsx +133 -0
- package/src/components/draggable-entity-card/entity-locked-icon/entity-locked.css +8 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/ExpandPropertiesIconButton.tsx +84 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/expand-properties-icon-button.css +21 -0
- package/src/components/draggable-entity-card/implement-entity-icon/ImplementEntityIcon.tsx +74 -0
- package/src/components/draggable-entity-card/implement-entity-icon/implement-entity-icon.css +13 -0
- package/src/components/draggable-entity-card/logic-error/LogicErrorIconMenu.tsx +424 -0
- package/src/components/draggable-entity-card/logic-error/logic-error.css +23 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewCardInputButton.tsx +193 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewDynamicInputButton.tsx +214 -0
- package/src/components/draggable-entity-card/new-card-input-button/new-card-input-button.css +71 -0
- package/src/components/draggable-entity-card/new-card-output-button/NewCardOutputButton.tsx +192 -0
- package/src/components/draggable-entity-card/new-card-output-button/new-card-output-button.css +71 -0
- package/src/components/draggable-entity-card/termination-statement/TerminationStatementCard.tsx +1543 -0
- package/src/components/draggable-entity-card/termination-statement/termination-statement-card.css +17 -0
- package/src/components/draggable-entity-card/test-entity-button.css +55 -0
- package/src/components/draggable-entity-card/test-menu.css +181 -0
- package/src/components/draggable-entity-card/unreachable-marker.css +43 -0
- package/src/components/draggable-entity-card/variable-scope-marker.css +22 -0
- package/src/components/dynamic-value/DynamicValue.tsx +2395 -0
- package/src/components/dynamic-value/DynamicValueEntry.tsx +1957 -0
- package/src/components/dynamic-value/dynamic-value.css +230 -0
- package/src/components/editor/ElyxMonacoEditor.tsx +38 -0
- package/src/components/entity-error/EntityErrorListItem.tsx +47 -0
- package/src/components/entity-error/entity-error.css +198 -0
- package/src/components/entity-icon/EntityIcon.tsx +292 -0
- package/src/components/entity-icon/entity-icon.css +39 -0
- package/src/components/gallery-card/CreateNewProject.tsx +222 -0
- package/src/components/gallery-card/GalleryCard.tsx +171 -0
- package/src/components/gallery-card/MarketplaceCard.tsx +87 -0
- package/src/components/gallery-card/ProjectDuplicationCard.tsx +575 -0
- package/src/components/gallery-card/gallery-card.css +25 -0
- package/src/components/notifications/NotificationsIconButton.tsx +124 -0
- package/src/components/notifications/NotificationsPanel.tsx +385 -0
- package/src/components/notifications/notifications.css +189 -0
- package/src/components/online-users/LocalOnlineUsers.tsx +175 -0
- package/src/components/online-users/PageOnlineUsers.tsx +297 -0
- package/src/components/online-users/online-users.css +72 -0
- package/src/components/page-backdrop/PageBackdrop.tsx +8 -0
- package/src/components/page-backdrop/page-backdrop.css +7 -0
- package/src/components/project-configuration/DeleteProjectConfirmationDialog.tsx +134 -0
- package/src/components/project-configuration/ProjectConfigurationDialog.tsx +972 -0
- package/src/components/project-configuration/ProjectDataForm.tsx +121 -0
- package/src/components/project-configuration/UnpublishProjectConfirmationDialog.tsx +162 -0
- package/src/components/project-configuration/project-configuration-content.css +209 -0
- package/src/components/project-name/ProjectName.tsx +2025 -0
- package/src/components/project-name/project-name.css +599 -0
- package/src/components/publishing/Publication.tsx +133 -0
- package/src/components/publishing/history/PublicationHistoryContent.tsx +414 -0
- package/src/components/publishing/history/PublicationHistoryDialog.tsx +234 -0
- package/src/components/publishing/preview/PublicationPreviewDialog.tsx +1158 -0
- package/src/components/publishing/preview/PublishingPriceForecast.tsx +160 -0
- package/src/components/publishing/preview/PublishingResourcesDetails.tsx +91 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceContent.tsx +375 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceDialog.tsx +344 -0
- package/src/components/publishing/publishing-dialog.css +142 -0
- package/src/components/publishing/utils.ts +227 -0
- package/src/components/resources/ResourcesDialog.tsx +591 -0
- package/src/components/resources/UpgradeBanner.tsx +102 -0
- package/src/components/resources/codebase/CodebaseDetails.tsx +156 -0
- package/src/components/resources/cron-job/CronJobsList.tsx +532 -0
- package/src/components/resources/functions/FunctionsList.tsx +454 -0
- package/src/components/resources/http-api/HttpAPI.tsx +566 -0
- package/src/components/resources/http-api/HttpAPIClientModule.tsx +37 -0
- package/src/components/resources/logs/LogsViewer.tsx +768 -0
- package/src/components/resources/query.ts +74 -0
- package/src/components/resources/relational-database/DatabaseTable.tsx +905 -0
- package/src/components/resources/relational-database/RelationalDatabase.tsx +83 -0
- package/src/components/resources/relational-database/RelationalDatabaseSecrets.tsx +361 -0
- package/src/components/resources/resources-dialog.css +74 -0
- package/src/components/test-relational-database/DatabaseTable.tsx +913 -0
- package/src/components/test-relational-database/TestDatabaseDialogContent.tsx +670 -0
- package/src/components/test-relational-database/query.ts +74 -0
- package/src/components/toolbar/ToolBar.tsx +236 -0
- package/src/components/toolbar/toolbar.css +78 -0
- package/src/components/transaction-history/TransactionHistoryDialog.tsx +268 -0
- package/src/components/user/CurrentUserAvatar.tsx +65 -0
- package/src/components/user/UserChip.tsx +62 -0
- package/src/components/user/user.css +39 -0
- package/src/components/user-profile/ChangePasswordForm.tsx +67 -0
- package/src/components/user-profile/OwnUserProfileContent.tsx +665 -0
- package/src/components/user-profile/PublicUserProfileContent.tsx +99 -0
- package/src/components/user-profile/UserDataForm.tsx +75 -0
- package/src/components/user-profile/UserProfileDialog.tsx +110 -0
- package/src/components/user-profile/user-profile-content.css +25 -0
- package/src/config.ts +130 -0
- package/src/globals.d.ts +13 -0
- package/src/index.html +27 -0
- package/src/index.tsx +23 -0
- package/src/lib/badge/Badge.tsx +35 -0
- package/src/lib/badge/badge.css +32 -0
- package/src/lib/button/Button.tsx +129 -0
- package/src/lib/button/button.css +145 -0
- package/src/lib/canvas/canvas-undo-redo.ts +263 -0
- package/src/lib/canvas/defs.ts +170 -0
- package/src/lib/canvas/index.test.ts +189 -0
- package/src/lib/canvas/index.ts +6999 -0
- package/src/lib/canvas/utils.ts +59 -0
- package/src/lib/card/Card.tsx +62 -0
- package/src/lib/card/LoadingCard.tsx +82 -0
- package/src/lib/card/card.css +259 -0
- package/src/lib/chip/Chip.tsx +79 -0
- package/src/lib/chip/chip.css +0 -0
- package/src/lib/dialog/Dialog.tsx +122 -0
- package/src/lib/dialog/SmallDialog.tsx +61 -0
- package/src/lib/dialog/dialog.css +40 -0
- package/src/lib/display-data-structure/index.tsx +21 -0
- package/src/lib/dropdown/CanvasDropdownMenuCard.tsx +68 -0
- package/src/lib/dropdown/CanvasDropdownMenuCardOption.tsx +136 -0
- package/src/lib/dropdown/DropdownButton.tsx +104 -0
- package/src/lib/dropdown/DropdownMenuCard.tsx +324 -0
- package/src/lib/dropdown/DropdownMenuPopup.tsx +27 -0
- package/src/lib/dropdown/dropdown-button.css +76 -0
- package/src/lib/dropdown/dropdown-menu.css +151 -0
- package/src/lib/json-editor/RawJsonEditor.tsx +137 -0
- package/src/lib/json-editor/json-editor.css +35 -0
- package/src/lib/loader/Loader.tsx +120 -0
- package/src/lib/loader/loader.css +38 -0
- package/src/lib/pagination/Pagination.tsx +64 -0
- package/src/lib/popup/CanvasPopupBaseComponent.tsx +103 -0
- package/src/lib/popup/Popup.tsx +243 -0
- package/src/lib/popup/popup.css +16 -0
- package/src/lib/table/RowForm.tsx +301 -0
- package/src/lib/table/Table.tsx +1069 -0
- package/src/lib/table/table.css +249 -0
- package/src/lib/table/types.ts +108 -0
- package/src/lib/text-area/TextArea.tsx +183 -0
- package/src/lib/text-area/text-area.css +156 -0
- package/src/lib/text-field/TextField.tsx +218 -0
- package/src/lib/text-field/index.ts +8 -0
- package/src/lib/text-field/text-field.css +201 -0
- package/src/lib/tooltip/Tooltip.tsx +24 -0
- package/src/lib/tooltip/tooltip.css +17 -0
- package/src/localization/index.ts +47 -0
- package/src/main.css +343 -0
- package/src/pages/Auth.tsx +848 -0
- package/src/pages/Editor.tsx +883 -0
- package/src/pages/ErrorPage.tsx +179 -0
- package/src/pages/Gallery.tsx +1693 -0
- package/src/pages/NewPaymentMethodCallback.tsx +53 -0
- package/src/pages/NotFoundPage.tsx +126 -0
- package/src/pages/PricingPlans.tsx +155 -0
- package/src/pages/auth.css +304 -0
- package/src/pages/gallery.css +421 -0
- package/src/payments/index.ts +187 -0
- package/src/popup-notification/index.ts +90 -0
- package/src/services/database/index.ts +1 -0
- package/src/services/database/utils.ts +1301 -0
- package/src/services/editor/CanvasElement.tsx +2934 -0
- package/src/services/editor/CanvasElementConnectionDeleteButton.ts +204 -0
- package/src/services/editor/CanvasPopup.tsx +749 -0
- package/src/services/editor/EditorService.ts +8157 -0
- package/src/services/editor/area.ts +1312 -0
- package/src/services/editor/connections.ts +1019 -0
- package/src/services/editor/create/condition.ts +25 -0
- package/src/services/editor/create/definition-entity.ts +29 -0
- package/src/services/editor/create/function-call.ts +25 -0
- package/src/services/editor/create/global-event.ts +33 -0
- package/src/services/editor/create/loop.ts +25 -0
- package/src/services/editor/create/operation.ts +30 -0
- package/src/services/editor/create/utils.ts +140 -0
- package/src/services/editor/create/variable-declaration.ts +135 -0
- package/src/services/editor/create/variable-instance.ts +100 -0
- package/src/services/editor/editor-ui-extensions-context.ts +43 -0
- package/src/services/editor/entities-metadata.json +9310 -0
- package/src/services/editor/icons.ts +1093 -0
- package/src/services/editor/index.ts +1 -0
- package/src/services/editor/layout.ts +102 -0
- package/src/services/editor/modules/built-in-function-implementations/base.ts +14 -0
- package/src/services/editor/modules/built-in-function-implementations/create-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/built-in-function-implementations/delete-persisted-entity/index.ts +55 -0
- package/src/services/editor/modules/built-in-function-implementations/index.ts +4 -0
- package/src/services/editor/modules/built-in-function-implementations/update-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/get-files.ts +183 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-drives.ts +124 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-root-folders.ts +125 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/smart-fetch-document.ts +702 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/upload-document.ts +535 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-gemini/generate-content.ts +193 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/get-emails.ts +586 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/send-email.ts +386 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/index.ts +12 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/channels.ts +240 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/messages.ts +210 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/replies.ts +200 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/send-message.ts +177 -0
- package/src/services/editor/modules/operations-implementations/index.ts +1 -0
- package/src/services/editor/modules/search-node-implementation/index.ts +42 -0
- package/src/services/editor/modules/sql-migrations-generation.tsx +1054 -0
- package/src/services/editor/publication/publication.ts +578 -0
- package/src/services/editor/ui.ts +1348 -0
- package/src/services/editor/utils.ts +5868 -0
- package/src/services/editor/value-store.ts +619 -0
- package/src/services/execution/built-in-function-implementations.ts +422 -0
- package/src/services/execution/index.ts +4747 -0
- package/src/services/execution/logic.ts +121 -0
- package/src/services/execution/test-instance.tsx +2296 -0
- package/src/services/execution/utils.ts +33 -0
- package/src/services/execution/value-resolution.test.ts +424 -0
- package/src/services/execution/value-resolution.ts +4087 -0
- package/src/services/integrations/ExternalIntegrationsService.ts +439 -0
- package/src/services/integrations/api.ts +175 -0
- package/src/services/local-relational-database/idb_helper.ts +66 -0
- package/src/services/local-relational-database/index.ts +3308 -0
- package/src/services/local-relational-database/utils.ts +403 -0
- package/src/services/notifications/index.ts +525 -0
- package/src/services/user/index.ts +144 -0
- package/src/setupTests.ts +1 -0
- package/src/socket/socket.ts +248 -0
- package/src/socket/utils.ts +10 -0
- package/src/store/workspace.ts +12 -0
- package/src/theme.ts +19 -0
- package/src/utils/DOM.ts +39 -0
- package/src/utils/date.ts +169 -0
- package/src/utils/index.ts +158 -0
- package/src/utils/react.tsx +679 -0
- package/src/utils/testing.ts +103 -0
|
@@ -0,0 +1,2025 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useCallback,
|
|
3
|
+
useEffect,
|
|
4
|
+
useMemo,
|
|
5
|
+
useState,
|
|
6
|
+
useRef,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import './project-name.css';
|
|
9
|
+
import { IUser } from '@elyx-code/definitions';
|
|
10
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
11
|
+
import { EditorService } from '../../services/editor';
|
|
12
|
+
import { IComponentLifecycleProps } from '../../utils/react';
|
|
13
|
+
import { onClickAway } from '../../utils/DOM';
|
|
14
|
+
import {
|
|
15
|
+
EntityType,
|
|
16
|
+
IBranch,
|
|
17
|
+
IBranchHead,
|
|
18
|
+
IBranchMerge,
|
|
19
|
+
StateMutationAction,
|
|
20
|
+
toSentenceCase,
|
|
21
|
+
} from '@elyx-code/project-logic-tree';
|
|
22
|
+
import axios from 'axios';
|
|
23
|
+
import { getUser } from '../../services/user';
|
|
24
|
+
import { ProPlanChip } from '../ProPlanChip';
|
|
25
|
+
import { useWorkspaceStore } from '../../store/workspace';
|
|
26
|
+
import { popupNotification } from '../../popup-notification';
|
|
27
|
+
|
|
28
|
+
// --- FEATURE FLAGS ---
|
|
29
|
+
const ENABLE_HISTORY_DROPDOWN = true;
|
|
30
|
+
const ENABLE_HISTORY_ACTIONS = true;
|
|
31
|
+
const ENABLE_REAL_HISTORY_DATA = true;
|
|
32
|
+
|
|
33
|
+
interface IProjectNameProps extends IComponentLifecycleProps {
|
|
34
|
+
ready: boolean;
|
|
35
|
+
project: EditorService;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type SyncStatus = 'loading' | 'offline' | 'saving' | 'synced' | 'error';
|
|
39
|
+
|
|
40
|
+
export interface IVersionMetadata {
|
|
41
|
+
version: string;
|
|
42
|
+
author: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
previousVersion: string | null;
|
|
45
|
+
deleted: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// --- MOCK DATA (Massive & Complex) ---
|
|
49
|
+
const MOCK_USERS = {
|
|
50
|
+
sophie: {
|
|
51
|
+
id: 'usr_1',
|
|
52
|
+
name: 'Sophie',
|
|
53
|
+
avatar: 'https://i.pravatar.cc/150?u=sophie',
|
|
54
|
+
},
|
|
55
|
+
helen: {
|
|
56
|
+
id: 'usr_2',
|
|
57
|
+
name: 'Helen',
|
|
58
|
+
avatar: 'https://i.pravatar.cc/150?u=helen',
|
|
59
|
+
},
|
|
60
|
+
mike: {
|
|
61
|
+
id: 'usr_3',
|
|
62
|
+
name: 'Mike Smith',
|
|
63
|
+
avatar: 'https://i.pravatar.cc/150?u=mike',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const MOCK_PROJECT_ID = 'proj_alpha';
|
|
68
|
+
|
|
69
|
+
export const MOCK_VERSIONS: IVersionMetadata[] = [
|
|
70
|
+
{
|
|
71
|
+
version: 'v_0',
|
|
72
|
+
author: 'usr_1',
|
|
73
|
+
createdAt: '2026-04-20T10:00:00Z',
|
|
74
|
+
previousVersion: null,
|
|
75
|
+
deleted: false,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
version: 'v_1',
|
|
79
|
+
author: 'usr_1',
|
|
80
|
+
createdAt: '2026-04-20T11:00:00Z',
|
|
81
|
+
previousVersion: 'v_0',
|
|
82
|
+
deleted: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
version: 'v_1a',
|
|
86
|
+
author: 'usr_1',
|
|
87
|
+
createdAt: '2026-04-20T11:15:00Z',
|
|
88
|
+
previousVersion: 'v_1',
|
|
89
|
+
deleted: false,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
version: 'v_1b',
|
|
93
|
+
author: 'usr_1',
|
|
94
|
+
createdAt: '2026-04-20T11:30:00Z',
|
|
95
|
+
previousVersion: 'v_1a',
|
|
96
|
+
deleted: false,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
version: 'v_2',
|
|
100
|
+
author: 'usr_2',
|
|
101
|
+
createdAt: '2026-04-20T12:00:00Z',
|
|
102
|
+
previousVersion: 'v_1b',
|
|
103
|
+
deleted: false,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
version: 'v_3',
|
|
107
|
+
author: 'usr_1',
|
|
108
|
+
createdAt: '2026-04-20T13:00:00Z',
|
|
109
|
+
previousVersion: 'v_2',
|
|
110
|
+
deleted: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
version: 'v_feat_1',
|
|
114
|
+
author: 'usr_1',
|
|
115
|
+
createdAt: '2026-04-20T14:00:00Z',
|
|
116
|
+
previousVersion: 'v_2',
|
|
117
|
+
deleted: false,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
version: 'v_4',
|
|
121
|
+
author: 'usr_2',
|
|
122
|
+
createdAt: '2026-04-20T15:00:00Z',
|
|
123
|
+
previousVersion: 'v_3',
|
|
124
|
+
deleted: false,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
version: 'v_fix_1',
|
|
128
|
+
author: 'usr_2',
|
|
129
|
+
createdAt: '2026-04-20T16:00:00Z',
|
|
130
|
+
previousVersion: 'v_4',
|
|
131
|
+
deleted: false,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
version: 'v_feat_2',
|
|
135
|
+
author: 'usr_1',
|
|
136
|
+
createdAt: '2026-04-20T17:00:00Z',
|
|
137
|
+
previousVersion: 'v_feat_1',
|
|
138
|
+
deleted: false,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
version: 'v_fix_2',
|
|
142
|
+
author: 'usr_2',
|
|
143
|
+
createdAt: '2026-04-20T18:00:00Z',
|
|
144
|
+
previousVersion: 'v_fix_1',
|
|
145
|
+
deleted: false,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
version: 'v_fix_2a',
|
|
149
|
+
author: 'usr_2',
|
|
150
|
+
createdAt: '2026-04-20T18:15:00Z',
|
|
151
|
+
previousVersion: 'v_fix_2',
|
|
152
|
+
deleted: false,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
version: 'v_fix_2b',
|
|
156
|
+
author: 'usr_2',
|
|
157
|
+
createdAt: '2026-04-20T18:30:00Z',
|
|
158
|
+
previousVersion: 'v_fix_2a',
|
|
159
|
+
deleted: false,
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
version: 'v_5',
|
|
163
|
+
author: 'usr_2',
|
|
164
|
+
createdAt: '2026-04-20T19:00:00Z',
|
|
165
|
+
previousVersion: 'v_4',
|
|
166
|
+
deleted: false,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
version: 'v_6',
|
|
170
|
+
author: 'usr_1',
|
|
171
|
+
createdAt: '2026-04-20T20:00:00Z',
|
|
172
|
+
previousVersion: 'v_5',
|
|
173
|
+
deleted: false,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
version: 'v_exp_1',
|
|
177
|
+
author: 'usr_3',
|
|
178
|
+
createdAt: '2026-04-20T21:00:00Z',
|
|
179
|
+
previousVersion: 'v_6',
|
|
180
|
+
deleted: false,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
version: 'v_feat_3',
|
|
184
|
+
author: 'usr_1',
|
|
185
|
+
createdAt: '2026-04-20T22:00:00Z',
|
|
186
|
+
previousVersion: 'v_feat_2',
|
|
187
|
+
deleted: false,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
version: 'v_exp_2',
|
|
191
|
+
author: 'usr_3',
|
|
192
|
+
createdAt: '2026-04-20T23:00:00Z',
|
|
193
|
+
previousVersion: 'v_exp_1',
|
|
194
|
+
deleted: false,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
version: 'v_7',
|
|
198
|
+
author: 'usr_1',
|
|
199
|
+
createdAt: '2026-04-21T00:00:00Z',
|
|
200
|
+
previousVersion: 'v_6',
|
|
201
|
+
deleted: false,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
version: 'v_8',
|
|
205
|
+
author: 'usr_2',
|
|
206
|
+
createdAt: '2026-04-21T01:00:00Z',
|
|
207
|
+
previousVersion: 'v_7',
|
|
208
|
+
deleted: false,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
version: 'v_exp_3',
|
|
212
|
+
author: 'usr_3',
|
|
213
|
+
createdAt: '2026-04-21T01:30:00Z',
|
|
214
|
+
previousVersion: 'v_exp_2',
|
|
215
|
+
deleted: false,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
version: 'v_exp_4',
|
|
219
|
+
author: 'usr_3',
|
|
220
|
+
createdAt: '2026-04-21T01:40:00Z',
|
|
221
|
+
previousVersion: 'v_exp_3',
|
|
222
|
+
deleted: false,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
version: 'v_9',
|
|
226
|
+
author: 'usr_3',
|
|
227
|
+
createdAt: '2026-04-21T02:00:00Z',
|
|
228
|
+
previousVersion: 'v_8',
|
|
229
|
+
deleted: false,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
version: 'v_10',
|
|
233
|
+
author: 'usr_3',
|
|
234
|
+
createdAt: '2026-04-21T03:00:00Z',
|
|
235
|
+
previousVersion: 'v_9',
|
|
236
|
+
deleted: false,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
version: 'v_11',
|
|
240
|
+
author: 'usr_3',
|
|
241
|
+
createdAt: '2026-04-21T04:00:00Z',
|
|
242
|
+
previousVersion: 'v_10',
|
|
243
|
+
deleted: false,
|
|
244
|
+
},
|
|
245
|
+
];
|
|
246
|
+
|
|
247
|
+
const MOCK_HEADS = (project: EditorService): IBranchHead[] => [
|
|
248
|
+
{
|
|
249
|
+
id: 'h_1',
|
|
250
|
+
branch: 'b_main',
|
|
251
|
+
userAuthor: 'usr_1',
|
|
252
|
+
versionId: 'v_1',
|
|
253
|
+
timestamp: '2026-04-20T11:00:00Z',
|
|
254
|
+
actionName: StateMutationAction.AddCall,
|
|
255
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
256
|
+
selfType: EntityType.Project,
|
|
257
|
+
selfVersion: 'v_1',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: 'h_1a',
|
|
261
|
+
branch: 'b_main',
|
|
262
|
+
userAuthor: 'usr_1',
|
|
263
|
+
versionId: 'v_1a',
|
|
264
|
+
timestamp: '2026-04-20T11:15:00Z',
|
|
265
|
+
actionName: StateMutationAction.RemoveInput,
|
|
266
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
267
|
+
selfType: EntityType.Project,
|
|
268
|
+
selfVersion: 'v_1a',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'h_1b',
|
|
272
|
+
branch: 'b_main',
|
|
273
|
+
userAuthor: 'usr_1',
|
|
274
|
+
versionId: 'v_1b',
|
|
275
|
+
timestamp: '2026-04-20T11:30:00Z',
|
|
276
|
+
actionName: StateMutationAction.SetDataType,
|
|
277
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
278
|
+
selfType: EntityType.Project,
|
|
279
|
+
selfVersion: 'v_1b',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
id: 'h_2',
|
|
283
|
+
branch: 'b_main',
|
|
284
|
+
userAuthor: 'usr_2',
|
|
285
|
+
versionId: 'v_2',
|
|
286
|
+
timestamp: '2026-04-20T12:00:00Z',
|
|
287
|
+
actionName: StateMutationAction.SetParent,
|
|
288
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
289
|
+
selfType: EntityType.Project,
|
|
290
|
+
selfVersion: 'v_2',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: 'h_3',
|
|
294
|
+
branch: 'b_main',
|
|
295
|
+
userAuthor: 'usr_1',
|
|
296
|
+
versionId: 'v_3',
|
|
297
|
+
timestamp: '2026-04-20T13:00:00Z',
|
|
298
|
+
actionName: StateMutationAction.AddSuccessCall,
|
|
299
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
300
|
+
selfType: EntityType.Project,
|
|
301
|
+
selfVersion: 'v_3',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: 'h_4',
|
|
305
|
+
branch: 'b_feat1',
|
|
306
|
+
userAuthor: 'usr_1',
|
|
307
|
+
versionId: 'v_feat_1',
|
|
308
|
+
timestamp: '2026-04-20T14:00:00Z',
|
|
309
|
+
actionName: StateMutationAction.AddErrorCall,
|
|
310
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
311
|
+
selfType: EntityType.Project,
|
|
312
|
+
selfVersion: 'v_feat_1',
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
id: 'h_5',
|
|
316
|
+
branch: 'b_main',
|
|
317
|
+
userAuthor: 'usr_2',
|
|
318
|
+
versionId: 'v_4',
|
|
319
|
+
timestamp: '2026-04-20T15:00:00Z',
|
|
320
|
+
actionName: StateMutationAction.RemoveEntity,
|
|
321
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
322
|
+
selfType: EntityType.Project,
|
|
323
|
+
selfVersion: 'v_4',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: 'h_6',
|
|
327
|
+
branch: 'b_fix',
|
|
328
|
+
userAuthor: 'usr_2',
|
|
329
|
+
versionId: 'v_fix_1',
|
|
330
|
+
timestamp: '2026-04-20T16:00:00Z',
|
|
331
|
+
actionName: StateMutationAction.SyncInputs,
|
|
332
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
333
|
+
selfType: EntityType.Project,
|
|
334
|
+
selfVersion: 'v_fix_1',
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
id: 'h_7',
|
|
338
|
+
branch: 'b_feat1',
|
|
339
|
+
userAuthor: 'usr_1',
|
|
340
|
+
versionId: 'v_feat_2',
|
|
341
|
+
timestamp: '2026-04-20T17:00:00Z',
|
|
342
|
+
actionName: StateMutationAction.AddInput,
|
|
343
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
344
|
+
selfType: EntityType.Project,
|
|
345
|
+
selfVersion: 'v_feat_2',
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: 'h_8',
|
|
349
|
+
branch: 'b_fix',
|
|
350
|
+
userAuthor: 'usr_2',
|
|
351
|
+
versionId: 'v_fix_2',
|
|
352
|
+
timestamp: '2026-04-20T18:00:00Z',
|
|
353
|
+
actionName: StateMutationAction.AddProperty,
|
|
354
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
355
|
+
selfType: EntityType.Project,
|
|
356
|
+
selfVersion: 'v_fix_2',
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: 'h_8a',
|
|
360
|
+
branch: 'b_fix',
|
|
361
|
+
userAuthor: 'usr_2',
|
|
362
|
+
versionId: 'v_fix_2a',
|
|
363
|
+
timestamp: '2026-04-20T18:15:00Z',
|
|
364
|
+
actionName: StateMutationAction.AddCall,
|
|
365
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
366
|
+
selfType: EntityType.Project,
|
|
367
|
+
selfVersion: 'v_fix_2a',
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
id: 'h_8b',
|
|
371
|
+
branch: 'b_fix',
|
|
372
|
+
userAuthor: 'usr_2',
|
|
373
|
+
versionId: 'v_fix_2b',
|
|
374
|
+
timestamp: '2026-04-20T18:30:00Z',
|
|
375
|
+
actionName: StateMutationAction.SetParent,
|
|
376
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
377
|
+
selfType: EntityType.Project,
|
|
378
|
+
selfVersion: 'v_fix_2b',
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
id: 'h_9',
|
|
382
|
+
branch: 'b_main',
|
|
383
|
+
userAuthor: 'usr_2',
|
|
384
|
+
versionId: 'v_5',
|
|
385
|
+
timestamp: '2026-04-20T19:00:00Z',
|
|
386
|
+
actionName: StateMutationAction.MergeDataTypes,
|
|
387
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
388
|
+
selfType: EntityType.Project,
|
|
389
|
+
selfVersion: 'v_5',
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
id: 'h_10',
|
|
393
|
+
branch: 'b_main',
|
|
394
|
+
userAuthor: 'usr_1',
|
|
395
|
+
versionId: 'v_6',
|
|
396
|
+
timestamp: '2026-04-20T20:00:00Z',
|
|
397
|
+
actionName: StateMutationAction.AddMethod,
|
|
398
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
399
|
+
selfType: EntityType.Project,
|
|
400
|
+
selfVersion: 'v_6',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
id: 'h_11',
|
|
404
|
+
branch: 'b_exp',
|
|
405
|
+
userAuthor: 'usr_3',
|
|
406
|
+
versionId: 'v_exp_1',
|
|
407
|
+
timestamp: '2026-04-20T21:00:00Z',
|
|
408
|
+
actionName: StateMutationAction.CloneEntity,
|
|
409
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
410
|
+
selfType: EntityType.Project,
|
|
411
|
+
selfVersion: 'v_exp_1',
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
id: 'h_12',
|
|
415
|
+
branch: 'b_feat1',
|
|
416
|
+
userAuthor: 'usr_1',
|
|
417
|
+
versionId: 'v_feat_3',
|
|
418
|
+
timestamp: '2026-04-20T22:00:00Z',
|
|
419
|
+
actionName: StateMutationAction.SetDataType,
|
|
420
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
421
|
+
selfType: EntityType.Project,
|
|
422
|
+
selfVersion: 'v_feat_3',
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
id: 'h_13',
|
|
426
|
+
branch: 'b_exp',
|
|
427
|
+
userAuthor: 'usr_3',
|
|
428
|
+
versionId: 'v_exp_2',
|
|
429
|
+
timestamp: '2026-04-20T23:00:00Z',
|
|
430
|
+
actionName: StateMutationAction.RemoveChildGroup,
|
|
431
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
432
|
+
selfType: EntityType.Project,
|
|
433
|
+
selfVersion: 'v_exp_2',
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
id: 'h_14',
|
|
437
|
+
branch: 'b_main',
|
|
438
|
+
userAuthor: 'usr_1',
|
|
439
|
+
versionId: 'v_7',
|
|
440
|
+
timestamp: '2026-04-21T00:00:00Z',
|
|
441
|
+
actionName: StateMutationAction.AddEntryCaller,
|
|
442
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
443
|
+
selfType: EntityType.Project,
|
|
444
|
+
selfVersion: 'v_7',
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
id: 'h_15',
|
|
448
|
+
branch: 'b_main',
|
|
449
|
+
userAuthor: 'usr_2',
|
|
450
|
+
versionId: 'v_8',
|
|
451
|
+
timestamp: '2026-04-21T01:00:00Z',
|
|
452
|
+
actionName: StateMutationAction.SetValueWriter,
|
|
453
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
454
|
+
selfType: EntityType.Project,
|
|
455
|
+
selfVersion: 'v_8',
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
id: 'h_15a',
|
|
459
|
+
branch: 'b_exp',
|
|
460
|
+
userAuthor: 'usr_3',
|
|
461
|
+
versionId: 'v_exp_3',
|
|
462
|
+
timestamp: '2026-04-21T01:30:00Z',
|
|
463
|
+
actionName: null as any,
|
|
464
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
465
|
+
selfType: EntityType.Project,
|
|
466
|
+
selfVersion: 'v_exp_3',
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
id: 'h_15b',
|
|
470
|
+
branch: 'b_exp',
|
|
471
|
+
userAuthor: 'usr_3',
|
|
472
|
+
versionId: 'v_exp_4',
|
|
473
|
+
timestamp: '2026-04-21T01:40:00Z',
|
|
474
|
+
actionName: null as any,
|
|
475
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
476
|
+
selfType: EntityType.Project,
|
|
477
|
+
selfVersion: 'v_exp_4',
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
id: 'h_16',
|
|
481
|
+
branch: 'b_main',
|
|
482
|
+
userAuthor: 'usr_3',
|
|
483
|
+
versionId: 'v_9',
|
|
484
|
+
timestamp: '2026-04-21T02:00:00Z',
|
|
485
|
+
actionName: StateMutationAction.AddEntryCaller,
|
|
486
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
487
|
+
selfType: EntityType.Project,
|
|
488
|
+
selfVersion: 'v_9',
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
id: 'h_17',
|
|
492
|
+
branch: 'b_main',
|
|
493
|
+
userAuthor: 'usr_3',
|
|
494
|
+
versionId: 'v_10',
|
|
495
|
+
timestamp: '2026-04-21T03:00:00Z',
|
|
496
|
+
actionName: StateMutationAction.SetValueWriter,
|
|
497
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
498
|
+
selfType: EntityType.Project,
|
|
499
|
+
selfVersion: 'v_10',
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
id: 'h_18',
|
|
503
|
+
branch: 'b_main',
|
|
504
|
+
userAuthor: 'usr_3',
|
|
505
|
+
versionId: project?.logic?.version || 'v_11',
|
|
506
|
+
timestamp: '2026-04-21T04:00:00Z',
|
|
507
|
+
actionName: StateMutationAction.UpdateWithGenerationTarget,
|
|
508
|
+
selfId: project?.projectId || 'tmp_proj_id',
|
|
509
|
+
selfType: EntityType.Project,
|
|
510
|
+
selfVersion: project?.logic?.version || 'v_11',
|
|
511
|
+
},
|
|
512
|
+
];
|
|
513
|
+
|
|
514
|
+
const MOCK_BRANCHES: IBranch[] = [
|
|
515
|
+
{
|
|
516
|
+
id: 'b_main',
|
|
517
|
+
userAuthor: 'usr_1',
|
|
518
|
+
project: MOCK_PROJECT_ID,
|
|
519
|
+
fromVersionId: 'v_0',
|
|
520
|
+
name: 'Main',
|
|
521
|
+
identifier: 'main',
|
|
522
|
+
createdAt: '2026-04-20T10:00:00Z',
|
|
523
|
+
default: true,
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: 'b_feat1',
|
|
527
|
+
userAuthor: 'usr_1',
|
|
528
|
+
project: MOCK_PROJECT_ID,
|
|
529
|
+
fromVersionId: 'v_2',
|
|
530
|
+
name: 'New Feature',
|
|
531
|
+
identifier: 'new-feature',
|
|
532
|
+
createdAt: '2026-04-20T13:30:00Z',
|
|
533
|
+
default: false,
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
id: 'b_fix',
|
|
537
|
+
userAuthor: 'usr_2',
|
|
538
|
+
project: MOCK_PROJECT_ID,
|
|
539
|
+
fromVersionId: 'v_4',
|
|
540
|
+
name: 'Fix User Bug',
|
|
541
|
+
identifier: 'fix-user-bug',
|
|
542
|
+
createdAt: '2026-04-20T15:30:00Z',
|
|
543
|
+
default: false,
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
id: 'b_exp',
|
|
547
|
+
userAuthor: 'usr_3',
|
|
548
|
+
project: MOCK_PROJECT_ID,
|
|
549
|
+
fromVersionId: 'v_6',
|
|
550
|
+
name: 'Change Button',
|
|
551
|
+
identifier: 'change-button',
|
|
552
|
+
createdAt: '2026-04-20T20:30:00Z',
|
|
553
|
+
default: false,
|
|
554
|
+
},
|
|
555
|
+
];
|
|
556
|
+
|
|
557
|
+
const MOCK_MERGES: IBranchMerge[] = [
|
|
558
|
+
{
|
|
559
|
+
id: 'm_1',
|
|
560
|
+
branch: 'b_fix',
|
|
561
|
+
userAuthor: 'usr_2',
|
|
562
|
+
mergedIntoBranch: 'b_main',
|
|
563
|
+
mergedIntoVersion: 'v_4',
|
|
564
|
+
mergedAsNewVersion: 'v_5',
|
|
565
|
+
timestamp: '2026-04-20T19:00:00Z',
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
id: 'm_2',
|
|
569
|
+
branch: 'b_feat1',
|
|
570
|
+
userAuthor: 'usr_1',
|
|
571
|
+
mergedIntoBranch: 'b_main',
|
|
572
|
+
mergedIntoVersion: 'v_6',
|
|
573
|
+
mergedAsNewVersion: 'v_7',
|
|
574
|
+
timestamp: '2026-04-21T00:00:00Z',
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: 'm_3',
|
|
578
|
+
branch: 'b_main',
|
|
579
|
+
userAuthor: 'usr_3',
|
|
580
|
+
mergedIntoBranch: 'b_exp',
|
|
581
|
+
mergedIntoVersion: 'v_exp_2',
|
|
582
|
+
mergedAsNewVersion: 'v_exp_3',
|
|
583
|
+
timestamp: '2026-04-21T01:30:00Z',
|
|
584
|
+
},
|
|
585
|
+
];
|
|
586
|
+
|
|
587
|
+
const BRANCH_COLORS = ['#a683fc', '#22c55e', '#ef4444', '#facc15', '#3b82f6'];
|
|
588
|
+
const getBranchColor = (id: string, index: number) =>
|
|
589
|
+
id === 'b_main'
|
|
590
|
+
? BRANCH_COLORS[0]
|
|
591
|
+
: BRANCH_COLORS[(index + 1) % BRANCH_COLORS.length];
|
|
592
|
+
|
|
593
|
+
// Engine now accepts enriched users and 'hasMoreData' to solve bottom clipping
|
|
594
|
+
const getCombinedTimeline = (
|
|
595
|
+
project: EditorService,
|
|
596
|
+
filterUser: string,
|
|
597
|
+
filterBranch: string,
|
|
598
|
+
useRealData: boolean,
|
|
599
|
+
apiData: {
|
|
600
|
+
items: any[];
|
|
601
|
+
branches: any[];
|
|
602
|
+
versions: any[];
|
|
603
|
+
total: number;
|
|
604
|
+
} | null,
|
|
605
|
+
enrichedUsers: Record<string, any>,
|
|
606
|
+
hasMoreData: boolean,
|
|
607
|
+
) => {
|
|
608
|
+
let timeline: any[] = [];
|
|
609
|
+
let mergesByVersion = new Map();
|
|
610
|
+
let branchesDb: any[] = [];
|
|
611
|
+
|
|
612
|
+
if (useRealData) {
|
|
613
|
+
if (!apiData) return [];
|
|
614
|
+
|
|
615
|
+
branchesDb = apiData.branches || [];
|
|
616
|
+
timeline = (apiData.items || []).map((item) => ({
|
|
617
|
+
...item,
|
|
618
|
+
type: item.eventType,
|
|
619
|
+
}));
|
|
620
|
+
|
|
621
|
+
timeline.forEach((item) => {
|
|
622
|
+
if (item.type === 'merge' && item.mergedAsNewVersion) {
|
|
623
|
+
mergesByVersion.set(item.mergedAsNewVersion, item);
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
} else {
|
|
627
|
+
let rawEvents = MOCK_HEADS(project).map((head) => ({
|
|
628
|
+
...head,
|
|
629
|
+
type: 'commit' as const,
|
|
630
|
+
}));
|
|
631
|
+
let merges = MOCK_MERGES.map((m) => ({ ...m, type: 'merge' as const }));
|
|
632
|
+
|
|
633
|
+
if (filterUser !== 'all') {
|
|
634
|
+
rawEvents = rawEvents.filter((h) => h.userAuthor === filterUser);
|
|
635
|
+
merges = merges.filter((m) => m.userAuthor === filterUser);
|
|
636
|
+
}
|
|
637
|
+
if (filterBranch !== 'all') {
|
|
638
|
+
rawEvents = rawEvents.filter((h) => h.branch === filterBranch);
|
|
639
|
+
merges = merges.filter(
|
|
640
|
+
(m) => m.branch === filterBranch || m.mergedIntoBranch === filterBranch,
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
mergesByVersion = new Map(merges.map((m) => [m.mergedAsNewVersion, m]));
|
|
645
|
+
timeline = [...rawEvents, ...merges].sort(
|
|
646
|
+
(a, b) =>
|
|
647
|
+
new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
|
|
648
|
+
);
|
|
649
|
+
branchesDb = MOCK_BRANCHES;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
const tracks: (string | null)[] = [];
|
|
653
|
+
const getCol = (bId: string) => {
|
|
654
|
+
let idx = tracks.indexOf(bId);
|
|
655
|
+
if (idx === -1) {
|
|
656
|
+
idx = tracks.indexOf(null);
|
|
657
|
+
if (idx === -1) {
|
|
658
|
+
idx = tracks.length;
|
|
659
|
+
tracks.push(bId);
|
|
660
|
+
} else {
|
|
661
|
+
tracks[idx] = bId;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return idx;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
const getParentBranchId = (bId: string) => {
|
|
668
|
+
const branch = branchesDb.find((b) => b.id === bId);
|
|
669
|
+
if (!branch) return 'b_main';
|
|
670
|
+
const parentHead = timeline.find(
|
|
671
|
+
(t) => t.versionId === branch.fromVersionId,
|
|
672
|
+
);
|
|
673
|
+
return parentHead ? parentHead.branch : 'b_main';
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
const seenBranches = new Set<string>();
|
|
677
|
+
const branchesMergedIn = new Set<string>();
|
|
678
|
+
|
|
679
|
+
return timeline.map((item, i) => {
|
|
680
|
+
const branch = branchesDb.find((b) => b.id === item.branch);
|
|
681
|
+
|
|
682
|
+
// ENRICHMENT: Map enriched API user, fallback to Mock, fallback to Dicebear
|
|
683
|
+
const userFallback = Object.values(MOCK_USERS).find(
|
|
684
|
+
(u) => u.id === item.userAuthor,
|
|
685
|
+
) || {
|
|
686
|
+
id: item.userAuthor,
|
|
687
|
+
name: `User`,
|
|
688
|
+
lastName: item.userAuthor?.substring(0, 4) || 'Unk',
|
|
689
|
+
picture: `https://api.dicebear.com/7.x/identicon/svg?seed=${item.userAuthor}`,
|
|
690
|
+
};
|
|
691
|
+
const user = enrichedUsers[item.userAuthor] || userFallback;
|
|
692
|
+
|
|
693
|
+
const mergeData = mergesByVersion.get(item.versionId);
|
|
694
|
+
const isMerge = !!mergeData;
|
|
695
|
+
const sourceBranch = mergeData
|
|
696
|
+
? branchesDb.find((b) => b.id === mergeData.branch)
|
|
697
|
+
: undefined;
|
|
698
|
+
|
|
699
|
+
const prevItem = timeline[i - 1];
|
|
700
|
+
const isPrevMerge = prevItem
|
|
701
|
+
? !!mergesByVersion.get(prevItem.versionId)
|
|
702
|
+
: false;
|
|
703
|
+
|
|
704
|
+
let isSubItem = false;
|
|
705
|
+
if (
|
|
706
|
+
prevItem &&
|
|
707
|
+
prevItem.type === 'commit' &&
|
|
708
|
+
item.type === 'commit' &&
|
|
709
|
+
prevItem.branch === item.branch &&
|
|
710
|
+
prevItem.userAuthor === item.userAuthor &&
|
|
711
|
+
!isPrevMerge &&
|
|
712
|
+
!isMerge
|
|
713
|
+
) {
|
|
714
|
+
isSubItem = true;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
const trackIndex = getCol(item.branch);
|
|
718
|
+
const isTip = !seenBranches.has(item.branch);
|
|
719
|
+
seenBranches.add(item.branch);
|
|
720
|
+
|
|
721
|
+
const activeTracks = tracks
|
|
722
|
+
.map((id, col) =>
|
|
723
|
+
id ? { id, col, color: getBranchColor(id, col) } : null,
|
|
724
|
+
)
|
|
725
|
+
.filter(Boolean);
|
|
726
|
+
|
|
727
|
+
const connections: any[] = [];
|
|
728
|
+
|
|
729
|
+
if (isMerge && sourceBranch) {
|
|
730
|
+
const srcCol = getCol(sourceBranch.id);
|
|
731
|
+
branchesMergedIn.add(sourceBranch.id);
|
|
732
|
+
connections.push({
|
|
733
|
+
fromCol: srcCol,
|
|
734
|
+
toCol: trackIndex,
|
|
735
|
+
color: getBranchColor(sourceBranch.id, srcCol),
|
|
736
|
+
isBranchOff: false,
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
const olderCommits = timeline
|
|
741
|
+
.slice(i + 1)
|
|
742
|
+
.filter((t) => t.branch === item.branch);
|
|
743
|
+
const isFirstInBranch = olderCommits.length === 0;
|
|
744
|
+
const isRootOfProject = isFirstInBranch && item.branch === 'b_main';
|
|
745
|
+
|
|
746
|
+
// Absolute Origin only triggers if there is NO more data waiting on the server
|
|
747
|
+
const isAbsoluteOrigin = isFirstInBranch && !hasMoreData;
|
|
748
|
+
|
|
749
|
+
if (isAbsoluteOrigin && !isRootOfProject) {
|
|
750
|
+
const parentBranchId = getParentBranchId(item.branch);
|
|
751
|
+
const parentCol = getCol(parentBranchId);
|
|
752
|
+
connections.push({
|
|
753
|
+
fromCol: trackIndex,
|
|
754
|
+
toCol: parentCol,
|
|
755
|
+
color: getBranchColor(item.branch, trackIndex),
|
|
756
|
+
isBranchOff: true,
|
|
757
|
+
});
|
|
758
|
+
tracks[trackIndex] = null;
|
|
759
|
+
} else if (isAbsoluteOrigin && isRootOfProject) {
|
|
760
|
+
tracks[trackIndex] = null;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
let maxCol = trackIndex;
|
|
764
|
+
activeTracks.forEach((t: any) => {
|
|
765
|
+
if (t.col > maxCol) maxCol = t.col;
|
|
766
|
+
});
|
|
767
|
+
connections.forEach((c: any) => {
|
|
768
|
+
if (c.fromCol > maxCol) maxCol = c.fromCol;
|
|
769
|
+
if (c.toCol > maxCol) maxCol = c.toCol;
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
const wasMerged = branchesMergedIn.has(item.branch);
|
|
773
|
+
|
|
774
|
+
return {
|
|
775
|
+
...item,
|
|
776
|
+
isMerge,
|
|
777
|
+
sourceBranch,
|
|
778
|
+
isAbsoluteOrigin, // Passed to renderer to know if it should cap the bottom
|
|
779
|
+
isTip,
|
|
780
|
+
wasMerged,
|
|
781
|
+
isSubItem,
|
|
782
|
+
track: trackIndex,
|
|
783
|
+
activeTracks,
|
|
784
|
+
connections,
|
|
785
|
+
branchObj: branch,
|
|
786
|
+
user,
|
|
787
|
+
maxCol,
|
|
788
|
+
};
|
|
789
|
+
});
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
const ProjectName = (props: IProjectNameProps) => {
|
|
793
|
+
const useForceUpdate = () => {
|
|
794
|
+
const [_, setValue] = useState(0);
|
|
795
|
+
return () => setValue((value) => value + 1);
|
|
796
|
+
};
|
|
797
|
+
const forceUpdate = useForceUpdate();
|
|
798
|
+
|
|
799
|
+
const { ready, project } = props;
|
|
800
|
+
|
|
801
|
+
const [status, setStatus] = useState<SyncStatus>(() =>
|
|
802
|
+
ready ? 'synced' : 'loading',
|
|
803
|
+
);
|
|
804
|
+
const [isHistoryOpen, setIsHistoryOpen] = useState(false);
|
|
805
|
+
const [activeTab, setActiveTab] = useState<'timeline' | 'merges'>('timeline');
|
|
806
|
+
const [openActionMenuId, setOpenActionMenuId] = useState<string | null>(null);
|
|
807
|
+
|
|
808
|
+
// State Hooks for Filters, Data, and Load More
|
|
809
|
+
const [filterBranch, setFilterBranch] = useState<string>('all');
|
|
810
|
+
const [filterUser, setFilterUser] = useState<string>('all');
|
|
811
|
+
const [showFilters, setShowFilters] = useState<boolean>(false);
|
|
812
|
+
|
|
813
|
+
const [apiData, setApiData] = useState<{
|
|
814
|
+
items: any[];
|
|
815
|
+
branches: any[];
|
|
816
|
+
versions: any[];
|
|
817
|
+
total: number;
|
|
818
|
+
} | null>(null);
|
|
819
|
+
const [isLoadingTimeline, setIsLoadingTimeline] = useState(false);
|
|
820
|
+
|
|
821
|
+
const [offset, setOffset] = useState(0);
|
|
822
|
+
const limit = 50;
|
|
823
|
+
const [isLoadingMore, setIsLoadingMore] = useState(false);
|
|
824
|
+
|
|
825
|
+
const [enrichedUsers, setEnrichedUsers] = useState<Record<string, IUser>>({});
|
|
826
|
+
|
|
827
|
+
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
828
|
+
|
|
829
|
+
// const [currentUser, setCurrentUser] = useState<IUser | null>(null);
|
|
830
|
+
// const [isUserLoaded, setIsUserLoaded] = useState(false);
|
|
831
|
+
|
|
832
|
+
const activeWorkspace = useWorkspaceStore((state) => state.activeWorkspace);
|
|
833
|
+
|
|
834
|
+
// useEffect(() => {
|
|
835
|
+
// getCurrentUserOrLogoutRedirect()
|
|
836
|
+
// .then((user: IUser) => {
|
|
837
|
+
// // if (activeWorkspace?.features?.versionControl !== undefined) {
|
|
838
|
+
// // // for testing
|
|
839
|
+
// // activeWorkspace.features.versionControl = false;
|
|
840
|
+
// // }
|
|
841
|
+
// setCurrentUser(user);
|
|
842
|
+
// setIsUserLoaded(true);
|
|
843
|
+
// })
|
|
844
|
+
// .catch((e) => {
|
|
845
|
+
// console.error('Failed to fetch user for history panel', e);
|
|
846
|
+
// setIsUserLoaded(true);
|
|
847
|
+
// });
|
|
848
|
+
// }, []);
|
|
849
|
+
|
|
850
|
+
const hasVersionControl = activeWorkspace?.features?.versionControl === true;
|
|
851
|
+
|
|
852
|
+
const statusText: Record<SyncStatus, string> = useMemo(
|
|
853
|
+
() => ({
|
|
854
|
+
loading: 'Loading project…',
|
|
855
|
+
offline: 'Offline — changes queued',
|
|
856
|
+
saving: 'Saving changes…',
|
|
857
|
+
synced: 'All changes saved',
|
|
858
|
+
error: 'Error — not in sync',
|
|
859
|
+
}),
|
|
860
|
+
[],
|
|
861
|
+
);
|
|
862
|
+
|
|
863
|
+
const statusClass = useMemo(() => {
|
|
864
|
+
switch (status) {
|
|
865
|
+
case 'saving':
|
|
866
|
+
return 'saving';
|
|
867
|
+
case 'synced':
|
|
868
|
+
return 'synced';
|
|
869
|
+
case 'error':
|
|
870
|
+
return 'error';
|
|
871
|
+
case 'offline':
|
|
872
|
+
case 'loading':
|
|
873
|
+
default:
|
|
874
|
+
return 'offline';
|
|
875
|
+
}
|
|
876
|
+
}, [status]);
|
|
877
|
+
|
|
878
|
+
const handleConnectionLost = useCallback(() => setStatus('offline'), []);
|
|
879
|
+
const handleConnectionRestored = useCallback(() => setStatus('saving'), []);
|
|
880
|
+
const handleChangeSetClosed = useCallback(() => {
|
|
881
|
+
if (
|
|
882
|
+
project.logic.history.find(
|
|
883
|
+
(changeSet) => !changeSet.open && changeSet.dirty,
|
|
884
|
+
)
|
|
885
|
+
)
|
|
886
|
+
setStatus('saving');
|
|
887
|
+
}, [project]);
|
|
888
|
+
|
|
889
|
+
const handleSubmissionSucceeded = useCallback(
|
|
890
|
+
(wsMessage: any) => {
|
|
891
|
+
setStatus('synced');
|
|
892
|
+
|
|
893
|
+
const newVersionId =
|
|
894
|
+
wsMessage.payload.updated?.[props.project.projectId]?.version;
|
|
895
|
+
|
|
896
|
+
// Push a new item to the timeline for this changeSet
|
|
897
|
+
const newTimelineItem = {
|
|
898
|
+
id: newVersionId || wsMessage.actionId, // Fallback to actionId if version is missing
|
|
899
|
+
branch: wsMessage.payload.branch,
|
|
900
|
+
userAuthor: wsMessage.userAuthor,
|
|
901
|
+
versionId: newVersionId,
|
|
902
|
+
timestamp: wsMessage.emittedAt || new Date().toISOString(),
|
|
903
|
+
actionName: wsMessage.payload?.actionName || null,
|
|
904
|
+
eventType: 'commit', // FIX: Use eventType so the engine maps it correctly
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
setApiData((prev: any) => {
|
|
908
|
+
if (!prev) return prev;
|
|
909
|
+
|
|
910
|
+
return {
|
|
911
|
+
...prev,
|
|
912
|
+
// Prepend the new item so it remains chronologically sorted at the top
|
|
913
|
+
items: [newTimelineItem, ...prev.items],
|
|
914
|
+
|
|
915
|
+
// FIX: Use .some() instead of .includes() since we are checking arrays of objects
|
|
916
|
+
branches: prev.branches.some(
|
|
917
|
+
(b: any) => b.id === wsMessage.payload.branch,
|
|
918
|
+
)
|
|
919
|
+
? prev.branches
|
|
920
|
+
: [...prev.branches, { id: wsMessage.payload.branch }],
|
|
921
|
+
|
|
922
|
+
versions: prev.versions.some((v: any) => v.version === newVersionId)
|
|
923
|
+
? prev.versions
|
|
924
|
+
: [...prev.versions, { version: newVersionId }],
|
|
925
|
+
};
|
|
926
|
+
});
|
|
927
|
+
},
|
|
928
|
+
[props.project?.projectId],
|
|
929
|
+
);
|
|
930
|
+
|
|
931
|
+
const handleSubmissionFailed = useCallback(() => setStatus('error'), []);
|
|
932
|
+
|
|
933
|
+
const projectId =
|
|
934
|
+
project?.projectId || window.location.pathname.split('/editor/')[1];
|
|
935
|
+
|
|
936
|
+
// Filter Change Handlers (Resets Offset)
|
|
937
|
+
const handleFilterBranchChange = (e: any) => {
|
|
938
|
+
setFilterBranch(e.target.value);
|
|
939
|
+
setOffset(0);
|
|
940
|
+
};
|
|
941
|
+
const handleFilterUserChange = (e: any) => {
|
|
942
|
+
setFilterUser(e.target.value);
|
|
943
|
+
setOffset(0);
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
// Fetch Timeline Effect
|
|
947
|
+
useEffect(() => {
|
|
948
|
+
if (
|
|
949
|
+
!project ||
|
|
950
|
+
!ENABLE_REAL_HISTORY_DATA ||
|
|
951
|
+
!isHistoryOpen ||
|
|
952
|
+
!projectId ||
|
|
953
|
+
!hasVersionControl
|
|
954
|
+
) {
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
if (offset === 0) setIsLoadingTimeline(true);
|
|
959
|
+
else setIsLoadingMore(true);
|
|
960
|
+
|
|
961
|
+
const fetchTimeline = async () => {
|
|
962
|
+
try {
|
|
963
|
+
const url = `${project.env.API_BASE_URL}/editor-service/v1/project/${projectId}/timeline?limit=${limit}&offset=${offset}&filterUser=${filterUser}&filterBranch=${filterBranch}`;
|
|
964
|
+
|
|
965
|
+
const response = await axios.get(url, {
|
|
966
|
+
headers: {
|
|
967
|
+
'Content-Type': 'application/json',
|
|
968
|
+
Authorization: `Bearer ${(await project.getAccessToken()) || ''}`,
|
|
969
|
+
},
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
const data = response.data;
|
|
973
|
+
|
|
974
|
+
setApiData((prev: any) => {
|
|
975
|
+
// Append data if paginating, otherwise replace
|
|
976
|
+
if (offset > 0 && prev) {
|
|
977
|
+
const newBranches = data.branches.filter(
|
|
978
|
+
(b: any) => !prev.branches.some((pb: any) => pb.id === b.id),
|
|
979
|
+
);
|
|
980
|
+
const newVersions = data.versions.filter(
|
|
981
|
+
(v: any) =>
|
|
982
|
+
!prev.versions.some((pv: any) => pv.version === v.version),
|
|
983
|
+
);
|
|
984
|
+
return {
|
|
985
|
+
...data,
|
|
986
|
+
items: [...prev.items, ...data.items],
|
|
987
|
+
branches: [...prev.branches, ...newBranches],
|
|
988
|
+
versions: [...prev.versions, ...newVersions],
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
return data;
|
|
992
|
+
});
|
|
993
|
+
setIsLoadingTimeline(false);
|
|
994
|
+
setIsLoadingMore(false);
|
|
995
|
+
} catch (error) {
|
|
996
|
+
console.error('Error fetching live timeline:', error);
|
|
997
|
+
setIsLoadingTimeline(false);
|
|
998
|
+
setIsLoadingMore(false);
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
fetchTimeline();
|
|
1003
|
+
}, [
|
|
1004
|
+
projectId,
|
|
1005
|
+
filterUser,
|
|
1006
|
+
filterBranch,
|
|
1007
|
+
isHistoryOpen,
|
|
1008
|
+
offset,
|
|
1009
|
+
project,
|
|
1010
|
+
hasVersionControl,
|
|
1011
|
+
]);
|
|
1012
|
+
|
|
1013
|
+
// User Enrichment Effect
|
|
1014
|
+
useEffect(() => {
|
|
1015
|
+
if (!apiData?.items) return;
|
|
1016
|
+
|
|
1017
|
+
// Collect all unique user UUIDs from the current timeline chunk
|
|
1018
|
+
const uniqueUserIds = Array.from(
|
|
1019
|
+
new Set(
|
|
1020
|
+
apiData.items.map((item: any) => item.userAuthor).filter(Boolean),
|
|
1021
|
+
),
|
|
1022
|
+
);
|
|
1023
|
+
|
|
1024
|
+
uniqueUserIds.forEach(async (id) => {
|
|
1025
|
+
if (!enrichedUsers[id as string]) {
|
|
1026
|
+
// getUser inherently caches internally, so this is safe
|
|
1027
|
+
const user = await getUser({ id: id as string });
|
|
1028
|
+
if (user) {
|
|
1029
|
+
setEnrichedUsers((prev) => ({ ...prev, [id as string]: user }));
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
});
|
|
1033
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1034
|
+
}, [apiData?.items]);
|
|
1035
|
+
|
|
1036
|
+
useEffect(() => {
|
|
1037
|
+
setStatus(ready ? 'synced' : 'loading');
|
|
1038
|
+
}, [ready]);
|
|
1039
|
+
|
|
1040
|
+
useEffect(() => {
|
|
1041
|
+
if (!project) return;
|
|
1042
|
+
const handleEntityUpdate = () => forceUpdate();
|
|
1043
|
+
project.on(project.projectId, handleEntityUpdate);
|
|
1044
|
+
project.on('connection-status-lost', handleConnectionLost);
|
|
1045
|
+
project.on('connection-status-restored', handleConnectionRestored);
|
|
1046
|
+
project.on('change-set-closed', handleChangeSetClosed);
|
|
1047
|
+
project.on('change-set-submission-succeeded', handleSubmissionSucceeded);
|
|
1048
|
+
project.on('change-set-submission-failed', handleSubmissionFailed);
|
|
1049
|
+
|
|
1050
|
+
return () => {
|
|
1051
|
+
project.off(project.projectId, handleEntityUpdate);
|
|
1052
|
+
project.off('connection-status-lost', handleConnectionLost);
|
|
1053
|
+
project.off('connection-status-restored', handleConnectionRestored);
|
|
1054
|
+
project.off('change-set-closed', handleChangeSetClosed);
|
|
1055
|
+
project.off('change-set-submission-succeeded', handleSubmissionSucceeded);
|
|
1056
|
+
project.off('change-set-submission-failed', handleSubmissionFailed);
|
|
1057
|
+
};
|
|
1058
|
+
}, [
|
|
1059
|
+
project,
|
|
1060
|
+
handleConnectionLost,
|
|
1061
|
+
handleConnectionRestored,
|
|
1062
|
+
handleChangeSetClosed,
|
|
1063
|
+
handleSubmissionSucceeded,
|
|
1064
|
+
handleSubmissionFailed,
|
|
1065
|
+
forceUpdate,
|
|
1066
|
+
]);
|
|
1067
|
+
|
|
1068
|
+
useEffect(() => {
|
|
1069
|
+
if (isHistoryOpen && dropdownRef.current) {
|
|
1070
|
+
const clickAwayHandler = onClickAway(dropdownRef.current, () =>
|
|
1071
|
+
setIsHistoryOpen(false),
|
|
1072
|
+
);
|
|
1073
|
+
return () =>
|
|
1074
|
+
document.removeEventListener('click', clickAwayHandler as any);
|
|
1075
|
+
}
|
|
1076
|
+
}, [isHistoryOpen]);
|
|
1077
|
+
|
|
1078
|
+
const projectName = ready ? project?.logic?.name || 'Untitled' : '-';
|
|
1079
|
+
const runtimeIp = project?.env?.EDITOR_RUNTIME_IP_ADDRESS || 'Not available';
|
|
1080
|
+
|
|
1081
|
+
const hasMoreData =
|
|
1082
|
+
ENABLE_REAL_HISTORY_DATA && apiData
|
|
1083
|
+
? apiData.total > offset + limit
|
|
1084
|
+
: false;
|
|
1085
|
+
|
|
1086
|
+
const processedTimeline = useMemo(
|
|
1087
|
+
() =>
|
|
1088
|
+
getCombinedTimeline(
|
|
1089
|
+
project,
|
|
1090
|
+
filterUser,
|
|
1091
|
+
filterBranch,
|
|
1092
|
+
hasVersionControl && ENABLE_REAL_HISTORY_DATA,
|
|
1093
|
+
apiData,
|
|
1094
|
+
enrichedUsers,
|
|
1095
|
+
hasMoreData,
|
|
1096
|
+
),
|
|
1097
|
+
[
|
|
1098
|
+
project,
|
|
1099
|
+
filterUser,
|
|
1100
|
+
filterBranch,
|
|
1101
|
+
apiData?.total,
|
|
1102
|
+
apiData?.items?.map((i: any) => i.id).join(','),
|
|
1103
|
+
apiData?.branches?.map((b: any) => b.id).join(','),
|
|
1104
|
+
apiData?.versions?.map((v: any) => v.version).join(','),
|
|
1105
|
+
enrichedUsers,
|
|
1106
|
+
hasMoreData,
|
|
1107
|
+
hasVersionControl,
|
|
1108
|
+
],
|
|
1109
|
+
);
|
|
1110
|
+
|
|
1111
|
+
// Derived loading state that doesn't lag behind the useEffect
|
|
1112
|
+
const isWaitingForRealData =
|
|
1113
|
+
hasVersionControl && ENABLE_REAL_HISTORY_DATA && !apiData;
|
|
1114
|
+
|
|
1115
|
+
const availableBranches = isWaitingForRealData
|
|
1116
|
+
? [] // Empty while loading real data
|
|
1117
|
+
: hasVersionControl && ENABLE_REAL_HISTORY_DATA
|
|
1118
|
+
? apiData.branches
|
|
1119
|
+
: MOCK_BRANCHES; // Mock only if they don't have version control
|
|
1120
|
+
|
|
1121
|
+
const availableUsers = isWaitingForRealData
|
|
1122
|
+
? [] // Empty while loading real data
|
|
1123
|
+
: hasVersionControl && ENABLE_REAL_HISTORY_DATA
|
|
1124
|
+
? Object.values(enrichedUsers)
|
|
1125
|
+
: Object.values(MOCK_USERS); // Mock only if they don't have version control
|
|
1126
|
+
|
|
1127
|
+
const isViewingOlderVersion = project?.isViewingNonHead;
|
|
1128
|
+
|
|
1129
|
+
// Extract the currently viewed version's data from the timeline
|
|
1130
|
+
const currentActiveVersion = project?.logic?.version || 'v_9';
|
|
1131
|
+
const currentlyViewedItem = processedTimeline.find(
|
|
1132
|
+
(item) => item.versionId === currentActiveVersion,
|
|
1133
|
+
);
|
|
1134
|
+
|
|
1135
|
+
let viewedItemDateStr = '';
|
|
1136
|
+
let viewedItemAction = '';
|
|
1137
|
+
|
|
1138
|
+
const date = !!project?.logic?.createdAt
|
|
1139
|
+
? new Date(project?.logic?.createdAt)
|
|
1140
|
+
: null;
|
|
1141
|
+
viewedItemDateStr = !!date
|
|
1142
|
+
? `${date.toLocaleString('default', { month: 'short' })} ${date.getDate()}, ${date.getFullYear()}, ${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}`
|
|
1143
|
+
: '';
|
|
1144
|
+
viewedItemAction = !!currentlyViewedItem?.actionName
|
|
1145
|
+
? toSentenceCase(currentlyViewedItem.actionName)
|
|
1146
|
+
: 'Modified';
|
|
1147
|
+
|
|
1148
|
+
return (
|
|
1149
|
+
<div className='editor__project-top-bar-wrapper'>
|
|
1150
|
+
<div id='project-name-chip' className='editor__project-name__container'>
|
|
1151
|
+
<Tooltip placement='bottom' title={'Back to the gallery'}>
|
|
1152
|
+
<a
|
|
1153
|
+
id='editor__project-name__back-to-gallery-link'
|
|
1154
|
+
href={`/ws/${activeWorkspace?.slug}/gallery`}
|
|
1155
|
+
onClick={(e) => {
|
|
1156
|
+
e.preventDefault();
|
|
1157
|
+
if (e.metaKey || e.ctrlKey) {
|
|
1158
|
+
window.open(`/ws/${activeWorkspace?.slug}/gallery`, '_blank');
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
props.project?.hideEntityCreationMenu();
|
|
1162
|
+
EditorService.navigate(`/ws/${activeWorkspace?.slug}/gallery`);
|
|
1163
|
+
}}
|
|
1164
|
+
>
|
|
1165
|
+
<i className='fa-solid fa-arrow-left' />
|
|
1166
|
+
</a>
|
|
1167
|
+
</Tooltip>
|
|
1168
|
+
|
|
1169
|
+
<span className='editor__project-name__separator' />
|
|
1170
|
+
|
|
1171
|
+
<Tooltip
|
|
1172
|
+
placement='bottom'
|
|
1173
|
+
title={
|
|
1174
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
|
1175
|
+
<span>{statusText[status]}</span>
|
|
1176
|
+
<span
|
|
1177
|
+
style={{
|
|
1178
|
+
fontSize: 10,
|
|
1179
|
+
opacity: 0.8,
|
|
1180
|
+
borderTop: '1px solid rgba(255,255,255,0.2)',
|
|
1181
|
+
paddingTop: 4,
|
|
1182
|
+
marginTop: 2,
|
|
1183
|
+
}}
|
|
1184
|
+
>
|
|
1185
|
+
Runtime IP:{' '}
|
|
1186
|
+
<strong style={{ userSelect: 'all' }}>{runtimeIp}</strong>
|
|
1187
|
+
</span>
|
|
1188
|
+
</div>
|
|
1189
|
+
}
|
|
1190
|
+
>
|
|
1191
|
+
<span
|
|
1192
|
+
role='status'
|
|
1193
|
+
aria-label={statusText[status]}
|
|
1194
|
+
className={`editor__project-status-dot editor__project-status-dot--${statusClass}${['loading', 'saving', 'error'].includes(status) ? ' blinking' : ''}`}
|
|
1195
|
+
/>
|
|
1196
|
+
</Tooltip>
|
|
1197
|
+
|
|
1198
|
+
<a
|
|
1199
|
+
href={`${props.project?.editorBasePath}/project-configuration`}
|
|
1200
|
+
title='Project settings'
|
|
1201
|
+
onClick={(e) => {
|
|
1202
|
+
e.preventDefault();
|
|
1203
|
+
EditorService.navigate(
|
|
1204
|
+
`${props.project?.editorBasePath}/project-configuration`,
|
|
1205
|
+
);
|
|
1206
|
+
}}
|
|
1207
|
+
>
|
|
1208
|
+
<p className='editor__project-name__label'>Project</p>
|
|
1209
|
+
<Tooltip placement='bottom' title={projectName}>
|
|
1210
|
+
<h1 className='editor__project-name__name'>{projectName}</h1>
|
|
1211
|
+
</Tooltip>
|
|
1212
|
+
</a>
|
|
1213
|
+
|
|
1214
|
+
{ENABLE_HISTORY_DROPDOWN && (
|
|
1215
|
+
<>
|
|
1216
|
+
<span className='editor__project-name__separator' />
|
|
1217
|
+
<div
|
|
1218
|
+
className='editor__project-name__branch-toggle'
|
|
1219
|
+
onClick={(e) => {
|
|
1220
|
+
e.stopPropagation();
|
|
1221
|
+
setIsHistoryOpen(!isHistoryOpen);
|
|
1222
|
+
}}
|
|
1223
|
+
>
|
|
1224
|
+
<p className='editor__project-name__branch-label'>
|
|
1225
|
+
{props?.project?.branchHead?.name || 'Main'}
|
|
1226
|
+
{' - '}
|
|
1227
|
+
{isViewingOlderVersion ? viewedItemDateStr : 'Latest'}
|
|
1228
|
+
</p>
|
|
1229
|
+
<i
|
|
1230
|
+
className='fa-solid fa-chevron-down'
|
|
1231
|
+
style={{ fontSize: 10, color: 'rgba(255,255,255,0.85)' }}
|
|
1232
|
+
/>
|
|
1233
|
+
</div>
|
|
1234
|
+
|
|
1235
|
+
{isHistoryOpen && (
|
|
1236
|
+
<div
|
|
1237
|
+
className='editor__project-history-dropdown'
|
|
1238
|
+
ref={dropdownRef}
|
|
1239
|
+
onClick={(e) => e.stopPropagation()}
|
|
1240
|
+
>
|
|
1241
|
+
<div className='editor__project-history-tabs'>
|
|
1242
|
+
<button
|
|
1243
|
+
className={`editor__project-history-tab ${activeTab === 'timeline' ? 'active' : ''}`}
|
|
1244
|
+
onClick={() => setActiveTab('timeline')}
|
|
1245
|
+
>
|
|
1246
|
+
Timeline
|
|
1247
|
+
</button>
|
|
1248
|
+
<button
|
|
1249
|
+
className={`editor__project-history-tab ${activeTab === 'merges' ? 'active' : ''}`}
|
|
1250
|
+
onClick={() => setActiveTab('merges')}
|
|
1251
|
+
>
|
|
1252
|
+
Merges
|
|
1253
|
+
</button>
|
|
1254
|
+
</div>
|
|
1255
|
+
|
|
1256
|
+
<div className='editor__project-history-content'>
|
|
1257
|
+
{activeTab === 'timeline' && (
|
|
1258
|
+
<>
|
|
1259
|
+
{/* 1. Filters (Naturally fixed at the top of the flex column) */}
|
|
1260
|
+
<div
|
|
1261
|
+
className='editor__project-history-sticky-filters-container'
|
|
1262
|
+
style={{ flexShrink: 0, zIndex: 15 }}
|
|
1263
|
+
>
|
|
1264
|
+
<div
|
|
1265
|
+
className='editor__project-history-filter-toggle'
|
|
1266
|
+
onClick={() => setShowFilters(!showFilters)}
|
|
1267
|
+
>
|
|
1268
|
+
<div
|
|
1269
|
+
style={{
|
|
1270
|
+
display: 'flex',
|
|
1271
|
+
alignItems: 'center',
|
|
1272
|
+
gap: '6px',
|
|
1273
|
+
}}
|
|
1274
|
+
>
|
|
1275
|
+
<i
|
|
1276
|
+
className='fa-solid fa-filter'
|
|
1277
|
+
style={{ fontSize: '10px' }}
|
|
1278
|
+
/>
|
|
1279
|
+
<span>
|
|
1280
|
+
{filterBranch !== 'all' || filterUser !== 'all'
|
|
1281
|
+
? 'Filters active'
|
|
1282
|
+
: 'Filter timeline'}
|
|
1283
|
+
</span>
|
|
1284
|
+
</div>
|
|
1285
|
+
<i
|
|
1286
|
+
className={`fa-solid fa-chevron-${showFilters ? 'up' : 'down'}`}
|
|
1287
|
+
style={{ fontSize: '10px' }}
|
|
1288
|
+
/>
|
|
1289
|
+
</div>
|
|
1290
|
+
|
|
1291
|
+
{showFilters && (
|
|
1292
|
+
<div className='editor__project-history-filters'>
|
|
1293
|
+
<select
|
|
1294
|
+
className='history-filter-select'
|
|
1295
|
+
value={filterBranch}
|
|
1296
|
+
onChange={handleFilterBranchChange}
|
|
1297
|
+
>
|
|
1298
|
+
<option value='all'>All branches</option>
|
|
1299
|
+
{availableBranches.map((b: any) => (
|
|
1300
|
+
<option key={b.id} value={b.id}>
|
|
1301
|
+
{b.name}
|
|
1302
|
+
</option>
|
|
1303
|
+
))}
|
|
1304
|
+
</select>
|
|
1305
|
+
<select
|
|
1306
|
+
className='history-filter-select'
|
|
1307
|
+
value={filterUser}
|
|
1308
|
+
onChange={handleFilterUserChange}
|
|
1309
|
+
>
|
|
1310
|
+
<option value='all'>All users</option>
|
|
1311
|
+
{availableUsers.map(
|
|
1312
|
+
(u: IUser | { id: string; name?: string }) => (
|
|
1313
|
+
<option key={u.id} value={u.id}>
|
|
1314
|
+
{u.name || u.id}
|
|
1315
|
+
</option>
|
|
1316
|
+
),
|
|
1317
|
+
)}
|
|
1318
|
+
</select>
|
|
1319
|
+
</div>
|
|
1320
|
+
)}
|
|
1321
|
+
</div>
|
|
1322
|
+
|
|
1323
|
+
{/* 2. Dynamic Content Area */}
|
|
1324
|
+
{isLoadingTimeline ||
|
|
1325
|
+
(hasVersionControl &&
|
|
1326
|
+
ENABLE_REAL_HISTORY_DATA &&
|
|
1327
|
+
!apiData) ? (
|
|
1328
|
+
<div
|
|
1329
|
+
className='editor__project-history-empty'
|
|
1330
|
+
style={{ padding: '60px 20px' }}
|
|
1331
|
+
>
|
|
1332
|
+
<i
|
|
1333
|
+
className='fa-solid fa-circle-notch fa-spin'
|
|
1334
|
+
style={{
|
|
1335
|
+
fontSize: 24,
|
|
1336
|
+
marginBottom: 8,
|
|
1337
|
+
opacity: 0.5,
|
|
1338
|
+
}}
|
|
1339
|
+
/>
|
|
1340
|
+
<p>Loading timeline...</p>
|
|
1341
|
+
</div>
|
|
1342
|
+
) : processedTimeline.length === 0 ? (
|
|
1343
|
+
<div className='editor__project-history-empty'>
|
|
1344
|
+
<p>No commits found.</p>
|
|
1345
|
+
</div>
|
|
1346
|
+
) : (
|
|
1347
|
+
// The Relative Wrapper uses `flex: 1` to fill the remaining space below the filters securely.
|
|
1348
|
+
<div
|
|
1349
|
+
style={{
|
|
1350
|
+
position: 'relative',
|
|
1351
|
+
flex: 1,
|
|
1352
|
+
display: 'flex',
|
|
1353
|
+
flexDirection: 'column',
|
|
1354
|
+
minHeight: 0,
|
|
1355
|
+
}}
|
|
1356
|
+
>
|
|
1357
|
+
{/* The Dedicated Scroll Container */}
|
|
1358
|
+
<div
|
|
1359
|
+
style={{
|
|
1360
|
+
flex: 1,
|
|
1361
|
+
overflowY: 'auto',
|
|
1362
|
+
paddingBottom: '20px',
|
|
1363
|
+
}}
|
|
1364
|
+
>
|
|
1365
|
+
<div
|
|
1366
|
+
className='editor__project-history-list'
|
|
1367
|
+
style={{
|
|
1368
|
+
opacity: hasVersionControl ? 1 : 0.4, // Bumped slightly to 0.4 so it's easier to see while scrolling
|
|
1369
|
+
pointerEvents: hasVersionControl
|
|
1370
|
+
? 'auto'
|
|
1371
|
+
: 'none',
|
|
1372
|
+
userSelect: hasVersionControl ? 'auto' : 'none',
|
|
1373
|
+
filter: hasVersionControl
|
|
1374
|
+
? 'none'
|
|
1375
|
+
: 'blur(1px)',
|
|
1376
|
+
}}
|
|
1377
|
+
>
|
|
1378
|
+
{processedTimeline.map((item) => {
|
|
1379
|
+
const date = new Date(item.timestamp);
|
|
1380
|
+
const formattedDate = `${date.toLocaleString('default', { month: 'short' })} ${date.getDate()}, ${date.getFullYear()}, ${date.getHours()}:${date.getMinutes().toString().padStart(2, '0')}`;
|
|
1381
|
+
|
|
1382
|
+
const color = getBranchColor(
|
|
1383
|
+
item.branch,
|
|
1384
|
+
item.track,
|
|
1385
|
+
);
|
|
1386
|
+
|
|
1387
|
+
const isActiveVersion =
|
|
1388
|
+
item.type === 'commit' &&
|
|
1389
|
+
item.versionId ===
|
|
1390
|
+
props.project?.viewingVersionId;
|
|
1391
|
+
|
|
1392
|
+
const liveVersionId =
|
|
1393
|
+
props.project?.lastPublishedProjectState
|
|
1394
|
+
?.version;
|
|
1395
|
+
const isLiveVersion =
|
|
1396
|
+
item.type === 'commit' &&
|
|
1397
|
+
!!liveVersionId &&
|
|
1398
|
+
item.versionId === liveVersionId;
|
|
1399
|
+
|
|
1400
|
+
const COL_W = 20;
|
|
1401
|
+
const rowCenter = item.isSubItem ? 14 : 20;
|
|
1402
|
+
|
|
1403
|
+
const userDisplayLabel = item.user.lastName
|
|
1404
|
+
? `${item.user.name} ${item.user.lastName}`
|
|
1405
|
+
: item.user.name;
|
|
1406
|
+
|
|
1407
|
+
return (
|
|
1408
|
+
<div
|
|
1409
|
+
key={item.id}
|
|
1410
|
+
className={`editor__project-history-item ${isActiveVersion ? 'active' : ''} ${item.isSubItem ? 'sub-item' : ''}`}
|
|
1411
|
+
onMouseLeave={() =>
|
|
1412
|
+
setOpenActionMenuId(null)
|
|
1413
|
+
}
|
|
1414
|
+
>
|
|
1415
|
+
<div
|
|
1416
|
+
className='editor__project-history-visuals'
|
|
1417
|
+
style={{
|
|
1418
|
+
width: `${(item.maxCol + 1) * COL_W}px`,
|
|
1419
|
+
}}
|
|
1420
|
+
>
|
|
1421
|
+
<svg className='history-svg-overlay'>
|
|
1422
|
+
{item.activeTracks.map((t: any) => {
|
|
1423
|
+
let y1: string | number = '0';
|
|
1424
|
+
let y2: string | number = '100%';
|
|
1425
|
+
|
|
1426
|
+
if (t.id === item.branch) {
|
|
1427
|
+
if (item.isTip && !item.wasMerged)
|
|
1428
|
+
y1 = rowCenter;
|
|
1429
|
+
if (item.isAbsoluteOrigin)
|
|
1430
|
+
y2 = rowCenter;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
return (
|
|
1434
|
+
<line
|
|
1435
|
+
key={t.id}
|
|
1436
|
+
x1={t.col * COL_W + 10}
|
|
1437
|
+
x2={t.col * COL_W + 10}
|
|
1438
|
+
y1={y1}
|
|
1439
|
+
y2={y2}
|
|
1440
|
+
stroke={t.color}
|
|
1441
|
+
strokeWidth='2'
|
|
1442
|
+
strokeOpacity='0.6'
|
|
1443
|
+
/>
|
|
1444
|
+
);
|
|
1445
|
+
})}
|
|
1446
|
+
{item.connections.map(
|
|
1447
|
+
(c: any, i: number) => (
|
|
1448
|
+
<line
|
|
1449
|
+
key={`conn-${i}`}
|
|
1450
|
+
x1={c.fromCol * COL_W + 10}
|
|
1451
|
+
y1={
|
|
1452
|
+
c.isBranchOff
|
|
1453
|
+
? rowCenter
|
|
1454
|
+
: '100%'
|
|
1455
|
+
}
|
|
1456
|
+
x2={c.toCol * COL_W + 10}
|
|
1457
|
+
y2={
|
|
1458
|
+
c.isBranchOff
|
|
1459
|
+
? '100%'
|
|
1460
|
+
: rowCenter
|
|
1461
|
+
}
|
|
1462
|
+
stroke={c.color}
|
|
1463
|
+
strokeWidth='2'
|
|
1464
|
+
strokeOpacity='0.6'
|
|
1465
|
+
/>
|
|
1466
|
+
),
|
|
1467
|
+
)}
|
|
1468
|
+
</svg>
|
|
1469
|
+
|
|
1470
|
+
<div
|
|
1471
|
+
className='history-dot'
|
|
1472
|
+
style={{
|
|
1473
|
+
left: `${item.track * COL_W + 10}px`,
|
|
1474
|
+
top: `${rowCenter}px`,
|
|
1475
|
+
width: item.isSubItem ? '6px' : '8px',
|
|
1476
|
+
height: item.isSubItem
|
|
1477
|
+
? '6px'
|
|
1478
|
+
: '8px',
|
|
1479
|
+
backgroundColor: color,
|
|
1480
|
+
}}
|
|
1481
|
+
/>
|
|
1482
|
+
</div>
|
|
1483
|
+
|
|
1484
|
+
{item.isSubItem ? (
|
|
1485
|
+
<div
|
|
1486
|
+
style={{ width: '24px', flexShrink: 0 }}
|
|
1487
|
+
/>
|
|
1488
|
+
) : (
|
|
1489
|
+
<Tooltip
|
|
1490
|
+
title={userDisplayLabel}
|
|
1491
|
+
placement='bottom'
|
|
1492
|
+
arrow
|
|
1493
|
+
>
|
|
1494
|
+
<div
|
|
1495
|
+
className={`editor__project-history-avatar user-avatar ${item.user.online ? 'user-avatar-online' : ''}`}
|
|
1496
|
+
>
|
|
1497
|
+
{item.user.picture ||
|
|
1498
|
+
item.user.avatar ? (
|
|
1499
|
+
<img
|
|
1500
|
+
src={
|
|
1501
|
+
item.user.picture ||
|
|
1502
|
+
item.user.avatar
|
|
1503
|
+
}
|
|
1504
|
+
alt={`Profile of ${userDisplayLabel}`}
|
|
1505
|
+
/>
|
|
1506
|
+
) : (
|
|
1507
|
+
<i
|
|
1508
|
+
className='fa-solid fa-user'
|
|
1509
|
+
style={{ fontSize: '14px' }}
|
|
1510
|
+
/>
|
|
1511
|
+
)}
|
|
1512
|
+
</div>
|
|
1513
|
+
</Tooltip>
|
|
1514
|
+
)}
|
|
1515
|
+
|
|
1516
|
+
<div
|
|
1517
|
+
className={`editor__project-history-content-right ${item.isSubItem ? 'sub-item' : ''}`}
|
|
1518
|
+
>
|
|
1519
|
+
<div
|
|
1520
|
+
style={{
|
|
1521
|
+
display: 'flex',
|
|
1522
|
+
justifyContent: 'space-between',
|
|
1523
|
+
alignItems: !!item.isSubItem
|
|
1524
|
+
? 'center'
|
|
1525
|
+
: 'flex-start',
|
|
1526
|
+
width: '100%',
|
|
1527
|
+
}}
|
|
1528
|
+
>
|
|
1529
|
+
<div
|
|
1530
|
+
style={{
|
|
1531
|
+
display: 'flex',
|
|
1532
|
+
flexDirection: 'column',
|
|
1533
|
+
gap: '4px',
|
|
1534
|
+
minWidth: 0,
|
|
1535
|
+
}}
|
|
1536
|
+
>
|
|
1537
|
+
{!item.isSubItem && (
|
|
1538
|
+
<div
|
|
1539
|
+
style={{
|
|
1540
|
+
display: 'flex',
|
|
1541
|
+
gap: '4px',
|
|
1542
|
+
alignItems: 'center',
|
|
1543
|
+
}}
|
|
1544
|
+
>
|
|
1545
|
+
<span className='history-user'>
|
|
1546
|
+
{userDisplayLabel}
|
|
1547
|
+
</span>
|
|
1548
|
+
{isActiveVersion && (
|
|
1549
|
+
<span className='history-active-badge'>
|
|
1550
|
+
Viewing
|
|
1551
|
+
</span>
|
|
1552
|
+
)}
|
|
1553
|
+
{isLiveVersion && (
|
|
1554
|
+
<Tooltip
|
|
1555
|
+
title='This version is currently live for your users'
|
|
1556
|
+
placement='top'
|
|
1557
|
+
arrow
|
|
1558
|
+
>
|
|
1559
|
+
<span className='history-live-badge'>
|
|
1560
|
+
<span className='history-live-badge__dot' />
|
|
1561
|
+
Live
|
|
1562
|
+
</span>
|
|
1563
|
+
</Tooltip>
|
|
1564
|
+
)}
|
|
1565
|
+
</div>
|
|
1566
|
+
)}
|
|
1567
|
+
<div
|
|
1568
|
+
style={{
|
|
1569
|
+
display: 'flex',
|
|
1570
|
+
gap: '6px',
|
|
1571
|
+
flexWrap: 'wrap',
|
|
1572
|
+
}}
|
|
1573
|
+
>
|
|
1574
|
+
{item.isMerge && (
|
|
1575
|
+
<span className='history-action-badge'>
|
|
1576
|
+
Merged
|
|
1577
|
+
</span>
|
|
1578
|
+
)}
|
|
1579
|
+
{!item.isMerge &&
|
|
1580
|
+
!item.isSubItem && (
|
|
1581
|
+
<span
|
|
1582
|
+
className='history-branch-badge'
|
|
1583
|
+
style={{
|
|
1584
|
+
backgroundColor: color,
|
|
1585
|
+
}}
|
|
1586
|
+
>
|
|
1587
|
+
{item.branchObj?.name}
|
|
1588
|
+
</span>
|
|
1589
|
+
)}
|
|
1590
|
+
{item.isSubItem && (
|
|
1591
|
+
<Tooltip
|
|
1592
|
+
title={
|
|
1593
|
+
<div
|
|
1594
|
+
style={{
|
|
1595
|
+
display: 'flex',
|
|
1596
|
+
flexDirection: 'column',
|
|
1597
|
+
gap: '2px',
|
|
1598
|
+
}}
|
|
1599
|
+
>
|
|
1600
|
+
<span>
|
|
1601
|
+
{item.actionName
|
|
1602
|
+
? toSentenceCase(
|
|
1603
|
+
item.actionName,
|
|
1604
|
+
)
|
|
1605
|
+
: 'Change made at:'}
|
|
1606
|
+
</span>
|
|
1607
|
+
<span
|
|
1608
|
+
style={{
|
|
1609
|
+
fontSize: '9px',
|
|
1610
|
+
opacity: 0.7,
|
|
1611
|
+
}}
|
|
1612
|
+
>
|
|
1613
|
+
{formattedDate}
|
|
1614
|
+
</span>
|
|
1615
|
+
</div>
|
|
1616
|
+
}
|
|
1617
|
+
placement='top'
|
|
1618
|
+
>
|
|
1619
|
+
<span className='history-mutation-label sub-item-label'>
|
|
1620
|
+
{!!item.actionName
|
|
1621
|
+
? toSentenceCase(
|
|
1622
|
+
item.actionName,
|
|
1623
|
+
)
|
|
1624
|
+
: `Modified at ${formattedDate}`}
|
|
1625
|
+
</span>
|
|
1626
|
+
</Tooltip>
|
|
1627
|
+
)}
|
|
1628
|
+
{item.isSubItem &&
|
|
1629
|
+
isActiveVersion && (
|
|
1630
|
+
<span className='history-active-badge'>
|
|
1631
|
+
Viewing
|
|
1632
|
+
</span>
|
|
1633
|
+
)}
|
|
1634
|
+
{item.isSubItem &&
|
|
1635
|
+
isLiveVersion && (
|
|
1636
|
+
<Tooltip
|
|
1637
|
+
title='This version is currently live for your users'
|
|
1638
|
+
placement='top'
|
|
1639
|
+
arrow
|
|
1640
|
+
>
|
|
1641
|
+
<span className='history-live-badge'>
|
|
1642
|
+
<span className='history-live-badge__dot' />
|
|
1643
|
+
Live
|
|
1644
|
+
</span>
|
|
1645
|
+
</Tooltip>
|
|
1646
|
+
)}
|
|
1647
|
+
</div>
|
|
1648
|
+
</div>
|
|
1649
|
+
|
|
1650
|
+
<div
|
|
1651
|
+
style={{
|
|
1652
|
+
display: 'flex',
|
|
1653
|
+
flexDirection: 'column',
|
|
1654
|
+
alignItems: 'flex-end',
|
|
1655
|
+
gap: '4px',
|
|
1656
|
+
flexShrink: 0,
|
|
1657
|
+
}}
|
|
1658
|
+
>
|
|
1659
|
+
{!item.isSubItem && (
|
|
1660
|
+
<span className='editor__project-history-timestamp'>
|
|
1661
|
+
{formattedDate}
|
|
1662
|
+
</span>
|
|
1663
|
+
)}
|
|
1664
|
+
{ENABLE_HISTORY_ACTIONS && (
|
|
1665
|
+
<div className='history-item-menu-wrapper'>
|
|
1666
|
+
<button
|
|
1667
|
+
className='history-item-action-btn'
|
|
1668
|
+
onClick={(e) => {
|
|
1669
|
+
e.stopPropagation();
|
|
1670
|
+
setOpenActionMenuId(
|
|
1671
|
+
openActionMenuId === item.id
|
|
1672
|
+
? null
|
|
1673
|
+
: item.id,
|
|
1674
|
+
);
|
|
1675
|
+
}}
|
|
1676
|
+
>
|
|
1677
|
+
<i className='fa-solid fa-ellipsis-vertical' />
|
|
1678
|
+
</button>
|
|
1679
|
+
{openActionMenuId === item.id && (
|
|
1680
|
+
<div className='history-item-dropdown-menu'>
|
|
1681
|
+
<button
|
|
1682
|
+
className='history-item-dropdown-btn'
|
|
1683
|
+
disabled={
|
|
1684
|
+
item.versionId ===
|
|
1685
|
+
props.project
|
|
1686
|
+
?.viewingVersionId
|
|
1687
|
+
}
|
|
1688
|
+
onClick={(e) => {
|
|
1689
|
+
e.stopPropagation();
|
|
1690
|
+
|
|
1691
|
+
// Navigate to the version's URL, which will trigger the project to load that version
|
|
1692
|
+
// Assemble new URL like `/ws/{workspaceSlug}/editor/{projectId}/{branchIdentifier}/{versionId}`
|
|
1693
|
+
const workspaceSlug =
|
|
1694
|
+
activeWorkspace?.slug;
|
|
1695
|
+
const projectId =
|
|
1696
|
+
project?.projectId;
|
|
1697
|
+
const branchIdentifier =
|
|
1698
|
+
item.branchObj
|
|
1699
|
+
?.identifier;
|
|
1700
|
+
const versionId =
|
|
1701
|
+
item.versionId;
|
|
1702
|
+
|
|
1703
|
+
if (
|
|
1704
|
+
!workspaceSlug ||
|
|
1705
|
+
!projectId ||
|
|
1706
|
+
!branchIdentifier ||
|
|
1707
|
+
!versionId
|
|
1708
|
+
) {
|
|
1709
|
+
popupNotification({
|
|
1710
|
+
color: 'error',
|
|
1711
|
+
text: 'Cannot preview version. Missing necessary data to load this version.',
|
|
1712
|
+
});
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
const path = `/ws/${workspaceSlug}/editor/${projectId}/${branchIdentifier}/${versionId}`;
|
|
1717
|
+
|
|
1718
|
+
// Check if new tab
|
|
1719
|
+
if (
|
|
1720
|
+
e.metaKey ||
|
|
1721
|
+
e.ctrlKey
|
|
1722
|
+
) {
|
|
1723
|
+
// Open same target in new tab
|
|
1724
|
+
window.open(
|
|
1725
|
+
path,
|
|
1726
|
+
'_blank',
|
|
1727
|
+
);
|
|
1728
|
+
setOpenActionMenuId(
|
|
1729
|
+
null,
|
|
1730
|
+
);
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// Replace the url and reload
|
|
1735
|
+
window.history.pushState(
|
|
1736
|
+
{},
|
|
1737
|
+
'',
|
|
1738
|
+
path,
|
|
1739
|
+
);
|
|
1740
|
+
window.location.reload();
|
|
1741
|
+
|
|
1742
|
+
setOpenActionMenuId(null);
|
|
1743
|
+
}}
|
|
1744
|
+
>
|
|
1745
|
+
<i className='fa-regular fa-eye' />{' '}
|
|
1746
|
+
Preview Version
|
|
1747
|
+
</button>
|
|
1748
|
+
</div>
|
|
1749
|
+
)}
|
|
1750
|
+
</div>
|
|
1751
|
+
)}
|
|
1752
|
+
</div>
|
|
1753
|
+
</div>
|
|
1754
|
+
|
|
1755
|
+
{!item.isSubItem && item.actionName && (
|
|
1756
|
+
<Tooltip
|
|
1757
|
+
title={
|
|
1758
|
+
<div
|
|
1759
|
+
style={{
|
|
1760
|
+
display: 'flex',
|
|
1761
|
+
flexDirection: 'column',
|
|
1762
|
+
gap: '2px',
|
|
1763
|
+
}}
|
|
1764
|
+
>
|
|
1765
|
+
<span>
|
|
1766
|
+
{toSentenceCase(
|
|
1767
|
+
item.actionName,
|
|
1768
|
+
)}
|
|
1769
|
+
</span>
|
|
1770
|
+
<span
|
|
1771
|
+
style={{
|
|
1772
|
+
fontSize: '9px',
|
|
1773
|
+
opacity: 0.7,
|
|
1774
|
+
}}
|
|
1775
|
+
>
|
|
1776
|
+
{formattedDate}
|
|
1777
|
+
</span>
|
|
1778
|
+
</div>
|
|
1779
|
+
}
|
|
1780
|
+
placement='top'
|
|
1781
|
+
>
|
|
1782
|
+
<span className='history-mutation-label full-width'>
|
|
1783
|
+
{toSentenceCase(item.actionName)}
|
|
1784
|
+
</span>
|
|
1785
|
+
</Tooltip>
|
|
1786
|
+
)}
|
|
1787
|
+
</div>
|
|
1788
|
+
</div>
|
|
1789
|
+
);
|
|
1790
|
+
})}
|
|
1791
|
+
</div>
|
|
1792
|
+
|
|
1793
|
+
{/* Load More Button */}
|
|
1794
|
+
{hasMoreData && hasVersionControl && (
|
|
1795
|
+
<div
|
|
1796
|
+
className='editor__project-history-load-more'
|
|
1797
|
+
style={{
|
|
1798
|
+
display: 'flex',
|
|
1799
|
+
justifyContent: 'center',
|
|
1800
|
+
padding: '16px',
|
|
1801
|
+
}}
|
|
1802
|
+
>
|
|
1803
|
+
<button
|
|
1804
|
+
className='history-btn outline'
|
|
1805
|
+
style={{ width: 'auto', padding: '6px 24px' }}
|
|
1806
|
+
onClick={() =>
|
|
1807
|
+
setOffset((prev) => prev + limit)
|
|
1808
|
+
}
|
|
1809
|
+
disabled={isLoadingMore}
|
|
1810
|
+
>
|
|
1811
|
+
{isLoadingMore ? (
|
|
1812
|
+
<i className='fa-solid fa-circle-notch fa-spin' />
|
|
1813
|
+
) : (
|
|
1814
|
+
'Load More'
|
|
1815
|
+
)}
|
|
1816
|
+
</button>
|
|
1817
|
+
</div>
|
|
1818
|
+
)}
|
|
1819
|
+
</div>
|
|
1820
|
+
|
|
1821
|
+
{/* The Overlay Magic (pointer-events: none) */}
|
|
1822
|
+
{!hasVersionControl && (
|
|
1823
|
+
<div
|
|
1824
|
+
className='editor__project-history-upgrade-overlay'
|
|
1825
|
+
style={{
|
|
1826
|
+
position: 'absolute',
|
|
1827
|
+
top: 0,
|
|
1828
|
+
left: 0,
|
|
1829
|
+
right: 0,
|
|
1830
|
+
bottom: 0,
|
|
1831
|
+
// Fades slightly slower so the scroll feels dynamic
|
|
1832
|
+
background:
|
|
1833
|
+
'linear-gradient(rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 120px, rgba(255, 255, 255, 0.8) 280px, rgb(255, 255, 255) 500px)',
|
|
1834
|
+
display: 'flex',
|
|
1835
|
+
flexDirection: 'column',
|
|
1836
|
+
alignItems: 'center',
|
|
1837
|
+
textAlign: 'center',
|
|
1838
|
+
padding: '32px',
|
|
1839
|
+
zIndex: 10,
|
|
1840
|
+
borderRadius: '0 0 8px 8px',
|
|
1841
|
+
pointerEvents: 'none',
|
|
1842
|
+
}}
|
|
1843
|
+
>
|
|
1844
|
+
{/* Re-enable pointer events just for the text/button so it remains clickable */}
|
|
1845
|
+
<div
|
|
1846
|
+
style={{
|
|
1847
|
+
pointerEvents: 'auto',
|
|
1848
|
+
display: 'flex',
|
|
1849
|
+
flexDirection: 'column',
|
|
1850
|
+
alignItems: 'center',
|
|
1851
|
+
}}
|
|
1852
|
+
>
|
|
1853
|
+
<ProPlanChip />
|
|
1854
|
+
<h4
|
|
1855
|
+
style={{
|
|
1856
|
+
marginTop: '12px',
|
|
1857
|
+
marginBottom: '4px',
|
|
1858
|
+
color: '#111827',
|
|
1859
|
+
fontSize: '14px',
|
|
1860
|
+
}}
|
|
1861
|
+
>
|
|
1862
|
+
Unlock Version History
|
|
1863
|
+
</h4>
|
|
1864
|
+
<p
|
|
1865
|
+
style={{
|
|
1866
|
+
margin: 0,
|
|
1867
|
+
fontSize: '12px',
|
|
1868
|
+
color: '#6b7280',
|
|
1869
|
+
marginBottom: '20px',
|
|
1870
|
+
}}
|
|
1871
|
+
>
|
|
1872
|
+
Upgrade to Pro to track every change, restore
|
|
1873
|
+
past versions, and collaborate safely.
|
|
1874
|
+
</p>
|
|
1875
|
+
<button
|
|
1876
|
+
className='history-btn solid'
|
|
1877
|
+
style={{ width: '100%', flex: 'none' }}
|
|
1878
|
+
onClick={() =>
|
|
1879
|
+
window.open('/pricing/plans', '_blank')
|
|
1880
|
+
}
|
|
1881
|
+
>
|
|
1882
|
+
Upgrade to Pro
|
|
1883
|
+
</button>
|
|
1884
|
+
</div>
|
|
1885
|
+
</div>
|
|
1886
|
+
)}
|
|
1887
|
+
</div>
|
|
1888
|
+
)}
|
|
1889
|
+
</>
|
|
1890
|
+
)}
|
|
1891
|
+
|
|
1892
|
+
{activeTab === 'merges' && (
|
|
1893
|
+
<div className='editor__project-history-empty'>
|
|
1894
|
+
<i
|
|
1895
|
+
className='fa-solid fa-code-merge'
|
|
1896
|
+
style={{
|
|
1897
|
+
fontSize: 24,
|
|
1898
|
+
marginBottom: 12,
|
|
1899
|
+
color: '#a683fc',
|
|
1900
|
+
}}
|
|
1901
|
+
/>
|
|
1902
|
+
<p
|
|
1903
|
+
style={{
|
|
1904
|
+
margin: '0 0 8px 0',
|
|
1905
|
+
fontWeight: 600,
|
|
1906
|
+
color: '#111827',
|
|
1907
|
+
}}
|
|
1908
|
+
>
|
|
1909
|
+
Merge Requests
|
|
1910
|
+
</p>
|
|
1911
|
+
<span className='history-coming-soon-badge'>
|
|
1912
|
+
Coming soon
|
|
1913
|
+
</span>
|
|
1914
|
+
</div>
|
|
1915
|
+
)}
|
|
1916
|
+
</div>
|
|
1917
|
+
|
|
1918
|
+
<div className='editor__project-history-footer'>
|
|
1919
|
+
<div className='history-btn-wrapper'>
|
|
1920
|
+
<button
|
|
1921
|
+
className='history-btn outline'
|
|
1922
|
+
disabled
|
|
1923
|
+
style={{ opacity: 0.5, cursor: 'not-allowed' }}
|
|
1924
|
+
>
|
|
1925
|
+
<i className='fa-solid fa-code-merge' /> MERGE
|
|
1926
|
+
</button>
|
|
1927
|
+
<span className='history-coming-soon-badge floating'>
|
|
1928
|
+
Coming soon
|
|
1929
|
+
</span>
|
|
1930
|
+
</div>
|
|
1931
|
+
<div className='history-btn-wrapper'>
|
|
1932
|
+
<button
|
|
1933
|
+
className='history-btn solid'
|
|
1934
|
+
disabled
|
|
1935
|
+
style={{ opacity: 0.5, cursor: 'not-allowed' }}
|
|
1936
|
+
>
|
|
1937
|
+
<i className='fa-solid fa-code-branch' /> BRANCH
|
|
1938
|
+
</button>
|
|
1939
|
+
<span className='history-coming-soon-badge floating'>
|
|
1940
|
+
Coming soon
|
|
1941
|
+
</span>
|
|
1942
|
+
</div>
|
|
1943
|
+
</div>
|
|
1944
|
+
</div>
|
|
1945
|
+
)}
|
|
1946
|
+
</>
|
|
1947
|
+
)}
|
|
1948
|
+
</div>
|
|
1949
|
+
|
|
1950
|
+
{isViewingOlderVersion ? (
|
|
1951
|
+
<div className='editor__project-name-secondary-badge'>
|
|
1952
|
+
<Tooltip
|
|
1953
|
+
title={
|
|
1954
|
+
currentlyViewedItem ? (
|
|
1955
|
+
<div
|
|
1956
|
+
style={{
|
|
1957
|
+
display: 'flex',
|
|
1958
|
+
flexDirection: 'column',
|
|
1959
|
+
gap: '2px',
|
|
1960
|
+
}}
|
|
1961
|
+
>
|
|
1962
|
+
<span>{viewedItemAction}</span>
|
|
1963
|
+
<span style={{ fontSize: '9px', opacity: 0.7 }}>
|
|
1964
|
+
{viewedItemDateStr}
|
|
1965
|
+
</span>
|
|
1966
|
+
</div>
|
|
1967
|
+
) : (
|
|
1968
|
+
'Viewing an older version of the project'
|
|
1969
|
+
)
|
|
1970
|
+
}
|
|
1971
|
+
placement='bottom'
|
|
1972
|
+
arrow
|
|
1973
|
+
>
|
|
1974
|
+
<span style={{ cursor: 'default' }}>Viewing older version</span>
|
|
1975
|
+
</Tooltip>
|
|
1976
|
+
|
|
1977
|
+
<Tooltip
|
|
1978
|
+
title='Restore this version to be the new active latest version'
|
|
1979
|
+
placement='bottom'
|
|
1980
|
+
arrow
|
|
1981
|
+
>
|
|
1982
|
+
<button
|
|
1983
|
+
onClick={async () => {
|
|
1984
|
+
if (!project) return;
|
|
1985
|
+
|
|
1986
|
+
try {
|
|
1987
|
+
await project.moveBranchHeadToVersion(
|
|
1988
|
+
project.viewingVersion,
|
|
1989
|
+
'restore',
|
|
1990
|
+
true,
|
|
1991
|
+
);
|
|
1992
|
+
|
|
1993
|
+
// Set the URL and reload the page
|
|
1994
|
+
const newUrl = `${window.location.origin}/editor/${project.projectId}/${project.branchHead?.identifier || 'main'}/latest`;
|
|
1995
|
+
window.history.pushState({ path: newUrl }, '', newUrl);
|
|
1996
|
+
window.location.reload();
|
|
1997
|
+
} catch (error) {
|
|
1998
|
+
console.error('Error restoring version:', error);
|
|
1999
|
+
// Optionally, you could show a user-friendly error message here
|
|
2000
|
+
}
|
|
2001
|
+
}}
|
|
2002
|
+
>
|
|
2003
|
+
Restore
|
|
2004
|
+
</button>
|
|
2005
|
+
</Tooltip>
|
|
2006
|
+
</div>
|
|
2007
|
+
) : (
|
|
2008
|
+
project?.ready &&
|
|
2009
|
+
project?.READ_ONLY && (
|
|
2010
|
+
<div className='editor__project-name-secondary-badge'>
|
|
2011
|
+
<Tooltip
|
|
2012
|
+
title="This project is read-only because because you don't have permission to edit"
|
|
2013
|
+
placement='bottom'
|
|
2014
|
+
arrow
|
|
2015
|
+
>
|
|
2016
|
+
<span style={{ cursor: 'default' }}>Read-only</span>
|
|
2017
|
+
</Tooltip>
|
|
2018
|
+
</div>
|
|
2019
|
+
)
|
|
2020
|
+
)}
|
|
2021
|
+
</div>
|
|
2022
|
+
);
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
export default ProjectName;
|