diff --git a/services/web/frontend/js/features/ide-redesign/components/toolbar/share-project-button.tsx b/services/web/frontend/js/features/ide-redesign/components/toolbar/share-project-button.tsx
new file mode 100644
index 0000000000..aeefb1336f
--- /dev/null
+++ b/services/web/frontend/js/features/ide-redesign/components/toolbar/share-project-button.tsx
@@ -0,0 +1,40 @@
+import ShareProjectModal from '@/features/share-project-modal/components/share-project-modal'
+import OLButton from '@/features/ui/components/ol/ol-button'
+import MaterialIcon from '@/shared/components/material-icon'
+import { useCallback, useState } from 'react'
+import { useTranslation } from 'react-i18next'
+import * as eventTracking from '@/infrastructure/event-tracking'
+
+export default function ShareProjectButton() {
+ const { t } = useTranslation()
+
+ const [showShareModal, setShowShareModal] = useState(false)
+
+ const handleOpenShareModal = useCallback(() => {
+ eventTracking.sendMBOnce('ide-open-share-modal-once')
+ setShowShareModal(true)
+ }, [])
+
+ const handleHideShareModal = useCallback(() => {
+ setShowShareModal(false)
+ }, [])
+
+ return (
+ <>
+
+
}
+ onClick={handleOpenShareModal}
+ >
+ {t('share')}
+
+
+
+ >
+ )
+}
diff --git a/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx b/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx
index d5ceee5dbf..a7043dc688 100644
--- a/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx
+++ b/services/web/frontend/js/features/ide-redesign/components/toolbar/toolbar.tsx
@@ -4,6 +4,12 @@ import { useTranslation } from 'react-i18next'
import { ToolbarMenuBar } from './menu-bar'
import { ToolbarProjectTitle } from './project-title'
import { OnlineUsers } from './online-users'
+import ShareProjectButton from './share-project-button'
+import importOverleafModules from '../../../../../macros/import-overleaf-module.macro'
+import { useEditorContext } from '@/shared/context/editor-context'
+
+const [publishModalModules] = importOverleafModules('publishModal')
+const SubmitProjectButton = publishModalModules?.import.NewPublishToolbarButton
export const Toolbar = () => {
return (
@@ -35,7 +41,12 @@ const ToolbarMenus = () => {
}
const ToolbarButtons = () => {
- const { t } = useTranslation()
+ const { permissionsLevel } = useEditorContext()
+
+ const shouldDisplaySubmitButton =
+ (permissionsLevel === 'owner' || permissionsLevel === 'readAndWrite') &&
+ SubmitProjectButton
+
return (
@@ -46,23 +57,8 @@ const ToolbarButtons = () => {
leadingIcon={}
/>
-
-
}
- >
- {t('submit_title')}
-
-
-
-
}
- >
- {t('share')}
-
-
+ {shouldDisplaySubmitButton && }
+
)
}