Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

style: revert changes to erp homepage

Brad Barbin551a5ada9836
diff --git a/apps/erp/app/routes/x+/_index.tsx b/apps/erp/app/routes/x+/_index.tsx
index 3f6cb91b97..d1a2e75169 100644
--- a/apps/erp/app/routes/x+/_index.tsx
+++ b/apps/erp/app/routes/x+/_index.tsx
@@ -1,15 +1,15 @@
-import { Button, Heading, cn } from "@carbon/react";
-import { useMode } from "@carbon/remix";
+import { Heading, cn } from "@carbon/react";
import { getLocalTimeZone } from "@internationalized/date";
import { useLocale } from "@react-aria/i18n";
import { Link } from "@remix-run/react";
import { useMemo, type ComponentProps } from "react";
-import { usePermissions, useUser } from "~/hooks";
-import { path } from "~/utils/path";
+import { useModules, useUser } from "~/hooks";
+import type { Authenticated, NavItem } from "~/types";
export default function AppIndexRoute() {
const user = useUser();
-
+ // const permissions = usePermissions();
+ const modules = useModules();
const { locale } = useLocale();
const date = new Date();
@@ -22,38 +22,52 @@ export default function AppIndexRoute() {
[locale]
);
- const { company } = useUser();
- const mode = useMode();
- const permissions = usePermissions();
- let logo = mode === "dark" ? company?.logoDark : company?.logoLight;
- let hasCustomLogo = !!logo;
- if (!logo) {
- logo =
- mode === "dark"
- ? "/carbon-word-only-dark.svg"
- : "/carbon-word-only-light.svg";
- }
-
return (
- <div className="p-8 w-full flex flex-col h-[calc(100dvh-var(--header-height)*2)] bg-muted">
+ <div className="p-8 w-full h-full bg-muted">
<Heading size="h3">Hello, {user.firstName}</Heading>
<Subheading>{formatter.format(date)}</Subheading>
- <div className="flex flex-col flex-grow items-center justify-center p-8">
- <div className="flex flex-col items-center justify-center gap-3 -mt-[var(--header-height)] ml-0 md:-ml-[30px]">
- <img src={logo} alt="Carbon" className="max-w-full lg:max-w-lg" />
- {!hasCustomLogo && permissions.can("update", "settings") && (
- <Button asChild size="sm" variant="secondary">
- <Link to={path.to.logos}>Update Logo</Link>
- </Button>
- )}
- </div>
+ <Hr />
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,300px),1fr))] gap-6 mb-8">
+ {/* {permissions.can("view", "production") && (
+ <ModuleCard
+ module={{
+ name: "Schedule",
+ to: path.to.schedule,
+ icon: LuCalendarClock,
+ }}
+ />
+ )} */}
+ {modules
+ .filter((mod) => mod.name !== "Settings")
+ .map((module) => (
+ <ModuleCard key={module.name} module={module} />
+ ))}
</div>
</div>
);
}
+const Hr = () => (
+ <hr className="h-px my-8 bg-black/10 border-0 dark:bg-white/10" />
+);
+
const Subheading = ({ children, className }: ComponentProps<"p">) => (
<p className={cn("text-muted-foreground text-base font-light", className)}>
{children}
</p>
);
+
+const ModuleCard = ({ module }: { module: Authenticated<NavItem> }) => (
+ <Link
+ to={module.to}
+ prefetch="intent"
+ className="aspect-video flex flex-col gap-3 items-center justify-center py-8 shadow-button-base bg-gradient-to-bl from-card from-50% to-background rounded-lg text-center group ring-2 ring-transparent hover:ring-white/10 cursor-pointer hover:scale-105 transition-all duration-300"
+ >
+ <div className="p-4 rounded-lg border">
+ <module.icon className="text-2xl" />
+ </div>
+ <span className="text-sm py-1 px-4 border border-border rounded-full group-hover:bg-accent font-medium tracking-tight">
+ {module.name}
+ </span>
+ </Link>
+);
diff --git a/packages/ee/src/paperless-parts/lib/utils.ts b/packages/ee/src/paperless-parts/lib/utils.ts
index ce0e29a949..935f8dca84 100644
--- a/packages/ee/src/paperless-parts/lib/utils.ts
+++ b/packages/ee/src/paperless-parts/lib/utils.ts
@@ -1,4 +1,5 @@
-import { openai } from "@ai-sdk/openai/edge";
+import { generateObject } from "@ai-sdk/core";
+import { openai } from "@ai-sdk/openai";
import type { Database } from "@carbon/database";
import {
getMaterialDescription,
@@ -8,7 +9,6 @@ import {
textToTiptap,
} from "@carbon/utils";
import type { SupabaseClient } from "@supabase/supabase-js";
-import { generateObject } from "ai";
import { nanoid } from "nanoid";
import { z } from "zod";
import type { PaperlessPartsClient, QuoteCostingVariable } from "./client";