clean code

This commit is contained in:
2025-12-25 23:39:45 +03:00
parent 611f26f6ff
commit 4bf18087cc
2 changed files with 45 additions and 17 deletions

View File

@@ -17,7 +17,9 @@ export function OrderTypesBottomSheet({
}: OrderTypesBottomSheetBottomSheetProps) {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const { restaurant, orderType } = useAppSelector((state) => state.order);
const { restaurant, orderType, hiddenServices } = useAppSelector(
(state) => state.order,
);
const buttonStyle = {
height: 48,
@@ -27,21 +29,7 @@ export function OrderTypesBottomSheet({
alignItems: "center",
};
// Count visible services
const visibleServicesCount = [
restaurant?.dineIn == true,
restaurant?.delivery == true,
restaurant?.pickup == true,
restaurant?.gift == true,
restaurant?.toRoom == true,
restaurant?.toOffice == true,
restaurant?.is_schedule_order_enabled == 1,
restaurant?.is_booking_enabled == 1,
].filter(Boolean).length;
// Calculate height: base 620px, subtract 48px for each hidden service
const totalServices = 8;
const hiddenServices = totalServices - visibleServicesCount;
const calculatedHeight = 620 - hiddenServices * 64;
const handleOrderTypeSelect = (selectedOrderType: OrderType) => {