From ebf5b29cc7ab22e7d70574b1b2519df924878f85 Mon Sep 17 00:00:00 2001 From: codetorso Date: Thu, 18 Jul 2024 23:14:48 +0530 Subject: [PATCH] improved textarea layout + home page imrpovemnts --- apps/web/app/(dash)/chat/chatWindow.tsx | 2 +- apps/web/app/(dash)/chat/queryinput.tsx | 83 +++++++++++++++ apps/web/app/(dash)/home/filterSpaces.tsx | 110 ++++++++++++-------- apps/web/app/(dash)/home/heading.tsx | 62 ++++------- apps/web/app/(dash)/home/headingVariants.ts | 50 --------- apps/web/app/(dash)/home/queryinput.tsx | 45 ++------ packages/ui/icons/arrowright.svg | 4 +- packages/ui/shadcn/command.tsx | 2 +- packages/ui/shadcn/divider.tsx | 7 -- 9 files changed, 185 insertions(+), 180 deletions(-) create mode 100644 apps/web/app/(dash)/chat/queryinput.tsx delete mode 100644 apps/web/app/(dash)/home/headingVariants.ts delete mode 100644 packages/ui/shadcn/divider.tsx diff --git a/apps/web/app/(dash)/chat/chatWindow.tsx b/apps/web/app/(dash)/chat/chatWindow.tsx index 3bc9fec6..066e7d20 100644 --- a/apps/web/app/(dash)/chat/chatWindow.tsx +++ b/apps/web/app/(dash)/chat/chatWindow.tsx @@ -2,7 +2,7 @@ import { AnimatePresence } from "framer-motion"; import React, { useEffect, useRef, useState } from "react"; -import QueryInput from "../home/queryinput"; +import QueryInput from "./queryinput"; import { cn } from "@repo/ui/lib/utils"; import { motion } from "framer-motion"; import { useRouter } from "next/navigation"; diff --git a/apps/web/app/(dash)/chat/queryinput.tsx b/apps/web/app/(dash)/chat/queryinput.tsx new file mode 100644 index 00000000..99f55986 --- /dev/null +++ b/apps/web/app/(dash)/chat/queryinput.tsx @@ -0,0 +1,83 @@ +"use client"; + +import { ArrowRightIcon } from "@repo/ui/icons"; +import Image from "next/image"; +import React, { useState } from "react"; + +function QueryInput({ + initialSpaces, + initialQuery = "", + disabled = false, + className, + mini = false, + handleSubmit, +}: { + initialQuery?: string; + initialSpaces?: { + id: number; + name: string; + }[]; + disabled?: boolean; + className?: string; + mini?: boolean; + handleSubmit: (q: string, spaces: { id: number; name: string }[]) => void; +}) { + const [q, setQ] = useState(initialQuery); + + const [selectedSpaces, setSelectedSpaces] = useState< + { id: number; name: string }[] + >([]); + + return ( +
+
+ {/* input and action button */} +
{ + if (q.trim().length === 0) { + return; + } + handleSubmit(q, selectedSpaces); + setQ(""); + }} + className="flex gap-4 p-3" + > +