Polishing The Navigation
Polishing the Navigation
Congratulations on reaching the final lesson of the course. You have built a surprisingly complete app by this point: a storefront with live products, cart and checkout flows, tax preview during purchase, order history and order lifecycle actions, admin product management, and a tax-rate management workspace. That is a full journey from customer browsing all the way through internal operations, and it is a huge milestone.
In this last lesson, the goal is not to introduce a brand-new system. Instead, you will make the app feel finished. You will polish the shared navigation, improve the footer and homepage so they reflect the product’s true capabilities, and tighten the fallback guidance in the shop page so empty states point users toward meaningful next steps. This kind of work matters because once an app has multiple surfaces, the information architecture becomes part of the product quality itself.
Previously
In the previous lesson, you completed the tax-rate management workspace. The app gained a dedicated TaxAdminPageClient, a read flow for tax rates, shared loading, error, and empty states, and write actions that save and delete tax rates before refreshing the list from canonical server data. That meant the internal admin side of the app was no longer limited to product operations; it now also had a dedicated tax-management surface.
This lesson builds on that exact progress. Now that the /admin/tax route exists and the app’s customer and internal workflows are both real, the shared shell needs to acknowledge the full route surface more honestly. The homepage also needs to describe the completed customer journey more accurately, and empty states should point users toward the routes that are now most relevant.
Extending the Navbar with the Tax Management Route
The first file in this lesson is src/components/layout/Navbar.tsx. The navbar already uses a small data-driven navItems array, which makes route expansion clean and local. That means adding the tax-management destination should be a tiny change, not a redesign.
Here is the updated navItems array:
-
The new
{ href: '/admin/tax', label: 'Tax Rates' }entry uses the exact same object shape as the existing navigation items. That is important because it means the new route automatically participates in the same rendering and active-state logic instead of needing a special-case link bolted on elsewhere. -
The existing customer-facing routes and the admin-products destination remain intact. This is the right move because the lesson is extending the finished app surface, not replacing one part of it with another.
-
A small data-driven structure like
navItemsis doing real architectural work here. Because the navbar is powered by a route array, exposing one more destination is a local, low-risk change instead of a scattered UI rewrite.
The mapped rendering logic stays exactly the same:
-
Because the new tax route is added inside
navItems, it inherits the same active-link styling behavior as the rest of the shell automatically. That is one of the biggest benefits of data-driven UI composition: the component’s existing behavior applies uniformly to new destinations. -
The
pathname.startsWith(item.href)logic is especially useful for admin routes, because it keeps a section highlighted even as that section grows into nested pages later. -
Leaving the rendering logic untouched is the right signal that the navbar API was designed well. Good component structure lets new capabilities arrive through extension rather than rewrite.
