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

Toasts (Notification Component) #163

Merged
merged 30 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2d89ec0
feature: responsive navbar
adityanandanx May 24, 2023
ded68b7
style: nav links hover animatiosn
adityanandanx May 24, 2023
6e11578
Merge branch 'main' into mad/ui-improvements
adityanandanx May 25, 2023
df116aa
style: better Input Fields
adityanandanx May 25, 2023
6d5188e
refactor: use form submit instead of button onclick
adityanandanx May 25, 2023
264bfd5
feature: loading states
adityanandanx May 25, 2023
6fdb8ef
feature: log out confirmation
adityanandanx May 25, 2023
791aaf0
feature: basic toast
adityanandanx May 25, 2023
3fb0023
feature: Toast variants
adityanandanx May 25, 2023
380e3a5
fix: use global toast provider
adityanandanx May 25, 2023
19c17f6
feature: use toast instead of alert for auth routes
adityanandanx May 25, 2023
67a3726
fix(mobile): nav menu close on route change
adityanandanx May 25, 2023
f171f5e
fix: field dark mode
adityanandanx May 25, 2023
e00a853
feature: redirect when login and logout
adityanandanx May 25, 2023
0d464f0
refactor: group auth routes
adityanandanx May 25, 2023
6c2c34e
refactor: use @/app imports
adityanandanx May 25, 2023
74464be
Merge branch 'main' into mad/ui-improvements
adityanandanx May 25, 2023
27d5d4e
style: use Field on /upload
adityanandanx May 25, 2023
a892bf4
fix: forward ref
adityanandanx May 25, 2023
25c2948
feature: Multi toast
adityanandanx May 25, 2023
9225847
feature: add toasts to /upload
adityanandanx May 26, 2023
859cfab
Merge branch 'main' into mad/ui-improvements
adityanandanx May 26, 2023
1566008
refactor: new login in auth group
adityanandanx May 26, 2023
20f3f2c
chore: quote
adityanandanx May 26, 2023
6ed8337
chore(pnpm): removed
StanGirard May 26, 2023
339ca68
Merge branch 'main' into mad/ui-improvements
adityanandanx May 26, 2023
2a45a31
feature: toasty animations
adityanandanx May 26, 2023
ebbadb8
fix: build errors and warnings
adityanandanx May 26, 2023
fbee42f
chore: remove irrelevant comments
adityanandanx May 26, 2023
3e64c22
fix: use unique ids for toasts
adityanandanx May 26, 2023
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
Next Next commit
feature: responsive navbar
  • Loading branch information
adityanandanx committed May 24, 2023
commit 2d89ec07638f94f2e4a61315af80fe97b6ff4ef7
2 changes: 1 addition & 1 deletion frontend/app/components/NavBar/DarkModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DarkModeToggle: FC<DarkModeToggleProps> = ({}) => {
return (
<Button
aria-label="toggle dark mode"
className="focus:outline-none"
className="focus:outline-none text-3xl"
onClick={() => setDark((d) => !d)}
variant={"tertiary"}
>
Expand Down
60 changes: 60 additions & 0 deletions frontend/app/components/NavBar/MobileMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { FC, ReactNode, useState } from "react";
import * as Dialog from "@radix-ui/react-dialog";
import { MdClose, MdMenu } from "react-icons/md";
import { AnimatePresence, motion } from "framer-motion";
import Button from "../ui/Button";
import NavItems from "./NavItems";

interface MobileMenuProps {}

const MobileMenu: FC<MobileMenuProps> = ({}) => {
const [open, setOpen] = useState(false);
return (
<Dialog.Root onOpenChange={setOpen}>
<Dialog.Trigger asChild>
<button className="block sm:hidden" aria-label="open menu">
<MdMenu className="text-4xl" />
</button>
</Dialog.Trigger>
<AnimatePresence>
{open ? (
<Dialog.Portal forceMount>
<Dialog.Overlay asChild forceMount>
<motion.div
className="fixed inset-0 flex overflow-auto cursor-pointer z-50 shadow-xl dark:shadow-primary/25"
initial={{ opacity: 1, y: "-100%" }}
animate={{ opacity: 1, y: "0%" }}
exit={{ opacity: 1, y: "-100%" }}
transition={{ duration: 0.4, ease: "circOut" }}
>
<Dialog.Content asChild forceMount>
<div className="flex flex-col items-center justify-between py-24 flex-1 w-full bg-white dark:bg-black border border-black/10 dark:border-white/25 p-10 shadow-xl dark:shadow-primary/50 focus:outline-none cursor-auto z-50">
<NavItems className="text-3xl h-fit text-center flex-col items-center justify-center gap-10" />

<p className="">
Get a Second Brain with{" "}
<span className="text-primary dark:bg-white rounded-sm">
Quivr
</span>
</p>

<Dialog.Close asChild>
<button
className="absolute top-0 p-3 right-0 flex items-center justify-center gap-2 appearance-none rounded-full focus:shadow-sm focus:outline-none"
aria-label="close menu"
>
<MdClose className="text-4xl" />
</button>
</Dialog.Close>
</div>
</Dialog.Content>
</motion.div>
</Dialog.Overlay>
</Dialog.Portal>
) : null}
</AnimatePresence>
</Dialog.Root>
);
};

export default MobileMenu;
52 changes: 52 additions & 0 deletions frontend/app/components/NavBar/NavItems.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { cn } from "@/lib/utils";
import Link from "next/link";
import { FC, HTMLAttributes } from "react";
import DarkModeToggle from "./DarkModeToggle";
import Button from "../ui/Button";

interface NavItemsProps extends HTMLAttributes<HTMLUListElement> {}

const NavItems: FC<NavItemsProps> = ({ className, ...props }) => {
return (
// <div className={cn("flex flex-1 items-center", className)} {...props}>
<ul
adityanandanx marked this conversation as resolved.
Show resolved Hide resolved
className={cn(
"flex flex-row items-center gap-4 text-sm flex-1",
className
)}
{...props}
>
{process.env.NEXT_PUBLIC_ENV === "local" ? (
<>
<li>
<Link href={"/upload"}>Upload</Link>
</li>
<li>
<Link href={"/chat"}>Chat</Link>
</li>
<li>
<Link href={"/explore"}>Explore</Link>
</li>
</>
) : (
<>
<li>
<Link href={"https://github.com/StanGirard/quivr"}>Github</Link>
</li>
<li>
<Link href={"https://discord.gg/HUpRgp2HG8"}>Discord</Link>
</li>
</>
)}
<div className="flex sm:flex-1 sm:justify-end flex-col items-center justify-center sm:flex-row gap-5 sm:gap-2">
<Link href={"https://try-quivr.streamlit.app"}>
<Button variant={"secondary"}>Try Demo</Button>
</Link>
<DarkModeToggle />
</div>
</ul>
// </div>
);
};

export default NavItems;
37 changes: 6 additions & 31 deletions frontend/app/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Link from "next/link";
import Button from "../ui/Button";
import DarkModeToggle from "./DarkModeToggle";
import { motion } from "framer-motion";
import MobileMenu from "./MobileMenu";
import NavItems from "./NavItems";

interface NavBarProps {}

Expand Down Expand Up @@ -34,9 +36,9 @@ const NavBar: FC<NavBarProps> = ({}) => {
y: hidden ? "-100%" : "0%",
transition: { ease: "circOut" },
}}
className="fixed top-0 w-full border-b border-b-black/10 dark:border-b-white/25 bg-white dark:bg-black z-50"
className="fixed top-0 w-full border-b border-b-black/10 dark:border-b-white/25 bg-white dark:bg-black z-20"
>
<nav className="max-w-screen-xl mx-auto py-1 flex items-center gap-8">
<nav className="max-w-screen-xl mx-auto py-1 flex items-center justify-between gap-8">
<Link href={"/"} className="flex items-center gap-4">
<Image
className="rounded-full"
Expand All @@ -47,35 +49,8 @@ const NavBar: FC<NavBarProps> = ({}) => {
/>
<h1 className="font-bold">Quivr</h1>
</Link>
{process.env.NEXT_PUBLIC_ENV === "local" ? (
<ul className="flex gap-4 text-sm flex-1">
<li>
<Link href={"/upload"}>Upload</Link>
</li>
<li>
<Link href={"/chat"}>Chat</Link>
</li>
<li>
<Link href={"/explore"}>Explore</Link>
</li>
</ul>
) : (
<ul className="flex gap-4 text-sm flex-1">
<li>
<Link href={"https://github.com/StanGirard/quivr"}>Github</Link>
</li>
<li>
<Link href={"https://discord.gg/HUpRgp2HG8"}>Discord</Link>
</li>
</ul>
)}

<div className="flex">
<Link href={"https://try-quivr.streamlit.app"}>
<Button variant={"secondary"}>Try Demo</Button>
</Link>
<DarkModeToggle />
</div>
<NavItems className="hidden sm:flex" />
<MobileMenu />
</nav>
</motion.header>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/ui/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ButtonVariants = cva(
"bg-black disabled:bg-gray-500 disabled:hover:bg-gray-500 text-white dark:bg-white dark:text-black hover:bg-gray-700 dark:hover:bg-gray-200 transition-colors",
tertiary: "text-black dark:text-white bg-transparent py-2 px-4",
secondary:
"border border-black dark:border-white bg-white dark:bg-black text-black dark:text-white focus:bg-black dark:focus:bg-white hover:bg-black dark:hover:bg-white hover:text-white dark:hover:text-black focus:text-white transition-colors py-2 px-4 shadow-none",
"border border-black dark:border-white bg-white dark:bg-black text-black dark:text-white focus:bg-black dark:focus:bg-white hover:bg-black dark:hover:bg-white hover:text-white dark:hover:text-black focus:text-white dark:focus:text-black transition-colors py-2 px-4 shadow-none",
danger:
"border border-red-500 hover:bg-red-500 hover:text-white transition-colors",
},
Expand Down