Related Items
+
{items.map((item) => (
- {items.map(item => (
- {related.map((item) => (
-
+
Image
{item.name}
-
${item.marketValue}
+
+ ${item.marketValue ?? "N/A"}
+
))}
diff --git a/app/routes/inventory-item-detail.tsx b/app/routes/inventory-item-detail.tsx
index 686fada..deacba9 100644
--- a/app/routes/inventory-item-detail.tsx
+++ b/app/routes/inventory-item-detail.tsx
@@ -143,7 +143,7 @@ export default function InventoryItemDetailPage() {
return
Item not found
;
}
- return (
+ return
@@ -168,9 +168,5 @@ export default function InventoryItemDetailPage() {
-
-
-
-
+
);
-}
\ No newline at end of file
From c37e5f4123159dcd5a5f1a2085cf3ed170ec62aa Mon Sep 17 00:00:00 2001
From: Sweta <254068510+sweta-126-ux@users.noreply.github.com>
Date: Mon, 6 Jul 2026 02:58:55 +0530
Subject: [PATCH 04/15] fixed typescript error
---
.../inventory-item-detail/item-header.tsx | 2 +-
app/routes/inventory-item-detail.tsx | 73 ++-----------------
2 files changed, 7 insertions(+), 68 deletions(-)
diff --git a/app/blocks/inventory-item-detail/item-header.tsx b/app/blocks/inventory-item-detail/item-header.tsx
index 9bfc967..d9abc0b 100644
--- a/app/blocks/inventory-item-detail/item-header.tsx
+++ b/app/blocks/inventory-item-detail/item-header.tsx
@@ -13,7 +13,7 @@ export function ItemHeader({ className, item }: Props) {
const displayCondition = item.condition
.replace(/_/g, " ")
.toLowerCase()
- .replace(/\b\w/g, (l) => l.toUpperCase());
+ .replace(/\b\w/g, (l: string) => l.toUpperCase());
return (
diff --git a/app/routes/inventory-item-detail.tsx b/app/routes/inventory-item-detail.tsx
index deacba9..f120c6e 100644
--- a/app/routes/inventory-item-detail.tsx
+++ b/app/routes/inventory-item-detail.tsx
@@ -68,7 +68,7 @@ export async function loader({ request, params }: Route.LoaderArgs) {
shippingCost: Number(item.sale.shippingCost),
}
: null,
- priceHistory: item.priceHistory.map((ph) => ({
+ priceHistory: item.priceHistory.map((ph: { askPrice: any; bidPrice: any; lastSold: any; }) => ({
...ph,
askPrice: ph.askPrice ? Number(ph.askPrice) : null,
bidPrice: ph.bidPrice ? Number(ph.bidPrice) : null,
@@ -79,62 +79,6 @@ export async function loader({ request, params }: Route.LoaderArgs) {
};
}
-const prisma = new PrismaClient();
-
-export async function loader({ request, params }: Route.LoaderArgs) {
- const { supabase } = getSupabaseServerClient(request);
- const {
- data: { user },
- } = await supabase.auth.getUser();
-
- if (!user) {
- throw new Response("Unauthorized", { status: 401 });
- }
-
- const { id } = params;
- if (!id) {
- throw new Response("Not Found", { status: 404 });
- }
-
- const item = await prisma.inventoryItem.findFirst({
- where: {
- id,
- userId: user.id,
- },
- include: {
- sale: true,
- priceHistory: {
- orderBy: { fetchedAt: "desc" },
- },
- },
- });
-
- if (!item) {
- throw new Response("Not Found", { status: 404 });
- }
-
- return {
- item: {
- ...item,
- purchasePrice: Number(item.purchasePrice),
- askingPrice: item.askingPrice ? Number(item.askingPrice) : null,
- sale: item.sale
- ? {
- ...item.sale,
- salePrice: Number(item.sale.salePrice),
- platformFee: Number(item.sale.platformFee),
- shippingCost: Number(item.sale.shippingCost),
- }
- : null,
- priceHistory: item.priceHistory.map((ph) => ({
- ...ph,
- askPrice: ph.askPrice ? Number(ph.askPrice) : null,
- bidPrice: ph.bidPrice ? Number(ph.bidPrice) : null,
- lastSold: ph.lastSold ? Number(ph.lastSold) : null,
- })),
- },
- };
-}
export default function InventoryItemDetailPage() {
const { item, relatedItems } = useLoaderData
();
@@ -143,11 +87,6 @@ export default function InventoryItemDetailPage() {
return Item not found
;
}
- return
-
-
-
- const { item } = useLoaderData
();
return (
@@ -163,10 +102,10 @@ export default function InventoryItemDetailPage() {
-
-
+
+
+
-
-
-
+
);
+}
From 0137f044cd88aa1bc5901484ddc6aa1b6668fd6f Mon Sep 17 00:00:00 2001
From: Sweta <254068510+sweta-126-ux@users.noreply.github.com>
Date: Tue, 7 Jul 2026 18:44:24 +0530
Subject: [PATCH 05/15] fixed duplicate errors
---
.../inventory-item-detail/price-history-chart.tsx | 10 +++-------
app/routes/app-layout.tsx | 6 +++---
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/app/blocks/inventory-item-detail/price-history-chart.tsx b/app/blocks/inventory-item-detail/price-history-chart.tsx
index 22eabe6..0caed0f 100644
--- a/app/blocks/inventory-item-detail/price-history-chart.tsx
+++ b/app/blocks/inventory-item-detail/price-history-chart.tsx
@@ -13,13 +13,9 @@ import styles from "./price-history-chart.module.css";
interface Props {
className?: string;
- priceHistory: (Pick