mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Git bridge, Template gallery: remove integration with the old editor code
This commit is contained in:
@@ -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,
|
||||
|
||||
+4
-4
@@ -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)}
|
||||
/>
|
||||
|
||||
<GitModalWrapper
|
||||
<GitModal
|
||||
show={show}
|
||||
handleHide={() => setShow(false)}
|
||||
projectId={projectId}
|
||||
handleHide={() => setShow(false)}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<OLModalHeader closeButton>
|
||||
<OLModalTitle>{t('clone_with_git')}</OLModalTitle>
|
||||
</OLModalHeader>
|
||||
|
||||
<OLModalBody>
|
||||
<p>{t('git_bridge_modal_git_clone_your_project')}</p>
|
||||
|
||||
<div className="git-bridge-copy">
|
||||
<span aria-label={t('git_clone_project_command')}>
|
||||
<code>
|
||||
{gitCloneCommand}
|
||||
</code>
|
||||
</span>
|
||||
<CopyToClipboard
|
||||
content={gitCloneCommand}
|
||||
tooltipId="git-copy-clone-project-command-tooltip"
|
||||
/>
|
||||
</div>
|
||||
<Trans
|
||||
i18nKey="git_bridge_modal_use_previous_token"
|
||||
components={[
|
||||
<a
|
||||
href="/learn/how-to/Git_integration_authentication_tokens"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
/>,
|
||||
]}
|
||||
/>
|
||||
</OLModalBody>
|
||||
|
||||
<OLModalFooter>
|
||||
<OLButton
|
||||
variant="secondary"
|
||||
onClick={handleHide}
|
||||
>
|
||||
{t('close')}
|
||||
</OLButton>
|
||||
<OLButton
|
||||
variant="primary"
|
||||
href="/user/settings"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
{t('go_to_settings')}
|
||||
</OLButton>
|
||||
</OLModalFooter>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -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 (
|
||||
<OLModal
|
||||
show={show}
|
||||
onHide={handleHide}
|
||||
id="git-sync-modal"
|
||||
backdrop="static"
|
||||
size="lg"
|
||||
>
|
||||
<GitModalContent
|
||||
projectId={projectId}
|
||||
handleHide={handleHide}
|
||||
/>
|
||||
</OLModal>
|
||||
)
|
||||
}
|
||||
@@ -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 (
|
||||
<>
|
||||
<LeftMenuButton
|
||||
variant="link"
|
||||
className="left-menu-button"
|
||||
onClick={() => setShow(true)}
|
||||
icon={<GitFork />}
|
||||
>
|
||||
{t('git')}
|
||||
</LeftMenuButton>
|
||||
|
||||
<GitModalWrapper
|
||||
show={show}
|
||||
handleHide={() => 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 (
|
||||
<OLModal
|
||||
show={show}
|
||||
onHide={handleHide}
|
||||
id="git-sync-modal"
|
||||
backdrop="static"
|
||||
size="lg"
|
||||
>
|
||||
|
||||
<OLModalHeader closeButton>
|
||||
<OLModalTitle>{t('clone_with_git')}</OLModalTitle>
|
||||
</OLModalHeader>
|
||||
|
||||
<OLModalBody>
|
||||
<p>{t('git_bridge_modal_git_clone_your_project')}</p>
|
||||
|
||||
<div className="git-bridge-copy">
|
||||
<span aria-label={t('git_clone_project_command')}>
|
||||
<code>
|
||||
{gitCloneCommand}
|
||||
</code>
|
||||
</span>
|
||||
<CopyToClipboard
|
||||
content={gitCloneCommand}
|
||||
tooltipId="git-copy-clone-project-command-tooltip"
|
||||
kind={'button'}
|
||||
/>
|
||||
</div>
|
||||
<Trans
|
||||
i18nKey="git_bridge_modal_use_previous_token"
|
||||
components={[
|
||||
<a
|
||||
href="/learn/how-to/Git_integration_authentication_tokens"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
/>,
|
||||
]}
|
||||
/>
|
||||
</OLModalBody>
|
||||
|
||||
<OLModalFooter>
|
||||
<OLButton
|
||||
variant="secondary"
|
||||
onClick={handleHide}
|
||||
>
|
||||
{t('close')}
|
||||
</OLButton>
|
||||
<OLButton
|
||||
variant="primary"
|
||||
href="/user/settings#project-sync"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
{t('go_to_settings')}
|
||||
</OLButton>
|
||||
</OLModalFooter>
|
||||
</OLModal>
|
||||
)
|
||||
}
|
||||
|
||||
-72
@@ -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 ? (
|
||||
<LeftMenuButton onClick={handleShowModal} icon='open_in_new'>
|
||||
{t('publish_as_template')}
|
||||
</LeftMenuButton>
|
||||
) : (
|
||||
<OLTooltip
|
||||
id="disabled-publish-as-template"
|
||||
description={t('please_compile_pdf_before_publish_as_template')}
|
||||
overlayProps={{
|
||||
placement: 'top',
|
||||
}}
|
||||
>
|
||||
{/* OverlayTrigger won't fire unless the child is a non-react html element (e.g div, span) */}
|
||||
<div>
|
||||
<LeftMenuButton
|
||||
icon='open_in_new'
|
||||
disabled
|
||||
disabledAccesibilityText={t(
|
||||
'please_compile_pdf_before_publish_as_template'
|
||||
)}
|
||||
>
|
||||
{t('publish_as_template')}
|
||||
</LeftMenuButton>
|
||||
</div>
|
||||
</OLTooltip>
|
||||
)}
|
||||
<EditorManageTemplateModalWrapper
|
||||
show={showModal}
|
||||
handleHide={() => setShowModal(false)}
|
||||
openTemplate={openTemplate}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user