fix: improve handling of empty number input for the rating field in CMS.

This commit is contained in:
pradeepkumar
2026-03-05 05:39:17 +05:30
parent c352d8ff64
commit d71b9a27c9

View File

@@ -629,7 +629,7 @@ export default function CmsPage() {
<div className="grid grid-cols-2 gap-2"> <div className="grid grid-cols-2 gap-2">
<div> <div>
<label className="block text-xs text-[#666666] mb-0.5">Rating</label> <label className="block text-xs text-[#666666] mb-0.5">Rating</label>
<input type="number" min={1} max={5} step={0.1} className={inputCls} value={item.rating} onChange={(e) => updateTestimonial(idx, { rating: parseFloat(e.target.value) || 0 })} /> <input type="number" min={1} max={5} step={0.1} className={inputCls} value={item.rating || ''} onChange={(e) => updateTestimonial(idx, { rating: e.target.value === '' ? 0 : parseFloat(e.target.value) })} />
</div> </div>
<div> <div>
<label className="block text-xs text-[#666666] mb-0.5">Title</label> <label className="block text-xs text-[#666666] mb-0.5">Title</label>