diff --git a/apps/web/app/(auth)/auth-buttons.tsx b/apps/web/app/(auth)/auth-buttons.tsx index 47dc1448..0e99213e 100644 --- a/apps/web/app/(auth)/auth-buttons.tsx +++ b/apps/web/app/(auth)/auth-buttons.tsx @@ -1,6 +1,6 @@ "use client"; -import { Button } from "@repo/ui/src/shadcn/button"; +import { Button } from "@repo/ui/shadcn/button"; import React from "react"; import { signIn } from "../helpers/server/auth"; diff --git a/apps/web/app/(auth)/signin/page.tsx b/apps/web/app/(auth)/signin/page.tsx index 214a582c..2f913a75 100644 --- a/apps/web/app/(auth)/signin/page.tsx +++ b/apps/web/app/(auth)/signin/page.tsx @@ -2,7 +2,7 @@ import Image from "next/image"; import Link from "next/link"; import Logo from "@/public/logo.svg"; import { signIn } from "@/app/helpers/server/auth"; -import { Google } from "@repo/ui/src/components/icons"; +import { Google } from "@repo/ui/components/icons"; export const runtime = "edge"; @@ -34,7 +34,7 @@ async function Signin() { action={async () => { "use server"; await signIn("google", { - redirectTo: "/home", + redirectTo: "/home?firstTime=true", }); }} > diff --git a/apps/web/app/(landing)/EmailInput.tsx b/apps/web/app/(landing)/EmailInput.tsx index 7e7ee5e7..ac1f7fca 100644 --- a/apps/web/app/(landing)/EmailInput.tsx +++ b/apps/web/app/(landing)/EmailInput.tsx @@ -2,7 +2,7 @@ import { FormEvent, useState } from "react"; import formSubmitAction from "./formSubmitAction"; -import { useToast } from "@repo/ui/src/shadcn/use-toast"; +import { useToast } from "@repo/ui/shadcn/use-toast"; function EmailInput() { const [email, setEmail] = useState(""); diff --git a/apps/web/app/(landing)/Features.tsx b/apps/web/app/(landing)/Features.tsx index dd60ce8f..c5737b57 100644 --- a/apps/web/app/(landing)/Features.tsx +++ b/apps/web/app/(landing)/Features.tsx @@ -2,10 +2,10 @@ import { useState, useRef, useEffect } from "react"; import Image from "next/image"; -import { X } from "@repo/ui/src/components/icons"; +import { X } from "@repo/ui/components/icons"; import { features } from "./FeatureContent"; -import { CardClick } from "@repo/ui/src/components/cardClick"; +import { CardClick } from "@repo/ui/components/cardClick"; export default function Features() { const [tab, setTab] = useState(0); diff --git a/apps/web/app/(landing)/Hero.tsx b/apps/web/app/(landing)/Hero.tsx index d571cc26..7568cf3a 100644 --- a/apps/web/app/(landing)/Hero.tsx +++ b/apps/web/app/(landing)/Hero.tsx @@ -1,7 +1,7 @@ "use client"; import React from "react"; import { motion } from "framer-motion"; -import { Twitter } from "@repo/ui/src/components/icons"; +import { Twitter } from "@repo/ui/components/icons"; import EmailInput from "./EmailInput"; import LinkArrow from "./linkArrow"; diff --git a/apps/web/app/(landing)/RotatingIcons.tsx b/apps/web/app/(landing)/RotatingIcons.tsx index fafe9f0b..87546dde 100644 --- a/apps/web/app/(landing)/RotatingIcons.tsx +++ b/apps/web/app/(landing)/RotatingIcons.tsx @@ -7,7 +7,7 @@ import { Notion, Reddit, Twitter, -} from "@repo/ui/src/components/icons"; +} from "@repo/ui/components/icons"; import Image from "next/image"; const icons = [ diff --git a/apps/web/app/(landing)/page.tsx b/apps/web/app/(landing)/page.tsx index e3201912..1275063e 100644 --- a/apps/web/app/(landing)/page.tsx +++ b/apps/web/app/(landing)/page.tsx @@ -2,7 +2,7 @@ import RotatingIcons from "./RotatingIcons"; import Hero from "./Hero"; import Navbar from "./Navbar"; import Cta from "./Cta"; -import { Toaster } from "@repo/ui/src/shadcn/toaster"; +import { Toaster } from "@repo/ui/shadcn/toaster"; import Features from "./Features"; import Footer from "./footer"; import { auth } from "../helpers/server/auth"; diff --git a/apps/web/app/chat/page.tsx b/apps/web/app/chat/page.tsx new file mode 100644 index 00000000..fce4bfd1 --- /dev/null +++ b/apps/web/app/chat/page.tsx @@ -0,0 +1,7 @@ +import React from "react"; + +function Page() { + return
Page
; +} + +export default Page; diff --git a/apps/web/app/helpers/lib/get-theme-button.tsx b/apps/web/app/helpers/lib/get-theme-button.tsx index 41720927..020cc976 100644 --- a/apps/web/app/helpers/lib/get-theme-button.tsx +++ b/apps/web/app/helpers/lib/get-theme-button.tsx @@ -4,7 +4,7 @@ import dynamic from "next/dynamic"; // Don't SSR the toggle since the value on the server will be different than the client export const getThemeToggler = () => - dynamic(() => import("@repo/ui/src/shadcn/theme-toggle"), { + dynamic(() => import("@repo/ui/shadcn/theme-toggle"), { ssr: false, // Make sure to code a placeholder so the UI doesn't jump when the component loads loading: () =>
, diff --git a/apps/web/app/helpers/lib/searchParams.ts b/apps/web/app/helpers/lib/searchParams.ts new file mode 100644 index 00000000..a43a28fe --- /dev/null +++ b/apps/web/app/helpers/lib/searchParams.ts @@ -0,0 +1,10 @@ +import { + createSearchParamsCache, + parseAsInteger, + parseAsString, + parseAsBoolean, +} from "nuqs/server"; + +export const homeSearchParamsCache = createSearchParamsCache({ + firstTime: parseAsBoolean.withDefault(false), +}); diff --git a/apps/web/app/home/actions.ts b/apps/web/app/home/actions.ts new file mode 100644 index 00000000..0bb2d051 --- /dev/null +++ b/apps/web/app/home/actions.ts @@ -0,0 +1,7 @@ +"use server"; + +import { redirect } from "next/navigation"; + +export async function navigate(q: string) { + redirect(`/chat?q=${q}`); +} diff --git a/apps/web/app/home/header.tsx b/apps/web/app/home/header.tsx index 0f84cbe2..bcbe9691 100644 --- a/apps/web/app/home/header.tsx +++ b/apps/web/app/home/header.tsx @@ -2,7 +2,7 @@ import React from "react"; import Image from "next/image"; import Link from "next/link"; import Logo from "../../public/logo.svg"; -import { AddIcon, ChatIcon } from "@repo/ui/src/icons"; +import { AddIcon, ChatIcon } from "@repo/ui/icons"; function Header() { return ( diff --git a/apps/web/app/home/menu.tsx b/apps/web/app/home/menu.tsx index 1ab22543..35a75ef9 100644 --- a/apps/web/app/home/menu.tsx +++ b/apps/web/app/home/menu.tsx @@ -1,7 +1,7 @@ import React from "react"; import Image from "next/image"; import Link from "next/link"; -import { MemoriesIcon, ExploreIcon, HistoryIcon } from "@repo/ui/src/icons"; +import { MemoriesIcon, ExploreIcon, HistoryIcon } from "@repo/ui/icons"; function Menu() { const menuItems = [ diff --git a/apps/web/app/home/page.tsx b/apps/web/app/home/page.tsx index 83416bee..d9025a9d 100644 --- a/apps/web/app/home/page.tsx +++ b/apps/web/app/home/page.tsx @@ -2,8 +2,15 @@ import React from "react"; import Menu from "./menu"; import Header from "./header"; import QueryInput from "./queryinput"; +import { homeSearchParamsCache } from "@/app/helpers/lib/searchParams"; + +function Page({ + searchParams, +}: { + searchParams: Record; +}) { + const { firstTime } = homeSearchParamsCache.parse(searchParams); -function Page() { return (
@@ -12,7 +19,7 @@ function Page() {
{/* all content goes here */} -
+ {/*
hi {firstTime ? 'first time' : ''}
*/}
diff --git a/apps/web/app/home/queryinput.tsx b/apps/web/app/home/queryinput.tsx index 4810ffd2..c394d9c6 100644 --- a/apps/web/app/home/queryinput.tsx +++ b/apps/web/app/home/queryinput.tsx @@ -1,35 +1,83 @@ -import { ArrowRightIcon, MemoriesIcon, SelectIcon } from "@repo/ui/src/icons"; +"use client"; + +import { ArrowRightIcon, MemoriesIcon, SelectIcon } from "@repo/ui/icons"; import Image from "next/image"; import React from "react"; -import Divider from "@repo/ui/src/shadcn/divider"; +import Divider from "@repo/ui/shadcn/divider"; +import { redirect } from "next/navigation"; +import { navigate } from "./actions"; +import { FilterSpaces } from "@repo/ui/components/filterSpaces"; function QueryInput() { + const [q, setQ] = React.useState(""); + + const parseQ = React.useCallback(() => { + const newQ = q.replace(/\n/g, "\\n"); + return newQ; + }, [q]); + + const [selectedSpaces, setSelectedSpaces] = React.useState([]); + return (
{/* input and action button */} -
+
navigate(parseQ())} className="flex gap-4 p-3"> + onKeyDown={(e) => { + if (e.key === "Enter") { + e.preventDefault(); + if (!e.shiftKey) navigate(parseQ()); + } + }} + onChange={(e) => setQ(e.target.value)} + value={q} + /> - -
+ - {/* suggestions */} + {/* selected sources */}
- + */} + +

Nvidia

Open-source

diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index e1956914..37541f04 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,4 +1,5 @@ -import "./globals.css"; +// import "./globals.css"; +import "@repo/tailwind-config/globals.css"; import type { Metadata } from "next"; import { Inter } from "next/font/google"; diff --git a/apps/web/app/ref/page.tsx b/apps/web/app/ref/page.tsx index 667f618c..9ace733a 100644 --- a/apps/web/app/ref/page.tsx +++ b/apps/web/app/ref/page.tsx @@ -1,4 +1,4 @@ -import { Button } from "@repo/ui/src/shadcn/button"; +import { Button } from "@repo/ui/shadcn/button"; import { auth, signIn, signOut } from "../helpers/server/auth"; import { db } from "../helpers/server/db"; import { sql } from "drizzle-orm"; @@ -97,7 +97,9 @@ export default async function Page() { await signOut(); }} > - + ) : ( diff --git a/apps/web/app/upload/file-uploader.tsx b/apps/web/app/upload/file-uploader.tsx deleted file mode 100644 index 2404ce7c..00000000 --- a/apps/web/app/upload/file-uploader.tsx +++ /dev/null @@ -1,315 +0,0 @@ -"use client"; - -import * as React from "react"; -import Image from "next/image"; -import { Cross2Icon, UploadIcon } from "@radix-ui/react-icons"; -import Dropzone, { - type DropzoneProps, - type FileRejection, -} from "react-dropzone"; -import { toast } from "sonner"; - -import { cn, formatBytes } from "@repo/ui/lib/utils"; -import { useControllableState } from "@repo/ui/hooks/use-controllable-state"; -import { Button } from "@repo/ui/src/button"; -import { Progress } from "@repo/ui/src/progress"; -import { ScrollArea } from "@repo/ui/src/scroll-area"; - -interface FileUploaderProps extends React.HTMLAttributes { - /** - * Value of the uploader. - * @type File[] - * @default undefined - * @example value={files} - */ - value?: File[]; - - /** - * Function to be called when the value changes. - * @type React.Dispatch> - * @default undefined - * @example onValueChange={(files) => setFiles(files)} - */ - onValueChange?: React.Dispatch>; - - /** - * Function to be called when files are uploaded. - * @type (files: File[]) => Promise - * @default undefined - * @example onUpload={(files) => uploadFiles(files)} - */ - onUpload?: (files: File[]) => Promise; - - /** - * Progress of the uploaded files. - * @type Record | undefined - * @default undefined - * @example progresses={{ "file1.png": 50 }} - */ - progresses?: Record; - - /** - * Accepted file types for the uploader. - * @type { [key: string]: string[]} - * @default - * ```ts - * { "image/*": [] } - * ``` - * @example accept={["image/png", "image/jpeg"]} - */ - accept?: DropzoneProps["accept"]; - - /** - * Maximum file size for the uploader. - * @type number | undefined - * @default 1024 * 1024 * 2 // 2MB - * @example maxSize={1024 * 1024 * 2} // 2MB - */ - maxSize?: DropzoneProps["maxSize"]; - - /** - * Maximum number of files for the uploader. - * @type number | undefined - * @default 1 - * @example maxFiles={5} - */ - maxFiles?: DropzoneProps["maxFiles"]; - - /** - * Whether the uploader should accept multiple files. - * @type boolean - * @default false - * @example multiple - */ - multiple?: boolean; - - /** - * Whether the uploader is disabled. - * @type boolean - * @default false - * @example disabled - */ - disabled?: boolean; -} - -export function FileUploader(props: FileUploaderProps) { - const { - value: valueProp, - onValueChange, - onUpload, - progresses, - accept = { "image/*": [] }, - maxSize = 1024 * 1024 * 2, - maxFiles = 1, - multiple = false, - disabled = false, - className, - ...dropzoneProps - } = props; - - const [files, setFiles] = useControllableState({ - prop: valueProp, - onChange: onValueChange, - }); - - const onDrop = React.useCallback( - (acceptedFiles: File[], rejectedFiles: FileRejection[]) => { - if (!multiple && maxFiles === 1 && acceptedFiles.length > 1) { - toast.error("Cannot upload more than 1 file at a time"); - return; - } - - if ((files?.length ?? 0) + acceptedFiles.length > maxFiles) { - toast.error(`Cannot upload more than ${maxFiles} files`); - return; - } - - const newFiles = acceptedFiles.map((file) => - Object.assign(file, { - preview: URL.createObjectURL(file), - }), - ); - - const updatedFiles = files ? [...files, ...newFiles] : newFiles; - - setFiles(updatedFiles); - - if (rejectedFiles.length > 0) { - rejectedFiles.forEach(({ file }) => { - toast.error(`File ${file.name} was rejected`); - }); - } - - if ( - onUpload && - updatedFiles.length > 0 && - updatedFiles.length <= maxFiles - ) { - const target = - updatedFiles.length > 0 ? `${updatedFiles.length} files` : `file`; - - toast.promise(onUpload(updatedFiles), { - loading: `Uploading ${target}...`, - success: () => { - setFiles([]); - return `${target} uploaded`; - }, - error: `Failed to upload ${target}`, - }); - } - }, - - [files, maxFiles, multiple, onUpload, setFiles], - ); - - function onRemove(index: number) { - if (!files) return; - const newFiles = files.filter((_, i) => i !== index); - setFiles(newFiles); - onValueChange?.(newFiles); - } - - // Revoke preview url when component unmounts - React.useEffect(() => { - return () => { - if (!files) return; - files.forEach((file) => { - if (isFileWithPreview(file)) { - URL.revokeObjectURL(file.preview); - } - }); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - const isDisabled = disabled || (files?.length ?? 0) >= maxFiles; - - return ( -
- 1 || multiple} - disabled={isDisabled} - > - {({ getRootProps, getInputProps, isDragActive }) => ( -
- - {isDragActive ? ( -
-
-
-

- Drop the files here -

-
- ) : ( -
-
-
-
-

- Drag {`'n'`} drop files here, or click to select files -

-

- You can upload - {maxFiles > 1 - ? ` ${maxFiles === Infinity ? "multiple" : maxFiles} - files (up to ${formatBytes(maxSize)} each)` - : ` a file with ${formatBytes(maxSize)}`} -

-
-
- )} -
- )} -
- {files?.length ? ( - -
- {files?.map((file, index) => ( - onRemove(index)} - progress={progresses?.[file.name]} - /> - ))} -
-
- ) : null} -
- ); -} - -interface FileCardProps { - file: File; - onRemove: () => void; - progress?: number; -} - -function FileCard({ file, progress, onRemove }: FileCardProps) { - return ( -
-
- {isFileWithPreview(file) ? ( - {file.name} - ) : null} -
-
-

- {file.name} -

-

- {formatBytes(file.size)} -

-
- {progress ? : null} -
-
-
- -
-
- ); -} - -function isFileWithPreview(file: File): file is File & { preview: string } { - return "preview" in file && typeof file.preview === "string"; -} diff --git a/apps/web/app/upload/page.tsx b/apps/web/app/upload/page.tsx deleted file mode 100644 index 4899d695..00000000 --- a/apps/web/app/upload/page.tsx +++ /dev/null @@ -1,99 +0,0 @@ -"use client"; - -import * as React from "react"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useForm } from "react-hook-form"; -import { toast } from "sonner"; -import { z } from "zod"; - -import { getErrorMessage } from "../helpers/lib/handle-errors"; -import { Button } from "@repo/ui/src/button"; -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from "@repo/ui/src/form"; -import { FileUploader } from "./file-uploader"; - -import { UploadedFilesCard } from "./uploaded-files-card"; -import { useUploadFile } from "@repo/ui/hooks/use-upload-file"; - -const schema = z.object({ - images: z.array(z.instanceof(File)), -}); - -type Schema = z.infer; - -export default function ReactHookFormDemo() { - const [loading, setLoading] = React.useState(false); - const { uploadFiles, uploadedFiles, isUploading } = useUploadFile( - "imageUploader", - { defaultUploadedFiles: [] }, - ); - const form = useForm({ - resolver: zodResolver(schema), - defaultValues: { - images: [], - }, - }); - - function onSubmit(input: Schema) { - setLoading(true); - - toast.promise(uploadFiles(input.images), { - loading: "Uploading images...", - success: () => { - form.reset(); - setLoading(false); - return "Images uploaded"; - }, - error: (err) => { - setLoading(false); - return getErrorMessage(err); - }, - }); - } - - return ( -
-
- - ( -
- - Images - - - - - - {uploadedFiles.length > 0 ? ( - - ) : null} -
- )} - /> - - - -
- ); -} diff --git a/apps/web/app/upload/uploaded-files-card.tsx b/apps/web/app/upload/uploaded-files-card.tsx deleted file mode 100644 index 869663b5..00000000 --- a/apps/web/app/upload/uploaded-files-card.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import Image from "next/image"; -// import type { UploadedFile } from '@repo/shared-types'; - -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@repo/ui/src/shadcn/card"; -import { ScrollArea, ScrollBar } from "@repo/ui/src/shadcn/scroll-area"; - -interface UploadedFilesCardProps { - uploadedFiles: any[]; -} - -import { ImageIcon } from "@radix-ui/react-icons"; - -import { cn } from "@repo/ui/lib/utils"; - -interface EmptyCardProps extends React.ComponentPropsWithoutRef { - title: string; - description?: string; - action?: React.ReactNode; - icon?: React.ComponentType<{ className?: string }>; - className?: string; -} - -function EmptyCard({ - title, - description, - icon: Icon = ImageIcon, - action, - className, - ...props -}: EmptyCardProps) { - return ( - -
-
-
- {title} - {description ? {description} : null} -
- {action ? action : null} -
- ); -} - -export function UploadedFilesCard({ uploadedFiles }: UploadedFilesCardProps) { - return ( - - - Uploaded files - View the uploaded files here - - - {uploadedFiles.length > 0 ? ( - -
- {uploadedFiles.map((file) => ( -
- {file.name} -
- ))} -
- -
- ) : ( - - )} -
-
- ); -} diff --git a/apps/web/package.json b/apps/web/package.json index adca3031..0bfb4119 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -14,9 +14,13 @@ }, "dependencies": { "@million/lint": "^1.0.0-rc.11", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-popover": "^1.0.7", "@repo/ui": "*", + "cmdk": "^1.0.0", "million": "^3.1.6", "next": "^14.1.1", + "nuqs": "^1.17.4", "react": "^18.2.0", "react-dom": "^18.2.0" }, @@ -32,5 +36,10 @@ "@types/react-dom": "^18.2.19", "eslint": "^8.57.0", "typescript": "^5.3.3" - } + }, + "trustedDependencies": [ + "esbuild", + "workerd", + "xycolors" + ] } diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index ee2fb650..34e0a9b0 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -16,7 +16,8 @@ "next.config.mjs", "**/*.ts", "**/*.tsx", - ".next/types/**/*.ts" + ".next/types/**/*.ts", + "../../packages/ui/" ], "exclude": ["node_modules/"] } diff --git a/package.json b/package.json index d169b935..efd537f2 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "@cloudflare/next-on-pages": "1", "@cloudflare/workers-types": "^4.20240512.0", "@repo/eslint-config": "*", - "@repo/shared-types": "*", "@repo/tailwind-config": "*", "@repo/typescript-config": "*", "@repo/ui": "*", diff --git a/packages/tailwind-config/globals.css b/packages/tailwind-config/globals.css index f00fd7ce..24120e68 100644 --- a/packages/tailwind-config/globals.css +++ b/packages/tailwind-config/globals.css @@ -2,10 +2,14 @@ @tailwind components; @tailwind utilities; -@layer base { +@media (prefers-color-scheme: dark) { :root { - --background: 0 0% 100%; - --foreground: 0 0% 3.9%; + --foreground: rgba(179, 188, 197, 1); + --foreground-menu: rgba(106, 115, 125, 1); + --background: rgba(23, 27, 31, 1); + --secondary: rgba(31, 36, 40, 1); + --primary: rgba(54, 157, 253, 1); + --border: rgba(51, 57, 67, 1); --card: 0 0% 100%; --card-foreground: 0 0% 3.9%; @@ -13,10 +17,8 @@ --popover: 0 0% 100%; --popover-foreground: 0 0% 3.9%; - --primary: 0 0% 9%; --primary-foreground: 0 0% 98%; - --secondary: 0 0% 96.1%; --secondary-foreground: 0 0% 9%; --muted: 0 0% 96.1%; @@ -28,49 +30,37 @@ --destructive: 0 84.2% 60.2%; --destructive-foreground: 0 0% 98%; - --border: 0 0% 89.8%; --input: 0 0% 89.8%; --ring: 0 0% 3.9%; --radius: 0.5rem; } +} - .dark { - --background: 0 0% 3.9%; - --foreground: 0 0% 98%; - - --card: 0 0% 3.9%; - --card-foreground: 0 0% 98%; - - --popover: 0 0% 3.9%; - --popover-foreground: 0 0% 98%; - - --primary: 0 0% 98%; - --primary-foreground: 0 0% 9%; - - --secondary: 0 0% 14.9%; - --secondary-foreground: 0 0% 98%; - - --muted: 0 0% 14.9%; - --muted-foreground: 0 0% 63.9%; - - --accent: 0 0% 14.9%; - --accent-foreground: 0 0% 98%; - - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 0 0% 98%; - - --border: 0 0% 14.9%; - --input: 0 0% 14.9%; - --ring: 0 0% 83.1%; - } +body { + color: var(--foreground); + background: var(--background); + font-size: 14px; } @layer base { - * { - @apply border-border; - } - body { - @apply bg-background text-foreground; + .all-center { + display: flex; + align-items: center; + justify-content: center; } } + +@layer utilities { + .text-balance { + text-wrap: balance; + } +} + +.gradient-background { + background: linear-gradient( + 150deg, + rgba(255, 255, 255, 0.1) 0%, + rgba(255, 255, 255, 0) + ); +} diff --git a/packages/tailwind-config/tailwind.config.ts b/packages/tailwind-config/tailwind.config.ts index 760c51f5..bf36b528 100644 --- a/packages/tailwind-config/tailwind.config.ts +++ b/packages/tailwind-config/tailwind.config.ts @@ -23,11 +23,12 @@ const config = { foreground: "var(--foreground)", "foreground-menu": "var(--foreground-menu)", background: "var(--background)", - secondary: "var(--secondary)", - primary: "var(--primary)", border: "var(--border)", input: "hsl(var(--input))", ring: "hsl(var(--ring))", + primary: "var(--primary)", + secondary: "var(--secondary)", + destructive: { DEFAULT: "hsl(var(--destructive))", foreground: "hsl(var(--destructive-foreground))", diff --git a/packages/ui/src/components/cardClick.tsx b/packages/ui/src/components/cardClick.tsx deleted file mode 100644 index 8543cb4c..00000000 --- a/packages/ui/src/components/cardClick.tsx +++ /dev/null @@ -1,78 +0,0 @@ -"use client"; - -import { cn } from "@repo/ui/lib/utils"; -import { AnimatePresence, motion } from "framer-motion"; -import React from "react"; - -export const CardClick = ({ - tab, - handleClickIndex, - items, -}: { - tab: number; - handleClickIndex: (tab: number) => void; - items: { - title: string; - description: string; - svg: React.ReactNode; - }[]; -}) => { - return ( -
- {items.map((item, idx) => ( -
handleClickIndex(idx)} - > - - {tab === idx && ( - - )} - - -
- ))} -
- ); -}; - -export const Card = ({ - title, - description, - svg, -}: { - title: string; - description: string; - svg: React.ReactNode; -}) => { - return ( -
- {svg} -
-
- {title} -
-
{description}
-
-
- ); -}; diff --git a/packages/ui/src/components/icons.tsx b/packages/ui/src/components/icons.tsx deleted file mode 100644 index d72c8e1f..00000000 --- a/packages/ui/src/components/icons.tsx +++ /dev/null @@ -1,304 +0,0 @@ -import type { SVGProps } from "react"; -export const Github = (props: SVGProps) => ( - - - -); - -export const Twitter = (props: SVGProps) => ( - - - -); - -export const Medium = (props: SVGProps) => ( - - - -); - -export const Reddit = (props: SVGProps) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -); - -export const Notion = (props: SVGProps) => ( - - - - -); - -export const X = (props: SVGProps) => ( - - - -); - -export const Google = (props: SVGProps) => ( - - - - - - -); diff --git a/packages/ui/src/hooks/use-callback-ref.ts b/packages/ui/src/hooks/use-callback-ref.ts deleted file mode 100644 index e3133618..00000000 --- a/packages/ui/src/hooks/use-callback-ref.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @see https://github.com/radix-ui/primitives/blob/main/packages/react/use-callback-ref/src/useCallbackRef.tsx - */ - -import { useEffect, useMemo, useRef } from "react"; - -/** - * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a - * prop or avoid re-executing effects when passed as a dependency - */ -function useCallbackRef unknown>( - callback: T | undefined, -): T { - const callbackRef = useRef(callback); - - useEffect(() => { - callbackRef.current = callback; - }); - - // https://github.com/facebook/react/issues/19240 - return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []); -} - -export { useCallbackRef }; diff --git a/packages/ui/src/hooks/use-controllable-state.ts b/packages/ui/src/hooks/use-controllable-state.ts deleted file mode 100644 index 7cf20f89..00000000 --- a/packages/ui/src/hooks/use-controllable-state.ts +++ /dev/null @@ -1,67 +0,0 @@ -import * as React from "react"; - -import { useCallbackRef } from "@repo/ui/src/hooks/use-callback-ref.js"; - -/** - * @see https://github.com/radix-ui/primitives/blob/main/packages/react/use-controllable-state/src/useControllableState.tsx - */ - -type UseControllableStateParams = { - prop?: T | undefined; - defaultProp?: T | undefined; - onChange?: (state: T) => void; -}; - -type SetStateFn = (prevState?: T) => T; - -function useControllableState({ - prop, - defaultProp, - onChange = () => {}, -}: UseControllableStateParams) { - const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ - defaultProp, - onChange, - }); - const isControlled = prop !== undefined; - const value = isControlled ? prop : uncontrolledProp; - const handleChange = useCallbackRef(onChange); - - const setValue: React.Dispatch> = - React.useCallback( - (nextValue) => { - if (isControlled) { - const setter = nextValue as SetStateFn; - const value = - typeof nextValue === "function" ? setter(prop) : nextValue; - if (value !== prop) handleChange(value as T); - } else { - setUncontrolledProp(nextValue); - } - }, - [isControlled, prop, setUncontrolledProp, handleChange], - ); - - return [value, setValue] as const; -} - -function useUncontrolledState({ - defaultProp, - onChange, -}: Omit, "prop">) { - const uncontrolledState = React.useState(defaultProp); - const [value] = uncontrolledState; - const prevValueRef = React.useRef(value); - const handleChange = useCallbackRef(onChange); - - React.useEffect(() => { - if (prevValueRef.current !== value) { - handleChange(value as T); - prevValueRef.current = value; - } - }, [value, prevValueRef, handleChange]); - - return uncontrolledState; -} - -export { useControllableState }; diff --git a/packages/ui/src/icons/add.svg b/packages/ui/src/icons/add.svg deleted file mode 100644 index 1c6d87f6..00000000 --- a/packages/ui/src/icons/add.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/ui/src/icons/arrowright.svg b/packages/ui/src/icons/arrowright.svg deleted file mode 100644 index d794b094..00000000 --- a/packages/ui/src/icons/arrowright.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/ui/src/icons/chat.svg b/packages/ui/src/icons/chat.svg deleted file mode 100644 index 7fe96c16..00000000 --- a/packages/ui/src/icons/chat.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/ui/src/icons/explore.svg b/packages/ui/src/icons/explore.svg deleted file mode 100644 index d6332612..00000000 --- a/packages/ui/src/icons/explore.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/ui/src/icons/history.svg b/packages/ui/src/icons/history.svg deleted file mode 100644 index 7766c75d..00000000 --- a/packages/ui/src/icons/history.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/ui/src/icons/index.ts b/packages/ui/src/icons/index.ts deleted file mode 100644 index 6c528aba..00000000 --- a/packages/ui/src/icons/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import AddIcon from "./add.svg"; -import ChatIcon from "./chat.svg"; -import HistoryIcon from "./history.svg"; -import ExploreIcon from "./explore.svg"; -import MemoriesIcon from "./memories.svg"; -import ArrowRightIcon from "./arrowRight.svg"; -import SelectIcon from "./select.svg"; - -export { - AddIcon, - ChatIcon, - HistoryIcon, - ExploreIcon, - MemoriesIcon, - ArrowRightIcon, - SelectIcon, -}; diff --git a/packages/ui/src/icons/memories.svg b/packages/ui/src/icons/memories.svg deleted file mode 100644 index 27784aac..00000000 --- a/packages/ui/src/icons/memories.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/packages/ui/src/icons/select.svg b/packages/ui/src/icons/select.svg deleted file mode 100644 index 0b019c01..00000000 --- a/packages/ui/src/icons/select.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/ui/src/shadcn/button.tsx b/packages/ui/src/shadcn/button.tsx deleted file mode 100644 index 90c4fa46..00000000 --- a/packages/ui/src/shadcn/button.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@repo/ui/lib/utils"; -import React from "react"; - -const buttonVariants = cva( - "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", - { - variants: { - variant: { - default: "bg-primary text-primary-foreground hover:bg-primary/90", - destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90", - outline: - "border border-input bg-background hover:bg-accent hover:text-accent-foreground", - secondary: - "bg-secondary text-secondary-foreground hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", - icon: "h-10 w-10", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - -export interface ButtonProps - extends React.ButtonHTMLAttributes, - VariantProps { - asChild?: boolean; -} - -const Button = React.forwardRef( - ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button"; - return ( - - ); - }, -); -Button.displayName = "Button"; - -export { Button, buttonVariants }; diff --git a/packages/ui/src/shadcn/card.tsx b/packages/ui/src/shadcn/card.tsx deleted file mode 100644 index 4e0d9363..00000000 --- a/packages/ui/src/shadcn/card.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as React from "react"; - -import { cn } from "@repo/ui/lib/utils"; - -const Card = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -Card.displayName = "Card"; - -const CardHeader = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -CardHeader.displayName = "CardHeader"; - -const CardTitle = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); -CardTitle.displayName = "CardTitle"; - -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); -CardDescription.displayName = "CardDescription"; - -const CardContent = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); -CardContent.displayName = "CardContent"; - -const CardFooter = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -CardFooter.displayName = "CardFooter"; - -export { - Card, - CardHeader, - CardFooter, - CardTitle, - CardDescription, - CardContent, -}; diff --git a/packages/ui/src/shadcn/divider.tsx b/packages/ui/src/shadcn/divider.tsx deleted file mode 100644 index 34439866..00000000 --- a/packages/ui/src/shadcn/divider.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { cn } from "@repo/ui/lib/utils"; - -function Divider({ className }: { className?: string }) { - return
; -} - -export default Divider; diff --git a/packages/ui/src/shadcn/form.tsx b/packages/ui/src/shadcn/form.tsx deleted file mode 100644 index 452a6e30..00000000 --- a/packages/ui/src/shadcn/form.tsx +++ /dev/null @@ -1,177 +0,0 @@ -import * as React from "react"; -import * as LabelPrimitive from "@radix-ui/react-label"; -import { Slot } from "@radix-ui/react-slot"; -import { - Controller, - ControllerProps, - FieldPath, - FieldValues, - FormProvider, - useFormContext, -} from "react-hook-form"; - -import { cn } from "@repo/ui/lib/utils"; -import { Label } from "@repo/ui/src/shadcn/label"; - -const Form = FormProvider; - -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, -> = { - name: TName; -}; - -const FormFieldContext = React.createContext( - {} as FormFieldContextValue, -); - -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, ->({ - ...props -}: ControllerProps) => { - return ( - - - - ); -}; - -const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext); - const itemContext = React.useContext(FormItemContext); - const { getFieldState, formState } = useFormContext(); - - const fieldState = getFieldState(fieldContext.name, formState); - - if (!fieldContext) { - throw new Error("useFormField should be used within "); - } - - const { id } = itemContext; - - return { - id, - name: fieldContext.name, - formItemId: `${id}-form-item`, - formDescriptionId: `${id}-form-item-description`, - formMessageId: `${id}-form-item-message`, - ...fieldState, - }; -}; - -type FormItemContextValue = { - id: string; -}; - -const FormItemContext = React.createContext( - {} as FormItemContextValue, -); - -const FormItem = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => { - const id = React.useId(); - - return ( - -
- - ); -}); -FormItem.displayName = "FormItem"; - -const FormLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => { - const { error, formItemId } = useFormField(); - - return ( -