Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions apps/web/app/(app)/[emailAccountId]/assistant/RulesSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { useSearchParams, useRouter } from "next/navigation";
import { parseAsString, useQueryState } from "nuqs";
import { ChevronDown, Tag } from "lucide-react";

export function RulesSelect() {
const { data, isLoading, error } = useRules();
const searchParams = useSearchParams();
const router = useRouter();
const currentValue = searchParams.get("ruleId") || "all";

const handleValueChange = (value: string) => {
const params = new URLSearchParams(searchParams.toString());
params.set("ruleId", value);
router.push(`?${params.toString()}`);
};
const [ruleId, setRuleId] = useQueryState(
"ruleId",
parseAsString.withDefault("all"),
);

const getCurrentLabel = () => {
if (currentValue === "all") return "All rules";
if (currentValue === "skipped") return "No match";
return data?.find((rule) => rule.id === currentValue)?.name || "All rules";
if (ruleId === "all") return "All rules";
if (ruleId === "skipped") return "No match";
return data?.find((rule) => rule.id === ruleId)?.name || "All rules";
};

return (
Expand All @@ -48,17 +43,14 @@ export function RulesSelect() {
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => handleValueChange("all")}>
<DropdownMenuItem onClick={() => setRuleId("all")}>
All rules
</DropdownMenuItem>
<DropdownMenuItem onClick={() => handleValueChange("skipped")}>
<DropdownMenuItem onClick={() => setRuleId("skipped")}>
No match
</DropdownMenuItem>
{data?.map((rule) => (
<DropdownMenuItem
key={rule.id}
onClick={() => handleValueChange(rule.id)}
>
<DropdownMenuItem key={rule.id} onClick={() => setRuleId(rule.id)}>
{rule.name}
</DropdownMenuItem>
))}
Expand Down
8 changes: 5 additions & 3 deletions apps/web/app/(app)/[emailAccountId]/stats/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export function ActionBar({
return (
<div
className={cn(
"flex items-center justify-between w-full gap-3",
"flex flex-col sm:flex-row sm:items-center sm:justify-between w-full gap-3",
className,
)}
>
<div className="flex items-center gap-3">{children}</div>
<div className="flex items-center gap-3">{rightContent}</div>
<div className="flex flex-wrap items-center gap-3">{children}</div>
{rightContent && (
<div className="flex items-center gap-3">{rightContent}</div>
)}
</div>
);
}
2 changes: 1 addition & 1 deletion apps/web/app/(marketing)
Submodule (marketing) updated from 59a58a to c43ec8
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.21.0
v2.21.1
Loading