Update frontend/src/components/admin/AIInsightBox.jsx
Browse files
frontend/src/components/admin/AIInsightBox.jsx
CHANGED
|
@@ -9,7 +9,13 @@ import {
|
|
| 9 |
} from "lucide-react";
|
| 10 |
import { differenceInDays } from "date-fns";
|
| 11 |
|
| 12 |
-
export default function AIInsightBox({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
const now = new Date();
|
| 14 |
|
| 15 |
const totalMembers = memberships.length;
|
|
@@ -26,7 +32,9 @@ export default function AIInsightBox({ memberships = [] }) {
|
|
| 26 |
return m.status === "expired" || days < 0;
|
| 27 |
}).length;
|
| 28 |
|
| 29 |
-
const goodStanding = memberships.filter(
|
|
|
|
|
|
|
| 30 |
|
| 31 |
const suggestionText =
|
| 32 |
totalMembers === 0
|
|
@@ -45,21 +53,29 @@ export default function AIInsightBox({ memberships = [] }) {
|
|
| 45 |
</h2>
|
| 46 |
|
| 47 |
<div className="space-y-3">
|
| 48 |
-
{/* Row 1 */}
|
| 49 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
<div className="flex items-center gap-3">
|
| 51 |
<div className="h-8 w-8 rounded-full bg-emerald-50 flex items-center justify-center">
|
| 52 |
<TrendingUp className="w-4 h-4 text-emerald-600" />
|
| 53 |
</div>
|
| 54 |
<p className="text-sm text-stone-700">
|
| 55 |
-
{renewingSoon} member{renewingSoon === 1 ? "" : "s"} are
|
| 56 |
-
renewal in the next 2 weeks
|
| 57 |
</p>
|
| 58 |
</div>
|
| 59 |
-
</
|
| 60 |
|
| 61 |
-
{/* Row 2 */}
|
| 62 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
<div className="flex items-center gap-3">
|
| 64 |
<div className="h-8 w-8 rounded-full bg-amber-50 flex items-center justify-center">
|
| 65 |
<AlertTriangle className="w-4 h-4 text-amber-600" />
|
|
@@ -69,10 +85,14 @@ export default function AIInsightBox({ memberships = [] }) {
|
|
| 69 |
immediate attention for renewal
|
| 70 |
</p>
|
| 71 |
</div>
|
| 72 |
-
</
|
| 73 |
|
| 74 |
-
{/* Row 3 */}
|
| 75 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
<div className="flex items-center gap-3">
|
| 77 |
<div className="h-8 w-8 rounded-full bg-blue-50 flex items-center justify-center">
|
| 78 |
<UsersIcon className="w-4 h-4 text-blue-600" />
|
|
@@ -82,17 +102,21 @@ export default function AIInsightBox({ memberships = [] }) {
|
|
| 82 |
maintaining good standing
|
| 83 |
</p>
|
| 84 |
</div>
|
| 85 |
-
</
|
| 86 |
|
| 87 |
-
{/* Suggestion row
|
| 88 |
-
<
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
<p className="text-sm text-purple-900">
|
| 93 |
<span className="font-semibold">Suggestion:</span> {suggestionText}
|
| 94 |
</p>
|
| 95 |
-
</
|
| 96 |
</div>
|
| 97 |
</div>
|
| 98 |
);
|
|
|
|
| 9 |
} from "lucide-react";
|
| 10 |
import { differenceInDays } from "date-fns";
|
| 11 |
|
| 12 |
+
export default function AIInsightBox({
|
| 13 |
+
memberships = [],
|
| 14 |
+
onRenewingSoonClick,
|
| 15 |
+
onNeedAttentionClick,
|
| 16 |
+
onGoodStandingClick,
|
| 17 |
+
onSuggestionClick,
|
| 18 |
+
}) {
|
| 19 |
const now = new Date();
|
| 20 |
|
| 21 |
const totalMembers = memberships.length;
|
|
|
|
| 32 |
return m.status === "expired" || days < 0;
|
| 33 |
}).length;
|
| 34 |
|
| 35 |
+
const goodStanding = memberships.filter(
|
| 36 |
+
(m) => m.status === "active"
|
| 37 |
+
).length;
|
| 38 |
|
| 39 |
const suggestionText =
|
| 40 |
totalMembers === 0
|
|
|
|
| 53 |
</h2>
|
| 54 |
|
| 55 |
<div className="space-y-3">
|
| 56 |
+
{/* Row 1: renewing soon */}
|
| 57 |
+
<button
|
| 58 |
+
type="button"
|
| 59 |
+
onClick={onRenewingSoonClick}
|
| 60 |
+
className="w-full flex items-center justify-between rounded-2xl bg-white/90 px-4 py-3 shadow-sm hover:shadow-md transition-shadow cursor-pointer text-left"
|
| 61 |
+
>
|
| 62 |
<div className="flex items-center gap-3">
|
| 63 |
<div className="h-8 w-8 rounded-full bg-emerald-50 flex items-center justify-center">
|
| 64 |
<TrendingUp className="w-4 h-4 text-emerald-600" />
|
| 65 |
</div>
|
| 66 |
<p className="text-sm text-stone-700">
|
| 67 |
+
{renewingSoon} member{renewingSoon === 1 ? "" : "s"} are
|
| 68 |
+
due for renewal in the next 2 weeks
|
| 69 |
</p>
|
| 70 |
</div>
|
| 71 |
+
</button>
|
| 72 |
|
| 73 |
+
{/* Row 2: need attention */}
|
| 74 |
+
<button
|
| 75 |
+
type="button"
|
| 76 |
+
onClick={onNeedAttentionClick}
|
| 77 |
+
className="w-full flex items-center justify-between rounded-2xl bg-white/90 px-4 py-3 shadow-sm hover:shadow-md transition-shadow cursor-pointer text-left"
|
| 78 |
+
>
|
| 79 |
<div className="flex items-center gap-3">
|
| 80 |
<div className="h-8 w-8 rounded-full bg-amber-50 flex items-center justify-center">
|
| 81 |
<AlertTriangle className="w-4 h-4 text-amber-600" />
|
|
|
|
| 85 |
immediate attention for renewal
|
| 86 |
</p>
|
| 87 |
</div>
|
| 88 |
+
</button>
|
| 89 |
|
| 90 |
+
{/* Row 3: good standing */}
|
| 91 |
+
<button
|
| 92 |
+
type="button"
|
| 93 |
+
onClick={onGoodStandingClick}
|
| 94 |
+
className="w-full flex items-center justify-between rounded-2xl bg-white/90 px-4 py-3 shadow-sm hover:shadow-md transition-shadow cursor-pointer text-left"
|
| 95 |
+
>
|
| 96 |
<div className="flex items-center gap-3">
|
| 97 |
<div className="h-8 w-8 rounded-full bg-blue-50 flex items-center justify-center">
|
| 98 |
<UsersIcon className="w-4 h-4 text-blue-600" />
|
|
|
|
| 102 |
maintaining good standing
|
| 103 |
</p>
|
| 104 |
</div>
|
| 105 |
+
</button>
|
| 106 |
|
| 107 |
+
{/* Suggestion row */}
|
| 108 |
+
<button
|
| 109 |
+
type="button"
|
| 110 |
+
onClick={onSuggestionClick}
|
| 111 |
+
className="mt-3 w-full rounded-2xl bg-purple-100 px-4 py-3 text-left hover:bg-purple-200/80 transition-colors cursor-pointer flex items-center gap-2"
|
| 112 |
+
>
|
| 113 |
+
<span className="inline-flex h-7 w-7 items-center justify-center rounded-full bg-yellow-100">
|
| 114 |
+
<Lightbulb className="w-4 h-4 text-yellow-500" />
|
| 115 |
+
</span>
|
| 116 |
<p className="text-sm text-purple-900">
|
| 117 |
<span className="font-semibold">Suggestion:</span> {suggestionText}
|
| 118 |
</p>
|
| 119 |
+
</button>
|
| 120 |
</div>
|
| 121 |
</div>
|
| 122 |
);
|