Change PDF Block Icon and input type (#1615)

This commit is contained in:
Shuchang Zheng
2025-01-22 21:07:25 +08:00
committed by GitHub
parent 0fd1a87710
commit 6f5490ab47
3 changed files with 13 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
import { HelpTooltip } from "@/components/HelpTooltip"; import { HelpTooltip } from "@/components/HelpTooltip";
import { Input } from "@/components/ui/input"; import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { WorkflowBlockInput } from "@/components/WorkflowBlockInput";
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback"; import { useDeleteNodeCallback } from "@/routes/workflows/hooks/useDeleteNodeCallback";
import { useNodeLabelChangeHandler } from "@/routes/workflows/hooks/useLabelChangeHandler"; import { useNodeLabelChangeHandler } from "@/routes/workflows/hooks/useLabelChangeHandler";
import { WorkflowBlockTypes } from "@/routes/workflows/types/workflowTypes"; import { WorkflowBlockTypes } from "@/routes/workflows/types/workflowTypes";
@@ -9,11 +11,9 @@ import { useState } from "react";
import { helpTooltips } from "../../helpContent"; import { helpTooltips } from "../../helpContent";
import { EditableNodeTitle } from "../components/EditableNodeTitle"; import { EditableNodeTitle } from "../components/EditableNodeTitle";
import { NodeActionMenu } from "../NodeActionMenu"; import { NodeActionMenu } from "../NodeActionMenu";
import { dataSchemaExampleForFileExtraction } from "../types";
import { WorkflowBlockIcon } from "../WorkflowBlockIcon"; import { WorkflowBlockIcon } from "../WorkflowBlockIcon";
import { type PDFParserNode } from "./types"; import { type PDFParserNode } from "./types";
import { Checkbox } from "@/components/ui/checkbox";
import { dataSchemaExampleForFileExtraction } from "../types";
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) { function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) {
const { updateNodeData } = useReactFlow(); const { updateNodeData } = useReactFlow();
@@ -81,14 +81,11 @@ function PDFParserNode({ id, data }: NodeProps<PDFParserNode>) {
<Label className="text-xs text-slate-300">File URL</Label> <Label className="text-xs text-slate-300">File URL</Label>
<HelpTooltip content={helpTooltips["pdfParser"]["fileUrl"]} /> <HelpTooltip content={helpTooltips["pdfParser"]["fileUrl"]} />
</div> </div>
<Input <WorkflowBlockInput
nodeId={id}
value={inputs.fileUrl} value={inputs.fileUrl}
onChange={(event) => { onChange={(value) => {
if (!data.editable) { handleChange("fileUrl", value);
return;
}
setInputs({ ...inputs, fileUrl: event.target.value });
updateNodeData(id, { fileUrl: event.target.value });
}} }}
className="nopan text-xs" className="nopan text-xs"
/> />

View File

@@ -6,6 +6,7 @@ import {
CursorTextIcon, CursorTextIcon,
DownloadIcon, DownloadIcon,
EnvelopeClosedIcon, EnvelopeClosedIcon,
FileTextIcon,
ListBulletIcon, ListBulletIcon,
LockOpen1Icon, LockOpen1Icon,
StopwatchIcon, StopwatchIcon,
@@ -68,7 +69,7 @@ function WorkflowBlockIcon({ workflowBlockType, className }: Props) {
return <StopwatchIcon className={className} />; return <StopwatchIcon className={className} />;
} }
case "pdf_parser": { case "pdf_parser": {
return <CursorTextIcon className={className} />; return <FileTextIcon className={className} />;
} }
} }
} }

View File

@@ -220,7 +220,7 @@ function WorkflowNodeLibraryPanel({ onNodeClick, first }: Props) {
</div> </div>
<span className="text-sm text-slate-400"> <span className="text-sm text-slate-400">
{first {first
? "Click on the node type to add your first node" ? "Click on the node type to add your first block"
: "Click on the node type you want to add"} : "Click on the node type you want to add"}
</span> </span>
</header> </header>
@@ -252,7 +252,7 @@ function WorkflowNodeLibraryPanel({ onNodeClick, first }: Props) {
}} }}
> >
<div className="flex gap-2"> <div className="flex gap-2">
<div className="flex h-[2.75rem] w-[2.75rem] items-center justify-center rounded border border-slate-600"> <div className="flex h-[2.75rem] w-[2.75rem] shrink-0 items-center justify-center rounded border border-slate-600">
{item.icon} {item.icon}
</div> </div>
<div className="flex flex-col gap-1"> <div className="flex flex-col gap-1">
@@ -264,7 +264,7 @@ function WorkflowNodeLibraryPanel({ onNodeClick, first }: Props) {
</span> </span>
</div> </div>
</div> </div>
<PlusIcon className="size-6" /> <PlusIcon className="size-6 shrink-0" />
</div> </div>
); );
})} })}