clean code
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user