import React from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@components/ui/card'; import { Textarea } from '@components/ui/textarea'; import { Toggle } from '@components/ui/toggle'; import { useGlobalState } from '@contexts/state/StateContext'; const stages = [ 'Purchase', 'Delivery', 'Use', 'Supplements', 'Maintenance', 'Disposal', ]; const utilities = [ 'Customer Productivity', 'Simplicity', 'Convenience', 'Risk', 'Environmental Friendliness', 'Fun', ]; const UtilityMap = () => { const { state, dispatch } = useGlobalState(); const toggleCell = (key: string) => { dispatch({ type: 'TOGGLE_UTILITY', payload: { key }, }); }; const updateNotes = (key: string, notes: string) => { dispatch({ type: 'UPDATE_UTILITY_NOTES', payload: { key, notes }, }); }; return ( Buyer Utility Map
{stages.map((stage) => ( ))} {utilities.map((utility) => ( {stages.map((stage) => { const key = `${utility}-${stage}`; return (
{stage}
{utility}
toggleCell(key)} className="w-full" > {state.utilityMap[key]?.value ? 'Opportunity' : 'No opportunity'}