Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use client";

import { DeleteDialog } from "@/components/ui/delete-dialog";

interface DeleteFolderDialogProps {
isOpen: boolean;
onClose: () => void;
onConfirm: () => void;
folderName: string;
isDeleting?: boolean;
}

export function DeleteFolderDialog({
isOpen,
onClose,
onConfirm,
folderName,
isDeleting = false,
}: DeleteFolderDialogProps) {
return (
<DeleteDialog
isOpen={isOpen}
onClose={onClose}
onConfirm={onConfirm}
title="Delete Folder"
description={`Are you sure you want to delete the folder "${folderName}"?`}
confirmLabel="Delete Folder"
isDeleting={isDeleting}
itemName={folderName}
>
<div className="rounded-md bg-muted p-3 text-sm text-muted-foreground">
<p>
Flags in this folder will <strong>not</strong> be deleted. They will be moved to
"Uncategorized".
</p>
Comment on lines +31 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Align styling with UI conventions.

Use rounded (not rounded-md) and add text-pretty for paragraph text.

🎨 Style tweak
-			<div className="rounded-md bg-muted p-3 text-sm text-muted-foreground">
+			<div className="rounded bg-muted p-3 text-sm text-pretty text-muted-foreground">
🤖 Prompt for AI Agents
In
`@apps/dashboard/app/`(main)/websites/[id]/flags/_components/delete-folder-dialog.tsx
around lines 31 - 35, Update the styling in the delete-folder dialog: replace
the container class "rounded-md" with "rounded" on the div that currently has
className="rounded-md bg-muted p-3 text-sm text-muted-foreground", and add
"text-pretty" to the paragraph element (<p>) inside that div so it becomes
consistent with UI conventions; ensure you only change those class names in the
component DeleteFolderDialog (the JSX block containing the flagged message) and
keep the other classes (bg-muted, p-3, text-sm, text-muted-foreground)
unchanged.

</div>
</DeleteDialog>
Comment on lines +21 to +37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use AlertDialog for destructive actions.

Guidelines require an AlertDialog for destructive/irreversible actions. DeleteDialog wraps Dialog, so this should be switched to an AlertDialog-based primitive.

🤖 Prompt for AI Agents
In
`@apps/dashboard/app/`(main)/websites/[id]/flags/_components/delete-folder-dialog.tsx
around lines 21 - 37, Replace the Dialog-based DeleteDialog usage with the
AlertDialog primitive: remove DeleteDialog and wrap the same content in
AlertDialog -> AlertDialogTrigger (if needed) -> AlertDialogContent, using
AlertDialogHeader/Title and AlertDialogDescription for the title/description;
move the confirm action into AlertDialogAction and the cancel into
AlertDialogCancel, passing the existing onConfirm handler to AlertDialogAction
and using onOpenChange/onClose as appropriate for AlertDialog state. Preserve
the inner warning box markup and reuse props (folderName, isDeleting,
confirmLabel) but map them to the AlertDialog equivalents (title ->
AlertDialogTitle, description -> AlertDialogDescription, confirmLabel ->
AlertDialogAction label, isDeleting -> disable or loading state on
AlertDialogAction). Ensure imports and component names (AlertDialog,
AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogTitle,
AlertDialogDescription) replace DeleteDialog and its props (isOpen, onClose,
onConfirm, title, description, confirmLabel, isDeleting, itemName).

);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { AutocompleteInput } from "@/components/ui/autocomplete-input";
import { LineSlider } from "@/components/ui/line-slider";
import {
Sheet,
Expand Down Expand Up @@ -157,6 +158,7 @@ export function FlagSheet({
dependencies: [],
environment: undefined,
targetGroupIds: [],
folder: undefined,
},
schedule: undefined,
},
Expand Down Expand Up @@ -199,6 +201,7 @@ export function FlagSheet({
dependencies: flag.dependencies ?? [],
environment: flag.environment || undefined,
targetGroupIds: extractTargetGroupIds(),
folder: flag.folder || undefined,
},
schedule: undefined,
});
Expand All @@ -220,6 +223,7 @@ export function FlagSheet({
variants: template.type === "multivariant" ? template.variants : [],
dependencies: [],
targetGroupIds: [],
folder: undefined,
},
schedule: undefined,
});
Expand All @@ -241,6 +245,7 @@ export function FlagSheet({
variants: [],
dependencies: [],
targetGroupIds: [],
folder: undefined,
},
schedule: undefined,
});
Expand Down Expand Up @@ -393,6 +398,8 @@ export function FlagSheet({
<div className="space-y-4">
<div className="grid place-items-start gap-4 sm:grid-cols-2">
<FormField
control={form.control}
name="flag.name"
control={form.control}
name="flag.name"
render={({ field }) => (
Expand All @@ -410,6 +417,33 @@ export function FlagSheet({
)}
/>

<FormField
control={form.control}
name="flag.folder"
render={({ field }) => (
<FormItem>
<FormLabel>Folder (optional)</FormLabel>
<FormControl>
<AutocompleteInput
suggestions={
Array.from(
new Set(
flagsList
?.map((f) => f.folder)
.filter(Boolean) as string[]
)
).sort()
}
placeholder="Select or type folder..."
value={field.value || ""}
onValueChange={field.onChange}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>

<FormField
control={form.control}
name="flag.key"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"use client";

import { CaretDown } from "@phosphor-icons/react/dist/ssr/CaretDown";
import { CaretRight } from "@phosphor-icons/react/dist/ssr/CaretRight";
import { Folder } from "@phosphor-icons/react/dist/ssr/Folder";
import { useState } from "react";
import { cn } from "@/lib/utils";

interface FolderListItemProps {
name: string;
count: number;
children: React.ReactNode;
defaultOpen?: boolean;
}

export function FolderListItem({
name,
count,
children,
defaultOpen = true,
}: FolderListItemProps) {
const [isOpen, setIsOpen] = useState(defaultOpen);

return (
<div className="border border-border rounded-lg overflow-hidden mb-4">
<button
type="button"
onClick={() => setIsOpen(!isOpen)}
className="w-full flex items-center justify-between px-4 py-3 bg-card hover:bg-muted/50 transition-colors"
>
<div className="flex items-center gap-2">
{isOpen ? (
<CaretDown size={14} className="text-muted-foreground" />
) : (
<CaretRight size={14} className="text-muted-foreground" />
)}
<Folder size={18} className="text-muted-foreground" />
<span className="font-medium text-sm">{name}</span>
Comment on lines +3 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Check the phosphor icons package to understand SSR import patterns
fd -e "json" -e "ts" -e "tsx" | head -20 | xargs grep -l "phosphor-icons" | head -5

Repository: databuddy-analytics/Databuddy

Length of output: 85


🏁 Script executed:

# Search for phosphor icon usage patterns in the codebase
rg "@phosphor-icons/react" -A 2 -B 1 | head -50

Repository: databuddy-analytics/Databuddy

Length of output: 2719


🏁 Script executed:

# Look at the full file to see the complete context
cat -n apps/dashboard/app/\(main\)/websites/\[id\]/flags/_components/folder-list-item.tsx 2>/dev/null || find . -name "folder-list-item.tsx" -type f -exec cat -n {} \;

Repository: databuddy-analytics/Databuddy

Length of output: 2393


🏁 Script executed:

# Search for phosphor icon imports to see the actual patterns used
rg "import.*Icon.*from.*@phosphor-icons" -A 1 | head -60

Repository: databuddy-analytics/Databuddy

Length of output: 3961


🏁 Script executed:

# Check the phosphor icons package structure in node_modules or lock file
rg "@phosphor-icons/react" package.json -A 5

Repository: databuddy-analytics/Databuddy

Length of output: 326


🏁 Script executed:

# Look for SSR-specific phosphor imports in the codebase
rg "from.*@phosphor-icons/react/dist/ssr" | head -20

Repository: databuddy-analytics/Databuddy

Length of output: 2735


🏁 Script executed:

# Check how SSR icons are being used elsewhere in the codebase
rg "from.*@phosphor-icons/react/dist/ssr" -A 3 | head -40

Repository: databuddy-analytics/Databuddy

Length of output: 3495


🏁 Script executed:

# Look for weight prop usage on phosphor icons
rg "weight=" | grep -i phosphor | head -10

Repository: databuddy-analytics/Databuddy

Length of output: 55


🏁 Script executed:

# Verify the actual import pattern in the codebase more thoroughly
rg "import.*Icon.*from.*@phosphor-icons/react" | head -30

Repository: databuddy-analytics/Databuddy

Length of output: 3314


🏁 Script executed:

# Check if weight prop is even supported for SSR imports
rg "weight=|weight:" | grep -i "caret\|folder" | head -5

Repository: databuddy-analytics/Databuddy

Length of output: 620


Use named Phosphor imports with Icon suffix and add weight="duotone" to icons.

The file should import icons as named imports with the Icon suffix for consistency with the codebase pattern, and add the duotone weight for styling.

✅ Suggested import/usage updates
-import { CaretDown } from "@phosphor-icons/react/dist/ssr/CaretDown";
-import { CaretRight } from "@phosphor-icons/react/dist/ssr/CaretRight";
-import { Folder } from "@phosphor-icons/react/dist/ssr/Folder";
+import { CaretDownIcon } from "@phosphor-icons/react/dist/ssr/CaretDown";
+import { CaretRightIcon } from "@phosphor-icons/react/dist/ssr/CaretRight";
+import { FolderIcon } from "@phosphor-icons/react/dist/ssr/Folder";
-						<CaretDown size={14} className="text-muted-foreground" />
+						<CaretDownIcon size={14} weight="duotone" className="text-muted-foreground" />
...
-						<CaretRight size={14} className="text-muted-foreground" />
+						<CaretRightIcon size={14} weight="duotone" className="text-muted-foreground" />
...
-					<Folder size={18} className="text-muted-foreground" />
+					<FolderIcon size={18} weight="duotone" className="text-muted-foreground" />
🤖 Prompt for AI Agents
In
`@apps/dashboard/app/`(main)/websites/[id]/flags/_components/folder-list-item.tsx
around lines 3 - 38, Replace the current SSR imports and usages of CaretDown,
CaretRight, and Folder in FolderListItem: import them as named icons with an
Icon suffix from "@phosphor-icons/react" (e.g., import { CaretDown as
CaretDownIcon, CaretRight as CaretRightIcon, Folder as FolderIcon } from
"@phosphor-icons/react") and update the JSX to use CaretDownIcon,
CaretRightIcon, and FolderIcon while passing weight="duotone" (and preserving
size/className props) so the components follow the codebase naming and styling
conventions.

<span className="px-2 py-0.5 rounded-full bg-muted text-muted-foreground text-xs">
{count}
</span>
Comment on lines +25 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use rounded and add tabular-nums for counts.

Guidelines require rounded (not rounded-lg/rounded-full), and numeric badges should use tabular-nums.

🎨 Suggested class updates
-		<div className="border border-border rounded-lg overflow-hidden mb-4">
+		<div className="border border-border rounded overflow-hidden mb-4">
...
-					<span className="px-2 py-0.5 rounded-full bg-muted text-muted-foreground text-xs">
+					<span className="px-2 py-0.5 rounded bg-muted text-muted-foreground text-xs tabular-nums">
🤖 Prompt for AI Agents
In
`@apps/dashboard/app/`(main)/websites/[id]/flags/_components/folder-list-item.tsx
around lines 25 - 41, The container and count badge use non-compliant rounding
and missing tabular numerals: replace the outer container's "rounded-lg" with
"rounded" and update the count badge (the span rendering {count}) to use
"rounded" instead of "rounded-full" and add the "tabular-nums" class; locate
these in the FolderListItem component where the JSX renders the outer <div
className="border border-border rounded-lg..."> and the count <span
className="px-2 py-0.5 rounded-full ..."> and apply the class substitutions.

</div>
</button>

<div
className={cn(
"border-t border-border transition-all duration-200",
isOpen ? "block" : "hidden"
)}
Comment on lines +45 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Remove transition-all (animation not requested).

Guidelines forbid adding animations unless explicitly requested and disallow transition-all (can animate layout properties).

🚫 Remove transition-all
-				className={cn(
-					"border-t border-border transition-all duration-200",
-					isOpen ? "block" : "hidden"
-				)}
+				className={cn("border-t border-border", isOpen ? "block" : "hidden")}
🤖 Prompt for AI Agents
In
`@apps/dashboard/app/`(main)/websites/[id]/flags/_components/folder-list-item.tsx
around lines 45 - 49, Remove the undesired animation by deleting
"transition-all" from the className string in the div that renders the folder
list toggle (the cn(...) call that currently uses "border-t border-border
transition-all duration-200" with isOpen ? "block" : "hidden"); keep the border
and conditional visibility classes intact (so leave "border-t border-border" and
the isOpen conditional), and remove any associated duration class if it's no
longer needed.

>
<div className="p-0">
{children}
</div>
</div>
</div>
);
}
Loading