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.

fix: always show History button for Starter teaser users

Sidwebworks62f0d2408731
diff --git a/apps/erp/app/components/AuditLog/useAuditLog.tsx b/apps/erp/app/components/AuditLog/useAuditLog.tsx
index 95f287b495..bf1fde69a2 100644
--- a/apps/erp/app/components/AuditLog/useAuditLog.tsx
+++ b/apps/erp/app/components/AuditLog/useAuditLog.tsx
@@ -79,38 +79,48 @@ type AuditLogTriggerProps = {
isStarterTeaser: boolean;
};
+function HistoryTrigger({
+ variant,
+ onOpen
+}: {
+ variant: "dropdown" | "card-action";
+ onOpen: () => void;
+}) {
+ if (variant === "dropdown") {
+ return (
+ <DropdownMenuItem onClick={onOpen}>
+ <DropdownMenuIcon icon={<LuHistory />} />
+ History
+ </DropdownMenuItem>
+ );
+ }
+
+ return (
+ <CardAction>
+ <Button variant="secondary" leftIcon={<LuHistory />} onClick={onOpen}>
+ History
+ </Button>
+ </CardAction>
+ );
+}
+
function AuditLogTrigger({
variant,
onOpen,
auditLogEnabledPromise,
isStarterTeaser
}: AuditLogTriggerProps) {
+ // Starter teaser: always show the button (no need to resolve auditLogEnabled)
+ if (isStarterTeaser) {
+ return <HistoryTrigger variant={variant} onOpen={onOpen} />;
+ }
+
return (
<Suspense fallback={null}>
<Await resolve={auditLogEnabledPromise}>
{(auditLogEnabled) => {
- if (!auditLogEnabled && !isStarterTeaser) return null;
-
- if (variant === "dropdown") {
- return (
- <DropdownMenuItem onClick={onOpen}>
- <DropdownMenuIcon icon={<LuHistory />} />
- History
- </DropdownMenuItem>
- );
- }
-
- return (
- <CardAction>
- <Button
- variant="secondary"
- leftIcon={<LuHistory />}
- onClick={onOpen}
- >
- History
- </Button>
- </CardAction>
- );
+ if (!auditLogEnabled) return null;
+ return <HistoryTrigger variant={variant} onOpen={onOpen} />;
}}
</Await>
</Suspense>