Rename document tab in sidebar based on editor mode

[MAILPOET-6336]
This commit is contained in:
Rostislav Wolny
2024-12-02 16:13:29 +01:00
committed by Rostislav Wolný
parent ed8d64816c
commit c612eb1c4e

View File

@ -13,12 +13,16 @@ import { Tabs } from '../../private-apis';
* Internal dependencies * Internal dependencies
*/ */
import { mainSidebarDocumentTab, mainSidebarBlockTab } from '../../store'; import { mainSidebarDocumentTab, mainSidebarBlockTab } from '../../store';
import { useEditorMode } from '../../hooks';
export function HeaderTabs( _, ref ) { export function HeaderTabs( _, ref ) {
const [ editorMode ] = useEditorMode();
return ( return (
<Tabs.TabList ref={ ref }> <Tabs.TabList ref={ ref }>
<Tabs.Tab tabId={ mainSidebarDocumentTab }> <Tabs.Tab tabId={ mainSidebarDocumentTab }>
{ __( 'Email', 'mailpoet' ) } { editorMode === 'template'
? __( 'Template', 'mailpoet' )
: __( 'Email', 'mailpoet' ) }
</Tabs.Tab> </Tabs.Tab>
<Tabs.Tab tabId={ mainSidebarBlockTab }>{ __( 'Block' ) }</Tabs.Tab> <Tabs.Tab tabId={ mainSidebarBlockTab }>{ __( 'Block' ) }</Tabs.Tab>
</Tabs.TabList> </Tabs.TabList>