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.

refactor: fix drawer redirect bug in currencies crud

Brad Barbin432411a63fbf
diff --git a/apps/carbon/app/components/Table/components/Filter/Filter.tsx b/apps/carbon/app/components/Table/components/Filter/Filter.tsx
index 3768a556bd..35db0f60c8 100644
--- a/apps/carbon/app/components/Table/components/Filter/Filter.tsx
+++ b/apps/carbon/app/components/Table/components/Filter/Filter.tsx
@@ -10,6 +10,7 @@ import {
Popover,
PopoverContent,
PopoverTrigger,
+ VStack,
} from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import type { PostgrestResponse } from "@supabase/supabase-js";
@@ -195,7 +196,16 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
>
<HStack spacing={2}>
<Checkbox id={option.value} isChecked={isChecked} />
- <label htmlFor={option.value}>{option.label}</label>
+ <label htmlFor={option.value}>
+ <VStack spacing={0}>
+ <span>{option.label}</span>
+ {option.helperText && (
+ <p className="text-xs text-muted-foreground truncate">
+ {option.helperText}
+ </p>
+ )}
+ </VStack>
+ </label>
</HStack>
</CommandItem>
);
diff --git a/apps/carbon/app/components/Table/components/Filter/types.ts b/apps/carbon/app/components/Table/components/Filter/types.ts
index 0c3ae351ea..d10dfba5e5 100644
--- a/apps/carbon/app/components/Table/components/Filter/types.ts
+++ b/apps/carbon/app/components/Table/components/Filter/types.ts
@@ -10,7 +10,7 @@ export type ColumnFilter = {
export type Option = {
label: string | ReactNode;
value: string;
- helper?: string;
+ helperText?: string;
};
export type ColumnFilterData =
diff --git a/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx b/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
index 1a0dcf3831..14505ada12 100644
--- a/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
+++ b/apps/carbon/app/components/Table/components/Pagination/Pagination.tsx
@@ -118,7 +118,7 @@ export const PaginationButtons = ({
/>
</TooltipTrigger>
<TooltipContent>
- <HStack>F</HStack>
+ <HStack>{prettifyKeyboardShortcut("ArrowLeft")}</HStack>
</TooltipContent>
</Tooltip>
<Tooltip>
@@ -132,7 +132,7 @@ export const PaginationButtons = ({
/>
</TooltipTrigger>
<TooltipContent>
- <HStack>J</HStack>
+ <HStack>{prettifyKeyboardShortcut("ArrowRight")}</HStack>
</TooltipContent>
</Tooltip>
</TooltipProvider>
diff --git a/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
index f4b2cb261b..6b5fbb5ae7 100644
--- a/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
@@ -47,9 +47,7 @@ const CurrenciesTable = memo(({ data, count }: CurrenciesTableProps) => {
{
accessorKey: "isBaseCurrency",
header: "Default Currency",
- cell: ({ row }) => (
- <Checkbox isChecked={row.original.isBaseCurrency} disabled />
- ),
+ cell: ({ row }) => <Checkbox isChecked={row.original.isBaseCurrency} />,
},
];
}, [navigate]);
diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx
index ccf93c45bf..52426e73d0 100644
--- a/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/currencies.$currencyId.tsx
@@ -13,7 +13,7 @@ import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session.server";
import { getCustomFields, setCustomFields } from "~/utils/form";
import { assertIsPost, notFound } from "~/utils/http";
-import { path } from "~/utils/path";
+import { getParams, path } from "~/utils/path";
import { error, success } from "~/utils/result";
export async function loader({ request, params }: LoaderFunctionArgs) {
@@ -66,7 +66,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
return redirect(
- path.to.currencies,
+ `${path.to.currencies}?${getParams(request)}`,
await flash(request, success("Updated currency"))
);
}
diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx
index 6d583e9974..4ae33601d5 100644
--- a/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/currencies.delete.$currencyId.tsx
@@ -6,7 +6,7 @@ import { deleteCurrency, getCurrency } from "~/modules/accounting";
import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session.server";
import { notFound } from "~/utils/http";
-import { path } from "~/utils/path";
+import { getParams, path } from "~/utils/path";
import { error, success } from "~/utils/result";
export async function loader({ request, params }: LoaderFunctionArgs) {
@@ -35,7 +35,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
const { currencyId } = params;
if (!currencyId) {
return redirect(
- path.to.currencies,
+ `${path.to.currencies}?${getParams(request)}`,
await flash(request, error(params, "Failed to get an currency id"))
);
}
@@ -43,13 +43,13 @@ export async function action({ request, params }: ActionFunctionArgs) {
const { error: deleteTypeError } = await deleteCurrency(client, currencyId);
if (deleteTypeError) {
return redirect(
- path.to.currencies,
+ `${path.to.currencies}?${getParams(request)}`,
await flash(request, error(deleteTypeError, "Failed to delete currency"))
);
}
return redirect(
- path.to.currencies,
+ `${path.to.currencies}?${getParams(request)}`,
await flash(request, success("Successfully deleted currency"))
);
}
diff --git a/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx b/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx
index a18475ab48..2c55fa819f 100644
--- a/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx
+++ b/apps/carbon/app/routes/x+/accounting+/currencies.new.tsx
@@ -10,7 +10,7 @@ import { requirePermissions } from "~/services/auth";
import { flash } from "~/services/session.server";
import { setCustomFields } from "~/utils/form";
import { assertIsPost } from "~/utils/http";
-import { path } from "~/utils/path";
+import { getParams, path } from "~/utils/path";
import { error, success } from "~/utils/result";
export async function loader({ request }: LoaderFunctionArgs) {
@@ -60,7 +60,7 @@ export async function action({ request }: ActionFunctionArgs) {
}
return redirect(
- path.to.currencies,
+ `${path.to.currencies}?${getParams(request)}`,
await flash(request, success("Currency created"))
);
}