diff --git a/packages/loot-design/src/components/NotesButton.js b/packages/loot-design/src/components/NotesButton.js
index c077e0dd955..ccd10f72f00 100644
--- a/packages/loot-design/src/components/NotesButton.js
+++ b/packages/loot-design/src/components/NotesButton.js
@@ -9,9 +9,10 @@ import { send } from 'loot-core/src/platform/client/fetch';
import { colors } from '../style';
import CustomNotesPaper from '../svg/v2/CustomNotesPaper';
-import { View, Button, Tooltip, useTooltip } from './common';
+import { View, Button, Tooltip, useTooltip, Text } from './common';
export function NotesTooltip({
+ editable,
defaultNotes,
position = 'bottom-left',
onClose
@@ -20,22 +21,39 @@ export function NotesTooltip({
let inputRef = React.createRef();
useEffect(() => {
- inputRef.current.focus();
- }, []);
+ if (editable) {
+ inputRef.current.focus();
+ }
+ }, [inputRef, editable]);
return (
onClose(notes)}>
-
+ {editable ? (
+
+ ) : (
+
+ {notes}
+
+ )}
);
}
@@ -48,6 +66,7 @@ export default function NotesButton({
tooltipPosition,
style
}) {
+ let [hover, setHover] = useState(false);
let tooltip = useTooltip();
let { data } = useLiveQuery(
useMemo(() => q('notes').filter({ id }).select('*'), [id])
@@ -60,11 +79,14 @@ export default function NotesButton({
tooltip.close();
}
+ // This account for both the tooltip hover, and editing tooltip
+ const tooltipOpen = tooltip.isOpen || (hasNotes && hover);
+
return (
setHover(true)}
+ onMouseLeave={() => setHover(false)}
>
- {tooltip.isOpen && (
+ {tooltipOpen && (