Fixed bug: flow not showing

This commit is contained in:
Lucas Oliveira 2023-08-15 12:21:20 -03:00
commit 3667f4812e
3 changed files with 43 additions and 59 deletions

View file

@ -363,7 +363,7 @@ export default function Page({
return ( return (
<div className="flex h-full overflow-hidden"> <div className="flex h-full overflow-hidden">
{view && <ExtraSidebar />} {!view && <ExtraSidebar />}
{/* Main area */} {/* Main area */}
<main className="flex flex-1"> <main className="flex flex-1">
{/* Primary column */} {/* Primary column */}
@ -372,63 +372,47 @@ export default function Page({
{Object.keys(templates).length > 0 && {Object.keys(templates).length > 0 &&
Object.keys(types).length > 0 ? ( Object.keys(types).length > 0 ? (
<div className="h-full w-full"> <div className="h-full w-full">
{view ? ( <ReactFlow
<ReactFlow nodes={nodes}
nodes={nodes} onMove={() => {
edges={edges} if (reactFlowInstance)
className="theme-attribution" updateFlow({
minZoom={0.01} ...flow,
maxZoom={8} data: reactFlowInstance.toObject(),
> });
<Background className="" /> }}
<Controls edges={edges}
className="bg-muted fill-foreground stroke-foreground text-primary onNodesChange={onNodesChangeMod}
[&>button]:border-b-border hover:[&>button]:bg-border" onEdgesChange={onEdgesChangeMod}
></Controls> onConnect={onConnect}
</ReactFlow> disableKeyboardA11y={true}
) : ( onLoad={setReactFlowInstance}
<ReactFlow onInit={setReactFlowInstance}
nodes={nodes} nodeTypes={nodeTypes}
onMove={() => { onEdgeUpdate={onEdgeUpdate}
if (reactFlowInstance) onEdgeUpdateStart={onEdgeUpdateStart}
updateFlow({ onEdgeUpdateEnd={onEdgeUpdateEnd}
...flow, onNodeDragStart={onNodeDragStart}
data: reactFlowInstance.toObject(), onSelectionDragStart={onSelectionDragStart}
}); onSelectionEnd={onSelectionEnd}
}} onSelectionStart={onSelectionStart}
edges={edges} onEdgesDelete={onEdgesDelete}
onNodesChange={onNodesChangeMod} connectionLineComponent={ConnectionLineComponent}
onEdgesChange={onEdgesChangeMod} onDragOver={onDragOver}
onConnect={onConnect} onDrop={onDrop}
disableKeyboardA11y={true} onNodesDelete={onDelete}
onLoad={setReactFlowInstance} onSelectionChange={onSelectionChange}
onInit={setReactFlowInstance} className="theme-attribution"
nodeTypes={nodeTypes} minZoom={0.01}
onEdgeUpdate={onEdgeUpdate} maxZoom={8}
onEdgeUpdateStart={onEdgeUpdateStart} >
onEdgeUpdateEnd={onEdgeUpdateEnd} <Background className="" />
onNodeDragStart={onNodeDragStart} <Controls
onSelectionDragStart={onSelectionDragStart} className="bg-muted fill-foreground stroke-foreground text-primary
onSelectionEnd={onSelectionEnd}
onSelectionStart={onSelectionStart}
onEdgesDelete={onEdgesDelete}
connectionLineComponent={ConnectionLineComponent}
onDragOver={onDragOver}
onDrop={onDrop}
onNodesDelete={onDelete}
onSelectionChange={onSelectionChange}
className="theme-attribution"
minZoom={0.01}
maxZoom={8}
>
<Background className="" />
<Controls
className="bg-muted fill-foreground stroke-foreground text-primary
[&>button]:border-b-border hover:[&>button]:bg-border" [&>button]:border-b-border hover:[&>button]:bg-border"
></Controls> ></Controls>
</ReactFlow> </ReactFlow>
)} {!view && (
{view && (
<Chat flow={flow} reactFlowInstance={reactFlowInstance} /> <Chat flow={flow} reactFlowInstance={reactFlowInstance} />
)} )}
</div> </div>

View file

@ -29,7 +29,7 @@ export default function FlowPage() {
{flows.length > 0 && {flows.length > 0 &&
tabId !== "" && tabId !== "" &&
flows.findIndex((flow) => flow.id === tabId) !== -1 && ( flows.findIndex((flow) => flow.id === tabId) !== -1 && (
<Page view flow={flows.find((flow) => flow.id === tabId)} /> <Page flow={flows.find((flow) => flow.id === tabId)} />
)} )}
<a <a
target={"_blank"} target={"_blank"}

View file

@ -26,7 +26,7 @@ export default function ViewPage() {
{flows.length > 0 && {flows.length > 0 &&
tabId !== "" && tabId !== "" &&
flows.findIndex((flow) => flow.id === tabId) !== -1 && ( flows.findIndex((flow) => flow.id === tabId) !== -1 && (
<Page flow={flows.find((flow) => flow.id === tabId)} /> <Page view flow={flows.find((flow) => flow.id === tabId)} />
)} )}
</div> </div>
); );