Consolidate admin pages into tabbed layouts with warm stone theme

- Add SettingsClient with tabs: General, Users, Integrations
- Add RouteTracePage with tabs: Dashboard, Lots, Lookup, Settings
- Fix dark styling in AdminMeClient.tsx (red/green alerts)
- Fix dark styling in AIClient.tsx (emerald/amber/green/red/blue)
- Fix ImportCenterClient.tsx (already correct, no changes needed)
- Fix TypeScript errors in LotListTable, RouteTraceDashboard
- Convert lot.id to lot.lot_id for HaulingLot compatibility
- Update route-trace components to warm stone theme
This commit is contained in:
2026-06-01 20:45:58 +00:00
parent 3274470737
commit 809e0061ca
20 changed files with 834 additions and 560 deletions
+38 -12
View File
@@ -1,8 +1,15 @@
import { redirect } from "next/navigation";
import { getAdminUser } from "@/lib/admin-permissions";
import { isFeatureEnabled } from "@/lib/feature-flags";
import AdminLookupPage from "@/components/route-trace/AdminLookupPage";
import RouteTraceNav from "@/components/route-trace/RouteTraceNav";
import RouteTracePage from "@/components/route-trace/RouteTracePage";
import {
getRouteTraceStats,
getRouteTraceLots,
getHarvestLotsReadyToHaul,
getFieldYieldSummary,
getInventoryByCrop,
getRecentLotEvents,
} from "@/actions/route-trace/lots";
export default async function LookupPage() {
const adminUser = await getAdminUser();
@@ -13,16 +20,35 @@ export default async function LookupPage() {
const enabled = await isFeatureEnabled(effectiveBrandId, "route_trace");
if (!enabled) redirect("/admin/settings/apps?reason=route_trace");
const [statsResult, lotsResult, haulingResult, yieldResult, invResult, eventsResult] = await Promise.all([
getRouteTraceStats(effectiveBrandId),
getRouteTraceLots(effectiveBrandId),
getHarvestLotsReadyToHaul(effectiveBrandId),
getFieldYieldSummary(effectiveBrandId),
getInventoryByCrop(effectiveBrandId),
getRecentLotEvents(effectiveBrandId, 10),
]);
const stats = statsResult.success ? statsResult.stats : {
active_count: 0, in_transit_count: 0, at_shed_count: 0, total_lots_today: 0, total_harvested_today: 0, total_lots: 0,
};
const recentLots = lotsResult.success ? lotsResult.lots.slice(0, 8) : [];
const allLots = lotsResult.success ? lotsResult.lots : [];
const haulingLots = haulingResult.success ? haulingResult.lots : [];
const fieldYield = yieldResult.success ? yieldResult.summary : [];
const inventoryByCrop = invResult.success ? invResult.inventory : [];
const recentActivity = eventsResult.success ? eventsResult.events : [];
return (
<div className="min-h-screen bg-zinc-950 px-6 py-10">
<div className="mx-auto max-w-3xl">
<div className="mb-8">
<h1 className="text-2xl font-semibold text-zinc-100">Lookup</h1>
<p className="mt-1 text-sm text-zinc-500">Find lots by lot number or crop type</p>
</div>
<RouteTraceNav activeTab="lookup" />
<AdminLookupPage brandId={effectiveBrandId} />
</div>
</div>
<RouteTracePage
stats={stats}
recentLots={recentLots}
haulingLots={haulingLots}
fieldYield={fieldYield}
inventoryByCrop={inventoryByCrop}
recentActivity={recentActivity}
brandId={effectiveBrandId}
lots={allLots}
/>
);
}