Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Enhance FunnelForm component with advanced options and improved UI (#815)

Bill Yang06cbe304c22c
diff --git a/client/src/app/[site]/components/Header/DemoSignupBanner.tsx b/client/src/app/[site]/components/Header/DemoSignupBanner.tsx
index 87e49faa0..9a127f696 100644
--- a/client/src/app/[site]/components/Header/DemoSignupBanner.tsx
+++ b/client/src/app/[site]/components/Header/DemoSignupBanner.tsx
@@ -25,7 +25,7 @@ export function DemoSignupBanner() {
return (
<div className="mt-4 px-4 py-3 rounded-lg border border-emerald-300 dark:border-emerald-400/30 bg-emerald-200/80 dark:bg-emerald-900/20 text-sm flex gap-4 items-center">
<div className="text-emerald-700 dark:text-emerald-300 flex items-center font-medium">
- <Sparkles className="mr-2 h-4 w-4" />
+ <Sparkles className="h-4 w-4" />
<span>Enjoying the demo? Get started with your own analytics dashboard!</span>
</div>
<Button variant="success" size="sm" asChild>
diff --git a/client/src/app/[site]/funnels/components/FunnelForm.tsx b/client/src/app/[site]/funnels/components/FunnelForm.tsx
index 3bde16586..5a66e6291 100644
--- a/client/src/app/[site]/funnels/components/FunnelForm.tsx
+++ b/client/src/app/[site]/funnels/components/FunnelForm.tsx
@@ -1,9 +1,11 @@
+import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { InputWithSuggestions, SuggestionOption } from "@/components/ui/input-with-suggestions";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
-import { Plus, Save, Trash2, X } from "lucide-react";
+import { Reorder } from "framer-motion";
+import { ChevronDown, ChevronUp, GripVertical, Plus, Save, Trash2, X } from "lucide-react";
import { useState } from "react";
import { FunnelResponse, FunnelStep } from "../../../../api/analytics/endpoints";
import { useMetric } from "../../../../api/analytics/hooks/useGetMetric";
@@ -47,19 +49,38 @@ export function FunnelForm({
}: FunnelFormProps) {
// State to track which event steps have property filtering enabled
const [useProperties, setUseProperties] = useState<boolean[]>(() =>
- steps.map(step => !!(step.propertyFilters?.length || (step.eventPropertyKey && step.eventPropertyValue !== undefined)))
+ steps.map(
+ step => !!(step.propertyFilters?.length || (step.eventPropertyKey && step.eventPropertyValue !== undefined))
+ )
);
// State for managing multiple property filters per step (store as strings in UI)
const [stepPropertyFilters, setStepPropertyFilters] = useState<Array<Array<{ key: string; value: string }>>>(() =>
- steps.map(step =>
- step.propertyFilters?.map(f => ({ key: f.key, value: String(f.value) })) ||
- (step.eventPropertyKey && step.eventPropertyValue !== undefined
- ? [{ key: step.eventPropertyKey, value: String(step.eventPropertyValue) }]
- : [{ key: "", value: "" }])
+ steps.map(
+ step =>
+ step.propertyFilters?.map(f => ({ key: f.key, value: String(f.value) })) ||
+ (step.eventPropertyKey && step.eventPropertyValue !== undefined
+ ? [{ key: step.eventPropertyKey, value: String(step.eventPropertyValue) }]
+ : [{ key: "", value: "" }])
+ )
+ );
+
+ // State to track which steps have advanced options expanded
+ const [expandedSteps, setExpandedSteps] = useState<boolean[]>(() =>
+ steps.map(
+ step =>
+ !!(
+ step.hostname ||
+ step.name ||
+ step.propertyFilters?.length ||
+ (step.eventPropertyKey && step.eventPropertyValue !== undefined)
+ )
)
);
+ // Unique IDs for each step (needed for drag-and-drop reordering)
+ const [stepIds, setStepIds] = useState<string[]>(() => steps.map((_, i) => `step-${Date.now()}-${i}`));
+
// Fetch suggestions for paths, events, and hostnames
const { data: pathsData } = useMetric({
parameter: "pathname",
@@ -98,11 +119,27 @@ export function FunnelForm({
label: item.value,
})) || [];
+ // Handle reordering steps via drag-and-drop
+ const handleReorder = (newOrder: string[]) => {
+ const newSteps = newOrder.map(id => steps[stepIds.indexOf(id)]);
+ const newUseProperties = newOrder.map(id => useProperties[stepIds.indexOf(id)]);
+ const newStepPropertyFilters = newOrder.map(id => stepPropertyFilters[stepIds.indexOf(id)]);
+ const newExpandedSteps = newOrder.map(id => expandedSteps[stepIds.indexOf(id)]);
+
+ setStepIds(newOrder);
+ setSteps(newSteps);
+ setUseProperties(newUseProperties);
+ setStepPropertyFilters(newStepPropertyFilters);
+ setExpandedSteps(newExpandedSteps);
+ };
+
// Handle adding a new step
const addStep = () => {
setSteps([...steps, { type: "page", value: "", name: "" }]);
setUseProperties([...useProperties, false]);
setStepPropertyFilters([...stepPropertyFilters, [{ key: "", value: "" }]]);
+ setExpandedSteps([...expandedSteps, false]);
+ setStepIds([...stepIds, `step-${Date.now()}`]);
};
// Handle removing a step
@@ -119,6 +156,14 @@ export function FunnelForm({
const newStepPropertyFilters = [...stepPropertyFilters];
newStepPropertyFilters.splice(index, 1);
setStepPropertyFilters(newStepPropertyFilters);
+
+ const newExpandedSteps = [...expandedSteps];
+ newExpandedSteps.splice(index, 1);
+ setExpandedSteps(newExpandedSteps);
+
+ const newStepIds = [...stepIds];
+ newStepIds.splice(index, 1);
+ setStepIds(newStepIds);
};
// Handle step input changes
@@ -185,7 +230,7 @@ export function FunnelForm({
return (
<>
- <div className="grid grid-cols-[600px_3fr] gap-6">
+ <div className="grid grid-cols-[500px_3fr] gap-6">
{/* Left side: Funnel configuration form */}
<div className="space-y-4">
<div>
@@ -193,172 +238,205 @@ export function FunnelForm({
<Input value={name} onChange={e => setName(e.target.value)} placeholder="Enter funnel name" />
</div>
- {/* Funnel Steps in a boxed container */}
- <Card className="border border-neutral-200 dark:border-neutral-800">
- <CardHeader className="p-3 flex flex-row justify-between items-center">
- <CardTitle className="text-base">Funnel Steps</CardTitle>
- <Button onClick={addStep} size="sm">
- <Plus className="mr-2 h-4 w-4" /> Add Step
- </Button>
- </CardHeader>
- <CardContent className="p-3 space-y-4 max-h-[calc(100vh-340px)] overflow-y-auto">
- {steps.map((step, index) => (
- <div
- key={index}
- className="flex flex-col space-y-2 border border-neutral-200 dark:border-neutral-750 p-4 rounded-lg bg-white dark:bg-neutral-850"
- >
- <div className="flex items-start gap-2">
- <div className="shrink-0 w-6 h-6 rounded-full border border-neutral-300 dark:border-neutral-400 bg-neutral-100 dark:bg-neutral-750 flex items-center justify-center text-xs mt-1.5">
- {index + 1}
- </div>
- <Select value={step.type} onValueChange={value => updateStepType(index, value as "page" | "event")}>
- <SelectTrigger className="min-w-[80px] max-w-[80px] border-neutral-300 dark:border-neutral-700">
- <SelectValue placeholder="Type" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="page">Path</SelectItem>
- <SelectItem value="event">Event</SelectItem>
- </SelectContent>
- </Select>
-
- <div className="grow space-y-2">
- <div className="flex gap-2">
- <InputWithSuggestions
- suggestions={hostnameSuggestions}
- placeholder="Hostname (optional)"
- value={step.hostname || ""}
- className="border-neutral-300 dark:border-neutral-700 w-30"
- onChange={e => updateStep(index, "hostname", e.target.value)}
- />
- <InputWithSuggestions
- suggestions={step.type === "page" ? pathSuggestions : eventSuggestions}
- placeholder={step.type === "page" ? "Path (e.g. /pricing)" : "Event name"}
- value={step.value}
- className="border-neutral-300 dark:border-neutral-700 w-56"
- onChange={e => updateStep(index, "value", e.target.value)}
- />
+ <div className="max-h-[calc(100vh-300px)] overflow-y-auto">
+ <Reorder.Group axis="y" values={stepIds} onReorder={handleReorder} className="list-none">
+ {stepIds.map((id, index) => {
+ const step = steps[index];
+ return (
+ <Reorder.Item
+ key={id}
+ value={id}
+ transition={{ duration: 0 }}
+ dragTransition={{ bounceStiffness: 100000, bounceDamping: 100000 }}
+ className={cn(
+ "flex flex-col space-y-2 border border-neutral-200 dark:border-neutral-800 p-4 bg-white dark:bg-neutral-900",
+ index === 0 && "rounded-t-lg",
+ index === steps.length - 1 && "rounded-b-lg",
+ index !== 0 && "-mt-px"
+ )}
+ >
+ {/* Top row: Step number, type, value, expand toggle, delete */}
+ <div className="flex items-center gap-2">
+ <GripVertical className="shrink-0 h-4 w-4 cursor-grab active:cursor-grabbing text-neutral-400" />
+ <div className="shrink-0 w-6 h-6 rounded-full border border-neutral-300 dark:border-neutral-700 flex items-center justify-center text-xs">
+ {index + 1}
</div>
- <div className="flex items-center gap-2">
- <Input
- placeholder="Label (optional)"
- className="border-neutral-300 dark:border-neutral-700"
- value={step.name || ""}
- onChange={e => updateStep(index, "name", e.target.value)}
- />
+ <Select
+ value={step.type}
+ onValueChange={value => updateStepType(index, value as "page" | "event")}
+ >
+ <SelectTrigger className="min-w-[80px] max-w-[80px] border-neutral-300 dark:border-neutral-700">
+ <SelectValue placeholder="Type" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="page">Path</SelectItem>
+ <SelectItem value="event">Event</SelectItem>
+ </SelectContent>
+ </Select>
+ <InputWithSuggestions
+ suggestions={step.type === "page" ? pathSuggestions : eventSuggestions}
+ placeholder={step.type === "page" ? "Path (e.g. /pricing)" : "Event name"}
+ value={step.value}
+ className="border-neutral-300 dark:border-neutral-700 w-[260px]"
+ onChange={e => updateStep(index, "value", e.target.value)}
+ />
+ <div className="flex items-center">
<Button
variant="ghost"
- size="icon"
+ size="smIcon"
+ onClick={() => {
+ const newExpandedSteps = [...expandedSteps];
+ newExpandedSteps[index] = !newExpandedSteps[index];
+ setExpandedSteps(newExpandedSteps);
+ }}
+ title={expandedSteps[index] ? "Hide advanced options" : "Show advanced options"}
+ >
+ {expandedSteps[index] ? (
+ <ChevronUp className="h-4 w-4" />
+ ) : (
+ <ChevronDown className="h-4 w-4" />
+ )}
+ </Button>
+ <Button
+ variant="ghost"
+ size="smIcon"
onClick={() => removeStep(index)}
disabled={steps.length <= 2}
>
<Trash2 className="h-4 w-4" />
</Button>
</div>
- {/* Property filtering for both page and event steps */}
- <div className="mt-2 space-y-2">
- <div className="flex items-center space-x-2">
- <Switch
- checked={useProperties[index]}
- onCheckedChange={checked => togglePropertyFiltering(index, checked)}
- id={`use-properties-${index}`}
+ </div>
+
+ {/* Collapsible advanced options */}
+ {expandedSteps[index] && (
+ <div className="ml-14 space-y-2 pt-2">
+ <div className="flex gap-2">
+ <InputWithSuggestions
+ suggestions={hostnameSuggestions}
+ placeholder="Hostname (optional)"
+ value={step.hostname || ""}
+ className="border-neutral-300 dark:border-neutral-700 w-40"
+ onChange={e => updateStep(index, "hostname", e.target.value)}
+ />
+ <Input
+ placeholder="Label (optional)"
+ className="border-neutral-300 dark:border-neutral-700 grow"
+ value={step.name || ""}
+ onChange={e => updateStep(index, "name", e.target.value)}
/>
- <Label htmlFor={`use-properties-${index}`}>
- {step.type === "page" ? "Filter by URL parameter" : "Filter by event property"}
- </Label>
</div>
+ {/* Property filtering for both page and event steps */}
+ <div className="space-y-2">
+ <div className="flex items-center space-x-2">
+ <Switch
+ checked={useProperties[index]}
+ onCheckedChange={checked => togglePropertyFiltering(index, checked)}
+ id={`use-properties-${index}`}
+ />
+ <Label htmlFor={`use-properties-${index}`}>
+ {step.type === "page" ? "Filter by URL parameter" : "Filter by event property"}
+ </Label>
+ </div>
- {useProperties[index] && (
- <div className="space-y-3">
- {stepPropertyFilters[index]?.map((filter, filterIndex) => (
- <div key={filterIndex} className="flex gap-2 items-start">
- <div className="flex-1 grid grid-cols-2 gap-2">
- <Input
- placeholder={step.type === "page" ? "e.g., utm_source" : "e.g., plan_type"}
- className="border-neutral-300 dark:border-neutral-700"
- value={filter.key}
- onChange={e => {
- // Create immutable copies for nested state
- const newStepPropertyFilters = [...stepPropertyFilters];
- const stepFilters = [...newStepPropertyFilters[index]];
- const updatedFilter = { ...stepFilters[filterIndex], key: e.target.value };
- stepFilters[filterIndex] = updatedFilter;
- newStepPropertyFilters[index] = stepFilters;
- setStepPropertyFilters(newStepPropertyFilters);
-
- // Update the step with propertyFilters immutably
- const newSteps = [...steps];
- newSteps[index] = { ...newSteps[index], propertyFilters: stepFilters };
- setSteps(newSteps);
- }}
- />
- <Input
- placeholder={step.type === "page" ? "e.g., adwords" : "e.g., premium"}
- className="border-neutral-300 dark:border-neutral-700"
- value={filter.value}
- onChange={e => {
- // Create immutable copies for nested state
- const newStepPropertyFilters = [...stepPropertyFilters];
- const stepFilters = [...newStepPropertyFilters[index]];
- const updatedFilter = { ...stepFilters[filterIndex], value: e.target.value };
- stepFilters[filterIndex] = updatedFilter;
- newStepPropertyFilters[index] = stepFilters;
- setStepPropertyFilters(newStepPropertyFilters);
-
- // Update the step with propertyFilters immutably
- const newSteps = [...steps];
- newSteps[index] = { ...newSteps[index], propertyFilters: stepFilters };
- setSteps(newSteps);
- }}
- />
+ {useProperties[index] && (
+ <div className="space-y-3">
+ {stepPropertyFilters[index]?.map((filter, filterIndex) => (
+ <div key={filterIndex} className="flex gap-2 items-start">
+ <div className="flex-1 grid grid-cols-2 gap-2">
+ <Input
+ placeholder={step.type === "page" ? "e.g., utm_source" : "e.g., plan_type"}
+ className="border-neutral-300 dark:border-neutral-700"
+ value={filter.key}
+ onChange={e => {
+ // Create immutable copies for nested state
+ const newStepPropertyFilters = [...stepPropertyFilters];
+ const stepFilters = [...newStepPropertyFilters[index]];
+ const updatedFilter = { ...stepFilters[filterIndex], key: e.target.value };
+ stepFilters[filterIndex] = updatedFilter;
+ newStepPropertyFilters[index] = stepFilters;
+ setStepPropertyFilters(newStepPropertyFilters);
+
+ // Update the step with propertyFilters immutably
+ const newSteps = [...steps];
+ newSteps[index] = { ...newSteps[index], propertyFilters: stepFilters };
+ setSteps(newSteps);
+ }}
+ />
+ <Input
+ placeholder={step.type === "page" ? "e.g., adwords" : "e.g., premium"}
+ className="border-neutral-300 dark:border-neutral-700"
+ value={filter.value}
+ onChange={e => {
+ // Create immutable copies for nested state
+ const newStepPropertyFilters = [...stepPropertyFilters];
+ const stepFilters = [...newStepPropertyFilters[index]];
+ const updatedFilter = { ...stepFilters[filterIndex], value: e.target.value };
+ stepFilters[filterIndex] = updatedFilter;
+ newStepPropertyFilters[index] = stepFilters;
+ setStepPropertyFilters(newStepPropertyFilters);
+
+ // Update the step with propertyFilters immutably
+ const newSteps = [...steps];
+ newSteps[index] = { ...newSteps[index], propertyFilters: stepFilters };
+ setSteps(newSteps);
+ }}
+ />
+ </div>
+ {stepPropertyFilters[index].length > 1 && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon"
+ onClick={() => {
+ // Create immutable copies for nested state
+ const newStepPropertyFilters = [...stepPropertyFilters];
+ const stepFilters = newStepPropertyFilters[index].filter(
+ (_, i) => i !== filterIndex
+ );
+ newStepPropertyFilters[index] = stepFilters;
+ setStepPropertyFilters(newStepPropertyFilters);
+
+ // Update the step with propertyFilters immutably
+ const newSteps = [...steps];
+ newSteps[index] = { ...newSteps[index], propertyFilters: stepFilters };
+ setSteps(newSteps);
+ }}
+ >
+ <X className="h-4 w-4" />
+ </Button>
+ )}
</div>
- {stepPropertyFilters[index].length > 1 && (
- <Button
- type="button"
- variant="ghost"
- size="icon"
- onClick={() => {
- // Create immutable copies for nested state
- const newStepPropertyFilters = [...stepPropertyFilters];
- const stepFilters = newStepPropertyFilters[index].filter(
- (_, i) => i !== filterIndex
- );
- newStepPropertyFilters[index] = stepFilters;
- setStepPropertyFilters(newStepPropertyFilters);
-
- // Update the step with propertyFilters immutably
- const newSteps = [...steps];
- newSteps[index] = { ...newSteps[index], propertyFilters: stepFilters };
- setSteps(newSteps);
- }}
- >
- <X className="h-4 w-4" />
- </Button>
- )}
- </div>
- ))}
- <Button
- type="button"
- variant="outline"
- size="sm"
- onClick={() => {
- const newStepPropertyFilters = [...stepPropertyFilters];
- newStepPropertyFilters[index] = [...newStepPropertyFilters[index], { key: "", value: "" }];
- setStepPropertyFilters(newStepPropertyFilters);
- }}
- className="w-full"
- >
- <Plus className="mr-2 h-4 w-4" />
- Add Another {step.type === "page" ? "Parameter" : "Property"}
- </Button>
- </div>
- )}
+ ))}
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ const newStepPropertyFilters = [...stepPropertyFilters];
+ newStepPropertyFilters[index] = [
+ ...newStepPropertyFilters[index],
+ { key: "", value: "" },
+ ];
+ setStepPropertyFilters(newStepPropertyFilters);
+ }}
+ >
+ <Plus className="h-4 w-4" />
+ New {step.type === "page" ? "Parameter" : "Property"}
+ </Button>
+ </div>
+ )}
+ </div>
</div>
- </div>
- </div>
- </div>
- ))}
- </CardContent>
- </Card>
+ )}
+ </Reorder.Item>
+ );
+ })}
+ </Reorder.Group>
+ <Button onClick={addStep} size="sm" className="mt-2">
+ <Plus className="h-4 w-4" /> Add Step
+ </Button>
+ </div>
</div>
{funnelArea}
</div>
@@ -382,7 +460,7 @@ export function FunnelForm({
Cancel
</Button>
<Button onClick={onSave} disabled={isSaving} variant="success">
- <Save className="mr-2 h-4 w-4" />
+ <Save className="h-4 w-4" />
{isSaving ? "Saving..." : saveButtonText}
</Button>
</div>
diff --git a/client/src/app/[site]/funnels/page.tsx b/client/src/app/[site]/funnels/page.tsx
index ababd8025..09cd030f9 100644
--- a/client/src/app/[site]/funnels/page.tsx
+++ b/client/src/app/[site]/funnels/page.tsx
@@ -4,6 +4,7 @@ import { Input } from "@/components/ui/input";
import { GOALS_PAGE_FILTERS } from "@/lib/filterGroups";
import { useStore } from "@/lib/store";
import { ArrowRight, Funnel } from "lucide-react";
+import { Card } from "@/components/ui/card";
import { useMemo, useState } from "react";
import { useGetFunnels } from "../../../api/analytics/hooks/funnels/useGetFunnels";
import { SavedFunnel } from "../../../api/analytics/endpoints";
@@ -17,28 +18,28 @@ import { FunnelRow } from "./components/FunnelRow";
// Skeleton for the funnel row component
const FunnelRowSkeleton = () => (
- <div className="rounded-md shadow-sm bg-white dark:bg-neutral-900 border border-neutral-100 dark:border-neutral-800 mb-4 overflow-hidden">
+ <Card className="mb-4 overflow-hidden">
<div className="flex items-center justify-between py-2 px-5 animate-pulse">
<div className="flex items-center grow">
- <div className="mt-1 text-xs flex flex-col gap-3 w-full">
+ <div className="mt-1 text-xs text-neutral-500 dark:text-neutral-400 flex flex-col gap-3">
{/* Funnel name and steps skeleton */}
- <div className="flex flex-wrap gap-1 items-center">
- <div className="h-5 bg-neutral-100 dark:bg-neutral-800 rounded w-32 mb-1"></div>
+ <div className="flex flex-wrap gap-1">
+ <div className="h-6 bg-neutral-200 dark:bg-neutral-700 rounded w-32 mr-2"></div>
<div className="flex items-center">
- <div className="rounded bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 w-20 h-5 flex items-center">
- <div className="w-3 h-3 bg-neutral-150 dark:bg-neutral-700 rounded-full mr-1"></div>
- <div className="h-3 bg-neutral-150 dark:bg-neutral-700 rounded w-12 ml-1"></div>
- </div>
- <ArrowRight className="h-3 w-3 mx-1 text-neutral-300 dark:text-neutral-600" />
- <div className="rounded bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 w-24 h-5 flex items-center">
- <div className="w-3 h-3 bg-neutral-150 dark:bg-neutral-700 rounded-full mr-1"></div>
- <div className="h-3 bg-neutral-150 dark:bg-neutral-700 rounded w-16 ml-1"></div>
- </div>
- <ArrowRight className="h-3 w-3 mx-1 text-neutral-300 dark:text-neutral-600" />
- <div className="rounded bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 w-20 h-5 flex items-center">
- <div className="w-3 h-3 bg-neutral-150 dark:bg-neutral-700 rounded-full mr-1"></div>
- <div className="h-3 bg-neutral-150 dark:bg-neutral-700 rounded w-12 ml-1"></div>
- </div>
+ <span className="rounded bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 flex items-center">
+ <div className="w-3 h-3 bg-neutral-200 dark:bg-neutral-700 rounded mr-1"></div>
+ <div className="h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-16"></div>
+ </span>
+ <ArrowRight className="h-3 w-3 mx-1 text-neutral-400" />
+ <span className="rounded bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 flex items-center">
+ <div className="w-3 h-3 bg-neutral-200 dark:bg-neutral-700 rounded mr-1"></div>
+ <div className="h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-20"></div>
+ </span>
+ <ArrowRight className="h-3 w-3 mx-1 text-neutral-400" />
+ <span className="rounded bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 flex items-center">
+ <div className="w-3 h-3 bg-neutral-200 dark:bg-neutral-700 rounded mr-1"></div>
+ <div className="h-3 bg-neutral-200 dark:bg-neutral-700 rounded w-14"></div>
+ </span>
</div>
</div>
</div>
@@ -46,13 +47,14 @@ const FunnelRowSkeleton = () => (
<div className="flex items-center gap-4">
<div className="flex">
- <div className="h-8 w-8 bg-neutral-100 dark:bg-neutral-800 rounded-md mr-1"></div>
- <div className="h-8 w-8 bg-neutral-100 dark:bg-neutral-800 rounded-md mr-1"></div>
- <div className="h-8 w-8 bg-neutral-100 dark:bg-neutral-800 rounded-md"></div>
+ <div className="h-9 w-9 bg-neutral-100 dark:bg-neutral-800 rounded-md"></div>
+ <div className="h-9 w-9 bg-neutral-100 dark:bg-neutral-800 rounded-md"></div>
+ <div className="h-9 w-9 bg-neutral-100 dark:bg-neutral-800 rounded-md"></div>
+ <div className="h-9 w-9 bg-neutral-100 dark:bg-neutral-800 rounded-md"></div>
</div>
</div>
</div>
- </div>
+ </Card>
);
export default function FunnelsPage() {
diff --git a/client/src/app/[site]/goals/components/GoalFormModal.tsx b/client/src/app/[site]/goals/components/GoalFormModal.tsx
index b5cc6695b..9d7031d5b 100644
--- a/client/src/app/[site]/goals/components/GoalFormModal.tsx
+++ b/client/src/app/[site]/goals/components/GoalFormModal.tsx
@@ -36,10 +36,14 @@ const formSchema = z
eventName: z.string().optional(),
eventPropertyKey: z.string().optional(),
eventPropertyValue: z.string().optional(),
- propertyFilters: z.array(z.object({
- key: z.string(),
- value: z.union([z.string(), z.number(), z.boolean()]),
- })).optional(),
+ propertyFilters: z
+ .array(
+ z.object({
+ key: z.string(),
+ value: z.union([z.string(), z.number(), z.boolean()]),
+ })
+ )
+ .optional(),
}),
})
.refine(
@@ -70,16 +74,18 @@ export default function GoalFormModal({ siteId, goal, trigger, isCloneMode = fal
const [isOpen, setIsOpen] = useState(false);
// Initialize useProperties based on either new propertyFilters or legacy properties
- const hasProperties = !!(goal?.config.propertyFilters?.length ||
- (goal?.config.eventPropertyKey && goal?.config.eventPropertyValue !== undefined));
+ const hasProperties = !!(
+ goal?.config.propertyFilters?.length ||
+ (goal?.config.eventPropertyKey && goal?.config.eventPropertyValue !== undefined)
+ );
const [useProperties, setUseProperties] = useState(hasProperties);
// State for managing multiple property filters (store as strings in UI)
const [propertyFilters, setPropertyFilters] = useState<Array<{ key: string; value: string }>>(
goal?.config.propertyFilters?.map(f => ({ key: f.key, value: String(f.value) })) ||
- (goal?.config.eventPropertyKey && goal?.config.eventPropertyValue !== undefined
- ? [{ key: goal.config.eventPropertyKey, value: String(goal.config.eventPropertyValue) }]
- : [{ key: "", value: "" }])
+ (goal?.config.eventPropertyKey && goal?.config.eventPropertyValue !== undefined
+ ? [{ key: goal.config.eventPropertyKey, value: String(goal.config.eventPropertyValue) }]
+ : [{ key: "", value: "" }])
);
// Fetch suggestions for paths and events
@@ -112,12 +118,15 @@ export default function GoalFormModal({ siteId, goal, trigger, isCloneMode = fal
useEffect(() => {
if (isOpen && goal) {
// Update useProperties based on either new propertyFilters or legacy properties
- const hasFilters = !!(goal.config.propertyFilters?.length ||
- (goal.config.eventPropertyKey && goal.config.eventPropertyValue !== undefined));
+ const hasFilters = !!(
+ goal.config.propertyFilters?.length ||
+ (goal.config.eventPropertyKey && goal.config.eventPropertyValue !== undefined)
+ );
setUseProperties(hasFilters);
// Update propertyFilters state
- const filters = goal.config.propertyFilters?.map(f => ({ key: f.key, value: String(f.value) })) ||
+ const filters =
+ goal.config.propertyFilters?.map(f => ({ key: f.key, value: String(f.value) })) ||
(goal.config.eventPropertyKey && goal.config.eventPropertyValue !== undefined
? [{ key: goal.config.eventPropertyKey, value: String(goal.config.eventPropertyValue) }]
: [{ key: "", value: "" }]);
@@ -395,7 +404,7 @@ export default function GoalFormModal({ siteId, goal, trigger, isCloneMode = fal
onClick={() => setPropertyFilters([...propertyFilters, { key: "", value: "" }])}
className="w-full"
>
- <Plus className="mr-2 h-4 w-4" />
+ <Plus className="h-4 w-4" />
Add Another Parameter
</Button>
</div>
@@ -476,7 +485,7 @@ export default function GoalFormModal({ siteId, goal, trigger, isCloneMode = fal
onClick={() => setPropertyFilters([...propertyFilters, { key: "", value: "" }])}
className="w-full"
>
- <Plus className="mr-2 h-4 w-4" />
+ <Plus className="h-4 w-4" />
Add Another Property
</Button>
</div>
diff --git a/client/src/app/admin/components/users/UsersTable.tsx b/client/src/app/admin/components/users/UsersTable.tsx
index 7d93ef322..ff25e41c7 100644
--- a/client/src/app/admin/components/users/UsersTable.tsx
+++ b/client/src/app/admin/components/users/UsersTable.tsx
@@ -143,7 +143,7 @@ export function UsersTable({
onClick={() => onImpersonate(row.original.id)}
disabled={row.original.id === userStore.getState().user?.id}
>
- <User className="mr-2 h-4 w-4" />
+ <User className="h-4 w-4" />
Impersonate
</DropdownMenuItem>
<DropdownMenuItem
@@ -152,7 +152,7 @@ export function UsersTable({
setShowAddToOrgDialog(true);
}}
>
- <UserPlus className="mr-2 h-4 w-4" />
+ <UserPlus className="h-4 w-4" />
Add to Organization
</DropdownMenuItem>
<DropdownMenuSeparator />
@@ -163,7 +163,7 @@ export function UsersTable({
}}
className="text-orange-500 focus:text-orange-600"
>
- <UserMinus className="mr-2 h-4 w-4" />
+ <UserMinus className="h-4 w-4" />
Remove from Organization
</DropdownMenuItem>
</DropdownMenuContent>
@@ -291,7 +291,10 @@ export function UsersTable({
}}
>
<Check
- className={cn("mr-2 h-4 w-4", selectedOrganizationId === org.id ? "opacity-100" : "opacity-0")}
+ className={cn(
+ "mr-2 h-4 w-4",
+ selectedOrganizationId === org.id ? "opacity-100" : "opacity-0"
+ )}
/>
{org.name}
</CommandItem>
diff --git a/client/src/app/uptime/monitors/[monitorId]/components/EventsTable.tsx b/client/src/app/uptime/monitors/[monitorId]/components/EventsTable.tsx
index c9f3f76f5..56572d558 100644
--- a/client/src/app/uptime/monitors/[monitorId]/components/EventsTable.tsx
+++ b/client/src/app/uptime/monitors/[monitorId]/components/EventsTable.tsx
@@ -244,7 +244,7 @@ export function EventsTable({ monitor, monitorId }: { monitor?: UptimeMonitor; m
{isFetchingNextPage && (
<div className="flex justify-center">
<Button variant="ghost" size="sm" disabled>
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
+ <Loader2 className="h-4 w-4 animate-spin" />
Loading more events...
</Button>
</div>
diff --git a/client/src/app/uptime/monitors/components/MonitorActions.tsx b/client/src/app/uptime/monitors/components/MonitorActions.tsx
index 503ee5667..2f5853c39 100644
--- a/client/src/app/uptime/monitors/components/MonitorActions.tsx
+++ b/client/src/app/uptime/monitors/components/MonitorActions.tsx
@@ -92,7 +92,7 @@ export function MonitorActions({ monitor }: { monitor?: UptimeMonitor }) {
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => setShowDeleteDialog(true)} className="text-red-500 focus:text-red-600">
- <Trash2 className="mr-2 h-4 w-4" />
+ <Trash2 className="h-4 w-4" />
Delete Monitor
</DropdownMenuItem>
</DropdownMenuContent>
diff --git a/client/src/app/uptime/monitors/components/dialog/MonitorDialog.tsx b/client/src/app/uptime/monitors/components/dialog/MonitorDialog.tsx
index 1996810e0..77882500c 100644
--- a/client/src/app/uptime/monitors/components/dialog/MonitorDialog.tsx
+++ b/client/src/app/uptime/monitors/components/dialog/MonitorDialog.tsx
@@ -269,9 +269,7 @@ export function MonitorDialog({ monitor, open, onOpenChange }: MonitorDialogProp
(!isEdit && (isPending || !activeOrganization))
}
>
- {(createMonitor.isPending || updateMonitor.isPending) && (
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
- )}
+ {(createMonitor.isPending || updateMonitor.isPending) && <Loader2 className="h-4 w-4 animate-spin" />}
{isEdit ? "Update" : "Create"} Monitor
</Button>
</DialogFooter>
diff --git a/client/src/app/uptime/notifications/page.tsx b/client/src/app/uptime/notifications/page.tsx
index 65745216d..cfab376d6 100644
--- a/client/src/app/uptime/notifications/page.tsx
+++ b/client/src/app/uptime/notifications/page.tsx
@@ -202,23 +202,23 @@ export default function NotificationsPage() {
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => handleToggleChannel(channel)}>
- <Power className="mr-2 h-4 w-4" />
+ <Power className="h-4 w-4" />
{channel.enabled ? "Disable" : "Enable"}
</DropdownMenuItem>
<DropdownMenuItem
onClick={() => handleTestChannel(channel)}
disabled={!channel.enabled}
>
- <Bell className="mr-2 h-4 w-4" />
+ <Bell className="h-4 w-4" />
Test
</DropdownMenuItem>
<DropdownMenuItem onClick={() => openEditDialog(channel)}>
- <Edit className="mr-2 h-4 w-4" />
+ <Edit className="h-4 w-4" />
Edit
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onClick={() => openDeleteModal(channel)} className="text-red-600">
- <Trash2 className="mr-2 h-4 w-4" />
+ <Trash2 className="h-4 w-4" />
Delete
</DropdownMenuItem>
</DropdownMenuContent>
diff --git a/client/src/components/SiteSettings/ImportManager.tsx b/client/src/components/SiteSettings/ImportManager.tsx
index 2658a6abc..172bfa271 100644
--- a/client/src/components/SiteSettings/ImportManager.tsx
+++ b/client/src/components/SiteSettings/ImportManager.tsx
@@ -247,12 +247,12 @@ export function ImportManager({ siteId, disabled }: ImportManagerProps) {
<Button type="submit" disabled={isImportDisabled} className="w-full sm:w-auto">
{createImportMutation.isPending ? (
<>
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
+ <Loader2 className="h-4 w-4 animate-spin" />
Importing...
</>
) : (
<>
- <Upload className="mr-2 h-4 w-4" />
+ <Upload className="h-4 w-4" />
Import
</>
)}
diff --git a/client/src/components/ui/input-with-suggestions.tsx b/client/src/components/ui/input-with-suggestions.tsx
index 9f278215c..6a6a75187 100644
--- a/client/src/components/ui/input-with-suggestions.tsx
+++ b/client/src/components/ui/input-with-suggestions.tsx
@@ -1,6 +1,7 @@
"use client";
import * as React from "react";
+import * as Portal from "@radix-ui/react-portal";
import { cn } from "@/lib/utils";
import { Input } from "@/components/ui/input";
@@ -18,7 +19,9 @@ export const InputWithSuggestions = React.forwardRef<HTMLInputElement, InputWith
({ suggestions, onValueChange, className, value: controlledValue, ...props }, ref) => {
const [open, setOpen] = React.useState(false);
const [internalValue, setInternalValue] = React.useState("");
+ const [dropdownPosition, setDropdownPosition] = React.useState({ top: 0, left: 0, width: 0 });
const wrapperRef = React.useRef<HTMLDivElement>(null);
+ const dropdownRef = React.useRef<HTMLDivElement>(null);
// Use controlled value if provided, otherwise use internal state
const value = controlledValue !== undefined ? controlledValue : internalValue;
@@ -27,9 +30,39 @@ export const InputWithSuggestions = React.forwardRef<HTMLInputElement, InputWith
suggestion.value.toLowerCase().includes(String(value).toLowerCase())
);
+ // Update dropdown position when open changes or on scroll/resize
+ React.useEffect(() => {
+ const updatePosition = () => {
+ if (wrapperRef.current && open) {
+ const rect = wrapperRef.current.getBoundingClientRect();
+ setDropdownPosition({
+ top: rect.bottom + window.scrollY,
+ left: rect.left + window.scrollX,
+ width: rect.width,
+ });
+ }
+ };
+
+ updatePosition();
+
+ if (open) {
+ window.addEventListener("scroll", updatePosition, true);
+ window.addEventListener("resize", updatePosition);
+ return () => {
+ window.removeEventListener("scroll", updatePosition, true);
+ window.removeEventListener("resize", updatePosition);
+ };
+ }
+ }, [open]);
+
React.useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
- if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) {
+ if (
+ wrapperRef.current &&
+ !wrapperRef.current.contains(event.target as Node) &&
+ dropdownRef.current &&
+ !dropdownRef.current.contains(event.target as Node)
+ ) {
setOpen(false);
}
};
@@ -74,17 +107,28 @@ export const InputWithSuggestions = React.forwardRef<HTMLInputElement, InputWith
{...props}
/>
{open && filteredSuggestions.length > 0 && (
- <div className="absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-md border border-neutral-150 bg-white shadow-md dark:border-neutral-800 dark:bg-neutral-900">
- {filteredSuggestions.map(suggestion => (
- <div
- key={suggestion.value}
- className="relative cursor-pointer px-3 py-2 text-sm hover:bg-neutral-100 dark:hover:bg-neutral-800"
- onClick={() => handleSuggestionClick(suggestion.value)}
- >
- {suggestion.label || suggestion.value}
- </div>
- ))}
- </div>
+ <Portal.Root>
+ <div
+ ref={dropdownRef}
+ style={{
+ position: "absolute",
+ top: dropdownPosition.top,
+ left: dropdownPosition.left,
+ width: dropdownPosition.width,
+ }}
+ className="z-50 max-h-60 overflow-auto rounded-md border border-neutral-150 bg-white shadow-md dark:border-neutral-800 dark:bg-neutral-900"
+ >
+ {filteredSuggestions.map(suggestion => (
+ <div
+ key={suggestion.value}
+ className="relative cursor-pointer px-3 py-2 text-sm hover:bg-neutral-100 dark:hover:bg-neutral-800"
+ onClick={() => handleSuggestionClick(suggestion.value)}
+ >
+ {suggestion.label || suggestion.value}
+ </div>
+ ))}
+ </div>
+ </Portal.Root>
)}
</div>
);
diff --git a/docs/content/docs/guides/shopify.mdx b/docs/content/docs/guides/shopify.mdx
index a252990fa..89befcf26 100644
--- a/docs/content/docs/guides/shopify.mdx
+++ b/docs/content/docs/guides/shopify.mdx
@@ -30,7 +30,8 @@ Navigate to your Rybbit dashboard to obtain your code snippet.
<Step>
### Add the Snippet to Your Shopify Store
-- In Shopify, go to **Online Store > Themes** and click **Edit code** from the settings dropdown beside the **Customize** button.
+- In Shopify, go to **Online Store > Themes**.
+- Find your current theme, click the **three dots (...)** button next to **Customize**, and select **Edit code**.
- Open `theme.liquid` in the **Layout** folder.
- Just before the closing `</head>` tag, insert your snippet.
- Save the file to apply the changes to your live store.
@@ -172,8 +173,13 @@ document.addEventListener('DOMContentLoaded', function() {
Track completed purchases on the Shopify "Order status" page (also known as the "Thank You" page).
-**Go to Shopify Admin > Settings > Checkout.**
-Scroll down to the **Order status page** section. In the **Additional scripts** box, paste the following:
+**1. Navigate to Checkout Settings:**
+- Go to **Settings** (bottom left in Admin).
+- Click on **Checkout** (or **Checkout and accounts** depending on your Admin version).
+
+**2. Add the Script:**
+- Scroll down to the **Order status page** section.
+- In the **Additional scripts** box, paste the following:
```liquid
{% raw %}{% if first_time_accessed %}