From 474fa637c3ec1b313bd36fe9d0f0da24a507af53 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Sivakumar Date: Sun, 12 Jul 2026 17:58:37 +0530 Subject: [PATCH] fix: dead sidebar/wallet/leads/marketplace navigation links - DashboardLayout sidebar: Leads/Credits/Settings/Logout pointed to routes with no matching file (404). Leads now routes to the real accepted-leads page; Credits/Settings/Logout reuse the working /dashboard?nav= deep-link into the main dashboard's tab switcher (fixes Logout leaving users authenticated on a 404). - wallet/buy.tsx, wallet/payu-return.tsx: post-purchase, cancel, and payment-verification redirects targeted non-existent /dashboard/wallet; now redirect to the existing credits/wallet tab. - leads/accepted.tsx already contained a detail view gated on useParams().id, but was only registered as a flat route with no :id segment, so the detail view was dead code. Split into leads/accepted/index.tsx + leads/accepted/[id].tsx backed by a shared AcceptedLeadsView component. - Added marketplace/[id].tsx: "View Requirement" buttons navigated to a route that never existed. --- src/components/DashboardLayout.tsx | 8 +- .../dashboard/AcceptedLeadsView.tsx} | 2 +- src/routes/dashboard/leads/accepted/[id].tsx | 5 + src/routes/dashboard/leads/accepted/index.tsx | 5 + src/routes/dashboard/marketplace/[id].tsx | 94 +++++++++++++++++++ src/routes/dashboard/wallet/buy.tsx | 4 +- src/routes/dashboard/wallet/payu-return.tsx | 2 +- 7 files changed, 112 insertions(+), 8 deletions(-) rename src/{routes/dashboard/leads/accepted.tsx => components/dashboard/AcceptedLeadsView.tsx} (99%) create mode 100644 src/routes/dashboard/leads/accepted/[id].tsx create mode 100644 src/routes/dashboard/leads/accepted/index.tsx create mode 100644 src/routes/dashboard/marketplace/[id].tsx diff --git a/src/components/DashboardLayout.tsx b/src/components/DashboardLayout.tsx index 61a6f60..19078eb 100644 --- a/src/components/DashboardLayout.tsx +++ b/src/components/DashboardLayout.tsx @@ -13,11 +13,11 @@ const SIDEBAR_ITEMS = [ const ROUTE_BY_LABEL: Record = { "my dashboard": "/dashboard", - leads: "/dashboard/leads", + leads: "/dashboard/leads/accepted", "my requests": "/dashboard/requests", - credits: "/dashboard/credits", - settings: "/dashboard/settings", - logout: "/dashboard/logout", + credits: "/dashboard?nav=credits", + settings: "/dashboard?nav=settings", + logout: "/dashboard?nav=logout", }; function readUserName() { diff --git a/src/routes/dashboard/leads/accepted.tsx b/src/components/dashboard/AcceptedLeadsView.tsx similarity index 99% rename from src/routes/dashboard/leads/accepted.tsx rename to src/components/dashboard/AcceptedLeadsView.tsx index 78bec5e..e33bcc2 100644 --- a/src/routes/dashboard/leads/accepted.tsx +++ b/src/components/dashboard/AcceptedLeadsView.tsx @@ -25,7 +25,7 @@ interface AcceptedLead { accepted_at: string; } -export default function AcceptedLeadsPage() { +export default function AcceptedLeadsView() { const navigate = useNavigate(); const params = useParams(); diff --git a/src/routes/dashboard/leads/accepted/[id].tsx b/src/routes/dashboard/leads/accepted/[id].tsx new file mode 100644 index 0000000..0456b15 --- /dev/null +++ b/src/routes/dashboard/leads/accepted/[id].tsx @@ -0,0 +1,5 @@ +import AcceptedLeadsView from "~/components/dashboard/AcceptedLeadsView"; + +export default function AcceptedLeadDetailRoute() { + return ; +} diff --git a/src/routes/dashboard/leads/accepted/index.tsx b/src/routes/dashboard/leads/accepted/index.tsx new file mode 100644 index 0000000..4eb4011 --- /dev/null +++ b/src/routes/dashboard/leads/accepted/index.tsx @@ -0,0 +1,5 @@ +import AcceptedLeadsView from "~/components/dashboard/AcceptedLeadsView"; + +export default function AcceptedLeadsIndexRoute() { + return ; +} diff --git a/src/routes/dashboard/marketplace/[id].tsx b/src/routes/dashboard/marketplace/[id].tsx new file mode 100644 index 0000000..da31e80 --- /dev/null +++ b/src/routes/dashboard/marketplace/[id].tsx @@ -0,0 +1,94 @@ +import { createResource, Show } from "solid-js"; +import { useNavigate, useParams } from "@solidjs/router"; +import DashboardLayout from "~/components/DashboardLayout"; +import { RequireAuth } from "~/lib/auth"; +import { apiFetch } from "~/lib/api"; + +export default function MarketplaceRequirementDetailRoute() { + const navigate = useNavigate(); + const params = useParams(); + + const [requirement] = createResource(() => params.id, async (id) => { + return apiFetch(`/api/customers/requirements/${id}`); + }); + + const formatDate = (date: string) => { + return new Date(date).toLocaleDateString("en-IN", { + day: "numeric", + month: "long", + year: "numeric", + }); + }; + + return ( + + +
+ + + +
+
+

Loading requirement...

+
+ + + +
+

Requirement not found

+

It may have been closed or removed.

+
+
+ + + {(req: any) => { + const r = req().data || req(); + return ( +
+
+

{r.title}

+

Posted on {r.created_at ? formatDate(r.created_at) : "—"}

+
+ +
+
+

Service Type

+

+ {(r.profession_key || "").toLowerCase().replace(/_/g, " ")} +

+
+
+

Location

+

{r.location}

+
+
+

Budget

+

+ ₹{r.budget?.toLocaleString() || "Not specified"} +

+
+ +
+

Preferred Date

+

{formatDate(r.preferred_date)}

+
+
+
+

Description

+

{r.description}

+
+
+
+ ); + }} +
+
+ + + ); +} diff --git a/src/routes/dashboard/wallet/buy.tsx b/src/routes/dashboard/wallet/buy.tsx index a85de6e..d8ddada 100644 --- a/src/routes/dashboard/wallet/buy.tsx +++ b/src/routes/dashboard/wallet/buy.tsx @@ -80,7 +80,7 @@ export default function BuyTracecoinsPage() { setSuccess(true); setTimeout(() => { - navigate("/dashboard/wallet"); + navigate("/dashboard?nav=credits"); }, 2000); } catch (e: any) { setError(e.message || "Payment failed. Please try again."); @@ -173,7 +173,7 @@ export default function BuyTracecoinsPage() {