Pls
This commit is contained in:
@ -134,6 +134,7 @@ const RegistryList = () => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Item</th>
|
<th>Item</th>
|
||||||
|
<th>Approximate Price</th>
|
||||||
<th>Link</th>
|
<th>Link</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Claim</th>
|
<th>Claim</th>
|
||||||
@ -167,6 +168,7 @@ const RegistryList = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<td>{item.approximatePrice ? `$${item.approximatePrice}` : "-"}</td>
|
||||||
<td>
|
<td>
|
||||||
{item.link && (
|
{item.link && (
|
||||||
<a
|
<a
|
||||||
|
@ -6,7 +6,7 @@ const RegistryManager = () => {
|
|||||||
const [registryItems, setRegistryItems] = useState<RegistryItem[]>([]);
|
const [registryItems, setRegistryItems] = useState<RegistryItem[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
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 [showClaimants, setShowClaimants] = useState<Set<string>>(new Set());
|
||||||
|
|
||||||
const fetchRegistryItems = async () => {
|
const fetchRegistryItems = async () => {
|
||||||
@ -63,7 +63,7 @@ const RegistryManager = () => {
|
|||||||
throw new Error(`Failed to add item: ${response.statusText}`);
|
throw new Error(`Failed to add item: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
setNewItem({ name: "", link: "" });
|
setNewItem({ name: "", link: "", approximatePrice: "" });
|
||||||
await fetchRegistryItems();
|
await fetchRegistryItems();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
setError(error.message);
|
setError(error.message);
|
||||||
@ -144,6 +144,15 @@ const RegistryManager = () => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</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">
|
<div className="form-control w-full">
|
||||||
<input
|
<input
|
||||||
type="url"
|
type="url"
|
||||||
@ -166,6 +175,7 @@ const RegistryManager = () => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
|
<th>Approximate Price</th>
|
||||||
<th>Link</th>
|
<th>Link</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
@ -175,6 +185,7 @@ const RegistryManager = () => {
|
|||||||
{registryItems.map((item) => (
|
{registryItems.map((item) => (
|
||||||
<tr key={item.id}>
|
<tr key={item.id}>
|
||||||
<td>{item.name}</td>
|
<td>{item.name}</td>
|
||||||
|
<td>{item.approximatePrice ? `$${item.approximatePrice}` : "-"}</td>
|
||||||
<td>
|
<td>
|
||||||
{item.link && (
|
{item.link && (
|
||||||
<a
|
<a
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export interface RegistryItem {
|
export interface RegistryItem {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
approximatePrice?: string;
|
||||||
taken: boolean;
|
taken: boolean;
|
||||||
link?: string;
|
link?: string;
|
||||||
claimedBy?: string;
|
claimedBy?: string;
|
||||||
|
@ -27,7 +27,7 @@ const handleGet: APIRoute = async () => {
|
|||||||
const handlePost: APIRoute = async ({ request }) => {
|
const handlePost: APIRoute = async ({ request }) => {
|
||||||
try {
|
try {
|
||||||
const body = await request.json();
|
const body = await request.json();
|
||||||
const { name, link } = body;
|
const { name, link, approximatePrice } = body;
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return new Response(
|
return new Response(
|
||||||
@ -42,6 +42,7 @@ const handlePost: APIRoute = async ({ request }) => {
|
|||||||
name,
|
name,
|
||||||
taken: false,
|
taken: false,
|
||||||
link,
|
link,
|
||||||
|
approximatePrice,
|
||||||
};
|
};
|
||||||
|
|
||||||
registry.push(newItem);
|
registry.push(newItem);
|
||||||
|
Reference in New Issue
Block a user