@pfm-platform/goals-ui-mui 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +514 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +209 -2
- package/dist/index.d.ts +209 -2
- package/dist/index.js +511 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -6,11 +6,17 @@ var goalsDataAccess = require('@pfm-platform/goals-data-access');
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var DeleteIcon = require('@mui/icons-material/Delete');
|
|
8
8
|
var goalsFeature = require('@pfm-platform/goals-feature');
|
|
9
|
+
var FlagIcon = require('@mui/icons-material/Flag');
|
|
10
|
+
var AddIcon = require('@mui/icons-material/Add');
|
|
11
|
+
var EmojiEventsIcon = require('@mui/icons-material/EmojiEvents');
|
|
9
12
|
var iconsMaterial = require('@mui/icons-material');
|
|
10
13
|
|
|
11
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
15
|
|
|
13
16
|
var DeleteIcon__default = /*#__PURE__*/_interopDefault(DeleteIcon);
|
|
17
|
+
var FlagIcon__default = /*#__PURE__*/_interopDefault(FlagIcon);
|
|
18
|
+
var AddIcon__default = /*#__PURE__*/_interopDefault(AddIcon);
|
|
19
|
+
var EmojiEventsIcon__default = /*#__PURE__*/_interopDefault(EmojiEventsIcon);
|
|
14
20
|
|
|
15
21
|
// src/components/GoalCreateForm.tsx
|
|
16
22
|
function GoalCreateForm({
|
|
@@ -453,12 +459,230 @@ function GoalEditForm({
|
|
|
453
459
|
}
|
|
454
460
|
);
|
|
455
461
|
}
|
|
462
|
+
function GoalsEmptyState({
|
|
463
|
+
onSetGoal,
|
|
464
|
+
title = "No Goals Yet",
|
|
465
|
+
message = "Set financial goals to stay motivated and track your progress.",
|
|
466
|
+
minHeight = 400
|
|
467
|
+
}) {
|
|
468
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
469
|
+
material.Box,
|
|
470
|
+
{
|
|
471
|
+
"data-testid": "goals-empty-state",
|
|
472
|
+
sx: {
|
|
473
|
+
minHeight,
|
|
474
|
+
height: "100%",
|
|
475
|
+
width: "100%",
|
|
476
|
+
display: "flex",
|
|
477
|
+
flexDirection: "column",
|
|
478
|
+
alignItems: "center",
|
|
479
|
+
justifyContent: "center",
|
|
480
|
+
gap: 3,
|
|
481
|
+
py: 6,
|
|
482
|
+
px: 2
|
|
483
|
+
},
|
|
484
|
+
children: [
|
|
485
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
486
|
+
FlagIcon__default.default,
|
|
487
|
+
{
|
|
488
|
+
sx: {
|
|
489
|
+
fontSize: 80,
|
|
490
|
+
color: "primary.main",
|
|
491
|
+
opacity: 0.6
|
|
492
|
+
},
|
|
493
|
+
"aria-hidden": "true"
|
|
494
|
+
}
|
|
495
|
+
),
|
|
496
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
497
|
+
material.Typography,
|
|
498
|
+
{
|
|
499
|
+
variant: "h5",
|
|
500
|
+
component: "h2",
|
|
501
|
+
color: "text.primary",
|
|
502
|
+
sx: { fontWeight: "medium" },
|
|
503
|
+
children: title
|
|
504
|
+
}
|
|
505
|
+
),
|
|
506
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
507
|
+
material.Typography,
|
|
508
|
+
{
|
|
509
|
+
variant: "body1",
|
|
510
|
+
color: "text.secondary",
|
|
511
|
+
align: "center",
|
|
512
|
+
sx: { maxWidth: 480, px: 2 },
|
|
513
|
+
children: message
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
517
|
+
material.Box,
|
|
518
|
+
{
|
|
519
|
+
sx: {
|
|
520
|
+
display: "flex",
|
|
521
|
+
flexDirection: "column",
|
|
522
|
+
gap: 1,
|
|
523
|
+
mt: 1,
|
|
524
|
+
mb: 2
|
|
525
|
+
},
|
|
526
|
+
children: [
|
|
527
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", color: "text.secondary", sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "success.main", fontWeight: "bold" }, children: "\u2713" }),
|
|
529
|
+
"Save for important purchases and milestones"
|
|
530
|
+
] }),
|
|
531
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", color: "text.secondary", sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
532
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "success.main", fontWeight: "bold" }, children: "\u2713" }),
|
|
533
|
+
"Pay off debt faster with targeted plans"
|
|
534
|
+
] }),
|
|
535
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", color: "text.secondary", sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "success.main", fontWeight: "bold" }, children: "\u2713" }),
|
|
537
|
+
"Track progress with visual charts and insights"
|
|
538
|
+
] })
|
|
539
|
+
]
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
onSetGoal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
543
|
+
material.Button,
|
|
544
|
+
{
|
|
545
|
+
variant: "contained",
|
|
546
|
+
color: "primary",
|
|
547
|
+
size: "large",
|
|
548
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(AddIcon__default.default, {}),
|
|
549
|
+
onClick: onSetGoal,
|
|
550
|
+
"aria-label": "Set your first goal",
|
|
551
|
+
sx: {
|
|
552
|
+
mt: 2,
|
|
553
|
+
px: 4,
|
|
554
|
+
py: 1.5,
|
|
555
|
+
fontSize: "1rem",
|
|
556
|
+
fontWeight: "medium",
|
|
557
|
+
textTransform: "none",
|
|
558
|
+
boxShadow: 2,
|
|
559
|
+
"&:hover": {
|
|
560
|
+
boxShadow: 4
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
children: "Set Your First Goal"
|
|
564
|
+
}
|
|
565
|
+
)
|
|
566
|
+
]
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
function GoalsCompletedState({
|
|
571
|
+
onSetNewGoal,
|
|
572
|
+
title = "All Goals Completed!",
|
|
573
|
+
message = "Congratulations! You've achieved all your financial goals.",
|
|
574
|
+
minHeight = 400
|
|
575
|
+
}) {
|
|
576
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
577
|
+
material.Box,
|
|
578
|
+
{
|
|
579
|
+
"data-testid": "goals-completed-state",
|
|
580
|
+
sx: {
|
|
581
|
+
minHeight,
|
|
582
|
+
height: "100%",
|
|
583
|
+
width: "100%",
|
|
584
|
+
display: "flex",
|
|
585
|
+
flexDirection: "column",
|
|
586
|
+
alignItems: "center",
|
|
587
|
+
justifyContent: "center",
|
|
588
|
+
gap: 3,
|
|
589
|
+
py: 6,
|
|
590
|
+
px: 2
|
|
591
|
+
},
|
|
592
|
+
children: [
|
|
593
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
594
|
+
EmojiEventsIcon__default.default,
|
|
595
|
+
{
|
|
596
|
+
sx: {
|
|
597
|
+
fontSize: 80,
|
|
598
|
+
color: "success.main",
|
|
599
|
+
opacity: 0.8
|
|
600
|
+
},
|
|
601
|
+
"aria-hidden": "true"
|
|
602
|
+
}
|
|
603
|
+
),
|
|
604
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
605
|
+
material.Typography,
|
|
606
|
+
{
|
|
607
|
+
variant: "h5",
|
|
608
|
+
component: "h2",
|
|
609
|
+
color: "success.main",
|
|
610
|
+
sx: { fontWeight: "medium" },
|
|
611
|
+
children: title
|
|
612
|
+
}
|
|
613
|
+
),
|
|
614
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
615
|
+
material.Typography,
|
|
616
|
+
{
|
|
617
|
+
variant: "body1",
|
|
618
|
+
color: "text.secondary",
|
|
619
|
+
align: "center",
|
|
620
|
+
sx: { maxWidth: 480, px: 2 },
|
|
621
|
+
children: message
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
625
|
+
material.Box,
|
|
626
|
+
{
|
|
627
|
+
sx: {
|
|
628
|
+
display: "flex",
|
|
629
|
+
flexDirection: "column",
|
|
630
|
+
gap: 1,
|
|
631
|
+
mt: 1,
|
|
632
|
+
mb: 2
|
|
633
|
+
},
|
|
634
|
+
children: [
|
|
635
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", color: "text.secondary", sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
636
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "success.main", fontWeight: "bold" }, children: "\u{1F389}" }),
|
|
637
|
+
"Celebrate your financial discipline and achievement"
|
|
638
|
+
] }),
|
|
639
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", color: "text.secondary", sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
640
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "success.main", fontWeight: "bold" }, children: "\u{1F680}" }),
|
|
641
|
+
"Ready to set even more ambitious goals"
|
|
642
|
+
] }),
|
|
643
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "body2", color: "text.secondary", sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
644
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { component: "span", sx: { color: "success.main", fontWeight: "bold" }, children: "\u{1F4AA}" }),
|
|
645
|
+
"Keep the momentum going with new challenges"
|
|
646
|
+
] })
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
),
|
|
650
|
+
onSetNewGoal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
651
|
+
material.Button,
|
|
652
|
+
{
|
|
653
|
+
variant: "contained",
|
|
654
|
+
color: "success",
|
|
655
|
+
size: "large",
|
|
656
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(AddIcon__default.default, {}),
|
|
657
|
+
onClick: onSetNewGoal,
|
|
658
|
+
"aria-label": "Set a new goal",
|
|
659
|
+
sx: {
|
|
660
|
+
mt: 2,
|
|
661
|
+
px: 4,
|
|
662
|
+
py: 1.5,
|
|
663
|
+
fontSize: "1rem",
|
|
664
|
+
fontWeight: "medium",
|
|
665
|
+
textTransform: "none",
|
|
666
|
+
boxShadow: 2,
|
|
667
|
+
"&:hover": {
|
|
668
|
+
boxShadow: 4
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
children: "Set New Goal"
|
|
672
|
+
}
|
|
673
|
+
)
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
}
|
|
456
678
|
function GoalList({
|
|
457
679
|
userId,
|
|
458
680
|
type,
|
|
459
681
|
title = "Goals",
|
|
460
682
|
currencySymbol = "$",
|
|
461
|
-
maxItems
|
|
683
|
+
maxItems,
|
|
684
|
+
onSetGoal,
|
|
685
|
+
onSetNewGoal
|
|
462
686
|
}) {
|
|
463
687
|
const goals = goalsFeature.useGoalProgress({ userId, type });
|
|
464
688
|
if (!goals) {
|
|
@@ -468,9 +692,10 @@ function GoalList({
|
|
|
468
692
|
] }) });
|
|
469
693
|
}
|
|
470
694
|
const displayGoals = maxItems ? goals.slice(0, maxItems) : goals;
|
|
695
|
+
const allGoalsCompleted = displayGoals.length > 0 && displayGoals.every((goal) => goal.percentComplete >= 100);
|
|
471
696
|
return /* @__PURE__ */ jsxRuntime.jsx(material.Card, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.CardContent, { children: [
|
|
472
697
|
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", gutterBottom: true, children: title }),
|
|
473
|
-
displayGoals.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
698
|
+
displayGoals.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(GoalsEmptyState, { onSetGoal }) : allGoalsCompleted ? /* @__PURE__ */ jsxRuntime.jsx(GoalsCompletedState, { onSetNewGoal }) : /* @__PURE__ */ jsxRuntime.jsx(material.List, { disablePadding: true, children: displayGoals.map((goal, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
474
699
|
material.ListItem,
|
|
475
700
|
{
|
|
476
701
|
divider: index < displayGoals.length - 1,
|
|
@@ -864,13 +1089,300 @@ function GoalMilestoneTracker({
|
|
|
864
1089
|
)
|
|
865
1090
|
] }) });
|
|
866
1091
|
}
|
|
1092
|
+
function GoalItemCondensed({
|
|
1093
|
+
name,
|
|
1094
|
+
currentValue,
|
|
1095
|
+
targetValue,
|
|
1096
|
+
percentComplete,
|
|
1097
|
+
goalType,
|
|
1098
|
+
imageUrl,
|
|
1099
|
+
currencySymbol = "$",
|
|
1100
|
+
complete = false,
|
|
1101
|
+
onClick
|
|
1102
|
+
}) {
|
|
1103
|
+
const formatCurrency = (amount) => {
|
|
1104
|
+
return `${currencySymbol}${amount.toLocaleString("en-US", {
|
|
1105
|
+
minimumFractionDigits: 0,
|
|
1106
|
+
maximumFractionDigits: 0
|
|
1107
|
+
})}`;
|
|
1108
|
+
};
|
|
1109
|
+
const progressColor = complete ? "success" : percentComplete >= 75 ? "primary" : percentComplete >= 50 ? "info" : "warning";
|
|
1110
|
+
const Icon = goalType === "savings" ? iconsMaterial.TrendingUp : iconsMaterial.TrendingDown;
|
|
1111
|
+
const iconColor = goalType === "savings" ? "success.main" : "warning.main";
|
|
1112
|
+
const handleKeyDown = (event) => {
|
|
1113
|
+
if (onClick && (event.key === "Enter" || event.key === " ")) {
|
|
1114
|
+
event.preventDefault();
|
|
1115
|
+
onClick();
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1119
|
+
material.Box,
|
|
1120
|
+
{
|
|
1121
|
+
"data-testid": "goal-item-condensed",
|
|
1122
|
+
onClick,
|
|
1123
|
+
onKeyDown: handleKeyDown,
|
|
1124
|
+
tabIndex: onClick ? 0 : void 0,
|
|
1125
|
+
role: onClick ? "button" : void 0,
|
|
1126
|
+
sx: {
|
|
1127
|
+
display: "flex",
|
|
1128
|
+
alignItems: "center",
|
|
1129
|
+
gap: 1.5,
|
|
1130
|
+
py: 1,
|
|
1131
|
+
px: 1.5,
|
|
1132
|
+
borderRadius: 1,
|
|
1133
|
+
cursor: onClick ? "pointer" : "default",
|
|
1134
|
+
transition: "background-color 0.2s",
|
|
1135
|
+
"&:hover": onClick ? {
|
|
1136
|
+
backgroundColor: "action.hover"
|
|
1137
|
+
} : void 0,
|
|
1138
|
+
"&:focus": onClick ? {
|
|
1139
|
+
outline: "2px solid",
|
|
1140
|
+
outlineColor: "primary.main",
|
|
1141
|
+
outlineOffset: "2px"
|
|
1142
|
+
} : void 0
|
|
1143
|
+
},
|
|
1144
|
+
children: [
|
|
1145
|
+
imageUrl ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1146
|
+
material.Avatar,
|
|
1147
|
+
{
|
|
1148
|
+
src: imageUrl,
|
|
1149
|
+
alt: name,
|
|
1150
|
+
sx: { width: 32, height: 32 },
|
|
1151
|
+
variant: "rounded"
|
|
1152
|
+
}
|
|
1153
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1154
|
+
material.Avatar,
|
|
1155
|
+
{
|
|
1156
|
+
sx: {
|
|
1157
|
+
width: 32,
|
|
1158
|
+
height: 32,
|
|
1159
|
+
bgcolor: "transparent",
|
|
1160
|
+
color: iconColor
|
|
1161
|
+
},
|
|
1162
|
+
variant: "rounded",
|
|
1163
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { fontSize: "small" })
|
|
1164
|
+
}
|
|
1165
|
+
),
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
1167
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5, mb: 0.5 }, children: [
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1169
|
+
material.Typography,
|
|
1170
|
+
{
|
|
1171
|
+
variant: "body2",
|
|
1172
|
+
fontWeight: "medium",
|
|
1173
|
+
sx: {
|
|
1174
|
+
overflow: "hidden",
|
|
1175
|
+
textOverflow: "ellipsis",
|
|
1176
|
+
whiteSpace: "nowrap",
|
|
1177
|
+
flex: 1
|
|
1178
|
+
},
|
|
1179
|
+
children: name
|
|
1180
|
+
}
|
|
1181
|
+
),
|
|
1182
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1183
|
+
material.Chip,
|
|
1184
|
+
{
|
|
1185
|
+
label: goalType,
|
|
1186
|
+
size: "small",
|
|
1187
|
+
color: goalType === "savings" ? "success" : "warning",
|
|
1188
|
+
sx: {
|
|
1189
|
+
height: 18,
|
|
1190
|
+
fontSize: "0.6875rem",
|
|
1191
|
+
"& .MuiChip-label": {
|
|
1192
|
+
px: 0.75,
|
|
1193
|
+
py: 0
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
)
|
|
1198
|
+
] }),
|
|
1199
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1200
|
+
material.LinearProgress,
|
|
1201
|
+
{
|
|
1202
|
+
variant: "determinate",
|
|
1203
|
+
value: Math.min(percentComplete, 100),
|
|
1204
|
+
color: progressColor,
|
|
1205
|
+
sx: {
|
|
1206
|
+
height: 4,
|
|
1207
|
+
borderRadius: 1,
|
|
1208
|
+
backgroundColor: "action.hover"
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1212
|
+
] }),
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", alignItems: "flex-end", minWidth: 80 }, children: [
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", fontWeight: "medium", color: "text.primary", children: formatCurrency(currentValue) }),
|
|
1215
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { variant: "caption", color: "text.secondary", sx: { fontSize: "0.6875rem" }, children: [
|
|
1216
|
+
percentComplete.toFixed(0),
|
|
1217
|
+
"% of ",
|
|
1218
|
+
formatCurrency(targetValue)
|
|
1219
|
+
] })
|
|
1220
|
+
] })
|
|
1221
|
+
]
|
|
1222
|
+
}
|
|
1223
|
+
);
|
|
1224
|
+
}
|
|
1225
|
+
function GoalImageDialog({
|
|
1226
|
+
open,
|
|
1227
|
+
onClose,
|
|
1228
|
+
onSelectImage,
|
|
1229
|
+
selectedImageName,
|
|
1230
|
+
goalType,
|
|
1231
|
+
title
|
|
1232
|
+
}) {
|
|
1233
|
+
const theme = material.useTheme();
|
|
1234
|
+
const isMobile = material.useMediaQuery(theme.breakpoints.down("sm"));
|
|
1235
|
+
const isTablet = material.useMediaQuery(theme.breakpoints.down("md"));
|
|
1236
|
+
const [tempSelectedImage, setTempSelectedImage] = react.useState(null);
|
|
1237
|
+
const savingsImages = goalsDataAccess.useSavingsGoalImages({ enabled: goalType === "savings" && open });
|
|
1238
|
+
const payoffImages = goalsDataAccess.usePayoffGoalImages({ enabled: goalType === "payoff" && open });
|
|
1239
|
+
const imagesQuery = goalType === "savings" ? savingsImages : payoffImages;
|
|
1240
|
+
const images = imagesQuery.data?.images || [];
|
|
1241
|
+
const cols = isMobile ? 2 : isTablet ? 3 : 4;
|
|
1242
|
+
const handleImageClick = (name, url) => {
|
|
1243
|
+
setTempSelectedImage({ name, url });
|
|
1244
|
+
};
|
|
1245
|
+
const handleConfirm = () => {
|
|
1246
|
+
if (tempSelectedImage) {
|
|
1247
|
+
onSelectImage(tempSelectedImage.name, tempSelectedImage.url);
|
|
1248
|
+
setTempSelectedImage(null);
|
|
1249
|
+
}
|
|
1250
|
+
onClose();
|
|
1251
|
+
};
|
|
1252
|
+
const handleCancel = () => {
|
|
1253
|
+
setTempSelectedImage(null);
|
|
1254
|
+
onClose();
|
|
1255
|
+
};
|
|
1256
|
+
const highlightedImageName = tempSelectedImage?.name || selectedImageName;
|
|
1257
|
+
const dialogTitle = title || `Select ${goalType === "savings" ? "Savings" : "Payoff"} Goal Image`;
|
|
1258
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1259
|
+
material.Dialog,
|
|
1260
|
+
{
|
|
1261
|
+
open,
|
|
1262
|
+
onClose: handleCancel,
|
|
1263
|
+
maxWidth: "md",
|
|
1264
|
+
fullWidth: true,
|
|
1265
|
+
fullScreen: isMobile,
|
|
1266
|
+
"aria-labelledby": "goal-image-dialog-title",
|
|
1267
|
+
children: [
|
|
1268
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "goal-image-dialog-title", children: dialogTitle }),
|
|
1269
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.DialogContent, { children: [
|
|
1270
|
+
imagesQuery.isLoading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1271
|
+
material.Box,
|
|
1272
|
+
{
|
|
1273
|
+
sx: {
|
|
1274
|
+
display: "flex",
|
|
1275
|
+
justifyContent: "center",
|
|
1276
|
+
alignItems: "center",
|
|
1277
|
+
minHeight: 200
|
|
1278
|
+
},
|
|
1279
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, {})
|
|
1280
|
+
}
|
|
1281
|
+
),
|
|
1282
|
+
imagesQuery.isError && /* @__PURE__ */ jsxRuntime.jsx(material.Alert, { severity: "error", sx: { mb: 2 }, children: "Failed to load goal images. Please try again." }),
|
|
1283
|
+
!imagesQuery.isLoading && !imagesQuery.isError && images.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(material.Alert, { severity: "info", children: [
|
|
1284
|
+
"No images available for ",
|
|
1285
|
+
goalType,
|
|
1286
|
+
" goals."
|
|
1287
|
+
] }),
|
|
1288
|
+
!imagesQuery.isLoading && !imagesQuery.isError && images.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1289
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "Click an image to select it, then click Confirm." }),
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.ImageList, { cols, gap: 16, sx: { maxHeight: isMobile ? "none" : 500 }, children: images.map((image) => {
|
|
1291
|
+
const isSelected = highlightedImageName === image.name;
|
|
1292
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1293
|
+
material.ImageListItem,
|
|
1294
|
+
{
|
|
1295
|
+
sx: {
|
|
1296
|
+
cursor: "pointer",
|
|
1297
|
+
border: isSelected ? `3px solid ${theme.palette.primary.main}` : "2px solid transparent",
|
|
1298
|
+
borderRadius: 1,
|
|
1299
|
+
overflow: "hidden",
|
|
1300
|
+
transition: "all 0.2s",
|
|
1301
|
+
position: "relative",
|
|
1302
|
+
"&:hover": {
|
|
1303
|
+
border: `3px solid ${isSelected ? theme.palette.primary.main : theme.palette.action.hover}`,
|
|
1304
|
+
transform: "scale(1.02)"
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
onClick: () => handleImageClick(image.name, image.url),
|
|
1308
|
+
children: [
|
|
1309
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1310
|
+
"img",
|
|
1311
|
+
{
|
|
1312
|
+
src: image.url,
|
|
1313
|
+
alt: image.name,
|
|
1314
|
+
loading: "lazy",
|
|
1315
|
+
style: {
|
|
1316
|
+
width: "100%",
|
|
1317
|
+
height: "100%",
|
|
1318
|
+
objectFit: "cover",
|
|
1319
|
+
display: "block"
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
),
|
|
1323
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1324
|
+
material.ImageListItemBar,
|
|
1325
|
+
{
|
|
1326
|
+
title: image.name,
|
|
1327
|
+
sx: {
|
|
1328
|
+
background: isSelected ? "linear-gradient(to top, rgba(25, 118, 210, 0.9) 0%, rgba(25, 118, 210, 0.7) 70%, rgba(25, 118, 210, 0) 100%)" : "linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, rgba(0,0,0,0) 100%)"
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1333
|
+
material.Box,
|
|
1334
|
+
{
|
|
1335
|
+
sx: {
|
|
1336
|
+
position: "absolute",
|
|
1337
|
+
top: 8,
|
|
1338
|
+
right: 8,
|
|
1339
|
+
bgcolor: "primary.main",
|
|
1340
|
+
borderRadius: "50%",
|
|
1341
|
+
width: 32,
|
|
1342
|
+
height: 32,
|
|
1343
|
+
display: "flex",
|
|
1344
|
+
alignItems: "center",
|
|
1345
|
+
justifyContent: "center",
|
|
1346
|
+
boxShadow: 2
|
|
1347
|
+
},
|
|
1348
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.Check, { sx: { color: "white", fontSize: 20 } })
|
|
1349
|
+
}
|
|
1350
|
+
)
|
|
1351
|
+
]
|
|
1352
|
+
},
|
|
1353
|
+
image.id
|
|
1354
|
+
);
|
|
1355
|
+
}) })
|
|
1356
|
+
] })
|
|
1357
|
+
] }),
|
|
1358
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.DialogActions, { children: [
|
|
1359
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: handleCancel, color: "inherit", children: "Cancel" }),
|
|
1360
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1361
|
+
material.Button,
|
|
1362
|
+
{
|
|
1363
|
+
onClick: handleConfirm,
|
|
1364
|
+
variant: "contained",
|
|
1365
|
+
disabled: !tempSelectedImage && !selectedImageName,
|
|
1366
|
+
"aria-label": "Confirm image selection",
|
|
1367
|
+
children: "Confirm"
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
] })
|
|
1371
|
+
]
|
|
1372
|
+
}
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
867
1375
|
|
|
868
1376
|
exports.GoalCreateForm = GoalCreateForm;
|
|
869
1377
|
exports.GoalDeleteButton = GoalDeleteButton;
|
|
870
1378
|
exports.GoalEditForm = GoalEditForm;
|
|
1379
|
+
exports.GoalImageDialog = GoalImageDialog;
|
|
1380
|
+
exports.GoalItemCondensed = GoalItemCondensed;
|
|
871
1381
|
exports.GoalList = GoalList;
|
|
872
1382
|
exports.GoalMilestoneTracker = GoalMilestoneTracker;
|
|
873
1383
|
exports.GoalProgressCard = GoalProgressCard;
|
|
874
1384
|
exports.GoalSummary = GoalSummary;
|
|
1385
|
+
exports.GoalsCompletedState = GoalsCompletedState;
|
|
1386
|
+
exports.GoalsEmptyState = GoalsEmptyState;
|
|
875
1387
|
//# sourceMappingURL=index.cjs.map
|
|
876
1388
|
//# sourceMappingURL=index.cjs.map
|