import React, { useState } from 'react';
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';
import DialogContent from '@mui/material/DialogContent';
import DialogActions from '@mui/material/DialogActions';
import Button from '@mui/material/Button';
import RadioGroup from '@mui/material/RadioGroup';
import FormControlLabel from '@mui/material/FormControlLabel';
import Radio from '@mui/material/Radio';
import Typography from '@mui/material/Typography';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import Box from '@mui/material/Box';
const CartSyncDialog = ({ open, localCart = [], serverCart = [], onClose, onConfirm }) => {
const [option, setOption] = useState('merge');
// Helper function to determine if an item is selected in the result
const isItemSelected = (item, cart, isResultCart = false) => {
if (isResultCart) return true; // All items in result cart are selected
switch (option) {
case 'deleteServer':
return cart === localCart;
case 'useServer':
return cart === serverCart;
case 'merge':
return true; // Both carts contribute to merge
default:
return false;
}
};
const renderCartItem = (item, cart, isResultCart = false) => {
const selected = isItemSelected(item, cart, isResultCart);
return (
{item.name} x {item.quantity}
);
};
return (
);
};
export default CartSyncDialog;