diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 25d290dc61..5fc97510da 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -97,6 +97,7 @@ "autocomplete_references": "", "back": "", "back_to_configuration": "", + "back_to_editor": "", "back_to_subscription": "", "back_to_your_projects": "", "beta_program_already_participating": "", diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/back-to-editor-button.tsx b/services/web/frontend/js/features/editor-navigation-toolbar/components/back-to-editor-button.tsx new file mode 100644 index 0000000000..b87b634b1a --- /dev/null +++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/back-to-editor-button.tsx @@ -0,0 +1,21 @@ +import { useTranslation } from 'react-i18next' +import { Button } from 'react-bootstrap' +import MaterialIcon from '@/shared/components/material-icon' + +function BackToEditorButton({ onClick }: { onClick: () => void }) { + const { t } = useTranslation() + + return ( + + ) +} + +export default BackToEditorButton diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.tsx b/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.tsx index d4b062202c..3a3477c859 100644 --- a/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.tsx +++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react' +import React, { useState, useCallback } from 'react' import ToolbarHeader from './toolbar-header' import { useEditorContext } from '../../../shared/context/editor-context' import { useChatContext } from '../../chat/context/chat-context' @@ -66,11 +66,21 @@ const EditorNavigationToolbarRoot = React.memo( [reviewPanelOpen, setReviewPanelOpen] ) + const [shouldReopenChat, setShouldReopenChat] = useState(chatIsOpen) const toggleHistoryOpen = useCallback(() => { const action = view === 'history' ? 'close' : 'open' eventTracking.sendMB('navigation-clicked-history', { action }) + + if (chatIsOpen && action === 'open') { + setShouldReopenChat(true) + toggleChatOpen() + } + if (shouldReopenChat && action === 'close') { + setShouldReopenChat(false) + toggleChatOpen() + } setView(view === 'history' ? 'editor' : 'history') - }, [view, setView]) + }, [view, chatIsOpen, shouldReopenChat, setView, toggleChatOpen]) const openShareModal = useCallback(() => { eventTracking.sendMB('navigation-clicked-share') diff --git a/services/web/frontend/js/features/editor-navigation-toolbar/components/history-toggle-button.jsx b/services/web/frontend/js/features/editor-navigation-toolbar/components/history-toggle-button.jsx index 3a19ea9274..bd135c17e2 100644 --- a/services/web/frontend/js/features/editor-navigation-toolbar/components/history-toggle-button.jsx +++ b/services/web/frontend/js/features/editor-navigation-toolbar/components/history-toggle-button.jsx @@ -1,18 +1,13 @@ import PropTypes from 'prop-types' -import classNames from 'classnames' import { useTranslation } from 'react-i18next' import Icon from '../../../shared/components/icon' -function HistoryToggleButton({ historyIsOpen, onClick }) { +function HistoryToggleButton({ onClick }) { const { t } = useTranslation() - const classes = classNames('btn', 'btn-full-height', { - active: historyIsOpen, - }) - return (