Admin AI Tools page: unified design system styling, provider selector with OpenAI turd emoji, free-text model input with exact ID warning

This commit is contained in:
2026-06-02 02:21:11 +00:00
parent 809e0061ca
commit 15e939ad7e
116 changed files with 14991 additions and 5326 deletions
+4 -7
View File
@@ -27,13 +27,10 @@ export async function getAdminUser(): Promise<AdminUser | null> {
return buildDevAdmin("platform_admin");
}
// ── Dev session bypass (enabled in all envs for demo) ──────────────
// Allow dev cookies via: document.cookie = "dev_session=platform_admin; path=/"
if (process.env.NODE_ENV === "development") {
const dev = cookieStore.get("dev_session")?.value;
if (dev === "platform_admin" || dev === "brand_admin" || dev === "store_employee") {
return buildDevAdmin(dev);
}
// ── Dev session bypass (enabled for testing on all envs) ──────────────
const dev = cookieStore.get("dev_session")?.value;
if (dev === "platform_admin" || dev === "brand_admin" || dev === "store_employee") {
return buildDevAdmin(dev);
}
// ── Main auth: rc_auth_uid (new) or rc_uid (legacy) cookie set by /api/login ─
+59
View File
@@ -0,0 +1,59 @@
/**
* Route Trace data fetching utilities
* Shared data fetching for all route-trace pages
*/
import {
getRouteTraceStats,
getRouteTraceLots,
getHarvestLotsReadyToHaul,
getFieldYieldSummary,
getInventoryByCrop,
getRecentLotEvents,
type RouteTraceStats,
type HaulingLot,
type FieldYieldSummary,
type InventoryByCrop,
type RecentLotEvent,
} from "@/actions/route-trace/lots";
export type RouteTraceData = {
stats: RouteTraceStats;
lots: HaulingLot[];
haulingLots: HaulingLot[];
fieldYield: FieldYieldSummary[];
inventoryByCrop: InventoryByCrop[];
recentActivity: RecentLotEvent[];
};
/**
* Fetch all route-trace data for a brand
*/
export async function fetchRouteTraceData(
brandId: string
): Promise<RouteTraceData> {
const [statsResult, lotsResult, haulingResult, yieldResult, invResult, eventsResult] = await Promise.all([
getRouteTraceStats(brandId),
getRouteTraceLots(brandId),
getHarvestLotsReadyToHaul(brandId),
getFieldYieldSummary(brandId),
getInventoryByCrop(brandId),
getRecentLotEvents(brandId, 10),
]);
return {
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,
},
lots: lotsResult.success ? lotsResult.lots : [],
haulingLots: haulingResult.success ? haulingResult.lots : [],
fieldYield: yieldResult.success ? yieldResult.summary : [],
inventoryByCrop: invResult.success ? invResult.inventory : [],
recentActivity: eventsResult.success ? eventsResult.events : [],
};
}