Pls
This commit is contained in:
@ -134,6 +134,7 @@ const RegistryList = () => {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<th>Approximate Price</th>
|
||||
<th>Link</th>
|
||||
<th>Status</th>
|
||||
<th>Claim</th>
|
||||
@ -167,6 +168,7 @@ const RegistryList = () => {
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
<td>{item.approximatePrice ? `$${item.approximatePrice}` : "-"}</td>
|
||||
<td>
|
||||
{item.link && (
|
||||
<a
|
||||
|
@ -6,7 +6,7 @@ const RegistryManager = () => {
|
||||
const [registryItems, setRegistryItems] = useState<RegistryItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [newItem, setNewItem] = useState({ name: "", link: "" });
|
||||
const [newItem, setNewItem] = useState({ name: "", link: "", approximatePrice: "" });
|
||||
const [showClaimants, setShowClaimants] = useState<Set<string>>(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
|
||||
/>
|
||||
</div>
|
||||
<div className="form-control w-full">
|
||||
<input
|
||||
type="text"
|
||||
value={newItem.approximatePrice}
|
||||
onChange={(e) => setNewItem({ ...newItem, approximatePrice: e.target.value })}
|
||||
placeholder="Approximate price"
|
||||
className="input input-bordered w-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="form-control w-full">
|
||||
<input
|
||||
type="url"
|
||||
@ -166,6 +175,7 @@ const RegistryManager = () => {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Approximate Price</th>
|
||||
<th>Link</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
@ -175,6 +185,7 @@ const RegistryManager = () => {
|
||||
{registryItems.map((item) => (
|
||||
<tr key={item.id}>
|
||||
<td>{item.name}</td>
|
||||
<td>{item.approximatePrice ? `$${item.approximatePrice}` : "-"}</td>
|
||||
<td>
|
||||
{item.link && (
|
||||
<a
|
||||
|
@ -1,6 +1,7 @@
|
||||
export interface RegistryItem {
|
||||
id: string;
|
||||
name: string;
|
||||
approximatePrice?: string;
|
||||
taken: boolean;
|
||||
link?: string;
|
||||
claimedBy?: string;
|
||||
|
@ -27,7 +27,7 @@ const handleGet: APIRoute = async () => {
|
||||
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);
|
||||
|
Reference in New Issue
Block a user