feat(frontend): migrated old > new silo adjustments

moved the apps around so we can use 1 url for cors bs
This commit is contained in:
2025-10-25 17:22:51 -05:00
parent d46ef922f3
commit 425f8f5f71
179 changed files with 7511 additions and 2724 deletions

View File

@@ -0,0 +1,41 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { checkUserAccess } from "@/lib/authClient";
import HistoricalData from "../../-components/logistics/siloAdjustments/HistoricalData";
export const Route = createFileRoute(
"/_old/old/(logistics)/siloAdjustments/$hist",
)({
component: RouteComponent,
beforeLoad: async () => {
const auth = await checkUserAccess({
allowedRoles: ["systemAdmin", "technician", "admin", "manager"],
moduleName: "siloAdjustments", // optional
});
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
// In a loader
loader: ({ params }) => params.hist,
// Or in a component
});
function RouteComponent() {
const { hist } = Route.useParams();
return (
<div>
<HistoricalData laneId={hist} />
</div>
);
}

View File

@@ -0,0 +1,39 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { checkUserAccess } from "@/lib/authClient";
import Comment from "../../../-components/logistics/siloAdjustments/Comment";
export const Route = createFileRoute(
"/_old/old/(logistics)/siloAdjustments/comment/$comment",
)({
beforeLoad: async () => {
const auth = await checkUserAccess({
allowedRoles: ["systemAdmin", "technician", "admin", "manager"],
moduleName: "siloAdjustments", // optional
});
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
// In a loader
loader: ({ params }) => params.comment,
// Or in a component
component: RouteComponent,
});
function RouteComponent() {
const { comment } = Route.useParams();
return (
<div className="ml-20 mt-20">
<Comment id={comment} />
</div>
);
}

View File

@@ -0,0 +1,34 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { checkUserAccess } from "../../../../../lib/authClient";
import SiloPage from "../../-components/logistics/siloAdjustments/SiloPage";
export const Route = createFileRoute("/_old/old/(logistics)/siloAdjustments/")({
component: RouteComponent,
beforeLoad: async () => {
const auth = await checkUserAccess({
allowedRoles: ["systemAdmin", "technician", "admin", "manager"],
moduleName: "siloAdjustments", // optional
});
if (!auth) {
throw redirect({
to: "/login",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.pathname + location.search,
},
});
}
},
});
function RouteComponent() {
return (
<div>
<SiloPage />
</div>
);
}