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: more spacing around table

Brad Barbin0100196804a9
diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsx
index 3568dce924..e3bc90e44b 100644
--- a/apps/erp/app/components/Table/Table.tsx
+++ b/apps/erp/app/components/Table/Table.tsx
@@ -61,6 +61,7 @@ import { getAccessorKey, updateNestedProperty } from "./utils";
interface TableProps<T extends object> {
columns: ColumnDef<T>[];
count?: number;
+ compact?: boolean;
data: T[];
defaultColumnOrder?: string[];
defaultColumnPinning?: ColumnPinningState;
@@ -85,6 +86,7 @@ interface TableProps<T extends object> {
const Table = <T extends object>({
data,
columns,
+ compact = false,
count = 0,
defaultColumnOrder,
defaultColumnPinning,
@@ -557,11 +559,18 @@ const Table = <T extends object>({
});
return (
- <VStack spacing={0} className="h-full">
+ <VStack
+ spacing={0}
+ className={cn(
+ "h-full bg-card",
+ !compact && "flex flex-col w-full px-0 md:px-4 lg:px-8 xl:px-12"
+ )}
+ >
<TableHeader
columnAccessors={columnAccessors}
columnOrder={columnOrder}
columns={table.getAllLeafColumns()}
+ compact={compact}
editMode={editMode}
filters={filters}
importCSV={importCSV}
@@ -580,7 +589,9 @@ const Table = <T extends object>({
<div
id="table-container"
- className="w-full h-full bg-background/90 overflow-x-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent"
+ className={cn(
+ "w-full h-full overflow-x-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent"
+ )}
style={{ contain: "strict" }}
ref={tableContainerRef}
onKeyDown={editMode ? onKeyDown : undefined}
diff --git a/apps/erp/app/components/Table/components/Pagination/Pagination.tsx b/apps/erp/app/components/Table/components/Pagination/Pagination.tsx
index cca6cbb285..ce963238d1 100644
--- a/apps/erp/app/components/Table/components/Pagination/Pagination.tsx
+++ b/apps/erp/app/components/Table/components/Pagination/Pagination.tsx
@@ -1,5 +1,6 @@
import {
Button,
+ cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuLabel,
@@ -19,6 +20,7 @@ import { useCallback, useRef } from "react";
import { BsChevronLeft, BsChevronRight } from "react-icons/bs";
export type PaginationProps = {
+ compact?: boolean;
count: number;
offset: number;
pageIndex: number;
@@ -33,7 +35,7 @@ export type PaginationProps = {
};
const Pagination = (props: PaginationProps) => {
- const { pageSize, setPageSize } = props;
+ const { compact, pageSize, setPageSize } = props;
const pageSizes = [20, 100, 500, 1000];
if (!pageSizes.includes(pageSize)) {
@@ -43,7 +45,10 @@ const Pagination = (props: PaginationProps) => {
return (
<HStack
- className="text-center bg-background border-t border-border justify-between px-4 py-2 w-full z-[1]"
+ className={cn(
+ "text-center bg-card border-t border-border justify-between py-2 w-full z-[1]",
+ compact ? "px-4" : "px-4 md:px-0"
+ )}
spacing={6}
>
<DropdownMenu>
diff --git a/apps/erp/app/components/Table/components/TableHeader.tsx b/apps/erp/app/components/Table/components/TableHeader.tsx
index 584165916f..874f591d63 100644
--- a/apps/erp/app/components/Table/components/TableHeader.tsx
+++ b/apps/erp/app/components/Table/components/TableHeader.tsx
@@ -1,6 +1,7 @@
import {
Badge,
Button,
+ cn,
DropdownMenu,
DropdownMenuContent,
DropdownMenuIcon,
@@ -33,6 +34,7 @@ type HeaderProps<T> = {
columnAccessors: Record<string, string>;
columnOrder: ColumnOrderState;
columns: Column<T, unknown>[];
+ compact?: boolean;
editMode: boolean;
filters: ColumnFilter[];
importCSV?: {
@@ -52,6 +54,7 @@ type HeaderProps<T> = {
};
const TableHeader = <T extends object>({
+ compact,
columnAccessors,
columnOrder,
columns,
@@ -77,12 +80,19 @@ const TableHeader = <T extends object>({
>(null);
return (
- <>
- <HStack className="px-4 py-2 justify-between bg-card border-b w-full">
- <HStack>
+ <div className={cn("w-full flex flex-col", !compact && "mb-8")}>
+ <HStack
+ className={cn(
+ compact
+ ? "px-4 py-2 justify-between bg-card border-b w-full"
+ : "px-4 md:px-0 py-6 md:py-[3.25rem] justify-between bg-card w-full relative"
+ )}
+ >
+ <HStack spacing={1}>
<CollapsibleSidebarTrigger />
- {title && <Heading size="h3">{title}</Heading>}
+ {title && <Heading size={compact ? "h3" : "h2"}>{title}</Heading>}
</HStack>
+
<HStack>
{/* <Button variant="secondary" leftIcon={<LuDownload />}>
Export
@@ -116,14 +126,18 @@ const TableHeader = <T extends object>({
)}
</HStack>
</HStack>
- <HStack className="px-4 py-2 justify-between bg-card border-b border-border w-full">
+ <HStack
+ className={cn(
+ compact
+ ? "px-4 py-2 justify-between bg-card border-b border-border w-full"
+ : "px-4 md:px-0 justify-between bg-card w-full"
+ )}
+ >
+ <HStack>{!!filters?.length && <Filter filters={filters} />}</HStack>
<HStack>
{withSearch && (
<SearchFilter param="search" size="sm" placeholder="Search" />
)}
- {!!filters?.length && <Filter filters={filters} />}
- </HStack>
- <HStack>
{withSelectableRows &&
selectedRows.length > 0 &&
typeof renderActions === "function" && (
@@ -177,10 +191,14 @@ const TableHeader = <T extends object>({
</HStack>
</HStack>
{currentFilters.length > 0 && (
- <HStack className="px-4 py-1.5 justify-between bg-card border-b border-border w-full">
- <HStack>
- <ActiveFilters filters={filters} />
- </HStack>
+ <HStack
+ className={cn(
+ compact
+ ? "px-4 py-1.5 justify-between bg-card border-b border-border w-full"
+ : "px-4 md:px-0 py-1.5 justify-between bg-card w-full"
+ )}
+ >
+ <ActiveFilters filters={filters} />
</HStack>
)}
{importCSVTable && (
@@ -189,7 +207,7 @@ const TableHeader = <T extends object>({
onClose={() => setImportCSVTable(null)}
/>
)}
- </>
+ </div>
);
};
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx
index fcfe921d1d..259a6f0de6 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobMaterialsTable.tsx
@@ -254,6 +254,7 @@ const JobMaterialsTable = memo(({ data, count }: JobMaterialsTableProps) => {
return (
<Table<JobMaterial>
+ compact
count={count}
columns={columns}
data={data}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobOperationsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobOperationsTable.tsx
index d3a3b29a3a..e935f06a03 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobOperationsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobOperationsTable.tsx
@@ -234,6 +234,7 @@ const JobOperationsTable = memo(({ data, count }: JobOperationsTableProps) => {
return (
<Table<JobOperation>
+ compact
count={count}
columns={columns}
data={optimisticData}
diff --git a/apps/erp/app/modules/production/ui/Jobs/ProductionEventsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/ProductionEventsTable.tsx
index 9d88230682..b52ab37255 100644
--- a/apps/erp/app/modules/production/ui/Jobs/ProductionEventsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/ProductionEventsTable.tsx
@@ -217,6 +217,7 @@ const ProductionEventsTable = memo(
return (
<>
<Table<ProductionEvent>
+ compact
count={count}
columns={columns}
data={data}
diff --git a/apps/erp/app/modules/production/ui/Jobs/ProductionQuantitiesTable.tsx b/apps/erp/app/modules/production/ui/Jobs/ProductionQuantitiesTable.tsx
index d7a6cbb7ec..f40d127180 100644
--- a/apps/erp/app/modules/production/ui/Jobs/ProductionQuantitiesTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/ProductionQuantitiesTable.tsx
@@ -194,6 +194,7 @@ const ProductionQuantitiesTable = memo(
return (
<>
<Table<ProductionQuantity>
+ compact
count={count}
columns={columns}
data={data}
diff --git a/packages/utils/src/themes.ts b/packages/utils/src/themes.ts
index b98d7d0e0a..bbeb37f591 100644
--- a/packages/utils/src/themes.ts
+++ b/packages/utils/src/themes.ts
@@ -374,18 +374,18 @@ export const themes = [
foreground: "220 0% 95%",
popover: "216 0% 9%",
"popover-foreground": "220 0% 95%",
- card: "220 0% 9%",
- "card-foreground": "220 0% 95%",
+ card: "220 10% 8.9%",
+ "card-foreground": "220 10% 95%",
primary: "216 98% 52%",
"primary-foreground": "216 80.4% 100%",
active: "216 50% 15%",
"active-foreground": "216 98% 58%",
secondary: "220 3.7% 15.9%",
"secondary-foreground": "220 0% 98%",
- muted: "220 0% 15%",
+ muted: "220 3.7% 15.9%",
"muted-foreground": "220 5% 64.9%",
- accent: "220 6.5% 15.1%",
- "accent-foreground": "220 0% 98%",
+ accent: "220 3.7% 15.9%",
+ "accent-foreground": "0 0% 98%",
destructive: "0 62.8% 30.6%",
"destructive-foreground": "0 85.7% 97.3%",
border: "220 3.7% 15.9%",