feat(checkout): add copy buttons for card info, province/city dropdowns, and wallet top-up button
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
05fe9b5594
commit
426334e27f
3 files changed
+279
-58
No files matched your search
@@ -4,6 +4,7 @@ import { motion, AnimatePresence } from "motion/react";
|
||||
import { X, MapPin, User, Phone, Hash, Save, Check } from "lucide-react";
|
||||
import { toPersian, cn } from "../lib/utils";
|
||||
import { Address } from "../lib/store/userStore";
|
||||
import { IRAN_PROVINCES, PROVINCE_CITIES } from "../lib/data/provinces";
|
||||
import { toast } from "sonner";
|
||||
|
||||
interface AddressModalProps {
|
||||
@@ -205,30 +206,55 @@ export default function AddressModal({ isOpen, onClose, onSave, editingAddress }
|
||||
{/* Row 3: Province & City */}
|
||||
<div className="space-y-1">
|
||||
<label htmlFor="addr-province" className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest block pr-2">استان</label>
|
||||
<input
|
||||
<select
|
||||
id="addr-province"
|
||||
name="address-level1"
|
||||
autoComplete="address-level1"
|
||||
type="text"
|
||||
value={formData.province}
|
||||
onChange={e => setFormData({...formData, province: e.target.value})}
|
||||
className={cn("w-full bg-medical-gray-50 border rounded-2xl py-3 px-5 outline-none font-bold transition-all focus:ring-2 focus:ring-canina-blue/20", errors.province ? "border-red-300" : "border-medical-gray-100")}
|
||||
placeholder="نام استان..."
|
||||
/>
|
||||
onChange={e => {
|
||||
const newProv = e.target.value;
|
||||
const cities = PROVINCE_CITIES[newProv] || [];
|
||||
setFormData({
|
||||
...formData,
|
||||
province: newProv,
|
||||
city: cities[0] || ""
|
||||
});
|
||||
}}
|
||||
className={cn("w-full bg-medical-gray-50 border rounded-2xl py-3 px-5 outline-none font-bold transition-all focus:ring-2 focus:ring-canina-blue/20 bg-white", errors.province ? "border-red-300" : "border-medical-gray-100")}
|
||||
>
|
||||
<option value="">انتخاب استان...</option>
|
||||
{IRAN_PROVINCES.map(prov => (
|
||||
<option key={prov} value={prov}>{prov}</option>
|
||||
))}
|
||||
</select>
|
||||
{errors.province && <p className="text-[10px] text-red-500 font-bold pr-2">{errors.province}</p>}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<label htmlFor="addr-city" className="text-[10px] font-black text-medical-gray-400 uppercase tracking-widest block pr-2">شهر</label>
|
||||
<input
|
||||
id="addr-city"
|
||||
name="address-level2"
|
||||
autoComplete="address-level2"
|
||||
type="text"
|
||||
value={formData.city}
|
||||
onChange={e => setFormData({...formData, city: e.target.value})}
|
||||
className={cn("w-full bg-medical-gray-50 border rounded-2xl py-3 px-5 outline-none font-bold transition-all focus:ring-2 focus:ring-canina-blue/20", errors.city ? "border-red-300" : "border-medical-gray-100")}
|
||||
placeholder="نام شهر..."
|
||||
/>
|
||||
{formData.province && PROVINCE_CITIES[formData.province] ? (
|
||||
<select
|
||||
id="addr-city"
|
||||
name="address-level2"
|
||||
value={formData.city}
|
||||
onChange={e => setFormData({...formData, city: e.target.value})}
|
||||
className={cn("w-full bg-medical-gray-50 border rounded-2xl py-3 px-5 outline-none font-bold transition-all focus:ring-2 focus:ring-canina-blue/20 bg-white", errors.city ? "border-red-300" : "border-medical-gray-100")}
|
||||
>
|
||||
<option value="">انتخاب شهر...</option>
|
||||
{PROVINCE_CITIES[formData.province].map(c => (
|
||||
<option key={c} value={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
) : (
|
||||
<input
|
||||
id="addr-city"
|
||||
name="address-level2"
|
||||
type="text"
|
||||
value={formData.city}
|
||||
onChange={e => setFormData({...formData, city: e.target.value})}
|
||||
className={cn("w-full bg-medical-gray-50 border rounded-2xl py-3 px-5 outline-none font-bold transition-all focus:ring-2 focus:ring-canina-blue/20", errors.city ? "border-red-300" : "border-medical-gray-100")}
|
||||
placeholder="نام شهر..."
|
||||
/>
|
||||
)}
|
||||
{errors.city && <p className="text-[10px] text-red-500 font-bold pr-2">{errors.city}</p>}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user