fix the TimeEstimateCard opening

This commit is contained in:
2025-10-15 22:07:42 +03:00
parent 1c509d915d
commit 5e43aeb5a0
3 changed files with 23 additions and 4 deletions

View File

@@ -1,19 +1,32 @@
import { Radio, Space } from "antd"; import { Radio, RadioChangeEvent, Space } from "antd";
import ProText from "components/ProText"; import ProText from "components/ProText";
import styles from "./ProRatioGroups.module.css"; import styles from "./ProRatioGroups.module.css";
interface ProRatioGroupsProps { interface ProRatioGroupsProps {
options: { label: string; value: string; price?: string }[]; options: { label: string; value: string; price?: string }[];
onRatioClick?: (value: string) => void; onRatioClick?: (value: string) => void;
onChange?: (e: RadioChangeEvent) => void;
value?: string; value?: string;
} }
const ProRatioGroups = ({ const ProRatioGroups = ({
options, options,
onRatioClick, onRatioClick,
onChange,
value, value,
...props ...props
}: ProRatioGroupsProps) => { }: ProRatioGroupsProps) => {
const handleChange = (e: RadioChangeEvent) => {
// If onChange is provided (from Form.Item), use it
if (onChange) {
onChange(e);
}
// Also call onRatioClick if provided (for backward compatibility)
if (onRatioClick) {
onRatioClick(e.target.value);
}
};
return ( return (
<div className={styles.proRatioGroups}> <div className={styles.proRatioGroups}>
<Radio.Group <Radio.Group
@@ -21,7 +34,7 @@ const ProRatioGroups = ({
width: "100%", width: "100%",
}} }}
value={value} value={value}
onChange={(e) => onRatioClick?.(e.target.value)} onChange={handleChange}
{...props} {...props}
> >
<Space direction="vertical" style={{ width: "100%" }}> <Space direction="vertical" style={{ width: "100%" }}>

View File

@@ -24,7 +24,7 @@ export function BottomSheet({
title={t("cart.selectTimeEstimate")} title={t("cart.selectTimeEstimate")}
showCloseButton={true} showCloseButton={true}
initialSnap={1} initialSnap={1}
height={510} height={555}
snapPoints={["65vh"]} snapPoints={["65vh"]}
> >
<Content onSave={onSave} initialDate={initialDate} onClose={onClose} /> <Content onSave={onSave} initialDate={initialDate} onClose={onClose} />

View File

@@ -28,7 +28,13 @@ export default function TimeEstimateCard() {
return ( return (
<> <>
<ProInputCard title={t("cart.estimateTime")}> <ProInputCard title={t("cart.estimateTime")}>
<Form.Item name="estimateWay" required rules={[{ required: true, message: t("cart.pleaseSelectEstimateTime") }]}> <Form.Item
name="estimateWay"
required
rules={[
{ required: true, message: t("cart.pleaseSelectEstimateTime") },
]}
>
<ProRatioGroups <ProRatioGroups
options={[ options={[
{ label: t("cart.now"), value: "now", price: "" }, { label: t("cart.now"), value: "now", price: "" },