From 479c9fce50649c27b347552104de60bf0de87f68 Mon Sep 17 00:00:00 2001 From: yu-i-i Date: Thu, 9 Jul 2026 22:19:30 +0200 Subject: [PATCH] Git bridge, Template gallery: remove integration with the old editor code --- services/web/config/settings.defaults.js | 14 +-- .../card/components/git-integration-card.tsx | 8 +- .../js/card/components/git-modal-content.tsx | 75 ----------- .../js/card/components/git-modal-wrapper.tsx | 29 ----- .../frontend/js/card/components/git-modal.tsx | 117 ++++++++++++------ .../components/actions-manage-template.tsx | 72 ----------- 6 files changed, 88 insertions(+), 227 deletions(-) delete mode 100644 services/web/modules/git-bridge/frontend/js/card/components/git-modal-content.tsx delete mode 100644 services/web/modules/git-bridge/frontend/js/card/components/git-modal-wrapper.tsx delete mode 100644 services/web/modules/template-gallery/frontend/js/features/template/components/actions-manage-template.tsx diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index ecb6565341..edf623c288 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -1086,18 +1086,8 @@ module.exports = { '../modules/github-sync/frontend/js/components/import-from-github-menu.tsx' ), ], - editorLeftMenuSync: [ - Path.resolve( - __dirname, - '../modules/git-bridge/frontend/js/card/components/git-modal.tsx' - ), - ], - editorLeftMenuManageTemplate: [ - Path.resolve( - __dirname, - '../modules/template-gallery/frontend/js/features/template/components/actions-manage-template' - ), - ], + editorLeftMenuSync: [], + editorLeftMenuManageTemplate: [], menubarExtraComponents: [ Path.resolve( __dirname, diff --git a/services/web/modules/git-bridge/frontend/js/card/components/git-integration-card.tsx b/services/web/modules/git-bridge/frontend/js/card/components/git-integration-card.tsx index e8685b9346..234871b979 100644 --- a/services/web/modules/git-bridge/frontend/js/card/components/git-integration-card.tsx +++ b/services/web/modules/git-bridge/frontend/js/card/components/git-integration-card.tsx @@ -1,10 +1,10 @@ import { useTranslation } from 'react-i18next' import { useState } from 'react' import { useProjectContext } from '@/shared/context/project-context' +import { OLModal } from '@/shared/components/ol/ol-modal' import IntegrationCard from '@/features/integrations-panel/integration-card.tsx' import GitLogoOrange from '@/shared/svgs/git-logo-orange' - -import GitModalWrapper from './git-modal-wrapper' +import GitModal from './git-modal' function GitSyncCard() { const { t } = useTranslation() @@ -23,10 +23,10 @@ function GitSyncCard() { onClick={() => setShow(true)} /> - setShow(false)} projectId={projectId} + handleHide={() => setShow(false)} /> ) diff --git a/services/web/modules/git-bridge/frontend/js/card/components/git-modal-content.tsx b/services/web/modules/git-bridge/frontend/js/card/components/git-modal-content.tsx deleted file mode 100644 index 5ad515bf16..0000000000 --- a/services/web/modules/git-bridge/frontend/js/card/components/git-modal-content.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { Trans, useTranslation } from 'react-i18next' -import { CopyToClipboard } from '@/shared/components/copy-to-clipboard' - -import { - OLModalBody, - OLModalFooter, - OLModalHeader, - OLModalTitle, -} from '@/shared/components/ol/ol-modal' -import OLButton from '@/shared/components/ol/ol-button' - -type Props = { - handleHide: () => void - projectId: string -} - -export default function GitModalContent({ - handleHide, - projectId, -}: Props) { - const { t } = useTranslation() - - const gitCloneCommand = `git clone ${window.location.protocol}//git@${window.location.host}/git/${projectId}` - - return ( - <> - - {t('clone_with_git')} - - - -

{t('git_bridge_modal_git_clone_your_project')}

- -
- - - {gitCloneCommand} - - - -
- , - ]} - /> -
- - - - {t('close')} - - - {t('go_to_settings')} - - - - ) -} diff --git a/services/web/modules/git-bridge/frontend/js/card/components/git-modal-wrapper.tsx b/services/web/modules/git-bridge/frontend/js/card/components/git-modal-wrapper.tsx deleted file mode 100644 index 468e03ade3..0000000000 --- a/services/web/modules/git-bridge/frontend/js/card/components/git-modal-wrapper.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { OLModal } from '@/shared/components/ol/ol-modal' -import GitModalContent from './git-modal-content' - -type Props = { - show: boolean - projectId: string - handleHide: () => void -} - -export default function GitModalWrapper({ - show, - projectId, - handleHide, -}: Props) { - return ( - - - - ) -} diff --git a/services/web/modules/git-bridge/frontend/js/card/components/git-modal.tsx b/services/web/modules/git-bridge/frontend/js/card/components/git-modal.tsx index 41d14c5b9d..98840368ac 100644 --- a/services/web/modules/git-bridge/frontend/js/card/components/git-modal.tsx +++ b/services/web/modules/git-bridge/frontend/js/card/components/git-modal.tsx @@ -1,39 +1,86 @@ -import { useTranslation } from 'react-i18next' -import { useState } from 'react' -import getMeta from '@/utils/meta' -import GitFork from '@/shared/svgs/git-fork' -import { useProjectContext } from '@/shared/context/project-context' -import LeftMenuButton from '@/features/editor-left-menu/components/left-menu-button' -import GitModalWrapper from './git-modal-wrapper' +import { Trans, useTranslation } from 'react-i18next' +import { CopyToClipboard } from '@/shared/components/copy-to-clipboard' -function GitSyncButton() { - const { t } = useTranslation() - const { project } = useProjectContext() - const [show, setShow] = useState(false) +import { + OLModal, + OLModalBody, + OLModalFooter, + OLModalHeader, + OLModalTitle, +} from '@/shared/components/ol/ol-modal' +import OLButton from '@/shared/components/ol/ol-button' - const gitBridgeEnabled = getMeta('ol-gitBridgeEnabled') - const projectId = project?._id - - if (!gitBridgeEnabled || !projectId) return null - - return ( - <> - setShow(true)} - icon={} - > - {t('git')} - - - setShow(false)} - projectId={projectId} - /> - - ) +type Props = { + show: bool + handleHide: () => void + projectId: string } -export default GitSyncButton +export default function GitModal({ + show, + handleHide, + projectId, +}: Props) { + const { t } = useTranslation() + + const gitCloneCommand = `git clone ${window.location.protocol}//git@${window.location.host}/git/${projectId}` + + return ( + + + + {t('clone_with_git')} + + + +

{t('git_bridge_modal_git_clone_your_project')}

+ +
+ + + {gitCloneCommand} + + + +
+ , + ]} + /> +
+ + + + {t('close')} + + + {t('go_to_settings')} + + +
+ ) +} diff --git a/services/web/modules/template-gallery/frontend/js/features/template/components/actions-manage-template.tsx b/services/web/modules/template-gallery/frontend/js/features/template/components/actions-manage-template.tsx deleted file mode 100644 index 2591dd7974..0000000000 --- a/services/web/modules/template-gallery/frontend/js/features/template/components/actions-manage-template.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { useCallback, useState } from 'react' -import { useTranslation } from 'react-i18next' -import * as eventTracking from '@/infrastructure/event-tracking' -import getMeta from '@/utils/meta' -import OLTooltip from '@/shared/components/ol/ol-tooltip' -import { useDetachCompileContext } from '@/shared/context/detach-compile-context' -import EditorManageTemplateModalWrapper from './manage-template-modal/editor-manage-template-modal-wrapper' -import LeftMenuButton from '@/features/editor-left-menu/components/left-menu-button' - -type TemplateManageResponse = { - template_id: string -} - -export default function ActionsManageTemplate() { - - const templatesAdmin = getMeta('ol-showTemplatesServerPro') - if (!templatesAdmin) { - return null - } - - const [showModal, setShowModal] = useState(false) - const { pdfFile } = useDetachCompileContext() - const { t } = useTranslation() - - const handleShowModal = useCallback(() => { - eventTracking.sendMB('left-menu-template') - setShowModal(true) - }, []) - - const openTemplate = useCallback( - ({ template_id: templateId }: TemplateManageResponse) => { - location.assign(`/template/${templateId}`) - }, - [] - ) - - return ( - <> - {pdfFile ? ( - - {t('publish_as_template')} - - ) : ( - - {/* OverlayTrigger won't fire unless the child is a non-react html element (e.g div, span) */} -
- - {t('publish_as_template')} - -
-
- )} - setShowModal(false)} - openTemplate={openTemplate} - /> - - ) -}