-
- {username}
-
+
+
-
-
{text}
+
+
+ {username}
+
+
+
+ {text}
+
+
{children}
-
{children}
diff --git a/src/components/Interpretations/common/Message/MessageButtonStrip.js b/src/components/Interpretations/common/Message/MessageButtonStrip.js
index f2768c968..685e518f2 100644
--- a/src/components/Interpretations/common/Message/MessageButtonStrip.js
+++ b/src/components/Interpretations/common/Message/MessageButtonStrip.js
@@ -8,8 +8,9 @@ const MessageButtonStrip = ({ children }) => (
diff --git a/src/components/Interpretations/common/Message/MessageEditorContainer.js b/src/components/Interpretations/common/Message/MessageEditorContainer.js
index 7f250a649..43eeaa788 100644
--- a/src/components/Interpretations/common/Message/MessageEditorContainer.js
+++ b/src/components/Interpretations/common/Message/MessageEditorContainer.js
@@ -5,17 +5,17 @@ import React from 'react'
const MessageEditorContainer = ({ children, currentUserName, dataTest }) => (
-
+
{children}
)}
@@ -93,9 +129,10 @@ MessageIconButton.propTypes = {
iconComponent: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
.isRequired,
tooltipContent: PropTypes.string.isRequired,
- count: PropTypes.number,
+ confirming: PropTypes.bool,
dataTest: PropTypes.string,
disabled: PropTypes.bool,
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
selected: PropTypes.bool,
viewOnly: PropTypes.bool,
onClick: PropTypes.func,
diff --git a/src/components/Interpretations/common/Message/MessageInput.js b/src/components/Interpretations/common/Message/MessageInput.js
index e000f29e2..2e202832a 100644
--- a/src/components/Interpretations/common/Message/MessageInput.js
+++ b/src/components/Interpretations/common/Message/MessageInput.js
@@ -13,7 +13,8 @@ const MessageInput = forwardRef((props, ref) => (
user-select: text;
color: ${colors.grey900};
background-color: white;
- padding: 12px 11px 10px;
+ padding: 7px 8px;
+ max-height: 32px;
outline: 0;
border: 1px solid ${colors.grey500};
border-radius: 3px;
diff --git a/src/components/Interpretations/common/Message/MessageStatsBar.js b/src/components/Interpretations/common/Message/MessageStatsBar.js
index b83e604bd..772f2d3c2 100644
--- a/src/components/Interpretations/common/Message/MessageStatsBar.js
+++ b/src/components/Interpretations/common/Message/MessageStatsBar.js
@@ -8,7 +8,8 @@ const MessageStatsBar = ({ children }) => (
diff --git a/src/components/Interpretations/common/useConfirmClick.js b/src/components/Interpretations/common/useConfirmClick.js
new file mode 100644
index 000000000..21e98360b
--- /dev/null
+++ b/src/components/Interpretations/common/useConfirmClick.js
@@ -0,0 +1,35 @@
+import { useCallback, useEffect, useRef, useState } from 'react'
+
+const CONFIRM_TIMEOUT_MS = 3000
+
+const useConfirmClick = (action) => {
+ const [isConfirming, setIsConfirming] = useState(false)
+ const timeoutRef = useRef(null)
+
+ const clearResetTimer = useCallback(() => {
+ if (timeoutRef.current) {
+ clearTimeout(timeoutRef.current)
+ timeoutRef.current = null
+ }
+ }, [])
+
+ useEffect(() => clearResetTimer, [clearResetTimer])
+
+ const onClick = useCallback(() => {
+ if (isConfirming) {
+ clearResetTimer()
+ setIsConfirming(false)
+ action()
+ } else {
+ setIsConfirming(true)
+ timeoutRef.current = setTimeout(() => {
+ timeoutRef.current = null
+ setIsConfirming(false)
+ }, CONFIRM_TIMEOUT_MS)
+ }
+ }, [isConfirming, action, clearResetTimer])
+
+ return { isConfirming, onClick }
+}
+
+export { useConfirmClick }
diff --git a/src/components/RichText/Editor/Editor.js b/src/components/RichText/Editor/Editor.js
index 82ab625df..10bcc0050 100644
--- a/src/components/RichText/Editor/Editor.js
+++ b/src/components/RichText/Editor/Editor.js
@@ -1,14 +1,13 @@
import i18n from '@dhis2/d2-i18n'
import {
- Button,
Popover,
Tooltip,
Help,
- IconAt24,
- IconFaceAdd24,
- IconLink24,
- IconTextBold24,
- IconTextItalic24,
+ IconAt16,
+ IconFaceAdd16,
+ IconLink16,
+ IconTextBold16,
+ IconTextItalic16,
colors,
} from '@dhis2/ui'
import cx from 'classnames'
@@ -34,6 +33,7 @@ import {
toolbarClasses,
tooltipAnchorClasses,
emojisPopoverClasses,
+ toolbarButtonClasses,
} from './styles/Editor.style.js'
const EmojisPopover = ({ onInsertMarkdown, onClose, reference }) => (
@@ -64,7 +64,12 @@ EmojisPopover.propTypes = {
const IconButtonWithTooltip = ({ tooltipContent, disabled, icon, onClick }) => (
<>
-
+
{({ ref, onMouseOver, onMouseOut }) => (
(
onMouseOut={onMouseOut}
className="tooltip"
>
-
+ type="button"
+ >
+ {icon}
+
)}
+
>
)
@@ -114,32 +121,32 @@ const Toolbar = ({
}
+ icon={}
onClick={() => onInsertMarkdown(BOLD)}
/>
}
+ icon={}
onClick={() => onInsertMarkdown(ITALIC)}
/>
}
+ icon={}
onClick={() => onInsertMarkdown(LINK)}
/>
}
+ icon={}
onClick={() => onInsertMarkdown(MENTION)}
/>
}
+ icon={}
onClick={() => setEmojisPopoverIsOpen(true)}
/>
@@ -156,30 +163,31 @@ const Toolbar = ({