diff --git a/src/components/RegistryList.tsx b/src/components/RegistryList.tsx index 9768f61..36caeb1 100644 --- a/src/components/RegistryList.tsx +++ b/src/components/RegistryList.tsx @@ -134,6 +134,7 @@ const RegistryList = () => { Item + Approximate Price Link Status Claim @@ -167,6 +168,7 @@ const RegistryList = () => { )} + {item.approximatePrice ? `$${item.approximatePrice}` : "-"} {item.link && ( { const [registryItems, setRegistryItems] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - const [newItem, setNewItem] = useState({ name: "", link: "" }); + const [newItem, setNewItem] = useState({ name: "", link: "", approximatePrice: "" }); const [showClaimants, setShowClaimants] = useState>(new Set()); const fetchRegistryItems = async () => { @@ -63,7 +63,7 @@ const RegistryManager = () => { throw new Error(`Failed to add item: ${response.statusText}`); } - setNewItem({ name: "", link: "" }); + setNewItem({ name: "", link: "", approximatePrice: "" }); await fetchRegistryItems(); } catch (error: any) { setError(error.message); @@ -144,6 +144,15 @@ const RegistryManager = () => { required /> +
+ setNewItem({ ...newItem, approximatePrice: e.target.value })} + placeholder="Approximate price" + className="input input-bordered w-full" + /> +
{ Name + Approximate Price Link Status Actions @@ -175,6 +185,7 @@ const RegistryManager = () => { {registryItems.map((item) => ( {item.name} + {item.approximatePrice ? `$${item.approximatePrice}` : "-"} {item.link && ( { const handlePost: APIRoute = async ({ request }) => { try { const body = await request.json(); - const { name, link } = body; + const { name, link, approximatePrice } = body; if (!name) { return new Response( @@ -42,6 +42,7 @@ const handlePost: APIRoute = async ({ request }) => { name, taken: false, link, + approximatePrice, }; registry.push(newItem);