import React, { useState } from 'react';
import { Card, CardContent, CardHeader, CardTitle } from '@components/ui/card';
import { Button } from '@components/ui/button';
import { Input } from '@components/ui/input';
import { useGlobalState } from '@contexts/state/StateContext';
import { Trash2, Plus } from 'lucide-react';
const FourActions = () => {
const { state, dispatch } = useGlobalState();
const [newItems, setNewItems] = useState({
eliminate: '',
reduce: '',
raise: '',
create: '',
});
const addItem = (actionType: keyof typeof newItems) => {
if (!newItems[actionType]) return;
dispatch({
type: 'ADD_ACTION',
payload: {
actionType,
value: newItems[actionType],
},
});
setNewItems((prev) => ({ ...prev, [actionType]: '' }));
};
const removeItem = (
actionType: keyof typeof state.fourActions,
index: number
) => {
dispatch({
type: 'SET_STATE',
payload: {
...state,
fourActions: {
...state.fourActions,
[actionType]: state.fourActions[actionType].filter(
(_, i) => i !== index
),
},
},
});
};
const renderActionSection = (
title: string,
actionType: keyof typeof state.fourActions,
description: string,
colorClasses: string
) => (
{description}