|
@@ -1,24 +1,33 @@
|
|
|
-import React, { useEffect } from 'react';
|
|
|
+import React from 'react';
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
-import Button from '../components/Button';
|
|
|
-import ExpansionPanel from '../components/ExpansionPanel';
|
|
|
-import Icon from '../components/Icon';
|
|
|
+// import Button from '../components/Button';
|
|
|
+// import ExpansionPanel from '../components/ExpansionPanel';
|
|
|
+// import Icon from '../components/Icon';
|
|
|
import HighlightTools from './HighlightTools';
|
|
|
import FreehandTools from './FreehandTools';
|
|
|
import TextTools from './FreeTextTools';
|
|
|
import StickyNoteTools from './StickyNoteTools';
|
|
|
import ShapeTools from './ShapeTools';
|
|
|
+import WatermarkTool from './WatermarkTool';
|
|
|
|
|
|
import useActions from '../actions';
|
|
|
import useStore from '../store';
|
|
|
|
|
|
const MarkupTools: React.FC = () => {
|
|
|
const { t } = useTranslation('sidebar');
|
|
|
- const [{ sidebarState, markupToolState }, dispatch] = useStore();
|
|
|
- const { setSidebar, setMarkupTool } = useActions(dispatch);
|
|
|
+ const [{ sidebarState }, dispatch] = useStore();
|
|
|
+ const { setSidebar } = useActions(dispatch);
|
|
|
|
|
|
- const onClickSidebar = (state: string): void => {
|
|
|
+ // const onClickSidebar = (state: string): void => {
|
|
|
+ // if (state === sidebarState) {
|
|
|
+ // setSidebar('');
|
|
|
+ // } else {
|
|
|
+ // setSidebar(state);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ const onClickTool = (state: string): void => {
|
|
|
if (state === sidebarState) {
|
|
|
setSidebar('');
|
|
|
} else {
|
|
@@ -26,71 +35,64 @@ const MarkupTools: React.FC = () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const onClickTool = (state: string): void => {
|
|
|
- if (state === markupToolState) {
|
|
|
- setMarkupTool('');
|
|
|
- } else {
|
|
|
- setMarkupTool(state);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- useEffect(() => {
|
|
|
- if (sidebarState !== 'markup-tools') {
|
|
|
- setMarkupTool('');
|
|
|
- }
|
|
|
- }, []);
|
|
|
+ // useEffect(() => {
|
|
|
+ // if (sidebarState !== 'markup-tools') {
|
|
|
+ // setSidebar('');
|
|
|
+ // }
|
|
|
+ // }, []);
|
|
|
|
|
|
- const Label = (
|
|
|
- <Button
|
|
|
- shouldFitContainer
|
|
|
- align="left"
|
|
|
- onClick={(): void => {
|
|
|
- onClickSidebar('markup-tools');
|
|
|
- }}
|
|
|
- >
|
|
|
- <Icon glyph="markup-tools" style={{ marginRight: '10px' }} />
|
|
|
- {t('markupTool')}
|
|
|
- </Button>
|
|
|
- );
|
|
|
+ // const Label = (
|
|
|
+ // <Button
|
|
|
+ // shouldFitContainer
|
|
|
+ // align="left"
|
|
|
+ // onClick={(): void => {
|
|
|
+ // onClickSidebar('markup-tools');
|
|
|
+ // }}
|
|
|
+ // >
|
|
|
+ // <Icon glyph="markup-tools" style={{ marginRight: '10px' }} />
|
|
|
+ // {t('markupTool')}
|
|
|
+ // </Button>
|
|
|
+ // );
|
|
|
|
|
|
return (
|
|
|
- <ExpansionPanel label={Label} isActive={sidebarState === 'markup-tools'}>
|
|
|
+ <>
|
|
|
<HighlightTools
|
|
|
title={t('annotate')}
|
|
|
- isActive={markupToolState === 'highlight'}
|
|
|
+ isActive={sidebarState === 'highlight'}
|
|
|
onClick={(): void => {
|
|
|
onClickTool('highlight');
|
|
|
}}
|
|
|
/>
|
|
|
<FreehandTools
|
|
|
title={t('freehand')}
|
|
|
- isActive={markupToolState === 'freehand'}
|
|
|
+ isActive={sidebarState === 'freehand'}
|
|
|
onClick={(): void => {
|
|
|
onClickTool('freehand');
|
|
|
}}
|
|
|
/>
|
|
|
<TextTools
|
|
|
title={t('textBox')}
|
|
|
- isActive={markupToolState === 'text'}
|
|
|
+ isActive={sidebarState === 'text'}
|
|
|
onClick={(): void => {
|
|
|
onClickTool('text');
|
|
|
}}
|
|
|
/>
|
|
|
<StickyNoteTools
|
|
|
title={t('stickyNote')}
|
|
|
- isActive={markupToolState === 'sticky'}
|
|
|
+ isActive={sidebarState === 'sticky'}
|
|
|
onClick={(): void => {
|
|
|
onClickTool('sticky');
|
|
|
}}
|
|
|
/>
|
|
|
<ShapeTools
|
|
|
title={t('shape')}
|
|
|
- isActive={markupToolState === 'shape'}
|
|
|
+ isActive={sidebarState === 'shape'}
|
|
|
onClick={(): void => {
|
|
|
onClickTool('shape');
|
|
|
}}
|
|
|
/>
|
|
|
- </ExpansionPanel>
|
|
|
+ <WatermarkTool />
|
|
|
+ </>
|
|
|
);
|
|
|
};
|
|
|
|