diff --git a/apps/web/app/(app)/automation/rule/create/page.tsx b/apps/web/app/(app)/automation/rule/create/page.tsx
index 0a40465c..cea1f7f3 100644
--- a/apps/web/app/(app)/automation/rule/create/page.tsx
+++ b/apps/web/app/(app)/automation/rule/create/page.tsx
@@ -1,12 +1,18 @@
import { RuleForm } from "@/app/(app)/automation/RuleForm";
import { examples } from "@/app/(app)/automation/create/examples";
import { getEmptyCondition } from "@/utils/condition";
-import type { RuleType } from "@prisma/client";
+import { ActionType, type RuleType } from "@prisma/client";
export default function CreateRulePage({
searchParams,
}: {
- searchParams: { example?: string; groupId?: string; tab?: RuleType };
+ searchParams: {
+ example?: string;
+ groupId?: string;
+ tab?: RuleType;
+ categoryId?: string;
+ label?: string;
+ };
}) {
const rule =
searchParams.example &&
@@ -17,11 +23,27 @@ export default function CreateRulePage({
diff --git a/apps/web/components/GroupedTable.tsx b/apps/web/components/GroupedTable.tsx
index 239f4b51..c1eb0a4c 100644
--- a/apps/web/components/GroupedTable.tsx
+++ b/apps/web/components/GroupedTable.tsx
@@ -12,9 +12,9 @@ import {
type ColumnDef,
flexRender,
} from "@tanstack/react-table";
-import { ArchiveIcon, ChevronRight, PencilIcon } from "lucide-react";
+import { ArchiveIcon, ChevronRight, PencilIcon, PlusIcon } from "lucide-react";
import { Table, TableBody, TableCell, TableRow } from "@/components/ui/table";
-import type { Category } from "@prisma/client";
+import { RuleType, type Category } from "@prisma/client";
import { EmailCell } from "@/components/EmailCell";
import { useThreads } from "@/hooks/useThreads";
import { Skeleton } from "@/components/ui/skeleton";
@@ -76,6 +76,19 @@ export function GroupedTable({
return grouped;
}, [emailGroups, categories]);
+ // for id lookup
+ const categoryMap = useMemo(
+ () =>
+ categories.reduce>>(
+ (acc, category) => {
+ acc[category.name] = category;
+ return acc;
+ },
+ {},
+ ),
+ [categories],
+ );
+
const [expanded, setExpanded] = useQueryState("expanded", {
parse: (value) => value.split(","),
serialize: (value) => value.join(","),
@@ -193,6 +206,7 @@ export function GroupedTable({
{
@@ -314,6 +328,7 @@ export function SendersTable({
function GroupRow({
category,
+ categoryId,
count,
isExpanded,
onToggle,
@@ -321,6 +336,7 @@ function GroupRow({
onEditCategory,
}: {
category: string;
+ categoryId: string;
count: number;
isExpanded: boolean;
onToggle: () => void;
@@ -350,6 +366,15 @@ function GroupRow({
Edit
+