diff --git a/package-lock.json b/package-lock.json index 240aecf..94349f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" diff --git a/src/api/lib.ts b/src/api/lib.ts index 3c593ca..bf755a5 100644 --- a/src/api/lib.ts +++ b/src/api/lib.ts @@ -2,7 +2,7 @@ import axios from 'axios' import { user } from '../data/user' import { Goal, Transaction, User } from './types' -export const API_ROOT = 'https://fencer-commbank.azurewebsites.net' +export const API_ROOT = 'http://localhost:11366' export async function getUser(): Promise { try { @@ -51,3 +51,4 @@ export async function updateGoal(goalId: string, updatedGoal: Goal): Promise(props.goal.icon ?? null) + + const pickEmojiOnClick = (emoji: BaseEmoji, event: React.MouseEvent) => { + event.stopPropagation() + + const updatedGoal: Goal = { + ...props.goal, + icon: emoji.native, + name: name ?? props.goal.name, + targetDate: targetDate ?? props.goal.targetDate, + targetAmount: targetAmount ?? props.goal.targetAmount, + } + + setIcon(emoji.native) + setEmojiPickerIsOpen(false) + + dispatch(updateGoalRedux(updatedGoal)) + updateGoalApi(props.goal.id, updatedGoal) +} + return ( - + event.stopPropagation()} + > + + @@ -106,6 +135,18 @@ export function GoalManager(props: Props) { {new Date(props.goal.created).toLocaleDateString()} + ) } @@ -182,3 +223,13 @@ const StringInput = styled.input` const Value = styled.div` margin-left: 2rem; ` + +const EmojiPickerContainer = styled.div` + display: ${(props) => (props.isOpen ? 'flex' : 'none')}; + position: absolute; + top: ${(props) => (props.hasIcon ? '10rem' : '2rem')}; + left: 0; + z-index: 10; +` + + diff --git a/src/ui/pages/Main/goals/GoalCard.tsx b/src/ui/pages/Main/goals/GoalCard.tsx index e8f6d0a..5727949 100644 --- a/src/ui/pages/Main/goals/GoalCard.tsx +++ b/src/ui/pages/Main/goals/GoalCard.tsx @@ -27,6 +27,8 @@ export default function GoalCard(props: Props) { return ( + {goal.icon} +{goal.name} ${goal.targetAmount} {asLocaleDateString(goal.targetDate)} @@ -54,3 +56,7 @@ const TargetDate = styled.h4` color: rgba(174, 174, 174, 1); font-size: 1rem; ` +const Icon = styled.h1` + font-size: 5.5rem; + margin-top: 1rem; +` \ No newline at end of file