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.

feat: make card data configurable and items only draggable to similar column types

Brad Barbin5d5d151c7abd
diff --git a/apps/carbon/app/components/CustomerAvatar.tsx b/apps/carbon/app/components/CustomerAvatar.tsx
index c46ce4ac7b..d7bc6fd190 100644
--- a/apps/carbon/app/components/CustomerAvatar.tsx
+++ b/apps/carbon/app/components/CustomerAvatar.tsx
@@ -5,11 +5,13 @@ import Avatar from "./Avatar";
type CustomerAvatarProps = AvatarProps & {
customerId: string | null;
+ className?: string;
};
const CustomerAvatar = ({
customerId,
size,
+ className,
...props
}: CustomerAvatarProps) => {
const [customers] = useCustomers();
@@ -24,7 +26,7 @@ const CustomerAvatar = ({
return (
<HStack className="truncate">
<Avatar size={size ?? "xs"} {...props} name={customer?.name ?? ""} />
- <span>{customer.name}</span>
+ <span className={className}>{customer.name}</span>
</HStack>
);
};
diff --git a/apps/carbon/app/components/EmployeeAvatar.tsx b/apps/carbon/app/components/EmployeeAvatar.tsx
index 4b08cfa298..a9afd7b3fd 100644
--- a/apps/carbon/app/components/EmployeeAvatar.tsx
+++ b/apps/carbon/app/components/EmployeeAvatar.tsx
@@ -5,11 +5,13 @@ import Avatar from "./Avatar";
type EmployeeAvatarProps = AvatarProps & {
employeeId: string | null;
+ className?: string;
};
const EmployeeAvatar = ({
employeeId,
size,
+ className,
...props
}: EmployeeAvatarProps) => {
const [people] = usePeople();
@@ -37,7 +39,7 @@ const EmployeeAvatar = ({
src={person.avatarUrl ?? undefined}
name={person?.name ?? ""}
/>
- <span>{person.name}</span>
+ <span className={className}>{person.name}</span>
</HStack>
);
};
diff --git a/apps/carbon/app/components/Kanban/Kanban.tsx b/apps/carbon/app/components/Kanban/Kanban.tsx
index 2d5d8e2a44..78eeaacce2 100644
--- a/apps/carbon/app/components/Kanban/Kanban.tsx
+++ b/apps/carbon/app/components/Kanban/Kanban.tsx
@@ -20,17 +20,18 @@ import { useMemo, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { BoardContainer, ColumnCard } from "./components/ColumnCard";
import { ItemCard } from "./components/ItemCard";
-import type { Column, Item } from "./types";
+import type { Column, DisplaySettings, Item } from "./types";
import { coordinateGetter, hasDraggableData } from "./utils";
type KanbanProps = {
columns: Column[];
items: Item[];
-};
+} & DisplaySettings;
const Kanban = ({
columns: initialColumns,
items: initialItems,
+ ...displaySettings
}: KanbanProps) => {
const [columns, setColumns] = useState<Column[]>(initialColumns);
const pickedUpItemColumn = useRef<string | null>(null);
@@ -171,6 +172,7 @@ const Kanban = ({
key={col.id}
column={col}
items={items.filter((item) => item.columnId === col.id)}
+ {...displaySettings}
/>
))}
</SortableContext>
@@ -187,9 +189,12 @@ const Kanban = ({
items={items.filter(
(item) => item.columnId === activeColumn.id
)}
+ {...displaySettings}
/>
)}
- {activeItem && <ItemCard item={activeItem} isOverlay />}
+ {activeItem && (
+ <ItemCard item={activeItem} isOverlay {...displaySettings} />
+ )}
</DragOverlay>,
document.body
)
@@ -217,6 +222,7 @@ const Kanban = ({
setActiveItem(null);
const { active, over } = event;
+
if (!over) return;
const activeId = active.id;
@@ -233,7 +239,6 @@ const Kanban = ({
setColumns((columns) => {
const activeColumnIndex = columns.findIndex((col) => col.id === activeId);
-
const overColumnIndex = columns.findIndex((col) => col.id === overId);
return arrayMove(columns, activeColumnIndex, overColumnIndex);
@@ -242,6 +247,7 @@ const Kanban = ({
function onDragOver(event: DragOverEvent) {
const { active, over } = event;
+
if (!over) return;
const activeId = active.id;
@@ -258,6 +264,7 @@ const Kanban = ({
const isOverAItem = overData?.type === "item";
if (!isActiveAItem) return;
+ if (activeData?.item.columnType !== overData?.item?.columnType) return; // only allow drop if both columns are same type
// Im dropping a Item over another Item
if (isActiveAItem && isOverAItem) {
diff --git a/apps/carbon/app/components/Kanban/components/ColumnCard.tsx b/apps/carbon/app/components/Kanban/components/ColumnCard.tsx
index e926b5f761..3a5d2ad55c 100644
--- a/apps/carbon/app/components/Kanban/components/ColumnCard.tsx
+++ b/apps/carbon/app/components/Kanban/components/ColumnCard.tsx
@@ -6,26 +6,36 @@ import {
ScrollArea,
ScrollBar,
} from "@carbon/react";
+import { formatDurationMilliseconds } from "@carbon/utils";
import { useDndContext } from "@dnd-kit/core";
import { SortableContext, useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { cva } from "class-variance-authority";
import { useMemo } from "react";
import { LuGripVertical } from "react-icons/lu";
-import type { Column, ColumnDragData, Item } from "../types";
+import type { Column, ColumnDragData, DisplaySettings, Item } from "../types";
import { ItemCard } from "./ItemCard";
type ColumnCardProps = {
column: Column;
items: Item[];
isOverlay?: boolean;
-};
+} & DisplaySettings;
-export function ColumnCard({ column, items, isOverlay }: ColumnCardProps) {
+export function ColumnCard({
+ column,
+ items,
+ isOverlay,
+ ...displaySettings
+}: ColumnCardProps) {
const itemsIds = useMemo(() => {
return items.map((item) => item.id);
}, [items]);
+ const totalDuration = items.reduce((acc, item) => {
+ return acc + (item.duration ?? 0);
+ }, 0);
+
const {
setNodeRef,
attributes,
@@ -71,9 +81,16 @@ export function ColumnCard({ column, items, isOverlay }: ColumnCardProps) {
})}
>
<CardHeader className="p-4 w-full font-semibold text-left flex flex-row space-between items-center">
- <div className="flex flex-grow items-center space-x-2">
+ <div className="flex flex-grow items-start space-x-2">
{column.active && <PulsingDot />}
- <span className="mr-auto truncate"> {column.title}</span>
+ <div className="flex flex-col flex-grow">
+ <span className="mr-auto truncate"> {column.title}</span>
+ {totalDuration > 0 && (
+ <span className="text-muted-foreground text-xs">
+ {formatDurationMilliseconds(totalDuration)}
+ </span>
+ )}
+ </div>
</div>
<Button
variant={"ghost"}
@@ -89,7 +106,7 @@ export function ColumnCard({ column, items, isOverlay }: ColumnCardProps) {
<CardContent className="flex flex-grow flex-col gap-2 p-2">
<SortableContext items={itemsIds}>
{items.map((item) => (
- <ItemCard key={item.id} item={item} />
+ <ItemCard key={item.id} item={item} {...displaySettings} />
))}
</SortableContext>
</CardContent>
@@ -126,7 +143,7 @@ export function BoardContainer({ children }: { children: React.ReactNode }) {
function PulsingDot() {
return (
- <span className="relative flex h-2 w-2">
+ <span className="relative flex h-2 w-2 mt-2">
<span
className={`absolute h-full w-full animate-ping rounded-full border border-emerald-500 opacity-100 duration-1000`}
/>
diff --git a/apps/carbon/app/components/Kanban/components/ItemCard.tsx b/apps/carbon/app/components/Kanban/components/ItemCard.tsx
index ecf1e8c9cf..769cc0208a 100644
--- a/apps/carbon/app/components/Kanban/components/ItemCard.tsx
+++ b/apps/carbon/app/components/Kanban/components/ItemCard.tsx
@@ -21,6 +21,7 @@ import { cva } from "class-variance-authority";
import { BsExclamationSquareFill } from "react-icons/bs";
import {
LuCheckCircle,
+ LuClipboardCheck,
LuFactory,
LuGripVertical,
LuTimer,
@@ -28,6 +29,7 @@ import {
LuXCircle,
} from "react-icons/lu";
+import { motion } from "framer-motion";
import { AlmostDoneIcon } from "~/assets/icons/AlmostDoneIcon";
import { HighPriorityIcon } from "~/assets/icons/HighPriorityIcon";
import { InProgressStatusIcon } from "~/assets/icons/InProgressStatusIcon";
@@ -36,20 +38,21 @@ import { MediumPriorityIcon } from "~/assets/icons/MediumPriorityIcon";
import { TodoStatusIcon } from "~/assets/icons/TodoStatusIcon";
import CustomerAvatar from "~/components/CustomerAvatar";
import EmployeeAvatarGroup from "~/components/EmployeeAvatarGroup";
-import { type Item, type ItemDragData } from "../types";
+import type { DisplaySettings, Item, ItemDragData } from "../types";
type ItemCardProps = {
item: Item;
isOverlay?: boolean;
-};
+} & DisplaySettings;
const cardVariants = cva(
- "bg-gradient-to-tl via-card to-card hover:from-muted/30 hover:to-muted/30 hover:via-muted/30",
+ "bg-gradient-to-tl via-card to-card hover:to-muted/30 hover:via-muted/30",
{
variants: {
dragging: {
- over: "ring-2 opacity-30",
- overlay: "ring-2 ring-primary",
+ over: "ring-2 ring-primary opacity-30",
+ overlay:
+ "ring-2 ring-primary hover:from-muted hover:via-muted hover:to-muted",
},
status: {
IN_PROGRESS: "border-green-600/30 from-green-600/10",
@@ -67,6 +70,8 @@ const cardVariants = cva(
}
);
+const MotionCard = motion(Card);
+
const cardHeaderVariants = cva("border-b", {
variants: {
status: {
@@ -84,7 +89,17 @@ const cardHeaderVariants = cva("border-b", {
},
});
-export function ItemCard({ item, isOverlay }: ItemCardProps) {
+export function ItemCard({
+ item,
+ isOverlay,
+ showCustomer,
+ showDescription,
+ showDueDate,
+ showDuration,
+ showEmployee,
+ showProgress,
+ showStatus,
+}: ItemCardProps) {
const {
setNodeRef,
attributes,
@@ -114,7 +129,7 @@ export function ItemCard({ item, isOverlay }: ItemCardProps) {
: false;
return (
- <Card
+ <MotionCard
ref={setNodeRef}
style={style}
className={cn(
@@ -135,9 +150,11 @@ export function ItemCard({ item, isOverlay }: ItemCardProps) {
>
<div className="flex w-full max-w-full justify-between">
<div className="flex flex-col space-y-0">
- <span className="text-xs text-muted-foreground truncate">
- F01234
- </span>
+ {item.subtitle && (
+ <span className="text-xs text-muted-foreground truncate">
+ {item.subtitle}
+ </span>
+ )}
<span className="mr-auto font-semibold truncate">{item.title}</span>
</div>
<Button
@@ -150,31 +167,41 @@ export function ItemCard({ item, isOverlay }: ItemCardProps) {
<LuGripVertical />
</Button>
</div>
- {["PAUSED", "DONE", "IN_PROGRESS"].includes(item.status!) && (
- <Progress
- indicatorClassName={item.status === "PAUSED" ? "bg-yellow-500" : ""}
- leftLabel={
- item.progress ? formatDurationMilliseconds(item.progress) : ""
- }
- rightLabel={
- item.duration ? formatDurationMilliseconds(item.duration) : ""
- }
- value={
- item.progress && item.duration
- ? (item.progress / item.duration) * 100
- : 0
- }
- />
- )}
+
+ {showProgress &&
+ ["PAUSED", "DONE", "IN_PROGRESS"].includes(item.status!) && (
+ <Progress
+ indicatorClassName={
+ item.status === "PAUSED" ? "bg-yellow-500" : ""
+ }
+ leftLabel={
+ item.progress ? formatDurationMilliseconds(item.progress) : ""
+ }
+ rightLabel={
+ item.duration ? formatDurationMilliseconds(item.duration) : ""
+ }
+ value={
+ item.progress && item.duration
+ ? (item.progress / item.duration) * 100
+ : 0
+ }
+ />
+ )}
</CardHeader>
- <CardContent className="p-3 space-y-2 text-left whitespace-pre-wrap">
- {item.status && (
+ <CardContent className="p-3 space-y-2 text-left whitespace-pre-wrap text-sm">
+ {showDescription && item.description && (
+ <HStack className="justify-start space-x-2">
+ <LuClipboardCheck className="text-muted-foreground" />
+ <span className="text-sm">{item.description}</span>
+ </HStack>
+ )}
+ {showStatus && item.status && (
<HStack className="justify-start space-x-2">
{getStatusIcon(item.status)}
<span className="text-sm">{getStatusText(item.status)}</span>
</HStack>
)}
- {item.duration && (
+ {showDuration && item.duration && (
<HStack className="justify-start space-x-2">
<LuTimer className="text-muted-foreground" />
<span className="text-sm">
@@ -182,7 +209,7 @@ export function ItemCard({ item, isOverlay }: ItemCardProps) {
</span>
</HStack>
)}
- {item.deadlineType && (
+ {showDueDate && item.deadlineType && (
<HStack className="justify-start space-x-2">
{getDeadlineIcon(item.deadlineType, isOverdue)}
<Tooltip>
@@ -206,21 +233,21 @@ export function ItemCard({ item, isOverlay }: ItemCardProps) {
</HStack>
)}
- {item.customerId && (
+ {showCustomer && item.customerId && (
<HStack className="justify-start space-x-2">
<LuFactory className="text-muted-foreground" />
<CustomerAvatar customerId={item.customerId} />
</HStack>
)}
- {item.employeeIds && (
+ {showEmployee && item.employeeIds && (
<HStack className="justify-start space-x-2">
<LuUsers className="text-muted-foreground" />
<EmployeeAvatarGroup employeeIds={item.employeeIds} />
</HStack>
)}
</CardContent>
- </Card>
+ </MotionCard>
);
}
diff --git a/apps/carbon/app/components/Kanban/types.ts b/apps/carbon/app/components/Kanban/types.ts
index fda742c829..c5404e82c0 100644
--- a/apps/carbon/app/components/Kanban/types.ts
+++ b/apps/carbon/app/components/Kanban/types.ts
@@ -4,6 +4,7 @@ export const columnValidator = z.object({
id: z.string(),
title: z.string(),
active: z.boolean().optional(),
+ type: z.string(),
});
export type Column = z.infer<typeof columnValidator>;
@@ -13,20 +14,33 @@ export interface ColumnDragData {
column: Column;
}
+export type DisplaySettings = {
+ showCustomer: boolean;
+ showDescription: boolean;
+ showDueDate: boolean;
+ showDuration: boolean;
+ showEmployee: boolean;
+ showProgress: boolean;
+ showStatus: boolean;
+};
+
export type DraggableData = ColumnDragData | ItemDragData;
const itemValidator = z.object({
id: z.string(),
columnId: z.string(),
+ columnType: z.string(),
title: z.string(),
+ subtitle: z.string().optional(),
customerId: z.string().optional(),
employeeIds: z.array(z.string()).optional(),
- dueDate: z.string().optional(),
- duration: z.number().optional(),
+ description: z.string().optional(),
+ dueDate: z.string().optional(), // 2024-05-28
+ duration: z.number().optional(), // miliseconds
deadlineType: z
.enum(["ASAP", "HARD_DEADLINE", "SOFT_DEADLINE", "NO_DEADLINE"])
.optional(),
- progress: z.number().optional(),
+ progress: z.number().optional(), // miliseconds
status: z
.enum([
"CANCELED",
diff --git a/apps/carbon/app/components/SupplierAvatar.tsx b/apps/carbon/app/components/SupplierAvatar.tsx
index c1ff931daa..5a2a03b76d 100644
--- a/apps/carbon/app/components/SupplierAvatar.tsx
+++ b/apps/carbon/app/components/SupplierAvatar.tsx
@@ -5,11 +5,13 @@ import Avatar from "./Avatar";
type SupplierAvatarProps = AvatarProps & {
supplierId: string | null;
+ className?: string;
};
const SupplierAvatar = ({
supplierId,
size,
+ className,
...props
}: SupplierAvatarProps) => {
const [suppliers] = useSuppliers();
@@ -24,7 +26,7 @@ const SupplierAvatar = ({
return (
<HStack className="truncate">
<Avatar size={size ?? "xs"} {...props} name={supplier?.name ?? ""} />
- <span>{supplier.name}</span>
+ <span className={className}>{supplier.name}</span>
</HStack>
);
};
diff --git a/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx b/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx
index 3f12ef909e..1c31cad65a 100644
--- a/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx
+++ b/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx
@@ -22,7 +22,7 @@ const IntegrationsList = ({ integrations }: IntegrationsListProps) => {
<Card
key={integration.id}
className="cursor-pointer"
- onClick={() => navigate(integration.id)}
+ onClick={() => navigate(integration.id!)}
>
<CardHeader>
<CardTitle className="text-base md:text-lg">
@@ -32,7 +32,7 @@ const IntegrationsList = ({ integrations }: IntegrationsListProps) => {
</CardHeader>
<CardContent>
- <Switch checked={integration.active} />
+ <Switch checked={!!integration.active} />
</CardContent>
</Card>
);
diff --git a/apps/carbon/app/routes/x+/scheduling+/index.tsx b/apps/carbon/app/routes/x+/scheduling+/index.tsx
index 4a2dc88ca6..8c0b27b342 100644
--- a/apps/carbon/app/routes/x+/scheduling+/index.tsx
+++ b/apps/carbon/app/routes/x+/scheduling+/index.tsx
@@ -1,8 +1,17 @@
-import { Button, HStack } from "@carbon/react";
+import {
+ Button,
+ HStack,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ Switch,
+ useLocalStorage,
+} from "@carbon/react";
import type { LoaderFunctionArgs } from "@remix-run/node";
+import { HiOutlineAdjustmentsHorizontal } from "react-icons/hi2";
import { LuListFilter, LuRefreshCcw } from "react-icons/lu";
import { typedjson, useTypedLoaderData } from "remix-typedjson";
-import type { Column, Item } from "~/components/Kanban";
+import type { Column, DisplaySettings, Item } from "~/components/Kanban";
import { Kanban } from "~/components/Kanban";
import { DebouncedInput } from "~/components/Search";
@@ -11,32 +20,40 @@ export async function loader({ request }: LoaderFunctionArgs) {
columns: [
{
id: "1",
+ type: "assembly",
title: "Assembly Station 1",
active: true,
},
{
id: "2",
+ type: "assembly",
title: "Assembly Station 2",
},
{
id: "3",
+ type: "saw",
title: "Band Saw",
},
{
id: "4",
+ type: "grinder",
title: "Bench Grinder",
active: true,
},
{
id: "5",
title: "CNC Mill 1",
+ type: "cnc",
},
] satisfies Column[],
items: [
{
id: "item0",
columnId: "4",
+ columnType: "grinder",
title: "1503",
+ subtitle: "F011432",
+ description: "Grind",
customerId: "ca2f11f8-1464-4753-9690-00107f141f3a",
dueDate: "2024-05-28",
duration: 30 * 60 * 1000,
@@ -47,7 +64,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item1",
columnId: "3",
+ columnType: "saw",
title: "1032",
+ subtitle: "F011432",
+ description: "Cut",
dueDate: "2024-05-30",
duration: 2 * 60 * 60 * 1000,
deadlineType: "SOFT_DEADLINE",
@@ -57,7 +77,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item2",
columnId: "3",
+ columnType: "saw",
title: "1023",
+ subtitle: "F011432",
+ description: "Cut",
dueDate: "2024-05-20",
duration: 2 * 60 * 60 * 1000,
deadlineType: "ASAP",
@@ -67,7 +90,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item3",
columnId: "3",
+ columnType: "saw",
title: "1022",
+ subtitle: "F011432",
+ description: "Cut",
duration: 10 * 60 * 1000,
deadlineType: "NO_DEADLINE",
status: "READY",
@@ -75,7 +101,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item4",
columnId: "2",
+ columnType: "assembly",
title: "1492",
+ subtitle: "F011432",
+ description: "Assemble",
duration: 4 * 60 * 60 * 1000,
deadlineType: "NO_DEADLINE",
status: "WAITING",
@@ -83,7 +112,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item5",
columnId: "2",
+ columnType: "assembly",
title: "1109",
+ subtitle: "F011432",
+ description: "Assemble",
dueDate: "2024-05-20",
duration: 4 * 60 * 60 * 1000,
deadlineType: "SOFT_DEADLINE",
@@ -92,7 +124,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item6",
columnId: "1",
+ columnType: "assembly",
title: "1013",
+ subtitle: "F011432",
+ description: "Assemble",
deadlineType: "NO_DEADLINE",
duration: 2 * 60 * 60 * 1000,
employeeIds: ["52cdefed-f4b7-45b1-9ec8-701473671fb7"],
@@ -102,7 +137,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item7",
columnId: "1",
+ columnType: "assembly",
title: "1014",
+ subtitle: "F011432",
+ description: "Assemble",
dueDate: "2024-06-20",
duration: 20 * 60 * 1000,
deadlineType: "HARD_DEADLINE",
@@ -112,7 +150,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item8",
columnId: "1",
+ columnType: "assembly",
title: "1032",
+ subtitle: "F011432",
+ description: "Assemble",
dueDate: "2024-05-24",
duration: 2 * 60 * 60 * 1000,
deadlineType: "SOFT_DEADLINE",
@@ -122,7 +163,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item9",
columnId: "1",
+ columnType: "assembly",
title: "1010",
+ subtitle: "F011432",
+ description: "Assemble",
dueDate: "2024-05-20",
duration: 32 * 1000,
deadlineType: "ASAP",
@@ -131,7 +175,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
{
id: "item10",
columnId: "1",
+ columnType: "assembly",
title: "1403",
+ subtitle: "F011432",
+ description: "Assemble",
dueDate: "2024-05-20",
duration: 6 * 60 * 60 * 1000,
deadlineType: "NO_DEADLINE",
@@ -144,6 +191,8 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function KanbanView() {
const { columns, items } = useTypedLoaderData<typeof loader>();
+ const [kanbanSettings, setKanbanSettings] = useKanbanSettings();
+
return (
<div className="flex flex-col h-full max-h-full overflow-auto relative">
<HStack className="px-4 py-2 justify-between bg-card border-b border-border">
@@ -159,15 +208,108 @@ export default function KanbanView() {
Filter
</Button>
</HStack>
- <Button leftIcon={<LuRefreshCcw />}>Reschedule</Button>
+ <HStack>
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ leftIcon={<HiOutlineAdjustmentsHorizontal />}
+ variant="secondary"
+ >
+ Display
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="overflow-y-auto p-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-fit"
+ align="end"
+ >
+ <div className="flex flex-col items-end gap-2 pl-4">
+ <Switch
+ variant="small"
+ label="Description"
+ checked={kanbanSettings.showDescription}
+ onCheckedChange={(e) =>
+ setKanbanSettings("showDescription", e.valueOf())
+ }
+ />
+ <Switch
+ variant="small"
+ label="Customer"
+ checked={kanbanSettings.showCustomer}
+ onCheckedChange={(e) =>
+ setKanbanSettings("showCustomer", e.valueOf())
+ }
+ />
+ <Switch
+ variant="small"
+ label="Employee"
+ checked={kanbanSettings.showEmployee}
+ onCheckedChange={(e) =>
+ setKanbanSettings("showEmployee", e.valueOf())
+ }
+ />
+ <Switch
+ variant="small"
+ label="Due Date"
+ checked={kanbanSettings.showDueDate}
+ onCheckedChange={(e) =>
+ setKanbanSettings("showDueDate", e.valueOf())
+ }
+ />
+ <Switch
+ variant="small"
+ label="Duration"
+ checked={kanbanSettings.showDuration}
+ onCheckedChange={(e) =>
+ setKanbanSettings("showDuration", e.valueOf())
+ }
+ />
+ <Switch
+ variant="small"
+ label="Progress"
+ checked={kanbanSettings.showProgress}
+ onCheckedChange={(e) =>
+ setKanbanSettings("showProgress", e.valueOf())
+ }
+ />
+ </div>
+ </PopoverContent>
+ </Popover>
+ <Button leftIcon={<LuRefreshCcw />} variant="secondary">
+ Reschedule
+ </Button>
+ </HStack>
</HStack>
<div className="flex flex-grow h-full items-stretch overflow-hidden relative">
<div className="flex flex-grow h-full items-stretch overflow-hidden relative">
<div className="flex flex-1 min-h-0 w-full relative">
- <Kanban columns={columns} items={items} />
+ <Kanban columns={columns} items={items} {...kanbanSettings} />
</div>
</div>
</div>
</div>
);
}
+
+function useKanbanSettings() {
+ const [kanbanSettings, setKanbanSettings] = useLocalStorage<DisplaySettings>(
+ "kanbanSettings",
+ {
+ showCustomer: false,
+ showDescription: false,
+ showDueDate: false,
+ showDuration: false,
+ showEmployee: false,
+ showProgress: false,
+ showStatus: false,
+ }
+ );
+
+ const updateKanbanSettings = (
+ key: keyof typeof kanbanSettings,
+ value: boolean
+ ) => {
+ setKanbanSettings({ ...kanbanSettings, [key]: value });
+ };
+
+ return [kanbanSettings, updateKanbanSettings] as const;
+}
diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsx
index f2ddfff9a5..5801a13c95 100644
--- a/packages/react/src/index.tsx
+++ b/packages/react/src/index.tsx
@@ -226,21 +226,9 @@ import {
TooltipTrigger,
} from "./Tooltip";
import { VStack } from "./VStack";
-import {
- useDebounce,
- useDisclosure,
- useEscape,
- useHydrated,
- useInitialDimensions,
- useInterval,
- useKeyboardShortcuts,
- useMount,
- useOutsideClick,
- useWindowSize,
-} from "./hooks";
import { cn } from "./utils/cn";
import { getValidChildren, reactNodeToString } from "./utils/react";
-
+export * from "./hooks";
export {
ActionMenu,
Alert,
@@ -449,19 +437,9 @@ export {
multiSelectTriggerVariants,
reactNodeToString,
toast,
- useDebounce,
- useDisclosure,
useEditor,
- useEscape,
- useHydrated,
- useInitialDimensions,
- useInterval,
- useKeyboardShortcuts,
useModalCardType,
useModalDrawerType,
- useMount,
- useOutsideClick,
- useWindowSize,
};
export type {
AvatarProps,