diff --git a/package-lock.json b/package-lock.json
index 240aecf..1cc92bf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,7 +15,6 @@
"@material-ui/core": "^4.12.4",
"@material-ui/pickers": "^3.3.10",
"@reduxjs/toolkit": "^1.5.1",
- "@types/emoji-mart": "^3.0.5",
"@types/node": "^17.0.41",
"@types/react": "^16.9.0",
"@types/react-redux": "^7.1.7",
@@ -35,7 +34,7 @@
"web-vitals": "^2.1.4"
},
"devDependencies": {
- "@types/emoji-mart": "^3.0.9",
+ "@types/emoji-mart": "^3.0.0",
"@types/react-dom": "^18.0.5",
"@types/styled-components": "^5.1.25"
}
@@ -3699,10 +3698,11 @@
}
},
"node_modules/@types/emoji-mart": {
- "version": "3.0.9",
- "resolved": "https://registry.npmjs.org/@types/emoji-mart/-/emoji-mart-3.0.9.tgz",
- "integrity": "sha512-qdBo/2Y8MXaJ/2spKjDZocuq79GpnOhkwMHnK2GnVFa8WYFgfA+ei6sil3aeWQPCreOKIx9ogPpR5+7MaOqYAA==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/emoji-mart/-/emoji-mart-3.0.0.tgz",
+ "integrity": "sha512-sTZX5TGcY8YVwKfy11Q9k9UfyjlQLEpaZkFvdqV89dO6WfPxsEPEqQ8cCG3VLpBphWJLDBvfvFKQiYP5Am1TSA==",
"dev": true,
+ "license": "MIT",
"dependencies": {
"@types/react": "*"
}
@@ -6611,6 +6611,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/emoji-mart/-/emoji-mart-3.0.1.tgz",
"integrity": "sha512-sxpmMKxqLvcscu6mFn9ITHeZNkGzIvD0BSNFE/LJESPbCA8s1jM6bCDPjWbV31xHq7JXaxgpHxLB54RCbBZSlg==",
+ "license": "BSD-3-Clause",
"dependencies": {
"@babel/runtime": "^7.0.0",
"prop-types": "^15.6.0"
@@ -19308,9 +19309,9 @@
}
},
"@types/emoji-mart": {
- "version": "3.0.9",
- "resolved": "https://registry.npmjs.org/@types/emoji-mart/-/emoji-mart-3.0.9.tgz",
- "integrity": "sha512-qdBo/2Y8MXaJ/2spKjDZocuq79GpnOhkwMHnK2GnVFa8WYFgfA+ei6sil3aeWQPCreOKIx9ogPpR5+7MaOqYAA==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/emoji-mart/-/emoji-mart-3.0.0.tgz",
+ "integrity": "sha512-sTZX5TGcY8YVwKfy11Q9k9UfyjlQLEpaZkFvdqV89dO6WfPxsEPEqQ8cCG3VLpBphWJLDBvfvFKQiYP5Am1TSA==",
"dev": true,
"requires": {
"@types/react": "*"
diff --git a/package.json b/package.json
index 87958ce..55ca097 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,6 @@
"@material-ui/core": "^4.12.4",
"@material-ui/pickers": "^3.3.10",
"@reduxjs/toolkit": "^1.5.1",
- "@types/emoji-mart": "^3.0.5",
"@types/node": "^17.0.41",
"@types/react": "^16.9.0",
"@types/react-redux": "^7.1.7",
@@ -55,8 +54,8 @@
]
},
"devDependencies": {
- "@types/emoji-mart": "^3.0.9",
+ "@types/emoji-mart": "^3.0.0",
"@types/react-dom": "^18.0.5",
"@types/styled-components": "^5.1.25"
}
-}
\ No newline at end of file
+}
diff --git a/src/api/types.ts b/src/api/types.ts
index f75edad..a92640a 100644
--- a/src/api/types.ts
+++ b/src/api/types.ts
@@ -27,6 +27,7 @@ export interface Goal {
accountId: string
transactionIds: string[]
tagIds: string[]
+ icon?: string;
}
export interface Tag {
diff --git a/src/ui/components/EmojiPicker.tsx b/src/ui/components/EmojiPicker.tsx
index 00bb54d..c795873 100644
--- a/src/ui/components/EmojiPicker.tsx
+++ b/src/ui/components/EmojiPicker.tsx
@@ -1,20 +1,16 @@
-import { BaseEmoji, Picker } from 'emoji-mart'
-import 'emoji-mart/css/emoji-mart.css'
-import { useAppSelector } from '../../store/hooks'
-import { selectMode } from '../../store/themeSlice'
+import 'emoji-mart/css/emoji-mart.css';
+import { Picker } from 'emoji-mart';
+import React from 'react';
-type Props = { onClick: (emoji: BaseEmoji, event: React.MouseEvent) => void }
+// We removed the "event" requirement here so it matches the v3 Picker perfectly
+type Props = { onClick: (emoji: any) => void }
export default function EmojiPicker(props: Props) {
- const theme = useAppSelector(selectMode)
-
return (
-
- )
-}
+ );
+}
\ No newline at end of file
diff --git a/src/ui/features/goalmanager/GoalManager.tsx b/src/ui/features/goalmanager/GoalManager.tsx
index 0779dda..9afa6a8 100644
--- a/src/ui/features/goalmanager/GoalManager.tsx
+++ b/src/ui/features/goalmanager/GoalManager.tsx
@@ -10,9 +10,11 @@ import { Goal } from '../../../api/types'
import { selectGoalsMap, updateGoal as updateGoalRedux } from '../../../store/goalsSlice'
import { useAppDispatch, useAppSelector } from '../../../store/hooks'
import DatePicker from '../../components/DatePicker'
-import { Theme } from '../../components/Theme'
+import { Theme } from '../../components/Theme';
+import EmojiPicker from '../../components/EmojiPicker';
type Props = { goal: Goal }
+
export function GoalManager(props: Props) {
const dispatch = useAppDispatch()
@@ -21,6 +23,7 @@ export function GoalManager(props: Props) {
const [name, setName] = useState(null)
const [targetDate, setTargetDate] = useState(null)
const [targetAmount, setTargetAmount] = useState(null)
+ const [showPicker, setShowPicker] = useState(false);
useEffect(() => {
setName(props.goal.name)
@@ -33,9 +36,6 @@ export function GoalManager(props: Props) {
props.goal.targetAmount,
])
- useEffect(() => {
- setName(goal.name)
- }, [goal.name])
const updateNameOnChange = (event: React.ChangeEvent) => {
const nextName = event.target.value
@@ -75,9 +75,23 @@ export function GoalManager(props: Props) {
}
}
+ const pickEmojiOnClick = (emoji: any) => {
+ const updatedGoal: Goal = {
+ ...props.goal,
+ icon: emoji.native,
+ }
+
+ dispatch(updateGoalRedux(updatedGoal))
+ updateGoalApi(props.goal.id, updatedGoal)
+ setShowPicker(false)
+ }
+
return (
+
+
+ {showPicker && }
@@ -181,4 +195,4 @@ const StringInput = styled.input`
const Value = styled.div`
margin-left: 2rem;
-`
+`
\ No newline at end of file
diff --git a/src/ui/pages/Main/goals/GoalCard.tsx b/src/ui/pages/Main/goals/GoalCard.tsx
index e8f6d0a..bce34c3 100644
--- a/src/ui/pages/Main/goals/GoalCard.tsx
+++ b/src/ui/pages/Main/goals/GoalCard.tsx
@@ -27,6 +27,7 @@ export default function GoalCard(props: Props) {
return (
+ {goal.icon}
${goal.targetAmount}
{asLocaleDateString(goal.targetDate)}