mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
Refactor/front (#313)
* 🚚 move footer component * 🚚 move navbar component * 🚚 move ui components * 🚚 move browser tab icon to public folder * 🚚 move Chat Provider * 🚚 move hooks to lib * 🚚 move helpers to lib * 🚚 move types to lib
This commit is contained in:
parent
4546e8bc1d
commit
f4aa22417f
@ -1,4 +1,4 @@
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
|
||||
import { useGoogleLogin } from "./hooks/useGoogleLogin";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { useToast } from "@/lib/hooks/useToast";
|
||||
import { useState } from "react";
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"use client";
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Card from "@/app/components/ui/Card";
|
||||
import { Divider } from "@/app/components/ui/Divider";
|
||||
import Field from "@/app/components/ui/Field";
|
||||
import PageHeading from "@/app/components/ui/PageHeading";
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import { Divider } from "@/lib/components/ui/Divider";
|
||||
import Field from "@/lib/components/ui/Field";
|
||||
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||
import { useToast } from "@/lib/hooks/useToast";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
|
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Card from "@/app/components/ui/Card";
|
||||
import PageHeading from "@/app/components/ui/PageHeading";
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||
import { useToast } from "@/lib/hooks/useToast";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Card from "@/app/components/ui/Card";
|
||||
import Field from "@/app/components/ui/Field";
|
||||
import PageHeading from "@/app/components/ui/PageHeading";
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import Field from "@/lib/components/ui/Field";
|
||||
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||
import { useToast } from "@/lib/hooks/useToast";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import { FC, ReactNode } from "react";
|
||||
import {
|
||||
GiArtificialIntelligence,
|
||||
@ -7,7 +8,6 @@ import {
|
||||
GiLockedDoor,
|
||||
GiOpenBook,
|
||||
} from "react-icons/gi";
|
||||
import Card from "../components/ui/Card";
|
||||
|
||||
const Features: FC = () => {
|
||||
return (
|
||||
|
@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { motion, useScroll, useSpring, useTransform } from "framer-motion";
|
||||
import Link from "next/link";
|
||||
import { FC, useRef } from "react";
|
||||
import { MdNorthEast } from "react-icons/md";
|
||||
import Button from "../components/ui/Button";
|
||||
|
||||
const Hero: FC = () => {
|
||||
const targetRef = useRef<HTMLDivElement | null>(null);
|
||||
|
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||
import { UUID } from "crypto";
|
||||
import { useEffect } from "react";
|
||||
import PageHeading from "../../components/ui/PageHeading";
|
||||
import useChatsContext from "../ChatsProvider/hooks/useChatsContext";
|
||||
import { ChatInput, ChatMessages } from "../components";
|
||||
|
||||
interface ChatPageProps {
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Link from "next/link";
|
||||
import { MdSettings } from "react-icons/md";
|
||||
import Button from "../../../../components/ui/Button";
|
||||
|
||||
export function ConfigButton() {
|
||||
return (
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { useSpeech } from "@/lib/context/ChatsProvider/hooks/useSpeech";
|
||||
import { MdMic, MdMicOff } from "react-icons/md";
|
||||
import Button from "../../../../components/ui/Button";
|
||||
import { useSpeech } from "../../../ChatsProvider/hooks/useSpeech";
|
||||
|
||||
export function MicButton() {
|
||||
const { isListening, speechSupported, startListening } = useSpeech();
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import useChatsContext from "@/app/chat/ChatsProvider/hooks/useChatsContext";
|
||||
import Button from "../../../../components/ui/Button";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||
import { ConfigButton } from "./ConfigButton";
|
||||
import { MicButton } from "./MicButton";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import Card from "@/app/components/ui/Card";
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||
import { FC, useEffect, useRef } from "react";
|
||||
import useChatsContext from "../../ChatsProvider/hooks/useChatsContext";
|
||||
import ChatMessage from "./ChatMessage";
|
||||
|
||||
export const ChatMessages: FC = () => {
|
||||
|
@ -5,7 +5,7 @@ import { usePathname } from "next/navigation";
|
||||
import { FC } from "react";
|
||||
import { FiTrash2 } from "react-icons/fi";
|
||||
import { MdChatBubbleOutline } from "react-icons/md";
|
||||
import { Chat } from "../../types";
|
||||
import { Chat } from "../../../../lib/types/Chat";
|
||||
|
||||
interface ChatsListItemProps {
|
||||
chat: Chat;
|
||||
|
@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import useChatsContext from "../../ChatsProvider/hooks/useChatsContext";
|
||||
import useChatsContext from "@/lib/context/ChatsProvider/hooks/useChatsContext";
|
||||
import ChatsListItem from "./ChatsListItem";
|
||||
import { NewChatButton } from "./NewChatButton";
|
||||
export function ChatsList() {
|
||||
|
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
import { ChatsProvider } from "@/lib/context/ChatsProvider/chats-provider";
|
||||
import { redirect } from "next/navigation";
|
||||
import { FC, ReactNode } from "react";
|
||||
import { useSupabase } from "../supabase-provider";
|
||||
import { ChatsProvider } from "./ChatsProvider/chats-provider";
|
||||
import { ChatsList } from "./components";
|
||||
|
||||
interface LayoutProps {
|
||||
|
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import Field from "@/lib/components/ui/Field";
|
||||
import { BrainConfig } from "@/lib/context/BrainConfigProvider/types";
|
||||
import { UseFormRegister } from "react-hook-form";
|
||||
import Field from "../../components/ui/Field";
|
||||
|
||||
interface BackendConfigProps {
|
||||
register: UseFormRegister<BrainConfig>;
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { useRouter } from "next/navigation";
|
||||
import Button from "../../components/ui/Button";
|
||||
import { useConfig } from "../hooks/useConfig";
|
||||
import { BackendConfig } from "./BackendConfig";
|
||||
import { ModelConfig } from "./ModelConfig";
|
||||
|
@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import Field from "@/lib/components/ui/Field";
|
||||
import {
|
||||
BrainConfig,
|
||||
Model,
|
||||
@ -8,7 +9,6 @@ import {
|
||||
paidModels,
|
||||
} from "@/lib/context/BrainConfigProvider/types";
|
||||
import { UseFormRegister } from "react-hook-form";
|
||||
import Field from "../../components/ui/Field";
|
||||
|
||||
interface ModelConfigProps {
|
||||
register: UseFormRegister<BrainConfig>;
|
||||
|
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Link from "next/link";
|
||||
import Button from "../../components/ui/Button";
|
||||
|
||||
export const UserAccountSection = (): JSX.Element => {
|
||||
const { session } = useSupabase();
|
||||
|
@ -1,6 +1,9 @@
|
||||
"use client";
|
||||
import Ellipsis from "@/app/components/ui/Ellipsis";
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { AnimatedCard } from "@/lib/components/ui/Card";
|
||||
import Ellipsis from "@/lib/components/ui/Ellipsis";
|
||||
import Modal from "@/lib/components/ui/Modal";
|
||||
import { useToast } from "@/lib/hooks/useToast";
|
||||
import { useAxios } from "@/lib/useAxios";
|
||||
import {
|
||||
@ -10,10 +13,7 @@ import {
|
||||
forwardRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import Button from "../../components/ui/Button";
|
||||
import { AnimatedCard } from "../../components/ui/Card";
|
||||
import Modal from "../../components/ui/Modal";
|
||||
import { Document } from "../types";
|
||||
import { Document } from "../../../lib/types/Document";
|
||||
import DocumentData from "./DocumentData";
|
||||
|
||||
interface DocumentProps {
|
||||
|
@ -1,14 +1,14 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Spinner from "@/lib/components/ui/Spinner";
|
||||
import { Document } from "@/lib/types/Document";
|
||||
import { useAxios } from "@/lib/useAxios";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import Button from "../components/ui/Button";
|
||||
import Spinner from "../components/ui/Spinner";
|
||||
import { useSupabase } from "../supabase-provider";
|
||||
import DocumentItem from "./DocumentItem";
|
||||
import { Document } from "./types";
|
||||
|
||||
export default function ExplorePage() {
|
||||
const [documents, setDocuments] = useState<Document[]>([]);
|
||||
|
@ -1,11 +1,11 @@
|
||||
import Footer from "@/lib/components/Footer";
|
||||
import { NavBar } from "@/lib/components/NavBar";
|
||||
import { ToastProvider } from "@/lib/components/ui/Toast";
|
||||
import { createServerComponentSupabaseClient } from "@supabase/auth-helpers-nextjs";
|
||||
import { Analytics } from "@vercel/analytics/react";
|
||||
import { Inter } from "next/font/google";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import { BrainConfigProvider } from "../lib/context/BrainConfigProvider/brain-config-provider";
|
||||
import Footer from "./components/Footer";
|
||||
import { NavBar } from "./components/NavBar";
|
||||
import { ToastProvider } from "./components/ui/Toast";
|
||||
import "./globals.css";
|
||||
import SupabaseProvider from "./supabase-provider";
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Card from "@/app/components/ui/Card";
|
||||
import Field from "@/app/components/ui/Field";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import Field from "@/lib/components/ui/Field";
|
||||
import { useCrawler } from "./hooks/useCrawler";
|
||||
|
||||
export const Crawler = (): JSX.Element => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Card from "@/lib/components/ui/Card";
|
||||
import { AnimatePresence } from "framer-motion";
|
||||
import Button from "../../../components/ui/Button";
|
||||
import Card from "../../../components/ui/Card";
|
||||
import FileComponent from "./components/FileComponent";
|
||||
import { useFileUploader } from "./hooks/useFileUploader";
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { Divider } from "@/lib/components/ui/Divider";
|
||||
import PageHeading from "@/lib/components/ui/PageHeading";
|
||||
import Link from "next/link";
|
||||
import Button from "../components/ui/Button";
|
||||
import { Divider } from "../components/ui/Divider";
|
||||
import PageHeading from "../components/ui/PageHeading";
|
||||
import { Crawler } from "./components/Crawler";
|
||||
import { FileUploader } from "./components/FileUploader";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { GiBrain } from "react-icons/gi";
|
||||
import { UserStats } from "../types";
|
||||
import { UserStats } from "../../../lib/types/User";
|
||||
|
||||
export const BrainConsumption = (userStats: UserStats): JSX.Element => {
|
||||
const { current_brain_size, max_brain_size } = userStats;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { HTMLAttributes } from "react";
|
||||
import { UserStats } from "../types";
|
||||
import { UserStats } from "../../../lib/types/User";
|
||||
|
||||
interface DateComponentProps extends HTMLAttributes<HTMLSpanElement> {
|
||||
date: UserStats["date"];
|
||||
|
@ -1,10 +1,10 @@
|
||||
"use client";
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import Link from "next/link";
|
||||
import prettyBytes from "pretty-bytes";
|
||||
import { HTMLAttributes } from "react";
|
||||
import { UserStats } from "../types";
|
||||
import { UserStats } from "../../../lib/types/User";
|
||||
import { BrainConsumption } from "./BrainConsumption";
|
||||
import { DateComponent } from "./Date";
|
||||
import BrainSpaceChart from "./Graphs/BrainSpaceChart";
|
||||
|
@ -1,11 +1,11 @@
|
||||
"use client";
|
||||
import Spinner from "@/lib/components/ui/Spinner";
|
||||
import { useAxios } from "@/lib/useAxios";
|
||||
import { redirect } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
import Spinner from "../components/ui/Spinner";
|
||||
import { UserStats } from "../../lib/types/User";
|
||||
import { useSupabase } from "../supabase-provider";
|
||||
import { UserStatistics } from "./components/UserStatistics";
|
||||
import { UserStats } from "./types";
|
||||
|
||||
export default function UserPage() {
|
||||
const [userStats, setUserStats] = useState<UserStats>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Button from "@/app/components/ui/Button";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { FC, useEffect, useLayoutEffect, useState } from "react";
|
||||
import { MdDarkMode, MdLightMode } from "react-icons/md";
|
||||
import Button from "../../../../ui/Button";
|
||||
|
||||
export const DarkModeToggle: FC = () => {
|
||||
const [dark, setDark] = useState(false);
|
@ -1,10 +1,10 @@
|
||||
"use client";
|
||||
import { useSupabase } from "@/app/supabase-provider";
|
||||
import Button from "@/lib/components/ui/Button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import Link from "next/link";
|
||||
import { Dispatch, FC, HTMLAttributes, SetStateAction } from "react";
|
||||
import { MdPerson, MdSettings } from "react-icons/md";
|
||||
import Button from "../../../ui/Button";
|
||||
import { AuthButtons } from "./components/AuthButtons";
|
||||
import { DarkModeToggle } from "./components/DarkModeToggle";
|
||||
import { NavLink } from "./components/NavLink";
|
@ -4,7 +4,7 @@ import { FC } from "react";
|
||||
import { Header } from "./components/Header";
|
||||
import { Logo } from "./components/Logo";
|
||||
import { MobileMenu } from "./components/MobileMenu";
|
||||
import { NavItems } from "./components/NavItems/";
|
||||
import { NavItems } from "./components/NavItems";
|
||||
|
||||
export const NavBar: FC = () => {
|
||||
return (
|
@ -4,7 +4,7 @@ import { useAxios } from "@/lib/useAxios";
|
||||
import { UUID } from "crypto";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Chat, ChatMessage } from "../../types";
|
||||
import { Chat, ChatMessage } from "../../../types/Chat";
|
||||
|
||||
export default function useChats() {
|
||||
const [allChats, setAllChats] = useState<Chat[]>([]);
|
@ -1,5 +1,5 @@
|
||||
import { isSpeechRecognitionSupported } from "@/lib/helpers/isSpeechRecognitionSupported";
|
||||
import { useEffect, useState } from "react";
|
||||
import { isSpeechRecognitionSupported } from "../../helpers/isSpeechRecognitionSupported";
|
||||
import useChatsContext from "./useChatsContext";
|
||||
|
||||
export const useSpeech = () => {
|
@ -1,5 +1,5 @@
|
||||
import { useContext } from "react";
|
||||
import { ToastContext } from "../../app/components/ui/Toast/domain/ToastContext";
|
||||
import { ToastContext } from "../components/ui/Toast/domain/ToastContext";
|
||||
|
||||
export const useToast = () => {
|
||||
const { publish } = useContext(ToastContext);
|
||||
|
0
frontend/lib/types/index.ts
Normal file
0
frontend/lib/types/index.ts
Normal file
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Loading…
Reference in New Issue
Block a user