Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User interface #55

Merged
merged 2 commits into from
Oct 16, 2024
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
62 changes: 41 additions & 21 deletions frontend-app/src/app/_components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,55 @@ import React from "react";

import { Sidebar } from "flowbite-react";
import { HiChartPie, HiViewBoards } from "react-icons/hi";
import { MdOutlineDeveloperMode } from "react-icons/md";
import { FaShoppingBag } from "react-icons/fa";
import { PiPlugsConnectedFill } from "react-icons/pi";
import Link from "next/link";

function SidebarWrapper() {
return (
<Sidebar style={{ height: "100vh" }} aria-label="Default sidebar example">
<Sidebar.Items>
<Sidebar.ItemGroup>
<Link href="create-run">
<Sidebar.Item icon={HiChartPie}>App Builder 👷‍♂️</Sidebar.Item>
</Link>
<Link href="market">
<Sidebar.Item icon={HiChartPie}>AutoMarket 🚀👜</Sidebar.Item>{" "}
</Link>
<Link href="connections">
<Sidebar.Item icon={HiChartPie}>Connections 🔌</Sidebar.Item>{" "}
</Link>
<div className="w-fit px-2 ">
<Sidebar style={{ height: "92vh", boxShadow: "0 0 10px 0 rgba(0, 0, 0, 0.2)" }} aria-label="Default sidebar example" className="rounded-lg shadow-md">
<Sidebar.Items style={{ borderRadius: "10px"}}>
<Sidebar.ItemGroup>
<Link href="create-run">
<Sidebar.Item icon={MdOutlineDeveloperMode} className="hover:text-[#5072A7] hover:shadow-lg">
<div className="flex transform-gpu flex-row items-center justify-between transition-transform duration-300 ease-in-out hover:translate-x-3">
<p>App Builder</p>
{/* <p>👷‍♂️</p> */}
</div>
</Sidebar.Item>
</Link>
<Link href="market">
<Sidebar.Item icon={FaShoppingBag} className="hover:text-[#5072A7] hover:shadow-lg">
<div className="flex transform-gpu flex-row items-center justify-between transition-transform duration-300 ease-in-out hover:translate-x-3">
<p>AutoMarket</p>
{/* <p>👜</p> */}
</div>
</Sidebar.Item>{" "}
</Link>
<Link href="connections">
<Sidebar.Item icon={PiPlugsConnectedFill} className="hover:text-[#5072A7] hover:shadow-lg">
<div className="flex transform-gpu flex-row items-center justify-between transition-transform duration-300 ease-in-out hover:translate-x-3">
<p>Connections</p>
{/* <p>🔌</p> */}
</div>
</Sidebar.Item>{" "}
</Link>

{/* <Sidebar.Item
{/* <Sidebar.Item
href="/run-apps"
icon={HiViewBoards}
// label="Pro"
labelColor="dark"
>
Run Apps 🚀
</Sidebar.Item> */}
</Sidebar.ItemGroup>
<Sidebar.ItemGroup
style={{ position: "absolute", bottom: "10px", left: "20px" }}
>
{/* <Sidebar.Item
</Sidebar.ItemGroup>
<Sidebar.ItemGroup
style={{ position: "absolute", bottom: "10px", left: "20px" }}
>
{/* <Sidebar.Item
href="#"
icon={HiViewBoards}
// label="Pro"
Expand All @@ -42,9 +61,10 @@ function SidebarWrapper() {
>
Save flow as App
</Sidebar.Item> */}
</Sidebar.ItemGroup>
</Sidebar.Items>
</Sidebar>
</Sidebar.ItemGroup>
</Sidebar.Items>
</Sidebar>
</div>
);
}

Expand Down
10 changes: 6 additions & 4 deletions frontend-app/src/app/apps/nodes/TextUpdaterNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ function TextUpdaterNode(props: any) {
position={Position.Top}
isConnectable={isConnectable}
/>
<div className="flex flex-col bg-gray-500">
{props.data.action}{" "}
<div className="flex flex-col bg-gray-200 border p-2 shadow-lg rounded-lg" style={{ borderColor: "#6b7280"}}>
<p className="font-bold ">{props.data.action}{" "}</p>
<div className="shadow-md mt-1 h-1 border-t border-black w-full bg-gray-300 "></div>
{props.data.inputs.map((input: any) => (
<div>
<label style={{ color: "black" }}>{input.name}</label>{" "}
<div className="pt-2">
<p className="font-semibold text-md pb-1">{input.name}</p>{" "}
<input
className="border rounded-lg h-8 bg-gray-200"
key={input.name}
type={input.type}
value={input.value}
Expand Down
158 changes: 86 additions & 72 deletions frontend-app/src/app/apps/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,25 +301,26 @@ function Page() {
/*auth and session */
const { data: sessionData, status } = useSession();
return (
<div className="flex flex-row">
<SidebarWrapper />
<div className=" flex flex-col" style={{ width: "100%" }}>
<div className="w-100 align-items-center flex flex-row justify-center text-center">
<div>
<Image
className="center"
src="/logo.png"
alt="logo"
width={200}
height={200}
/>
<div>
<div className="w-100 flex items-center justify-between shadow-md">
<div>
<Image
className="center pl-3"
src="/logo.png"
alt="logo"
width={180}
height={100}
/>
</div>
<div className="flex items-center gap-3 pr-3">
<div className="p-2 font-semibold">
👋 Hello! {sessionData?.user?.name}
</div>
<div>👋 Hello {sessionData?.user?.name}</div>
{status === "unauthenticated" ? (
<div>
<button
onClick={() => signIn("google", { callbackUrl: "/" })}
className="bg-blue-500 p-2 hover:bg-blue-400"
className="rounded bg-[#5072A7] px-[6px] py-[2px] text-white hover:bg-[#6699CC]"
>
Sign in
</button>
Expand All @@ -328,75 +329,88 @@ function Page() {
<div>
<button
onClick={() => signOut()}
className="bg-blue-500 p-2 hover:bg-blue-400"
className="rounded bg-[#5072A7] px-[6px] py-[2px] text-white hover:bg-[#6699CC]"
>
Sign out
</button>
</div>
)}
</div>
</div>

<div className="canvas-and-runs w-100 flex flex-row">
<div style={{ width: "70%", height: "80vh", background: "#F3F4F6" }}>
<ReactFlow
nodes={nodes}
onNodesChange={onNodesChange}
edges={edges}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
nodeTypes={nodeTypes}
<div className="flex gap-4 pt-5">
<div className="pl-3"><SidebarWrapper /></div>
<div className=" flex flex-col" style={{ width: "100%" }}>
<div className="canvas-and-runs w-100 flex gap-5 pr-3">
<div
style={{
width: "75%",
height: "84vh",
background: "#F3F4F6",
borderRadius: "10px",
}}
>
<Background />
<Controls />
</ReactFlow>
<div className="action-buttons m-5 flex flex-row">
<button
className="mr-5 bg-blue-500 p-2 hover:bg-blue-400"
onClick={() => saveToMarket()}
>
Save to Market
</button>
<button
className="bg-blue-500 p-2 hover:bg-blue-400"
onClick={runFlow}
<ReactFlow
nodes={nodes}
onNodesChange={onNodesChange}
edges={edges}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
nodeTypes={nodeTypes}
>
Run Flow
</button>
</div>
</div>
<div style={{ width: "30%" }}>
<div className="actions-container">
<h1 className="w-100 mb-3 bg-gray-500">Add More Actions</h1>
<div
className="actions"
style={{ height: "370px", overflowY: "scroll" }}
>
{actions.map((action: any) => {
return (
<>
{" "}
<button
className="action mb-2 bg-blue-300 hover:bg-blue-400"
onClick={() => addNode(action)}
>
<p>{action}</p>
</button>
<br></br>
</>
);
})}
<Background />
<Controls />
</ReactFlow>
<div className="action-buttons flex flex-row gap-5 p-5">
<button
className="rounded bg-[#5072A7] px-[6px] py-[2px] text-white hover:bg-[#6699CC]"
onClick={() => saveToMarket()}
>
Save to Market
</button>
<button
className="rounded bg-[#5072A7] px-[6px] py-[2px] text-white hover:bg-[#6699CC]"
onClick={runFlow}
>
Run Flow
</button>
</div>
</div>
<div>
<h1 className=" mt-4 bg-gray-500">Workflow Runs</h1>
<div className=" h-48 overflow-y-scroll">
{runs &&
runs.map((run: any) => (
<div className="pt-2 text-sm">
ID: {run.id} <br />
Status: Success
</div>
))}

<div style={{ width: "25%" }}>
<div className="actions-container shadow-md rounded-lg">
<h1 className="rounded-t-lg w-100 p-2 bg-gray-500 text-white">Add More Actions</h1>
<div
className="actions pl-2"
style={{ height: "400px", overflowY: "scroll" }}
>
{actions.map((action: any) => {
return (
<>
{" "}
<button
className="action w-[98%] mb-1 p-2 hover:text-[#5072A7] text-left"
onClick={() => addNode(action)}
>
<p className="transition-transform duration-300 ease-in-out hover:translate-x-3">{action}</p>
</button>
<div className="border-b-2"></div>
</>
);
})}
</div>
</div>
<div>
<h1 className=" mt-4 bg-gray-500">Workflow Runs</h1>
<div className=" h-48 overflow-y-scroll">
{runs &&
runs.map((run: any) => (
<div className="pt-2 text-sm">
ID: {run.id} <br />
Status: Success
</div>
))}
</div>
</div>
</div>
</div>
Expand Down