Skip to content

Commit

Permalink
Landing & footer
Browse files Browse the repository at this point in the history
  • Loading branch information
radityaharya committed May 8, 2024
1 parent e605d02 commit 340dde4
Show file tree
Hide file tree
Showing 17 changed files with 632 additions and 60 deletions.
3 changes: 0 additions & 3 deletions src/app/api/workflow/[id]/delete/route.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Logger } from "@/lib/log";
import { authOptions } from "@/server/auth";
import { db } from "@/server/db";
import { eq } from "drizzle-orm";
import { getServerSession } from "next-auth";
import { type NextRequest, NextResponse } from "next/server";
import { isUUID } from "validator";
import { deleteWorkflowJob } from "~/lib/workflow/utils/workflowQueue";
import { workflowJobs } from "~/server/db/schema";

const log = new Logger("/api/workflow/[id]");

Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import "~/styles/globals.css";
import { Toaster } from "@/components/ui/sonner";
import { getServerSession } from "next-auth";
import { Inter } from "next/font/google";
import Footer from "~/components/main-footer";
import { SiteNav } from "~/components/main-nav";
import NextAuthProvider from "~/providers/NextAuthProvider";
import SWRCacheProvider from "~/providers/SWRCacheProvider";
Expand Down Expand Up @@ -34,6 +35,7 @@ export default async function RootLayout({
<SiteNav session={session} />
{children}
<Toaster expand={true} richColors />
<Footer />
</SWRCacheProvider>
</NextAuthProvider>
</body>
Expand Down
4 changes: 2 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export default async function IndexPage() {
const session = await getServerSession(authOptions);

return (
<div className="relative h-[100dvh]">
<div className="relative h-[70dvh] md:h-[100dvh]">
<PageHeader>
<Announcement />
<PageHeaderHeading>Insert Cheesy Tagline Here</PageHeaderHeading>
<PageHeaderHeading>Flows For Your Playlists!</PageHeaderHeading>
<PageHeaderDescription>
Something something... make playlist
</PageHeaderDescription>
Expand Down
2 changes: 2 additions & 0 deletions src/app/utils/reactFlowToWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export default async function reactFlowToWorkflow({
connections: [],
};

console.log({ nodes, edges });

let [valid, errors] = [true, {}];
if (nodes.length > 0 && edges.length > 0) {
addNodesToWorkflow(nodes, workflowObject);
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/runWorkflow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { toast } from "sonner";
import useStore, { workflowRunStore } from "../states/store";
import { mutate } from "swr";
import useStore, { workflowRunStore } from "../states/store";

export async function runWorkflow(workflow: Workflow.WorkflowResponse) {
if (!workflow.id) {
Expand Down
9 changes: 2 additions & 7 deletions src/app/workflow/Builder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { toast } from "sonner";
import { useRouter } from "next/navigation";
import { LoadingWithText } from "~/components/LoadingSpinner";
import { useWorkflowData } from "~/hooks/useWorkflowData";
import useSWR from "swr";

function Builder({
params,
Expand All @@ -40,7 +39,7 @@ function Builder({
useEffect(() => {
if (session) {
setSessionStore(session);
}
}
}, [session]);

const {
Expand Down Expand Up @@ -179,11 +178,7 @@ function Builder({
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={83}>
{workflowIsLoading || !session?.user ? (
<Loading />
) : (
<Flow />
)}
{workflowIsLoading || !session?.user ? <Loading /> : <Flow />}
</ResizablePanel>
<ResizableHandle withHandle />
<ResizablePanel defaultSize={0} minSize={0} ref={rightPanelRef}>
Expand Down
14 changes: 5 additions & 9 deletions src/app/workflow/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ReactFlow,
getOutgoers,
} from "@xyflow/react";
import { useCallback, useMemo, useRef } from "react";
import { useCallback, useRef } from "react";
import useSWR from "swr";

import useStore from "~/app/states/store";
Expand Down Expand Up @@ -189,6 +189,10 @@ export const Nodes = {
},
};

export const nodeTypes = Object.fromEntries(
Object.entries(Nodes).map(([key, value]) => [key, value.node]),
);

export function App() {
const reactFlowWrapper = useRef(null);
const {
Expand Down Expand Up @@ -226,14 +230,6 @@ export function App() {
const router = useRouter();
const path = usePathname();

const nodeTypes = useMemo(
() =>
Object.fromEntries(
Object.entries(Nodes).map(([key, value]) => [key, value.node]),
),
[],
);

const onDragDrop = useCallback(
(event) => {
event.preventDefault();
Expand Down
19 changes: 9 additions & 10 deletions src/app/workflows/WorkflowGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import {
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import {
Tooltip,
TooltipContent,
Expand All @@ -24,6 +31,7 @@ import {
import Image from "next/image";
import Link from "next/link";
import { useState } from "react";
import { toast } from "sonner";
import useSWR, { mutate } from "swr";
import { Badge } from "~/components/ui/badge";
import { Button, buttonVariants } from "~/components/ui/button";
Expand All @@ -37,15 +45,6 @@ import {
} from "~/components/ui/card";
import { Skeleton } from "~/components/ui/skeleton";
import { runWorkflow } from "../utils/runWorkflow";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { toast } from "sonner";

function getTargets(
operations: Workflow.WorkflowResponse["workflow"]["operations"],
Expand Down Expand Up @@ -315,7 +314,7 @@ const WorkflowCard = ({ d }) => {
const id = d.id;

const handleRunClick = (event: React.MouseEvent) => {
runWorkflow(d.workflow)
runWorkflow(d.workflow);
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/workflows/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { redirect } from "next/navigation";
import { getServerAuthSession } from "~/server/auth";
import { WorkflowsGrid } from "./WorkflowGrid";
import { redirect } from "next/navigation";
export default async function Dashboard() {
const workflows = undefined;

Expand Down
Loading

0 comments on commit 340dde4

Please sign in to comment.