hide unnecessary elements
This commit is contained in:
@@ -7,6 +7,8 @@ import CarRatioGroups from "./CarRatioGroups/CarRatioGroups";
|
||||
import PlusIcon from "components/Icons/PlusIcon";
|
||||
import styles from "../checkout.module.css";
|
||||
import { AddCarBottomSheet } from "components/CustomBottomSheet/AddCarBottomSheet";
|
||||
import { updatePlateCar } from "features/order/orderSlice";
|
||||
import { useAppDispatch } from "redux/hooks";
|
||||
|
||||
interface CarBottomSheetProps {
|
||||
isOpen: boolean;
|
||||
@@ -17,6 +19,7 @@ export function CarBottomSheet({ isOpen, onClose }: CarBottomSheetProps) {
|
||||
const { t } = useTranslation();
|
||||
const [value, setValue] = useState<string | null>(null);
|
||||
const [isAddCarOpen, setIsAddCarOpen] = useState(false);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const handleCancel = () => {
|
||||
setValue(null);
|
||||
@@ -24,8 +27,8 @@ export function CarBottomSheet({ isOpen, onClose }: CarBottomSheetProps) {
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
dispatch(updatePlateCar(value || ""));
|
||||
onClose();
|
||||
setValue(value);
|
||||
};
|
||||
|
||||
const handleAddCarClick = () => {
|
||||
@@ -38,9 +41,8 @@ export function CarBottomSheet({ isOpen, onClose }: CarBottomSheetProps) {
|
||||
// The parent component should handle reopening, but we'll ensure state is correct
|
||||
};
|
||||
|
||||
const handleAddCarSave = (carDetails: any) => {
|
||||
// Handle saving the new car details
|
||||
console.log("Car details saved:", carDetails);
|
||||
const handleAddCarSave = () => {
|
||||
dispatch(updatePlateCar(value || ""));
|
||||
// After saving, close AddCarBottomSheet which will trigger reopening CarBottomSheet
|
||||
setIsAddCarOpen(false);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user