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: refactor views for new fullscreen layout

Brad Barbin36c103e4269a
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
index a1d23815f7..94b05365a0 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -141,9 +141,7 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {
const onToggleItem = (id: string) => {
if (!permissions.can("update", "parts")) return;
setItems((prevItems) =>
- prevItems.map((item) =>
- item.id === id ? { ...item, checked: !item.checked } : item
- )
+ prevItems.map((i) => (i.id === id ? { ...i, checked: !i.checked } : i))
);
};
@@ -230,11 +228,11 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {
const onCloseOnDrag = useCallback(() => {
setItems((prevItems) => {
- const updatedItems = prevItems.map((item) =>
- item.checked ? { ...item, checked: false } : item
+ const updatedItems = prevItems.map((i) =>
+ i.checked ? { ...i, checked: false } : i
);
return updatedItems.some(
- (item, index) => item.checked !== prevItems[index].checked
+ (i, index) => i.checked !== prevItems[index].checked
)
? updatedItems
: prevItems;
@@ -242,21 +240,6 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {
}, []);
const onUpdateWorkInstruction = useDebounce(async (content: JSONContent) => {
- if (!permissions.can("update", "parts")) return;
- setItems((prevItems) =>
- prevItems.map((item) =>
- item.id === selectedItemId
- ? {
- ...item,
- data: {
- ...item.data,
- workInstruction: content,
- },
- }
- : item
- )
- );
-
if (selectedItemId !== null && !isTemporaryId(selectedItemId))
await carbon
?.from("methodOperation")
@@ -336,7 +319,24 @@ const BillOfProcess = ({ makeMethodId, operations }: BillOfProcessProps) => {
item.data.workInstruction ?? ({} as JSONContent)
}
onUpload={onUploadImage}
- onChange={onUpdateWorkInstruction}
+ onChange={(content) => {
+ if (!permissions.can("update", "parts")) return;
+ setItems((prevItems) =>
+ prevItems.map((i) =>
+ i.id === selectedItemId
+ ? {
+ ...i,
+ data: {
+ ...i.data,
+ workInstruction: content,
+ },
+ }
+ : i
+ )
+ );
+ onUpdateWorkInstruction(content);
+ }}
+ className="py-8"
/>
) : (
<div
diff --git a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index 8f205c4584..cc4e508f7e 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -176,9 +176,7 @@ const JobBillOfProcess = ({
const onToggleItem = (id: string) => {
if (!permissions.can("update", "sales") || isDisabled) return;
setItems((prevItems) =>
- prevItems.map((item) =>
- item.id === id ? { ...item, checked: !item.checked } : item
- )
+ prevItems.map((i) => (i.id === id ? { ...i, checked: !i.checked } : i))
);
};
@@ -276,20 +274,6 @@ const JobBillOfProcess = ({
const onUpdateWorkInstruction = useDebounce(
async (content: JSONContent) => {
- if (!permissions.can("update", "parts")) return;
- setItems((prevItems) =>
- prevItems.map((item) =>
- item.id === selectedItemId
- ? {
- ...item,
- data: {
- ...item.data,
- workInstruction: content,
- },
- }
- : item
- )
- );
if (selectedItemId !== null && !isTemporaryId(selectedItemId))
await carbon
?.from("jobOperation")
@@ -407,6 +391,7 @@ const JobBillOfProcess = ({
}, [isLoading, hasMore, carbon, selectedItemId, companyId, page]);
const [tabChangeRerender, setTabChangeRerender] = useState<number>(1);
+
const renderListItem = ({
item,
items,
@@ -414,6 +399,7 @@ const JobBillOfProcess = ({
onToggleItem,
onRemoveItem,
}: SortableItemRenderProps<ItemWithData>) => {
+ console.log({ item, items, selectedItemId });
const isOpen = item.id === selectedItemId;
const tabs = [
{
@@ -454,7 +440,24 @@ const JobBillOfProcess = ({
item.data.workInstruction ?? ({} as JSONContent)
}
onUpload={onUploadImage}
- onChange={onUpdateWorkInstruction}
+ onChange={(content) => {
+ if (!permissions.can("update", "parts")) return;
+ setItems((prevItems) =>
+ prevItems.map((i) =>
+ i.id === selectedItemId
+ ? {
+ ...i,
+ data: {
+ ...i.data,
+ workInstruction: content,
+ },
+ }
+ : i
+ )
+ );
+ onUpdateWorkInstruction(content);
+ }}
+ className="py-8"
/>
) : (
<div
diff --git a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
index c32c7fc894..d5bcd69b9f 100644
--- a/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
+++ b/apps/carbon/app/modules/production/ui/Schedule/Kanban/components/ItemCard.tsx
@@ -45,7 +45,7 @@ type ItemCardProps = {
} & DisplaySettings;
const cardVariants = cva(
- "dark:bg-gradient-to-bl dark:via-card dark:to-card dark:hover:to-muted/30 dark:hover:via-muted/30 bg-card hover:bg-muted/30",
+ "dark:bg-gradient-to-tr dark:via-card dark:to-card dark:hover:to-muted/30 dark:hover:via-muted/30 bg-card hover:bg-muted/30",
{
variants: {
dragging: {
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index 4206e5cb82..40157cd043 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -156,9 +156,7 @@ const QuoteBillOfProcess = ({
const onToggleItem = (id: string) => {
if (!permissions.can("update", "sales") || isDisabled) return;
setItems((prevItems) =>
- prevItems.map((item) =>
- item.id === id ? { ...item, checked: !item.checked } : item
- )
+ prevItems.map((i) => (i.id === id ? { ...i, checked: !i.checked } : i))
);
};
@@ -243,11 +241,11 @@ const QuoteBillOfProcess = ({
const onCloseOnDrag = useCallback(() => {
setItems((prevItems) => {
- const updatedItems = prevItems.map((item) =>
- item.checked ? { ...item, checked: false } : item
+ const updatedItems = prevItems.map((i) =>
+ i.checked ? { ...i, checked: false } : i
);
return updatedItems.some(
- (item, index) => item.checked !== prevItems[index].checked
+ (i, index) => i.checked !== prevItems[index].checked
)
? updatedItems
: prevItems;
@@ -256,20 +254,6 @@ const QuoteBillOfProcess = ({
const onUpdateWorkInstruction = useDebounce(
async (content: JSONContent) => {
- if (!permissions.can("update", "parts")) return;
- setItems((prevItems) =>
- prevItems.map((item) =>
- item.id === selectedItemId
- ? {
- ...item,
- data: {
- ...item.data,
- workInstruction: content,
- },
- }
- : item
- )
- );
if (selectedItemId !== null && !isTemporaryId(selectedItemId))
await carbon
?.from("quoteOperation")
@@ -349,7 +333,24 @@ const QuoteBillOfProcess = ({
item.data.workInstruction ?? ({} as JSONContent)
}
onUpload={onUploadImage}
- onChange={onUpdateWorkInstruction}
+ onChange={(content) => {
+ if (!permissions.can("update", "parts")) return;
+ setItems((prevItems) =>
+ prevItems.map((i) =>
+ i.id === selectedItemId
+ ? {
+ ...i,
+ data: {
+ ...i.data,
+ workInstruction: content,
+ },
+ }
+ : i
+ )
+ );
+ onUpdateWorkInstruction(content);
+ }}
+ className="py-8"
/>
) : (
<div
diff --git a/apps/mes/app/components/Filter/ActiveFilters.tsx b/apps/mes/app/components/Filter/ActiveFilters.tsx
new file mode 100644
index 0000000000..a985fc1c26
--- /dev/null
+++ b/apps/mes/app/components/Filter/ActiveFilters.tsx
@@ -0,0 +1,204 @@
+import {
+ Button,
+ Checkbox,
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ HStack,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ reactNodeToString,
+ useMount,
+} from "@carbon/react";
+import { useFetcher } from "@remix-run/react";
+import type { PostgrestResponse } from "@supabase/supabase-js";
+import { useEffect, useState } from "react";
+import { LuX } from "react-icons/lu";
+import Filter from "./Filter";
+import type { ColumnFilter } from "./types";
+import { useFilters } from "./useFilters";
+
+type ActiveFiltersProps = {
+ filters: ColumnFilter[];
+};
+
+const ActiveFilters = ({ filters }: ActiveFiltersProps) => {
+ const { urlFiltersParams } = useFilters();
+ return (
+ <HStack spacing={2}>
+ {urlFiltersParams.map((f) => {
+ const [key, operator, value] = f.split(":");
+ const columnFilter = filters.find((f) => f.accessorKey === key);
+ if (!columnFilter) return null;
+
+ return (
+ <ActiveFilter
+ key={key}
+ filter={columnFilter}
+ operator={operator}
+ value={value}
+ />
+ );
+ })}
+ {urlFiltersParams.length > 0 && (
+ <Filter filters={filters} trigger="icon" />
+ )}
+ </HStack>
+ );
+};
+
+type ActiveFilterProps = {
+ filter: ColumnFilter;
+ operator: string;
+ value: string;
+};
+
+const ActiveFilter = ({ filter, operator, value }: ActiveFilterProps) => {
+ const { hasFilter, removeKey, toggleFilter } = useFilters();
+
+ const [open, setOpen] = useState(false);
+ const [input, setInput] = useState("");
+ const [loading, setLoading] = useState(false);
+ const [options, setOptions] = useState(
+ filter.filter.type === "static" ? filter.filter.options : []
+ );
+
+ useEffect(() => {
+ if (filter.filter.type === "static") {
+ setOptions(filter.filter.options);
+ }
+ }, [filter.filter]);
+
+ useEffect(() => {
+ if (!open) {
+ setInput("");
+ }
+ }, [open]);
+
+ const fetcher = useFetcher<PostgrestResponse<{ id: string; name: string }>>();
+
+ useMount(() => {
+ if (filter.filter.type === "fetcher") {
+ setLoading(true);
+ fetcher.load(filter.filter.endpoint);
+ }
+ });
+
+ useEffect(() => {
+ if (
+ filter.filter.type === "fetcher" &&
+ fetcher.data !== null &&
+ typeof fetcher.data === "object" &&
+ "data" in fetcher.data
+ ) {
+ setOptions(
+ filter.filter.transform
+ ? filter.filter.transform(fetcher.data.data)
+ : fetcher.data.data?.map((d) => ({ label: d.name, value: d.id })) ??
+ []
+ );
+
+ setLoading(false);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [fetcher.data, filter.filter.type]);
+
+ const makeLabel = (v: string) => {
+ const [, ...others] = v.split(",");
+ if (others && others.length > 0) {
+ return `${1 + others.length} ${
+ filter.pluralHeader ? filter.pluralHeader : filter.header + "s"
+ }`;
+ } else {
+ const node = options.find((o) => o.value === v)?.label ?? "";
+ return typeof node === "string" ? node : reactNodeToString(node);
+ }
+ };
+
+ return (
+ <HStack spacing={0}>
+ <Button
+ leftIcon={filter.icon ?? undefined}
+ className="rounded-r-none"
+ size="sm"
+ variant="secondary"
+ >
+ {filter.header}
+ </Button>
+ <Button className="rounded-none border-l-0" size="sm" variant="secondary">
+ {operator === "eq" ? "is" : operator === "in" ? "is any of" : "matches"}
+ </Button>
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <Button
+ className="rounded-none"
+ role="combobox"
+ variant="secondary"
+ onClick={() => {
+ setOpen(true);
+ }}
+ size="sm"
+ >
+ {makeLabel(value)}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="min-w-[200px] w-[--radix-popover-trigger-width] p-0"
+ sticky="always"
+ >
+ <Command>
+ <CommandInput
+ value={input}
+ onValueChange={setInput}
+ placeholder="Search..."
+ className="h-9"
+ />
+ <CommandEmpty>
+ {loading ? "Loading..." : "No options found."}
+ </CommandEmpty>
+ <CommandGroup>
+ {options.map((option) => {
+ const isChecked = hasFilter(filter.accessorKey, option.value);
+ return (
+ <CommandItem
+ value={option.value}
+ key={option.value}
+ onSelect={() => {
+ toggleFilter(
+ filter.accessorKey,
+ option.value,
+ filter.filter.isArray
+ );
+ setOpen(false);
+ }}
+ >
+ <HStack spacing={2}>
+ <Checkbox id={option.value} isChecked={isChecked} />
+ <label htmlFor={option.value}>{option.label}</label>
+ </HStack>
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ </Command>
+ </PopoverContent>
+ </Popover>
+ <Button
+ aria-label="Remove filter"
+ className="rounded-l-none border-l-0 px-1 w-6"
+ size="sm"
+ variant="secondary"
+ onClick={() => {
+ removeKey(filter.accessorKey);
+ }}
+ >
+ <LuX />
+ </Button>
+ </HStack>
+ );
+};
+
+export default ActiveFilters;
diff --git a/apps/mes/app/components/Filter/Filter.tsx b/apps/mes/app/components/Filter/Filter.tsx
new file mode 100644
index 0000000000..ed0d4d269f
--- /dev/null
+++ b/apps/mes/app/components/Filter/Filter.tsx
@@ -0,0 +1,234 @@
+import {
+ Button,
+ Checkbox,
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ HStack,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+ reactNodeToString,
+ VStack,
+} from "@carbon/react";
+import { useFetcher } from "@remix-run/react";
+import type { PostgrestResponse } from "@supabase/supabase-js";
+import type { ComponentPropsWithoutRef } from "react";
+import { forwardRef, useCallback, useEffect, useMemo, useState } from "react";
+import { IoMdAdd } from "react-icons/io";
+import { LuListFilter, LuX } from "react-icons/lu";
+import type { ColumnFilter, Option } from "./types";
+import { useFilters } from "./useFilters";
+
+export type FilterProps = Omit<
+ ComponentPropsWithoutRef<"button">,
+ "onChange"
+> & {
+ filters: ColumnFilter[];
+ trigger?: "button" | "icon";
+};
+
+const Filter = forwardRef<HTMLButtonElement, FilterProps>(
+ ({ filters, trigger = "button", ...props }, ref) => {
+ const { clearFilters, hasFilter, hasFilters, hasFilterKey, toggleFilter } =
+ useFilters();
+
+ const [open, setOpen] = useState(false);
+ const [input, setInput] = useState("");
+ const [loading, setLoading] = useState(false);
+ const [activeFilter, setActiveFilter] = useState<ColumnFilter | null>(null);
+ const [activeOptions, setActiveOptions] = useState<Option[]>([]);
+
+ // reset the state when the filter
+ useEffect(() => {
+ if (!open) {
+ setInput("");
+ setActiveOptions([]);
+ setActiveFilter(null);
+ }
+ }, [open]);
+
+ const fetcher =
+ useFetcher<PostgrestResponse<{ id: string; name: string }>>();
+
+ useEffect(() => {
+ if (
+ activeFilter?.filter.type === "fetcher" &&
+ fetcher.data !== null &&
+ typeof fetcher.data === "object" &&
+ "data" in fetcher.data
+ ) {
+ setActiveOptions(
+ activeFilter.filter.transform
+ ? activeFilter.filter.transform(fetcher.data.data)
+ : fetcher.data.data?.map((d) => ({ label: d.name, value: d.id })) ??
+ []
+ );
+
+ setLoading(false);
+ }
+ }, [fetcher.data, activeFilter]);
+
+ const columnFilters = useMemo(
+ () =>
+ filters.map((f) => ({
+ value: f.accessorKey,
+ label: f.header,
+ icon: f.icon,
+ })),
+ [filters]
+ );
+
+ const updateActiveOptions = useCallback(
+ (value: string) => {
+ const accessorKey = value.split(":")?.[1] ?? "";
+
+ const filter = filters.find(
+ (f) => f.accessorKey.toLowerCase() === accessorKey.toLowerCase()
+ );
+
+ if (!filter)
+ throw new Error(`Filter not found for accessorKey: ${accessorKey}`);
+
+ setInput("");
+ setActiveFilter(filter ?? null);
+
+ if (filter?.filter.type === "static") {
+ setActiveOptions(filter.filter.options);
+ } else if (filter?.filter.type === "fetcher") {
+ setLoading(true);
+ fetcher.load(filter.filter.endpoint);
+ }
+ },
+ [fetcher, filters]
+ );
+
+ return hasFilters && !open && trigger !== "icon" ? (
+ <HStack>
+ <Button
+ rightIcon={<LuX />}
+ ref={ref}
+ variant="secondary"
+ onClick={clearFilters}
+ className={"!border-dashed border-border"}
+ {...props}
+ >
+ Clear Filters
+ </Button>
+ </HStack>
+ ) : (
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ {trigger === "icon" ? (
+ <Button
+ aria-label="Remove filter"
+ className="px-1 w-6"
+ variant="secondary"
+ size="sm"
+ onClick={() => {
+ setOpen(true);
+ }}
+ >
+ <IoMdAdd />
+ </Button>
+ ) : (
+ <Button
+ rightIcon={<LuListFilter />}
+ role="combobox"
+ ref={ref}
+ variant="secondary"
+ onClick={() => {
+ setOpen(true);
+ }}
+ className={"!border-dashed border-border"}
+ {...props}
+ >
+ Filter
+ </Button>
+ )}
+ </PopoverTrigger>
+ <PopoverContent
+ align="start"
+ className="min-w-[260px] w-[--radix-popover-trigger-width] p-0"
+ >
+ <Command>
+ <CommandInput
+ value={input}
+ onValueChange={setInput}
+ placeholder="Search..."
+ className="h-9"
+ />
+ <CommandEmpty>
+ {loading ? "Loading..." : "No available filters."}
+ </CommandEmpty>
+ {activeFilter === null ? (
+ <CommandGroup>
+ {columnFilters
+ .filter((column) => !hasFilterKey(column.value))
+ .map((option) => (
+ <CommandItem
+ key={option.value}
+ value={`${option.label}:${option.value}`}
+ onSelect={updateActiveOptions}
+ className="flex items-center gap-2"
+ >
+ {option.icon}
+ {option.label}
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ ) : (
+ <div className="max-h-[300px] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
+ <CommandGroup>
+ {activeOptions.map((option) => {
+ const isChecked = hasFilter(
+ activeFilter.accessorKey,
+ option.value
+ );
+ return (
+ <CommandItem
+ value={reactNodeToString(option.label)}
+ key={option.value}
+ onSelect={() => {
+ toggleFilter(
+ activeFilter.accessorKey,
+ option.value,
+ activeFilter.filter.isArray
+ );
+ if (trigger === "icon") {
+ setOpen(false);
+ } else {
+ setInput("");
+ }
+ }}
+ >
+ <HStack spacing={2}>
+ <Checkbox id={option.value} isChecked={isChecked} />
+ <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>
+ );
+ })}
+ </CommandGroup>
+ </div>
+ )}
+ </Command>
+ </PopoverContent>
+ </Popover>
+ );
+ }
+);
+Filter.displayName = "Filter";
+
+export default Filter;
diff --git a/apps/mes/app/components/Filter/index.ts b/apps/mes/app/components/Filter/index.ts
new file mode 100644
index 0000000000..2c214df78e
--- /dev/null
+++ b/apps/mes/app/components/Filter/index.ts
@@ -0,0 +1,6 @@
+import ActiveFilters from "./ActiveFilters";
+import Filter from "./Filter";
+import { useFilters } from "./useFilters";
+
+export * from "./types";
+export { ActiveFilters, Filter, useFilters };
diff --git a/apps/mes/app/components/Filter/types.ts b/apps/mes/app/components/Filter/types.ts
new file mode 100644
index 0000000000..e8485b9fcb
--- /dev/null
+++ b/apps/mes/app/components/Filter/types.ts
@@ -0,0 +1,28 @@
+import type { ReactElement, ReactNode } from "react";
+
+export type ColumnFilter = {
+ accessorKey: string;
+ header: string;
+ pluralHeader?: string;
+ filter: ColumnFilterData;
+ icon?: ReactElement;
+};
+
+export type Option = {
+ label: string | ReactNode;
+ value: string;
+ helperText?: string;
+};
+
+export type ColumnFilterData =
+ | {
+ type: "static";
+ options: Option[];
+ isArray?: boolean;
+ }
+ | {
+ type: "fetcher";
+ endpoint: string;
+ transform?: (result: any) => Option[];
+ isArray?: boolean;
+ };
diff --git a/apps/mes/app/components/Filter/useFilters.tsx b/apps/mes/app/components/Filter/useFilters.tsx
new file mode 100644
index 0000000000..23ed92b2fd
--- /dev/null
+++ b/apps/mes/app/components/Filter/useFilters.tsx
@@ -0,0 +1,132 @@
+import { useUrlParams } from "~/hooks/useUrlParams";
+
+export function useFilters() {
+ const [params, setParams] = useUrlParams();
+ const urlFiltersParams = params.getAll("filter");
+ const hasFilter = (searchKey: string, searchValue: string) => {
+ return urlFiltersParams.some((filter) => {
+ const [key, operator, value] = filter.split(":");
+ if (key && operator && value) {
+ switch (operator) {
+ case "eq":
+ return key === searchKey && value === searchValue;
+ case "in":
+ case "contains":
+ const values = value.split(",");
+ return key === searchKey && values.some((v) => v === searchValue);
+ default:
+ return false;
+ }
+ }
+ return false;
+ });
+ };
+
+ const hasFilterKey = (searchKey: string) => {
+ return urlFiltersParams.some((filter) => {
+ const [key] = filter.split(":");
+ return key === searchKey;
+ });
+ };
+
+ const getFilterKeyIndex = (key: string) => {
+ return urlFiltersParams.findIndex((f) => {
+ let accessorKey = f.split(":")?.[0];
+ return key === accessorKey;
+ });
+ };
+
+ const addFilter = (newKey: string, newValue: string, isArray = false) => {
+ if (hasFilterKey(newKey)) {
+ const filterIndex = getFilterKeyIndex(newKey);
+ const filter = urlFiltersParams[filterIndex];
+ const [key, operator, value] = filter.split(":");
+
+ let newFilter = "";
+ if (["in", "contains"].includes(operator)) {
+ newFilter = `${filter},${newValue}`;
+ } else {
+ newFilter = `${key}:in:${value},${newValue}`;
+ }
+
+ setParams({
+ filter: urlFiltersParams.map((f, index) =>
+ index === filterIndex ? newFilter : f
+ ),
+ });
+ } else {
+ if (isArray) {
+ setParams({
+ filter: urlFiltersParams.concat(`${newKey}:contains:${newValue}`),
+ });
+ } else {
+ setParams({
+ filter: urlFiltersParams.concat(`${newKey}:eq:${newValue}`),
+ });
+ }
+ }
+ };
+
+ const removeFilter = (oldKey: string, oldValue: string, isArray = false) => {
+ const filterIndex = getFilterKeyIndex(oldKey);
+ const filter = urlFiltersParams[filterIndex];
+ const [key, operator, value] = filter.split(":");
+ if (["in", "contains"].includes(operator)) {
+ const values = value.split(",").filter((v) => v !== oldValue);
+ if (operator === "in" && values.length === 1) {
+ setParams({
+ filter: urlFiltersParams.map((f, index) =>
+ index === filterIndex ? `${key}:eq:${values[0]}` : f
+ ),
+ });
+ } else if (values.length === 0) {
+ setParams({
+ filter: urlFiltersParams.filter((_, index) => index !== filterIndex),
+ });
+ } else {
+ setParams({
+ filter: urlFiltersParams.map((f, index) =>
+ index === filterIndex ? `${key}:${operator}:${values.join(",")}` : f
+ ),
+ });
+ }
+ } else {
+ setParams({
+ filter: urlFiltersParams.filter((_, index) => index !== filterIndex),
+ });
+ }
+ };
+
+ const removeKey = (key: string) => {
+ setParams({
+ filter: urlFiltersParams.filter((f) => {
+ const [filterKey] = f.split(":");
+ return filterKey !== key;
+ }),
+ });
+ };
+
+ const toggleFilter = (key: string, value: string, isArray = false) => {
+ if (hasFilter(key, value)) {
+ removeFilter(key, value, isArray);
+ } else {
+ addFilter(key, value, isArray);
+ }
+ };
+
+ const clearFilters = () => {
+ setParams({ filter: undefined });
+ };
+
+ const hasFilters = urlFiltersParams.length > 0;
+
+ return {
+ clearFilters,
+ hasFilter,
+ hasFilters,
+ hasFilterKey,
+ removeKey,
+ toggleFilter,
+ urlFiltersParams,
+ };
+}
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index eb8923b366..8842ba2297 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -8,7 +8,6 @@ import {
generateHTML,
Heading,
HStack,
- IconButton,
Modal,
ModalBody,
ModalContent,
@@ -20,6 +19,7 @@ import {
Progress,
ScrollArea,
Separator,
+ SidebarTrigger,
Skeleton,
Slider,
Table,
@@ -44,7 +44,7 @@ import {
VStack,
type JSONContent,
} from "@carbon/react";
-import { Await, Link, useFetcher, useParams } from "@remix-run/react";
+import { Await, useFetcher, useNavigate, useParams } from "@remix-run/react";
import type { ComponentProps, ReactNode } from "react";
import {
Suspense,
@@ -59,7 +59,6 @@ import {
FileIcon,
FilePreview,
OperationStatusIcon,
- OptionallyFullscreen,
} from "~/components";
import { useMode, useRealtime, useUser } from "~/hooks";
import type {
@@ -99,14 +98,17 @@ import {
parseAbsolute,
toZoned,
} from "@internationalized/date";
-import type { PostgrestResponse, RealtimeChannel } from "@supabase/supabase-js";
+import type {
+ PostgrestResponse,
+ PostgrestSingleResponse,
+ RealtimeChannel,
+} from "@supabase/supabase-js";
import { FaTasks } from "react-icons/fa";
import { FaCheck, FaPause, FaPlay, FaPlus, FaTrash } from "react-icons/fa6";
import {
LuAlertTriangle,
LuChevronLeft,
LuClipboardCheck,
- LuExpand,
LuHammer,
LuHardHat,
LuTimer,
@@ -116,29 +118,29 @@ import ItemThumbnail from "./ItemThumbnail";
import ScrapReason from "./ScrapReason";
type JobOperationProps = {
- backPath: string;
events: ProductionEvent[];
files: Promise<StorageItem[]>;
materials: Promise<PostgrestResponse<JobMaterial>>;
operation: OperationWithDetails;
job: Job;
thumbnailPath: string | null;
+ workCenter: Promise<PostgrestSingleResponse<{ name: string }>>;
};
export const JobOperation = ({
- backPath,
events,
files,
job,
materials,
operation: originalOperation,
thumbnailPath,
+ workCenter,
}: JobOperationProps) => {
+ const navigate = useNavigate();
useRealtime("job", `id=eq.${job.id}`);
const {
activeTab,
eventType,
- fullscreen,
isOverdue,
operation,
finishModal,
@@ -154,7 +156,7 @@ export const JobOperation = ({
if (operation.setupDuration > 0) operations++;
if (operation.laborDuration > 0) operations++;
if (operation.machineDuration > 0) operations++;
- return 122 + operations * 24;
+ return 40 + operations * 24;
}, [
operation.laborDuration,
operation.machineDuration,
@@ -175,10 +177,7 @@ export const JobOperation = ({
const { operationId } = useParams();
return (
- <OptionallyFullscreen
- isFullScreen={fullscreen.isOpen}
- onClose={fullscreen.onClose}
- >
+ <>
<Tabs
key={operation.id}
value={activeTab}
@@ -188,93 +187,91 @@ export const JobOperation = ({
{ "--controls-height": `${controlsHeight}px` } as React.CSSProperties
}
>
- <div className="flex items-center justify-between px-4 py-2 h-[var(--header-height)] bg-background">
- <div className="flex items-center flex-grow gap-2">
- {!fullscreen.isOpen && (
- <Link to={backPath}>
- <IconButton
- aria-label="Back"
- icon={<LuChevronLeft />}
- variant="secondary"
- />
- </Link>
+ <header className="flex h-[var(--header-height)] shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 border-b px-2">
+ <HStack className="w-full justify-between">
+ <div className="flex items-center gap-0">
+ <SidebarTrigger />
+
+ <Button
+ variant="ghost"
+ leftIcon={<LuChevronLeft />}
+ onClick={() => navigate(-1)}
+ className="pl-2"
+ >
+ Back
+ </Button>
+ </div>
+ <div className="hidden md:flex flex-shrink-0 items-center justify-end gap-2">
+ <Navigation job={job} operation={operation} />
+ </div>
+ </HStack>
+ </header>
+
+ <div className="hidden md:flex items-center justify-between px-4 py-2 h-[var(--header-height)] bg-background gap-4 max-w-[100vw] overflow-x-hidden scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
+ <Heading size="h4">{operation.jobReadableId}</Heading>
+
+ <HStack className="justify-end items-center gap-2">
+ {operation.description && (
+ <HStack className="justify-start space-x-2">
+ <LuClipboardCheck className="text-muted-foreground" />
+ <span className="text-sm truncate">
+ {operation.description}
+ </span>
+ </HStack>
)}
- <Heading size="h4">{operation.jobReadableId}</Heading>
- </div>
- <div className="hidden md:flex flex-shrink-0 items-center justify-end gap-2">
- <Navigation
- job={job}
- operation={operation}
- fullscreen={fullscreen}
- />
- </div>
- </div>
-
- <Separator />
- <div className="flex items-center justify-start px-4 py-2 h-[var(--header-height)] bg-background gap-4 w-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
- {operation.description && (
- <HStack className="justify-start space-x-2">
- <LuClipboardCheck className="text-muted-foreground" />
- <span className="text-sm truncate">{operation.description}</span>
- </HStack>
- )}
- {operation.operationStatus && (
- <HStack className="justify-start space-x-2">
- <OperationStatusIcon
- status={
- operation.jobStatus === "Paused"
+ {operation.operationStatus && (
+ <HStack className="justify-start space-x-2">
+ <OperationStatusIcon
+ status={
+ operation.jobStatus === "Paused"
+ ? "Paused"
+ : operation.operationStatus
+ }
+ />
+ <span className="text-sm truncate">
+ {operation.jobStatus === "Paused"
? "Paused"
- : operation.operationStatus
- }
- />
- <span className="text-sm truncate">
- {operation.jobStatus === "Paused"
- ? "Paused"
- : operation.operationStatus}
- </span>
- </HStack>
- )}
- {typeof operation.duration === "number" && (
- <HStack className="justify-start space-x-2">
- <LuTimer className="text-muted-foreground" />
- <span className="text-sm truncate">
- {formatDurationMilliseconds(operation.duration)}
- </span>
- </HStack>
- )}
- {operation.jobDeadlineType && (
- <HStack className="justify-start space-x-2">
- <DeadlineIcon
- deadlineType={operation.jobDeadlineType}
- overdue={isOverdue}
- />
+ : operation.operationStatus}
+ </span>
+ </HStack>
+ )}
+ {typeof operation.duration === "number" && (
+ <HStack className="justify-start space-x-2">
+ <LuTimer className="text-muted-foreground" />
+ <span className="text-sm truncate">
+ {formatDurationMilliseconds(operation.duration)}
+ </span>
+ </HStack>
+ )}
+ {operation.jobDeadlineType && (
+ <HStack className="justify-start space-x-2">
+ <DeadlineIcon
+ deadlineType={operation.jobDeadlineType}
+ overdue={isOverdue}
+ />
- <span
- className={cn(
- "text-sm truncate",
- isOverdue ? "text-red-500" : ""
- )}
- >
- {["ASAP", "No Deadline"].includes(operation.jobDeadlineType)
- ? operation.jobDeadlineType
- : operation.jobDueDate
- ? `Due ${formatRelativeTime(
- convertDateStringToIsoString(operation.jobDueDate)
- )}`
- : "–"}
- </span>
- </HStack>
- )}
+ <span
+ className={cn(
+ "text-sm truncate",
+ isOverdue ? "text-red-500" : ""
+ )}
+ >
+ {["ASAP", "No Deadline"].includes(operation.jobDeadlineType)
+ ? operation.jobDeadlineType
+ : operation.jobDueDate
+ ? `Due ${formatRelativeTime(
+ convertDateStringToIsoString(operation.jobDueDate)
+ )}`
+ : "–"}
+ </span>
+ </HStack>
+ )}
+ </HStack>
</div>
<Separator />
- <div className="flex md:hidden items-center justify-start px-4 py-2 h-[var(--header-height)] bg-background gap-4">
- <Navigation job={job} operation={operation} fullscreen={fullscreen} />
- </div>
- <Separator className="flex md:hidden" />
-
- <TabsContent value="details" className="flex flex-col">
- <ScrollArea className="w-full h-[calc(100dvh-var(--header-height)*2-var(--controls-height)-2rem)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
+ <TabsContent value="details" className="flex-col hidden md:flex">
+ <ScrollArea className="w-full pl-[calc(var(--controls-width))] h-[calc(100dvh-var(--header-height)*2-var(--controls-height)-2rem)] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
<div className="flex items-start justify-between p-4">
<HStack>
{thumbnailPath && (
@@ -300,23 +297,23 @@ export const JobOperation = ({
<div className="rounded-xl border bg-card text-card-foreground shadow">
<div className="p-6 flex flex-row items-center justify-between space-y-0 pb-2">
<h3 className="tracking-tight text-sm font-medium">
- Scrapped
+ Completed
</h3>
- <FaTrash className="h-3 w-3 text-muted-foreground" />
+ <FaCheck className="h-3 w-3 text-muted-foreground" />
</div>
<div className="p-6 pt-0">
- <Heading size="h2">{operation.quantityScrapped}</Heading>
+ <Heading size="h2">{operation.quantityComplete}</Heading>
</div>
</div>
<div className="rounded-xl border bg-card text-card-foreground shadow">
<div className="p-6 flex flex-row items-center justify-between space-y-0 pb-2">
<h3 className="tracking-tight text-sm font-medium">
- Completed
+ Scrapped
</h3>
- <FaCheck className="h-3 w-3 text-muted-foreground" />
+ <FaTrash className="h-3 w-3 text-muted-foreground" />
</div>
<div className="p-6 pt-0">
- <Heading size="h2">{operation.quantityComplete}</Heading>
+ <Heading size="h2">{operation.quantityScrapped}</Heading>
</div>
</div>
@@ -467,7 +464,7 @@ export const JobOperation = ({
</ScrollArea>
</TabsContent>
<TabsContent value="model">
- <div className="w-full h-[calc(100dvh-var(--header-height)*2-var(--controls-height))] p-0">
+ <div className="w-full h-[calc(100dvh-var(--header-height)*2)] p-0">
<ModelViewer
file={null}
key={operation.itemModelPath ?? job.modelPath}
@@ -491,8 +488,142 @@ export const JobOperation = ({
/>
</ScrollArea>
</TabsContent>
+ {activeTab !== "instructions" && (
+ <Controls>
+ <div className="flex flex-col items-center gap-2 p-4">
+ <VStack spacing={2}>
+ <VStack spacing={1}>
+ <span className="text-muted-foreground text-xs">
+ Work Center
+ </span>
+ <Suspense fallback={<Heading size="h4">...</Heading>}>
+ <Await resolve={workCenter}>
+ {(resolvedWorkCenter) =>
+ resolvedWorkCenter.data && (
+ <Heading size="h4" className="line-clamp-1">
+ {resolvedWorkCenter.data?.name}
+ </Heading>
+ )
+ }
+ </Await>
+ </Suspense>
+ </VStack>
+
+ <VStack spacing={1}>
+ <span className="text-muted-foreground text-xs">Item</span>
+ <Heading size="h4" className="line-clamp-1">
+ {operation.itemReadableId}
+ </Heading>
+ </VStack>
+ </VStack>
+
+ <div className="md:hidden flex flex-col items-center gap-2 w-full">
+ <VStack spacing={1}>
+ <span className="text-muted-foreground text-xs">Job</span>
+ <HStack className="justify-start space-x-2">
+ <LuClipboardCheck className="text-muted-foreground" />
+ <span className="text-sm truncate">
+ {operation.jobReadableId}
+ </span>
+ </HStack>
+ </VStack>
+ {operation.description && (
+ <VStack spacing={1}>
+ <span className="text-muted-foreground text-xs">
+ Description
+ </span>
+ <HStack className="justify-start space-x-2">
+ <LuClipboardCheck className="text-muted-foreground" />
+ <span className="text-sm truncate">
+ {operation.description}
+ </span>
+ </HStack>
+ </VStack>
+ )}
+ {operation.jobDeadlineType && (
+ <VStack spacing={1}>
+ <span className="text-muted-foreground text-xs">
+ Deadline
+ </span>
+ <HStack className="justify-start space-x-2">
+ <DeadlineIcon
+ deadlineType={operation.jobDeadlineType}
+ overdue={isOverdue}
+ />
+
+ <span
+ className={cn(
+ "text-sm truncate",
+ isOverdue ? "text-red-500" : ""
+ )}
+ >
+ {["ASAP", "No Deadline"].includes(
+ operation.jobDeadlineType
+ )
+ ? operation.jobDeadlineType
+ : operation.jobDueDate
+ ? `Due ${formatRelativeTime(
+ convertDateStringToIsoString(operation.jobDueDate)
+ )}`
+ : "–"}
+ </span>
+ </HStack>
+ </VStack>
+ )}
+ </div>
+
+ <WorkTypeToggle
+ active={active}
+ operation={operation}
+ value={eventType}
+ onChange={setEventType}
+ className="py-2"
+ />
+
+ <StartStopButton
+ eventType={eventType as (typeof productionEventType)[number]}
+ job={job}
+ operation={operation}
+ setupProductionEvent={setupProductionEvent}
+ laborProductionEvent={laborProductionEvent}
+ machineProductionEvent={machineProductionEvent}
+ />
+ <div className="flex items-center gap-2 justify-center">
+ {/* <IconButtonWithTooltip
+ icon={
+ <FaRedoAlt className="text-accent-foreground group-hover:text-accent-foreground/80" />
+ }
+ tooltip="Log Rework"
+ onClick={reworkModal.onOpen}
+ />
+ */}
+ <IconButtonWithTooltip
+ icon={
+ <FaTrash className="text-accent-foreground group-hover:text-accent-foreground/80" />
+ }
+ tooltip="Log Scrap"
+ onClick={scrapModal.onOpen}
+ />
- <Controls>
+ <IconButtonWithTooltip
+ icon={
+ <FaPlus className="text-accent-foreground group-hover:text-accent-foreground/80" />
+ }
+ tooltip="Log Completed"
+ onClick={completeModal.onOpen}
+ />
+ <IconButtonWithTooltip
+ icon={
+ <FaCheck className="text-accent-foreground group-hover:text-accent-foreground/80" />
+ }
+ tooltip="Close Out"
+ onClick={finishModal.onOpen}
+ />
+ </div>
+ </div>
+ </Controls>
+ )}
+ <Times>
<div className="flex items-start p-4">
<div className="flex flex-col w-full gap-2">
{operation.setupDuration > 0 && (
@@ -585,55 +716,7 @@ export const JobOperation = ({
</HStack>
</div>
</div>
- <div className="flex flex-col items-center gap-4">
- <div className="flex items-center gap-4 justify-center">
- {/* <IconButtonWithTooltip
- icon={
- <FaRedoAlt className="text-accent-foreground group-hover:text-accent-foreground/80" />
- }
- tooltip="Log Rework"
- onClick={reworkModal.onOpen}
- />
- */}
- <IconButtonWithTooltip
- icon={
- <FaTrash className="text-accent-foreground group-hover:text-accent-foreground/80" />
- }
- tooltip="Log Scrap"
- onClick={scrapModal.onOpen}
- />
- <StartStopButton
- eventType={eventType as (typeof productionEventType)[number]}
- job={job}
- operation={operation}
- setupProductionEvent={setupProductionEvent}
- laborProductionEvent={laborProductionEvent}
- machineProductionEvent={machineProductionEvent}
- />
-
- <IconButtonWithTooltip
- icon={
- <FaPlus className="text-accent-foreground group-hover:text-accent-foreground/80" />
- }
- tooltip="Log Completed"
- onClick={completeModal.onOpen}
- />
- <IconButtonWithTooltip
- icon={
- <FaCheck className="text-accent-foreground group-hover:text-accent-foreground/80" />
- }
- tooltip="Close Out"
- onClick={finishModal.onOpen}
- />
- <WorkTypeToggle
- active={active}
- operation={operation}
- value={eventType}
- onChange={setEventType}
- />
- </div>
- </div>
- </Controls>
+ </Times>
</Tabs>
{reworkModal.isOpen && (
<QuantityModal
@@ -676,7 +759,7 @@ export const JobOperation = ({
onClose={finishModal.onClose}
/>
)}
- </OptionallyFullscreen>
+ </>
);
};
@@ -879,8 +962,6 @@ function useFiles(job: Job) {
}
function useOperationState(operation: OperationWithDetails, job: Job) {
- const fullscreen = useDisclosure();
-
const scrapModal = useDisclosure();
const reworkModal = useDisclosure();
const completeModal = useDisclosure();
@@ -956,7 +1037,6 @@ function useOperationState(operation: OperationWithDetails, job: Job) {
operation: operationState,
activeTab,
eventType,
- fullscreen,
scrapModal,
reworkModal,
completeModal,
@@ -1005,12 +1085,31 @@ function Controls({
}: {
children: ReactNode;
className?: string;
+}) {
+ return (
+ <div
+ className={cn(
+ "flex flex-col md:absolute p-2 top-[calc(var(--header-height)*2-2px)] left-0 w-full md:w-[var(--controls-width)] md:min-h-[200px] z-1 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 md:border-r border-y md:rounded-br-lg",
+ className
+ )}
+ >
+ {children}
+ </div>
+ );
+}
+
+function Times({
+ children,
+ className,
+}: {
+ children: ReactNode;
+ className?: string;
}) {
return (
<TooltipProvider>
<div
className={cn(
- "absolute p-2 bottom-2 left-1/2 transform -translate-x-1/2 w-[calc(100%-1rem)] z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border rounded-lg",
+ "flex flex-col md:absolute p-2 bottom-2 md:left-1/2 md:transform md:-translate-x-1/2 w-full md:w-[420px] z-50 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 border-b md:border md:rounded-lg",
className
)}
>
@@ -1044,7 +1143,7 @@ function IconButtonWithTooltip({
<ButtonWithTooltip
{...props}
tooltip={tooltip}
- className="w-12 h-12 md:w-16 md:h-16 flex flex-row items-center gap-2 justify-center bg-accent rounded-full shadow-lg hover:cursor-pointer hover:shadow-xl hover:accent hover:scale-105 transition-all disabled:cursor-not-allowed disabled:bg-muted"
+ className="size-12 md:size-16 flex flex-row items-center gap-2 justify-center bg-accent rounded-full shadow-lg hover:cursor-pointer hover:shadow-xl hover:accent hover:scale-105 transition-all disabled:cursor-not-allowed disabled:bg-muted"
>
{icon}
</ButtonWithTooltip>
@@ -1056,33 +1155,54 @@ function WorkTypeToggle({
operation,
value,
onChange,
+ className,
}: {
active: { setup: boolean; labor: boolean; machine: boolean };
operation: OperationWithDetails;
value: string;
onChange: (type: string) => void;
+ className?: string;
}) {
- const nonZeroDurations = [
- operation.setupDuration,
+ const count = useMemo(() => {
+ let count = 0;
+ if (operation.setupDuration > 0) {
+ count++;
+ }
+ if (operation.laborDuration > 0) {
+ count++;
+ }
+ if (operation.machineDuration > 0) {
+ count++;
+ }
+ return count;
+ }, [
operation.laborDuration,
operation.machineDuration,
- ].filter((duration) => duration > 0);
-
- if (nonZeroDurations.length <= 1) {
- return null;
- }
+ operation.setupDuration,
+ ]);
return (
- <ToggleGroup value={value} type="single" onValueChange={onChange}>
+ <ToggleGroup
+ value={value}
+ type="single"
+ onValueChange={onChange}
+ className={cn(
+ "grid w-full",
+ count <= 1 && "grid-cols-1",
+ count === 2 && "grid-cols-2",
+ count === 3 && "grid-cols-3",
+ className
+ )}
+ >
{operation.setupDuration > 0 && (
<ToggleGroupItem
- className="w-[80px] sm:w-[110px] relative"
+ className="flex flex-col items-center relative justify-center text-center h-14 w-full"
value="Setup"
size="lg"
aria-label="Toggle setup"
>
- <LuTimer className="h-4 w-4 mr-2 flex-shrink-0" />
- <span className="hidden sm:inline-flex">Setup</span>
+ <LuTimer className="size-6 pt-1" />
+ <span className="text-xxs">Setup</span>
{active.setup && (
<span className="absolute -top-1 -right-1 h-3 w-3 bg-emerald-500 rounded-full" />
)}
@@ -1090,13 +1210,13 @@ function WorkTypeToggle({
)}
{operation.laborDuration > 0 && (
<ToggleGroupItem
- className="w-[80px] sm:w-[110px] relative"
+ className="flex flex-col items-center relative justify-center text-center h-14 w-full"
value="Labor"
size="lg"
aria-label="Toggle labor"
>
- <LuHardHat className="h-4 w-4 mr-2 flex-shrink-0" />
- <span className="hidden sm:inline-flex">Labor</span>
+ <LuHardHat className="size-6 pt-1" />
+ <span className="text-xxs">Labor</span>
{active.labor && (
<span className="absolute -top-1 -right-1 h-3 w-3 bg-emerald-500 rounded-full" />
)}
@@ -1104,13 +1224,13 @@ function WorkTypeToggle({
)}
{operation.machineDuration > 0 && (
<ToggleGroupItem
- className="w-[80px] sm:w-[110px] relative"
+ className="flex flex-col items-center relative justify-center text-center h-14 w-full"
value="Machine"
size="lg"
aria-label="Toggle machine"
>
- <LuHammer className="h-4 w-4 mr-2 flex-shrink-0" />
- <span className="hidden sm:inline-flex">Machine</span>
+ <LuHammer className="size-6 pt-1" />
+ <span className="text-xxs">Machine</span>
{active.machine && (
<span className="absolute -top-1 -right-1 h-3 w-3 bg-emerald-500 rounded-full" />
)}
@@ -1221,9 +1341,9 @@ function PauseButton({ className, ...props }: ComponentProps<"button">) {
<ButtonWithTooltip
{...props}
tooltip="Pause"
- className="group w-16 h-16 md:w-20 md:h-20 flex flex-row items-center gap-2 justify-center bg-red-500 rounded-full shadow-lg hover:cursor-pointer hover:drop-shadow-xl hover:bg-red-600 hover:scale-105 transition-all text-accent disabled:bg-muted disabled:text-muted-foreground/80 text-2xl"
+ className="group size-32 flex flex-row items-center gap-2 justify-center bg-red-500 rounded-full shadow-lg hover:cursor-pointer hover:drop-shadow-xl hover:bg-red-600 hover:scale-105 transition-all text-accent disabled:bg-muted disabled:text-muted-foreground/80 text-4xl border-b-4 border-red-700 active:border-b-0 active:translate-y-1 disabled:bg-gray-500 disabled:hover:bg-gray-600 disabled:border-gray-700 disabled:text-white"
>
- <FaPause className="group-hover:scale-125" />
+ <FaPause className="group-hover:scale-110" />
</ButtonWithTooltip>
);
}
@@ -1233,9 +1353,9 @@ function PlayButton({ className, ...props }: ComponentProps<"button">) {
<ButtonWithTooltip
{...props}
tooltip="Start"
- className="group w-16 h-16 md:w-20 md:h-20 flex flex-row items-center gap-2 justify-center bg-emerald-500 rounded-full shadow-lg hover:cursor-pointer hover:drop-shadow-xl hover:bg-emerald-600 hover:scale-105 transition-all text-accent disabled:bg-muted disabled:text-muted-foreground/80 text-xl"
+ className="group size-32 flex flex-row items-center gap-2 justify-center bg-emerald-500 rounded-full shadow-lg hover:cursor-pointer hover:drop-shadow-xl hover:bg-emerald-600 hover:scale-105 transition-all text-accent disabled:bg-muted disabled:text-muted-foreground/80 text-4xl border-b-4 border-emerald-700 active:border-b-0 active:translate-y-1 disabled:bg-gray-500 disabled:hover:bg-gray-600 disabled:border-gray-700 disabled:text-white"
>
- <FaPlay className="group-hover:scale-125" />
+ <FaPlay className="group-hover:scale-110" />
</ButtonWithTooltip>
);
}
@@ -1408,11 +1528,9 @@ function QuantityModal({
function Navigation({
job,
operation,
- fullscreen,
}: {
job: Job;
operation: OperationWithDetails;
- fullscreen: ReturnType<typeof useDisclosure>;
}) {
return (
<>
@@ -1438,15 +1556,6 @@ function Navigation({
Instructions
</TabsTrigger>
</TabsList>
- {!fullscreen.isOpen && (
- <IconButton
- aria-label="Expand"
- className="hidden md:flex"
- icon={<LuExpand />}
- variant="secondary"
- onClick={fullscreen.onOpen}
- />
- )}
</>
);
}
diff --git a/apps/mes/app/components/Kanban/components/ColumnCard.tsx b/apps/mes/app/components/Kanban/components/ColumnCard.tsx
index 58b40f038b..86d92713f3 100644
--- a/apps/mes/app/components/Kanban/components/ColumnCard.tsx
+++ b/apps/mes/app/components/Kanban/components/ColumnCard.tsx
@@ -85,11 +85,11 @@ export function ColumnCard({
dragging: isOverlay ? "overlay" : isDragging ? "over" : undefined,
})} flex flex-col p-[1px] pt-0`,
currentFilters.length > 0
- ? `h-[calc(100dvh-var(--header-height)-var(--filters-height))]`
- : `h-[calc(100dvh-var(--header-height))]`
+ ? `h-[calc(100dvh-var(--header-height)*2-var(--filters-height))]`
+ : `h-[calc(100dvh-var(--header-height)*2)]`
)}
>
- <CardHeader className="p-4 w-full font-semibold text-left flex flex-row space-between items-center sticky top-0 bg-card z-10 border-b">
+ <CardHeader className="p-4 w-full font-semibold text-left flex flex-row space-between items-center sticky top-0 bg-card z-1 border-b">
<div className="flex flex-grow items-start space-x-2">
{column.active && <PulsingDot />}
<div className="flex flex-col flex-grow">
diff --git a/apps/mes/app/components/Kanban/components/ItemCard.tsx b/apps/mes/app/components/Kanban/components/ItemCard.tsx
index 911e96db83..7dc6b16d09 100644
--- a/apps/mes/app/components/Kanban/components/ItemCard.tsx
+++ b/apps/mes/app/components/Kanban/components/ItemCard.tsx
@@ -4,7 +4,6 @@ import {
CardHeader,
cn,
HStack,
- IconButton,
Progress,
} from "@carbon/react";
import {
@@ -16,7 +15,6 @@ import { cva } from "class-variance-authority";
import {
LuCheckCircle,
LuClipboardCheck,
- LuExternalLink,
LuTimer,
LuXCircle,
} from "react-icons/lu";
@@ -28,6 +26,7 @@ import { InProgressStatusIcon } from "~/assets/icons/InProgressStatusIcon";
import { TodoStatusIcon } from "~/assets/icons/TodoStatusIcon";
import { DeadlineIcon } from "~/components/Icons";
+import { path } from "~/utils/path";
import type { DisplaySettings, Item } from "../types";
type ItemCardProps = {
@@ -35,7 +34,7 @@ type ItemCardProps = {
} & DisplaySettings;
const cardVariants = cva(
- "dark:bg-gradient-to-bl dark:via-card dark:to-card dark:hover:to-muted/30 dark:hover:via-muted/30 bg-card hover:bg-muted/30",
+ "dark:bg-gradient-to-tr dark:via-card dark:to-card dark:hover:to-muted/30 dark:hover:via-muted/30 bg-card hover:bg-muted/30",
{
variants: {
status: {
@@ -89,118 +88,106 @@ export function ItemCard({
: false;
return (
- <Card
- className={cn(
- "max-w-[330px]",
- cardVariants({
- status: item.status,
- })
- )}
- >
- <CardHeader
+ <Link to={path.to.operation(item.id)}>
+ <Card
className={cn(
- "max-w-full p-3 border-b relative",
- cardHeaderVariants({
+ "max-w-[330px]",
+ cardVariants({
status: item.status,
})
)}
>
- <div className="flex w-full max-w-full justify-between">
- <div className="flex flex-col space-y-0">
- {item.subtitle && (
- <span className="text-xs text-muted-foreground line-clamp-1">
- {item.subtitle}
- </span>
- )}
- <Link
- to={`${item.link}?selectedOperation=${item.id}`}
- className="mr-auto font-semibold line-clamp-1"
- >
- {item.title}
- </Link>
+ <CardHeader
+ className={cn(
+ "max-w-full p-3 border-b relative",
+ cardHeaderVariants({
+ status: item.status,
+ })
+ )}
+ >
+ <div className="flex w-full max-w-full justify-between">
+ <div className="flex flex-col space-y-0">
+ {item.subtitle && (
+ <span className="text-xs text-muted-foreground line-clamp-1">
+ {item.subtitle}
+ </span>
+ )}
+ <span>{item.title}</span>
+ </div>
</div>
- {item.link && (
- <Link to={`${item.link}?selectedOperation=${item.id}`}>
- <IconButton
- aria-label="Link to job operation"
- icon={<LuExternalLink />}
- variant={"ghost"}
+
+ {showProgress &&
+ ["Paused", "Done", "In Progress"].includes(item.status!) && (
+ <Progress
+ indicatorClassName={
+ item.status === "Paused" ? "bg-yellow-500" : ""
+ }
+ numerator={
+ item.progress ? formatDurationMilliseconds(item.progress) : ""
+ }
+ denominator={
+ item.duration ? formatDurationMilliseconds(item.duration) : ""
+ }
+ value={
+ item.progress && item.duration
+ ? (item.progress / item.duration) * 100
+ : 0
+ }
/>
- </Link>
+ )}
+ </CardHeader>
+ <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 line-clamp-1">{item.description}</span>
+ </HStack>
)}
- </div>
-
- {showProgress &&
- ["Paused", "Done", "In Progress"].includes(item.status!) && (
- <Progress
- indicatorClassName={
- item.status === "Paused" ? "bg-yellow-500" : ""
- }
- numerator={
- item.progress ? formatDurationMilliseconds(item.progress) : ""
- }
- denominator={
- item.duration ? formatDurationMilliseconds(item.duration) : ""
- }
- value={
- item.progress && item.duration
- ? (item.progress / item.duration) * 100
- : 0
- }
- />
+ {showStatus && item.status && (
+ <HStack className="justify-start space-x-2">
+ {getStatusIcon(item.status)}
+ <span className="text-sm">{item.status}</span>
+ </HStack>
)}
- </CardHeader>
- <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 line-clamp-1">{item.description}</span>
- </HStack>
- )}
- {showStatus && item.status && (
- <HStack className="justify-start space-x-2">
- {getStatusIcon(item.status)}
- <span className="text-sm">{item.status}</span>
- </HStack>
- )}
- {showDuration && typeof item.duration === "number" && (
- <HStack className="justify-start space-x-2">
- <LuTimer className="text-muted-foreground" />
- <span className="text-sm">
- {formatDurationMilliseconds(item.duration)}
- </span>
- </HStack>
- )}
- {showDueDate && item.deadlineType && (
- <HStack className="justify-start space-x-2">
- <DeadlineIcon
- deadlineType={item.deadlineType}
- overdue={isOverdue}
- />
-
- <span className={cn("text-sm", isOverdue ? "text-red-500" : "")}>
- {["ASAP", "No Deadline"].includes(item.deadlineType)
- ? item.deadlineType
- : item.dueDate
- ? `Due ${formatRelativeTime(
- convertDateStringToIsoString(item.dueDate)
- )}`
- : "–"}
- </span>
- </HStack>
- )}
-
- {showSalesOrder &&
- item.salesOrderReadableId &&
- item.salesOrderId &&
- item.salesOrderLineId && (
+ {showDuration && typeof item.duration === "number" && (
+ <HStack className="justify-start space-x-2">
+ <LuTimer className="text-muted-foreground" />
+ <span className="text-sm">
+ {formatDurationMilliseconds(item.duration)}
+ </span>
+ </HStack>
+ )}
+ {showDueDate && item.deadlineType && (
<HStack className="justify-start space-x-2">
- <RiProgress8Line className="text-muted-foreground" />
- <span className="text-sm">{item.salesOrderReadableId}</span>
+ <DeadlineIcon
+ deadlineType={item.deadlineType}
+ overdue={isOverdue}
+ />
+
+ <span className={cn("text-sm", isOverdue ? "text-red-500" : "")}>
+ {["ASAP", "No Deadline"].includes(item.deadlineType)
+ ? item.deadlineType
+ : item.dueDate
+ ? `Due ${formatRelativeTime(
+ convertDateStringToIsoString(item.dueDate)
+ )}`
+ : "–"}
+ </span>
</HStack>
)}
- </CardContent>
- </Card>
+
+ {showSalesOrder &&
+ item.salesOrderReadableId &&
+ item.salesOrderId &&
+ item.salesOrderLineId && (
+ <HStack className="justify-start space-x-2">
+ <RiProgress8Line className="text-muted-foreground" />
+ <span className="text-sm">{item.salesOrderReadableId}</span>
+ </HStack>
+ )}
+ </CardContent>
+ </Card>
+ </Link>
);
}
diff --git a/apps/mes/app/components/OperationsList.tsx b/apps/mes/app/components/OperationsList.tsx
index dc9395f831..bd9045011f 100644
--- a/apps/mes/app/components/OperationsList.tsx
+++ b/apps/mes/app/components/OperationsList.tsx
@@ -4,7 +4,6 @@ import {
CardHeader,
cn,
HStack,
- ScrollArea,
Tooltip,
TooltipContent,
TooltipTrigger,
@@ -14,12 +13,13 @@ import {
formatDurationMilliseconds,
formatRelativeTime,
} from "@carbon/utils";
-import { Link, useParams } from "@remix-run/react";
-import { LuAlertTriangle, LuClipboardCheck, LuTimer } from "react-icons/lu";
+import { Link } from "@remix-run/react";
+import { LuClipboardCheck, LuTimer } from "react-icons/lu";
import type {
Operation,
OperationSettings,
} from "~/services/operations.service";
+import { path } from "~/utils/path";
import { DeadlineIcon, OperationStatusIcon } from "./Icons";
type OperationsListProps = {
@@ -37,45 +37,22 @@ const settings = {
showStatus: true,
}; // TODO: load dynamically
-export function OperationsList({
- operations,
- emptyMessage = "No scheduled operations",
-}: OperationsListProps) {
- const { operationId } = useParams();
-
- return operations.length > 0 ? (
- <ScrollArea className="h-[calc(100dvh-120px)]">
- <div className="flex flex-col gap-2">
- {operations.map((operation) => (
- <OperationCard
- key={operation.id}
- operation={operation}
- isSelected={operationId === operation.id}
- {...settings}
- />
- ))}
- </div>
- </ScrollArea>
- ) : (
- <div className="flex flex-col w-full h-[calc(100dvh-120px)] items-center justify-center gap-4">
- <div className="flex justify-center items-center h-12 w-12 rounded-full bg-foreground text-background">
- <LuAlertTriangle className="h-6 w-6" />
- </div>
- <span className="text-lg font-mono font-light text-foreground uppercase">
- {emptyMessage}
- </span>
- </div>
+export function OperationsList({ operations }: OperationsListProps) {
+ return (
+ <>
+ {operations.map((operation) => (
+ <OperationCard key={operation.id} operation={operation} {...settings} />
+ ))}
+ </>
);
}
type OperationCardProps = {
- isSelected: boolean;
operation: Operation;
} & OperationSettings;
function OperationCard({
operation,
- isSelected = false,
showCustomer,
showDescription,
showDueDate,
@@ -90,22 +67,17 @@ function OperationCard({
: false;
return (
- <Link to={operation.id}>
- <Card
- className={cn(
- "cursor-pointer shadow",
- isSelected && "from-muted via-muted"
- )}
- >
+ <Link to={path.to.operation(operation.id)}>
+ <Card className="cursor-pointer shadow">
<CardHeader className={cn("max-w-full p-3 border-b relative")}>
<div className="flex w-full max-w-full justify-between">
<div className="flex flex-col space-y-0">
{operation.itemReadableId && (
- <span className="text-xs text-muted-foreground truncate">
+ <span className="text-xs text-muted-foreground line-clamp-1">
{operation.itemReadableId}
</span>
)}
- <span className="mr-auto font-semibold truncate">
+ <span className="mr-auto font-semibold line-clamp-1">
{operation.jobReadableId}
</span>
</div>
diff --git a/apps/mes/app/components/OptionallyFullscreen.tsx b/apps/mes/app/components/OptionallyFullscreen.tsx
deleted file mode 100644
index 3076be562b..0000000000
--- a/apps/mes/app/components/OptionallyFullscreen.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import {
- Modal,
- ModalContent,
- ResizableHandle,
- ResizablePanel,
-} from "@carbon/react";
-import type { PropsWithChildren } from "react";
-import { defaultLayout } from "~/utils/layout";
-
-interface OptionallyFullscreenProps {
- isFullScreen: boolean;
- onClose: () => void;
-}
-
-export const OptionallyFullscreen = ({
- children,
- isFullScreen,
- onClose,
-}: PropsWithChildren<OptionallyFullscreenProps>) => {
- return (
- <>
- <ResizableHandle withHandle />
- <ResizablePanel defaultSize={defaultLayout[2]} className="relative">
- {children}
- </ResizablePanel>
- {isFullScreen && (
- <Modal
- open={isFullScreen}
- onOpenChange={(open) => {
- if (!open) onClose();
- }}
- >
- <ModalContent className="min-w-full h-screen py-2">
- {children}
- </ModalContent>
- </Modal>
- )}
- </>
- );
-};
diff --git a/apps/mes/app/components/SearchFilter.tsx b/apps/mes/app/components/SearchFilter.tsx
new file mode 100644
index 0000000000..4e59cc3d34
--- /dev/null
+++ b/apps/mes/app/components/SearchFilter.tsx
@@ -0,0 +1,41 @@
+import type { InputProps } from "@carbon/react";
+import {
+ Input,
+ InputGroup,
+ InputLeftElement,
+ useDebounce,
+} from "@carbon/react";
+import { useState } from "react";
+import { LuSearch } from "react-icons/lu";
+import { useUrlParams } from "~/hooks/useUrlParams";
+
+type SearchFilterProps = InputProps & {
+ param: string;
+};
+
+const SearchFilter = ({ param, size, ...props }: SearchFilterProps) => {
+ const [params, setParams] = useUrlParams();
+ const [query, setQuery] = useState(params.get(param) || "");
+ const debounceQuery = useDebounce((q: string) => {
+ setParams({ [param]: q });
+ }, 500);
+
+ return (
+ <InputGroup size={size}>
+ <InputLeftElement>
+ <LuSearch className="text-muted-foreground w-3.5 h-3.5 mt-[-2px]" />
+ </InputLeftElement>
+ <Input
+ value={query}
+ onChange={(e) => {
+ setQuery(e.target.value);
+ debounceQuery(e.target.value);
+ }}
+ className="w-[100px] sm:w-[200px] text-sm"
+ {...props}
+ />
+ </InputGroup>
+ );
+};
+
+export default SearchFilter;
diff --git a/apps/mes/app/components/index.ts b/apps/mes/app/components/index.ts
index 4651bfc271..35501c47b4 100644
--- a/apps/mes/app/components/index.ts
+++ b/apps/mes/app/components/index.ts
@@ -6,7 +6,6 @@ import Hyperlink from "./Hyperlink";
import { DeadlineIcon, FileIcon, OperationStatusIcon } from "./Icons";
import { JobOperation } from "./JobOperation";
import { OperationsList } from "./OperationsList";
-import { OptionallyFullscreen } from "./OptionallyFullscreen";
export {
AppSidebar,
@@ -18,5 +17,4 @@ export {
JobOperation,
OperationsList,
OperationStatusIcon,
- OptionallyFullscreen,
};
diff --git a/apps/mes/app/root.tsx b/apps/mes/app/root.tsx
index 83c05b77d0..699030743b 100644
--- a/apps/mes/app/root.tsx
+++ b/apps/mes/app/root.tsx
@@ -5,12 +5,12 @@ import { Button, Heading, toast } from "@carbon/react";
import type { Theme } from "@carbon/utils";
import { themes } from "@carbon/utils";
import {
+ isRouteErrorResponse,
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
- isRouteErrorResponse,
useLoaderData,
useRouteError,
} from "@remix-run/react";
diff --git a/apps/mes/app/routes/x+/_layout.tsx b/apps/mes/app/routes/x+/_layout.tsx
index b9f34bbe61..6d458f144a 100644
--- a/apps/mes/app/routes/x+/_layout.tsx
+++ b/apps/mes/app/routes/x+/_layout.tsx
@@ -3,13 +3,7 @@ import {
destroyAuthSession,
requireAuthSession,
} from "@carbon/auth/session.server";
-import {
- SidebarInset,
- SidebarProvider,
- SidebarTrigger,
- Toaster,
- TooltipProvider,
-} from "@carbon/react";
+import { SidebarInset, SidebarProvider, TooltipProvider } from "@carbon/react";
import type { ShouldRevalidateFunction } from "@remix-run/react";
import { Outlet, useLoaderData, useNavigation } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
@@ -126,9 +120,9 @@ export default function AuthenticatedRoute() {
}, [transition.state]);
return (
- <div className="h-screen w-screen overflow-hidden">
+ <div className="h-screen w-screen overflow-y-auto md:overflow-hidden">
<CarbonProvider session={session}>
- <SidebarProvider>
+ <SidebarProvider defaultOpen={false}>
<TooltipProvider delayDuration={0}>
<AppSidebar
activeEvents={activeEvents}
@@ -137,18 +131,10 @@ export default function AuthenticatedRoute() {
location={location}
locations={locations}
/>
- <SidebarInset>
- <header className="flex h-[var(--header-height)] shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 border-b">
- <div className="flex items-center gap-2 px-4">
- <SidebarTrigger className="-ml-1" />
- </div>
- </header>
- <main className="flex flex-1 w-full h-[calc(100vh-var(--header-height))] overflow-hidden">
- <Outlet />
- </main>
+ <SidebarInset className="bg-card">
+ <Outlet />
</SidebarInset>
</TooltipProvider>
- <Toaster position="bottom-left" />
</SidebarProvider>
</CarbonProvider>
</div>
diff --git a/apps/mes/app/routes/x+/active.tsx b/apps/mes/app/routes/x+/active.tsx
index 9edfb4f20c..25cebdbfdc 100644
--- a/apps/mes/app/routes/x+/active.tsx
+++ b/apps/mes/app/routes/x+/active.tsx
@@ -1,18 +1,16 @@
import { requirePermissions } from "@carbon/auth/auth.server";
-import { Heading, Input, ResizablePanel, Separator, Tabs } from "@carbon/react";
-import { json, Outlet, useLoaderData, useParams } from "@remix-run/react";
+import { Button, Heading, Input, SidebarTrigger } from "@carbon/react";
+import { json, useLoaderData, useParams } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { useEffect, useMemo, useRef, useState } from "react";
-import { LuSearch } from "react-icons/lu";
+import { LuAlertTriangle, LuSearch } from "react-icons/lu";
import type { ImperativePanelHandle } from "react-resizable-panels";
import { OperationsList } from "~/components";
import { useMediaQuery } from "~/hooks";
import { getActiveJobOperationsByEmployee } from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
-import { defaultLayout } from "~/utils/layout";
-
export async function loader({ request, params }: LoaderFunctionArgs) {
const { client, companyId, userId } = await requirePermissions(request, {});
@@ -57,45 +55,54 @@ export default function ActiveRoute() {
return (
<>
- <ResizablePanel
- ref={panelRef}
- collapsible={true}
- collapsedSize={0}
- defaultSize={defaultLayout[1]}
- minSize={isMobile ? 0 : 30}
- className="flex flex-col flex-grow"
- >
- <Tabs defaultValue="current">
- <div className="flex items-center px-4 py-2 h-[52px] bg-background">
- <Heading size="h4">Active</Heading>
- </div>
- <Separator />
- <div className="p-4">
- <div className="relative">
- <div className="flex justify-between gap-4">
- <div className="flex flex-grow">
- <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
- <Input
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- placeholder="Search"
- className="pl-8"
- />
- </div>
+ <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 border-b bg-background">
+ <div className="flex items-center gap-2 px-2">
+ <SidebarTrigger />
+ <Heading size="h4">Active</Heading>
+ </div>
+ </header>
+
+ <main className="h-[calc(100dvh-var(--header-height))] w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
+ <div className="w-full p-4 h-[var(--header-height)]">
+ <div className="relative">
+ <div className="flex justify-between gap-4">
+ <div className="flex flex-grow">
+ <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
+ <Input
+ value={searchTerm}
+ onChange={(e) => setSearchTerm(e.target.value)}
+ placeholder="Search"
+ className="pl-8"
+ />
</div>
</div>
</div>
-
- <div className="p-4 pt-0">
- <OperationsList
- key="active"
- emptyMessage="No active operations"
- operations={filteredOperations}
- />
+ </div>
+ {filteredOperations.length > 0 ? (
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,420px),1fr))] p-4 gap-4">
+ <OperationsList key="active" operations={filteredOperations} />
+ </div>
+ ) : searchTerm ? (
+ <div className="flex flex-col flex-1 w-full h-[calc(100%-var(--header-height)*2)] items-center justify-center gap-4">
+ <div className="flex justify-center items-center h-12 w-12 rounded-full bg-foreground text-background">
+ <LuAlertTriangle className="h-6 w-6" />
+ </div>
+ <span className="text-xs font-mono font-light text-foreground uppercase">
+ No results exist
+ </span>
+ <Button onClick={() => setSearchTerm("")}>Clear Search</Button>
+ </div>
+ ) : (
+ <div className="flex flex-col flex-1 w-full h-[calc(100%-var(--header-height)*2)] items-center justify-center gap-4">
+ <div className="flex justify-center items-center h-12 w-12 rounded-full bg-foreground text-background">
+ <LuAlertTriangle className="h-6 w-6" />
+ </div>
+ <span className="text-xs font-mono font-light text-foreground uppercase">
+ No active operations
+ </span>
</div>
- </Tabs>
- </ResizablePanel>
- <Outlet />
+ )}
+ </main>
</>
);
}
diff --git a/apps/mes/app/routes/x+/old-active.$operationId.tsx b/apps/mes/app/routes/x+/old-active.$operationId.tsx
deleted file mode 100644
index d57ae47360..0000000000
--- a/apps/mes/app/routes/x+/old-active.$operationId.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { useLoaderData, useParams } from "@remix-run/react";
-
-import { JobOperation } from "~/components";
-
-import type { loader } from "~/services/operation.server";
-import { path } from "~/utils/path";
-export { loader } from "~/services/operation.server";
-
-export default function OperationRoute() {
- const { operationId } = useParams();
- if (!operationId) throw new Error("Operation ID is required");
-
- const { events, job, files, materials, operation, thumbnailPath } =
- useLoaderData<typeof loader>();
-
- return (
- <JobOperation
- backPath={path.to.active}
- events={events}
- files={files}
- materials={materials}
- operation={operation}
- job={job}
- thumbnailPath={thumbnailPath}
- />
- );
-}
diff --git a/apps/mes/app/routes/x+/old-operations.$workCenterId.$operationId.tsx b/apps/mes/app/routes/x+/old-operations.$workCenterId.$operationId.tsx
deleted file mode 100644
index 6b046e606d..0000000000
--- a/apps/mes/app/routes/x+/old-operations.$workCenterId.$operationId.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useLoaderData, useParams } from "@remix-run/react";
-
-import { JobOperation } from "~/components";
-
-import type { loader } from "~/services/operation.server";
-import { path } from "~/utils/path";
-export { loader } from "~/services/operation.server";
-
-export default function OperationRoute() {
- const { operationId, workCenterId } = useParams();
- if (!operationId) throw new Error("Operation ID is required");
- if (!workCenterId) throw new Error("Work Center ID is required");
-
- const { events, job, files, materials, operation, thumbnailPath } =
- useLoaderData<typeof loader>();
-
- return (
- <JobOperation
- backPath={path.to.workCenter(workCenterId)}
- events={events}
- files={files}
- materials={materials}
- operation={operation}
- job={job}
- thumbnailPath={thumbnailPath}
- />
- );
-}
diff --git a/apps/mes/app/routes/x+/old-operations.$workCenterId.tsx b/apps/mes/app/routes/x+/old-operations.$workCenterId.tsx
deleted file mode 100644
index e06d0f9ca5..0000000000
--- a/apps/mes/app/routes/x+/old-operations.$workCenterId.tsx
+++ /dev/null
@@ -1,200 +0,0 @@
-import {
- Heading,
- Input,
- ResizablePanel,
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
- Separator,
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "@carbon/react";
-import { LuSearch } from "react-icons/lu";
-import { defaultLayout } from "~/utils/layout";
-
-import { notFound } from "@carbon/auth";
-import { requirePermissions } from "@carbon/auth/auth.server";
-import {
- Outlet,
- useLoaderData,
- useNavigate,
- useParams,
-} from "@remix-run/react";
-import { json, type LoaderFunctionArgs } from "@vercel/remix";
-import { useEffect, useMemo, useRef, useState } from "react";
-import type { ImperativePanelHandle } from "react-resizable-panels";
-import { OperationsList } from "~/components";
-import { useMediaQuery } from "~/hooks";
-import {
- getLocationAndWorkCenter,
- setLocationAndWorkCenter,
-} from "~/services/location.server";
-import {
- getJobOperationsByWorkCenter,
- getWorkCenter,
- getWorkCentersByLocation,
-} from "~/services/operations.service";
-import { makeDurations } from "~/utils/durations";
-import { path } from "~/utils/path";
-
-// TODO: it's possible that the location cookie and the work cell become out of sync.
-// we should probably include the location in the url param when using work centers
-
-export async function loader({ request, params }: LoaderFunctionArgs) {
- const { client, companyId, userId } = await requirePermissions(request, {});
-
- const { workCenterId } = params;
- if (!workCenterId) throw notFound("workCenterId not found");
-
- const storedLocations = await getLocationAndWorkCenter(request, client, {
- companyId,
- userId,
- });
-
- let workCenter = await getWorkCenter(client, workCenterId);
- if (workCenter.error) {
- throw new Error("Work center not found");
- }
-
- const [operations, workCenters] = await Promise.all([
- getJobOperationsByWorkCenter(client, {
- locationId: workCenter.data.locationId!,
- workCenterId: workCenterId,
- }),
- getWorkCentersByLocation(client, workCenter.data.locationId!),
- ]);
-
- const payload = {
- operations: operations.data?.map(makeDurations) ?? [],
- workCenters: workCenters.data ?? [],
- };
-
- if (storedLocations.updated || workCenterId !== storedLocations.workCenter) {
- return json(payload, {
- headers: {
- "Set-Cookie": setLocationAndWorkCenter(
- companyId,
- storedLocations.location,
- workCenterId
- ),
- },
- });
- }
-
- return json(payload);
-}
-
-export default function OperationsRoute() {
- const { operations, workCenters } = useLoaderData<typeof loader>();
- const [searchTerm, setSearchTerm] = useState("");
-
- const { workCenterId, operationId } = useParams();
-
- if (!workCenterId) throw new Error("workCenterId not found");
-
- const panelRef = useRef<ImperativePanelHandle>(null);
- const { isMobile } = useMediaQuery();
-
- useEffect(() => {
- if (isMobile && !!operationId) {
- panelRef.current?.collapse();
- } else {
- panelRef.current?.expand();
- }
- }, [isMobile, operationId]);
-
- const navigate = useNavigate();
-
- const filteredOperations = useMemo(() => {
- if (!searchTerm) return operations;
- const lowercasedTerm = searchTerm.toLowerCase();
- return operations.filter(
- (operation) =>
- operation.description?.toLowerCase().includes(lowercasedTerm) ||
- operation.jobReadableId?.toLowerCase().includes(lowercasedTerm) ||
- operation.itemReadableId?.toLowerCase().includes(lowercasedTerm)
- );
- }, [operations, searchTerm]);
-
- return (
- <>
- <ResizablePanel
- ref={panelRef}
- collapsible={true}
- collapsedSize={0}
- defaultSize={defaultLayout[1]}
- minSize={isMobile ? 0 : 30}
- className="flex flex-col flex-grow"
- >
- <Tabs defaultValue="current">
- <div className="flex items-center px-4 py-2 h-[52px] bg-background">
- <Heading size="h4">Operations</Heading>
- <TabsList className="ml-auto">
- <TabsTrigger value="current">Current</TabsTrigger>
- <TabsTrigger value="all">All</TabsTrigger>
- </TabsList>
- </div>
- <Separator />
- <div className="p-4">
- <div className="relative">
- <div className="flex justify-between gap-4">
- <div className="flex flex-grow">
- <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
- <Input
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- placeholder="Search"
- className="pl-8"
- />
- </div>
- <div className="flex flex-shrink basis-64">
- <Select
- value={workCenterId}
- onValueChange={(value) => {
- navigate(path.to.workCenter(value));
- }}
- >
- <SelectTrigger aria-label="Select work cell">
- <SelectValue placeholder="Select a work cell">
- {workCenters.find((wc) => wc.id === workCenterId)?.name}
- </SelectValue>
- </SelectTrigger>
- <SelectContent>
- {workCenters.map((cell) => (
- <SelectItem key={cell.id} value={cell.id}>
- {cell.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- </div>
- </div>
- </div>
- </div>
-
- <TabsContent value="current" className="p-4 pt-0">
- <OperationsList
- key={`current:${workCenterId}`}
- operations={filteredOperations.filter((operation) =>
- ["In Progress", "Ready", "Todo", "Waiting", "Paused"].includes(
- operation.operationStatus
- )
- )}
- />
- </TabsContent>
- <TabsContent value="all" className="p-4 pt-0">
- <OperationsList
- key={`all-${workCenterId}`}
- operations={filteredOperations}
- />
- </TabsContent>
- </Tabs>
- </ResizablePanel>
- <Outlet />
- </>
- );
-}
diff --git a/apps/mes/app/routes/x+/old-operations._index.tsx b/apps/mes/app/routes/x+/old-operations._index.tsx
deleted file mode 100644
index 8b286cb833..0000000000
--- a/apps/mes/app/routes/x+/old-operations._index.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { requirePermissions } from "@carbon/auth/auth.server";
-import type { LoaderFunction } from "@vercel/remix";
-import { redirect } from "@vercel/remix";
-import { getLocationAndWorkCenter } from "~/services/location.server";
-import { path } from "~/utils/path";
-
-export const loader: LoaderFunction = async ({ request }) => {
- const { client, companyId, userId } = await requirePermissions(request, {});
- const { workCenter } = await getLocationAndWorkCenter(request, client, {
- companyId,
- userId,
- });
-
- return redirect(path.to.workCenter(workCenter));
-};
diff --git a/apps/mes/app/routes/x+/old-recent.$operationId.tsx b/apps/mes/app/routes/x+/old-recent.$operationId.tsx
deleted file mode 100644
index 23c396b947..0000000000
--- a/apps/mes/app/routes/x+/old-recent.$operationId.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { useLoaderData, useParams } from "@remix-run/react";
-
-import { JobOperation } from "~/components";
-
-import type { loader } from "~/services/operation.server";
-import { path } from "~/utils/path";
-export { loader } from "~/services/operation.server";
-
-export default function OperationRoute() {
- const { operationId } = useParams();
- if (!operationId) throw new Error("Operation ID is required");
-
- const { events, job, files, materials, operation, thumbnailPath } =
- useLoaderData<typeof loader>();
-
- return (
- <JobOperation
- backPath={path.to.recent}
- events={events}
- files={files}
- materials={materials}
- operation={operation}
- job={job}
- thumbnailPath={thumbnailPath}
- />
- );
-}
diff --git a/apps/mes/app/routes/x+/operation.$operationId.tsx b/apps/mes/app/routes/x+/operation.$operationId.tsx
new file mode 100644
index 0000000000..79cf7e14a3
--- /dev/null
+++ b/apps/mes/app/routes/x+/operation.$operationId.tsx
@@ -0,0 +1,118 @@
+import { useLoaderData, useParams } from "@remix-run/react";
+
+import { JobOperation } from "~/components";
+
+import { error, getCarbonServiceRole } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import type { LoaderFunctionArgs } from "@vercel/remix";
+import { defer, redirect } from "@vercel/remix";
+import type { OperationWithDetails } from "~/services/operations.service";
+import {
+ getJobByOperationId,
+ getJobFiles,
+ getJobMaterialsByOperationId,
+ getJobOperationById,
+ getProductionEventsForJobOperation,
+ getProductionQuantitiesForJobOperation,
+ getThumbnailPathByItemId,
+ getWorkCenter,
+} from "~/services/operations.service";
+import { makeDurations } from "~/utils/durations";
+import { path } from "~/utils/path";
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { userId, companyId } = await requirePermissions(request, {});
+
+ const { operationId } = params;
+ if (!operationId) throw new Error("Operation ID is required");
+
+ const serviceRole = await getCarbonServiceRole();
+
+ const [events, quantities, job, operation] = await Promise.all([
+ getProductionEventsForJobOperation(serviceRole, {
+ operationId,
+ userId,
+ }),
+ getProductionQuantitiesForJobOperation(serviceRole, operationId),
+ getJobByOperationId(serviceRole, operationId),
+ getJobOperationById(serviceRole, operationId),
+ ]);
+
+ if (job.error) {
+ throw redirect(
+ path.to.operations,
+ await flash(request, error(job.error, "Failed to fetch job"))
+ );
+ }
+
+ if (operation.error) {
+ throw redirect(
+ path.to.operations,
+ await flash(request, error(operation.error, "Failed to fetch operation"))
+ );
+ }
+
+ if (!job.data.itemId) {
+ throw redirect(
+ path.to.operations,
+ await flash(request, error("Item ID is required", "Failed to fetch item"))
+ );
+ }
+
+ const thumbnailPath = await getThumbnailPathByItemId(
+ serviceRole,
+ job.data.itemId
+ );
+
+ return defer({
+ events: events.data ?? [],
+ quantities: (quantities.data ?? []).reduce(
+ (acc, curr) => {
+ if (curr.type === "Scrap") {
+ acc.scrap += curr.quantity;
+ } else if (curr.type === "Production") {
+ acc.production += curr.quantity;
+ } else if (curr.type === "Rework") {
+ acc.rework += curr.quantity;
+ }
+ return acc;
+ },
+ { scrap: 0, production: 0, rework: 0 }
+ ),
+ job: job.data,
+ files: getJobFiles(serviceRole, companyId, job.data),
+ materials: getJobMaterialsByOperationId(serviceRole, operation.data?.[0]),
+ operation: makeDurations(operation.data?.[0]) as OperationWithDetails,
+ workCenter: getWorkCenter(serviceRole, operation.data?.[0].workCenterId),
+ thumbnailPath,
+ });
+}
+
+export default function OperationRoute() {
+ const { operationId } = useParams();
+ if (!operationId) throw new Error("Operation ID is required");
+
+ const {
+ events,
+ job,
+ files,
+ materials,
+ operation,
+ workCenter,
+ thumbnailPath,
+ } = useLoaderData<typeof loader>();
+
+ return (
+ <JobOperation
+ key={operationId}
+ events={events}
+ files={files}
+ materials={materials}
+ operation={operation}
+ job={job}
+ thumbnailPath={thumbnailPath}
+ workCenter={workCenter}
+ />
+ );
+}
diff --git a/apps/mes/app/routes/x+/operations.tsx b/apps/mes/app/routes/x+/operations.tsx
index 5345aa3741..3f1dc25336 100644
--- a/apps/mes/app/routes/x+/operations.tsx
+++ b/apps/mes/app/routes/x+/operations.tsx
@@ -1,11 +1,24 @@
import { getCarbonServiceRole } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
-import { ClientOnly, Spinner } from "@carbon/react";
+import {
+ Button,
+ ClientOnly,
+ Heading,
+ HStack,
+ SidebarTrigger,
+ Spinner,
+} from "@carbon/react";
import { json, useLoaderData } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
+import { useMemo } from "react";
import { LuAlertTriangle } from "react-icons/lu";
+
+import type { ColumnFilter } from "~/components/Filter";
+import { ActiveFilters, Filter, useFilters } from "~/components/Filter";
import type { Column, Item } from "~/components/Kanban";
import { Kanban } from "~/components/Kanban";
+import SearchFilter from "~/components/SearchFilter";
+import { useUrlParams } from "~/hooks/useUrlParams";
import { getLocationAndWorkCenter } from "~/services/location.server";
import {
getActiveJobOperationsByLocation,
@@ -162,12 +175,61 @@ export async function loader({ request }: LoaderFunctionArgs) {
export default function Operations() {
const { columns, items, processes } = useLoaderData<typeof loader>();
- const hasFilters = false; // TODO: implement filters
+
+ const [params] = useUrlParams();
+ const { hasFilters, clearFilters } = useFilters();
+ const currentFilters = params.getAll("filter");
+ const filters = useMemo<ColumnFilter[]>(() => {
+ return [
+ {
+ accessorKey: "workCenterId",
+ header: "Work Center",
+ filter: {
+ type: "static",
+ options: columns.map((col) => ({
+ label: col.title,
+ value: col.id,
+ })),
+ },
+ },
+ {
+ accessorKey: "processId",
+ header: "Process",
+ pluralHeader: "Processes",
+ filter: {
+ type: "static",
+ options: processes.map((p) => ({
+ label: p.name,
+ value: p.id,
+ })),
+ },
+ },
+ ];
+ }, [columns, processes]);
return (
- <div className="flex flex-col h-full max-h-full overflow-auto relative">
- <div className="flex flex-grow h-full items-stretch overflow-hidden relative">
- <div className="flex flex-1 min-h-0 w-full relative">
+ <>
+ <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 border-b bg-background">
+ <div className="flex items-center gap-2 px-2">
+ <SidebarTrigger />
+ <Heading size="h4">Schedule</Heading>
+ </div>
+ </header>
+ <main className="flex flex-1 w-full h-[calc(100vh-var(--header-height))] overflow-hidden">
+ <div className="flex flex-col h-full max-h-full w-full overflow-x-auto relative">
+ <HStack className="px-4 py-2 justify-between bg-card border-b border-border">
+ <HStack>
+ <SearchFilter param="search" size="sm" placeholder="Search" />
+ <Filter filters={filters} />
+ </HStack>
+ </HStack>
+ {currentFilters.length > 0 && (
+ <HStack className="h-[var(--filters-height)] px-4 py-1.5 justify-between bg-card border-b border-border w-full">
+ <HStack>
+ <ActiveFilters filters={filters} />
+ </HStack>
+ </HStack>
+ )}
{columns.length > 0 ? (
<ClientOnly
fallback={
@@ -199,7 +261,7 @@ export default function Operations() {
<span className="text-xs font-mono font-light text-foreground uppercase">
No results
</span>
- {/* <Button onClick={clearFilters}>Clear Filters</Button> */}
+ <Button onClick={clearFilters}>Clear Filters</Button>
</div>
) : (
<div className="flex flex-col w-full h-full items-center justify-center gap-4">
@@ -212,7 +274,7 @@ export default function Operations() {
</div>
)}
</div>
- </div>
- </div>
+ </main>
+ </>
);
}
diff --git a/apps/mes/app/routes/x+/recent.tsx b/apps/mes/app/routes/x+/recent.tsx
index 7e6f6f4d74..698d74a2ee 100644
--- a/apps/mes/app/routes/x+/recent.tsx
+++ b/apps/mes/app/routes/x+/recent.tsx
@@ -1,17 +1,15 @@
import { requirePermissions } from "@carbon/auth/auth.server";
-import { Heading, Input, ResizablePanel, Separator, Tabs } from "@carbon/react";
-import { json, Outlet, useLoaderData, useParams } from "@remix-run/react";
+import { Button, Heading, Input, SidebarTrigger } from "@carbon/react";
+import { json, useLoaderData, useParams } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { useEffect, useMemo, useRef, useState } from "react";
-import { LuSearch } from "react-icons/lu";
+import { LuAlertTriangle, LuSearch } from "react-icons/lu";
import type { ImperativePanelHandle } from "react-resizable-panels";
import { OperationsList } from "~/components";
import { useMediaQuery } from "~/hooks";
import { getRecentJobOperationsByEmployee } from "~/services/operations.service";
import { makeDurations } from "~/utils/durations";
-import { defaultLayout } from "~/utils/layout";
-
export async function loader({ request, params }: LoaderFunctionArgs) {
const { client, companyId, userId } = await requirePermissions(request, {});
@@ -56,45 +54,54 @@ export default function ActiveRoute() {
return (
<>
- <ResizablePanel
- ref={panelRef}
- collapsible={true}
- collapsedSize={0}
- defaultSize={defaultLayout[1]}
- minSize={isMobile ? 0 : 30}
- className="flex flex-col flex-grow"
- >
- <Tabs defaultValue="current">
- <div className="flex items-center px-4 py-2 h-[52px] bg-background">
- <Heading size="h4">Recent</Heading>
- </div>
- <Separator />
- <div className="p-4">
- <div className="relative">
- <div className="flex justify-between gap-4">
- <div className="flex flex-grow">
- <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
- <Input
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- placeholder="Search"
- className="pl-8"
- />
- </div>
+ <header className="sticky top-0 z-10 flex h-[var(--header-height)] shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12 border-b bg-background">
+ <div className="flex items-center gap-2 px-2">
+ <SidebarTrigger />
+ <Heading size="h4">Recent</Heading>
+ </div>
+ </header>
+
+ <main className="h-[calc(100dvh-var(--header-height))] w-full overflow-y-auto scrollbar-thin scrollbar-thumb-accent scrollbar-track-transparent">
+ <div className="w-full p-4 h-[var(--header-height)]">
+ <div className="relative">
+ <div className="flex justify-between gap-4">
+ <div className="flex flex-grow">
+ <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
+ <Input
+ value={searchTerm}
+ onChange={(e) => setSearchTerm(e.target.value)}
+ placeholder="Search"
+ className="pl-8"
+ />
</div>
</div>
</div>
-
- <div className="p-4 pt-0">
- <OperationsList
- key="active"
- emptyMessage="No active operations"
- operations={filteredOperations}
- />
+ </div>
+ {filteredOperations.length > 0 ? (
+ <div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,420px),1fr))] p-4 gap-4">
+ <OperationsList key="active" operations={filteredOperations} />
+ </div>
+ ) : searchTerm ? (
+ <div className="flex flex-col flex-1 w-full h-[calc(100%-var(--header-height)*2)] items-center justify-center gap-4">
+ <div className="flex justify-center items-center h-12 w-12 rounded-full bg-foreground text-background">
+ <LuAlertTriangle className="h-6 w-6" />
+ </div>
+ <span className="text-xs font-mono font-light text-foreground uppercase">
+ No results exist
+ </span>
+ <Button onClick={() => setSearchTerm("")}>Clear Search</Button>
+ </div>
+ ) : (
+ <div className="flex flex-col flex-1 w-full h-[calc(100%-var(--header-height)*2)] items-center justify-center gap-4">
+ <div className="flex justify-center items-center h-12 w-12 rounded-full bg-foreground text-background">
+ <LuAlertTriangle className="h-6 w-6" />
+ </div>
+ <span className="text-xs font-mono font-light text-foreground uppercase">
+ No recent operations
+ </span>
</div>
- </Tabs>
- </ResizablePanel>
- <Outlet />
+ )}
+ </main>
</>
);
}
diff --git a/apps/mes/app/styles/tailwind.css b/apps/mes/app/styles/tailwind.css
index 6f28b6092d..28a85e7971 100644
--- a/apps/mes/app/styles/tailwind.css
+++ b/apps/mes/app/styles/tailwind.css
@@ -19,7 +19,8 @@
--sidebar-ring: 217.2 91.2% 59.8%;
--header-height: 50px;
- --filters-height: 50px;
+ --filters-height: 38px;
+ --controls-width: 240px;
}
.dark {
diff --git a/apps/mes/app/utils/path.ts b/apps/mes/app/utils/path.ts
index 27a7fd22cb..d565b0c9b8 100644
--- a/apps/mes/app/utils/path.ts
+++ b/apps/mes/app/utils/path.ts
@@ -30,6 +30,7 @@ export const path = {
finish: `${x}/finish`,
forgotPassword: "/forgot-password",
healthcheck: "/healthcheck",
+ operation: (id: string) => generatePath(`${x}/operation/${id}`),
operations: `${x}/operations`,
location: `${x}/location`,
login: "/login",