diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts
index 8ff1406..d1bbecb 100644
--- a/frontend/src/api/index.ts
+++ b/frontend/src/api/index.ts
@@ -64,6 +64,7 @@ export const mealPlannerApi = {
getMealPlans: (params?: any) => api.get('/admin/meal-plans', { params }),
getStats: () => api.get('/admin/stats'),
testEmail: (email: string) => api.post('/admin/test-email', null, { params: { email } }),
+ triggerOrchestrate: (step: string, weekStart?: string) => api.post(`/admin/orchestrate/${step}`, null, { params: { week_start: weekStart } }),
},
feedback: {
diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx
index ecc2bce..5577d65 100644
--- a/frontend/src/pages/Dashboard.tsx
+++ b/frontend/src/pages/Dashboard.tsx
@@ -1,6 +1,8 @@
import { useQuery } from '@tanstack/react-query'
+import { useState } from 'react'
import { Link } from 'react-router-dom'
-import { CookingPot, CalendarDays, ShoppingCart, ChevronRight, Sparkles } from 'lucide-react'
+import { CookingPot, CalendarDays, ShoppingCart, ChevronRight, Sparkles, Loader2 } from 'lucide-react'
+import toast from 'react-hot-toast'
import { mealPlannerApi } from '../api'
import type { MealPlan, MealPlanItem } from '../types'
import { Badge } from '../components/ui/Badge'
@@ -129,6 +131,34 @@ function DashboardSkeleton() {
)
}
+function VoteEmailButton() {
+ const [sendingVoteEmail, setSendingVoteEmail] = useState(false)
+
+ async function handleSend() {
+ setSendingVoteEmail(true)
+ try {
+ const res = await mealPlannerApi.admin.triggerOrchestrate('email')
+ const status = res.data?.status || res.data?.message || 'sent'
+ toast.success(status)
+ } catch (err: any) {
+ toast.error(err?.response?.data?.detail || 'Failed to send vote emails')
+ } finally {
+ setSendingVoteEmail(false)
+ }
+ }
+
+ return (
+
+ )
+}
+
export default function Dashboard() {
const { data: mealPlan, isLoading } = useQuery({
queryKey: ['mealPlan'],
@@ -251,9 +281,7 @@ export default function Dashboard() {
>
Manage Pantry
-
+