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
2 changes: 1 addition & 1 deletion src/components/BuilderCore/Flow/FlowFormBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function FlowFormBuilder({
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
>
<FieldPalette />
<FieldPalette mode="flow" />

<FlowPageCanvas
fields={fields}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export default function SinglePageFormBuilder({
onDragStart={handleDragStart}
onDragEnd={handleDragEnd}
>
<FieldPalette />
<FieldPalette mode="single" />

<SinglePageCanvas
fields={fields}
Expand Down
15 changes: 12 additions & 3 deletions src/components/BuilderCore/shared/FieldPalette.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDraggable } from "@dnd-kit/core";
import { FIELD_TEMPLATES } from "./constants";
import type { FieldTemplate } from "./types";
import type { FieldTemplate, FormMode } from "./types";

interface DraggablePaletteItemProps {
template: FieldTemplate;
Expand Down Expand Up @@ -35,15 +35,24 @@ function DraggablePaletteItem({ template }: DraggablePaletteItemProps) {
);
}

export default function FieldPalette() {
interface FieldPaletteProps {
mode?: FormMode;
}

export default function FieldPalette({ mode = "single" }: FieldPaletteProps) {
const filteredTemplates =
mode === "flow"
? FIELD_TEMPLATES.filter((t) => t.type !== "page_break")
: FIELD_TEMPLATES;

return (
<div className="w-64 bg-gray-50 border-r border-gray-200 p-4 overflow-y-auto">
<h2 className="text-lg font-semibold text-gray-800 mb-2">Form Fields</h2>
<p className="text-xs text-gray-500 mb-4">
Drag fields to build your form
</p>
<div className="space-y-2">
{FIELD_TEMPLATES.map((template) => (
{filteredTemplates.map((template) => (
<DraggablePaletteItem key={template.type} template={template} />
))}
</div>
Expand Down
Loading