-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue: #1861 - Update Quivr font - Add Actions modal - Update Popover component - Move Chat config to Actions modal Demo: https://github.com/StanGirard/quivr/assets/63923024/df3ac138-6950-46fe-8e40-6276005c7ef1
- Loading branch information
1 parent
f28e009
commit a30042f
Showing
19 changed files
with
170 additions
and
177 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...atId]/components/ActionsBar/components/ChatInput/components/ActionsModal/ActionsModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { PopoverAnchor } from "@radix-ui/react-popover"; | ||
import { useState } from "react"; | ||
import { LuPlusCircle, LuXCircle } from "react-icons/lu"; | ||
|
||
import Button from "@/lib/components/ui/Button"; | ||
import { | ||
Popover, | ||
PopoverContent, | ||
PopoverTrigger, | ||
} from "@/lib/components/ui/Popover"; | ||
|
||
import { ConfigModal } from "./components/ConfigModal"; | ||
|
||
export const ActionsModal = (): JSX.Element => { | ||
const [isActionsModalOpened, setIsActionsModalOpened] = useState(false); | ||
|
||
const Icon = isActionsModalOpened ? LuXCircle : LuPlusCircle; | ||
|
||
return ( | ||
<div className="flex items-center"> | ||
<Popover | ||
open={isActionsModalOpened} | ||
onOpenChange={(isOpened) => setIsActionsModalOpened(isOpened)} | ||
> | ||
<PopoverTrigger> | ||
<PopoverAnchor asChild> | ||
<Button variant="tertiary" type="button" className="p-0"> | ||
<Icon className="text-accent font-bold" size={30} /> | ||
</Button> | ||
</PopoverAnchor> | ||
</PopoverTrigger> | ||
<PopoverContent | ||
align="end" | ||
sideOffset={15} | ||
className="min-h-[200px] w-[200px]" | ||
> | ||
<ConfigModal /> | ||
</PopoverContent> | ||
</Popover> | ||
</div> | ||
); | ||
}; |
42 changes: 42 additions & 0 deletions
42
.../components/ActionsBar/components/ChatInput/components/ActionsModal/components/Button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { forwardRef } from "react"; | ||
|
||
import CoreButton, { | ||
ButtonProps as CoreButtonProps, | ||
} from "@/lib/components/ui/Button"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
type ButtonProps = CoreButtonProps & { | ||
onClick?: () => void; | ||
className?: string; | ||
label?: string; | ||
startIcon?: JSX.Element; | ||
endIcon?: JSX.Element; | ||
}; | ||
|
||
export const Button = forwardRef( | ||
( | ||
{ onClick, className, label, startIcon, endIcon, ...props }: ButtonProps, | ||
forwardedRef | ||
): JSX.Element => { | ||
return ( | ||
<CoreButton | ||
className={cn("p-2 sm:px-3 text-primary focus:ring-0 ", className)} | ||
variant={"tertiary"} | ||
data-testid="config-button" | ||
ref={forwardedRef} | ||
onClick={onClick} | ||
{...props} | ||
> | ||
<div className="flex flex-row justify-between w-full items-center"> | ||
<div className="flex flex-row gap-2 items-center"> | ||
{startIcon} | ||
<span className="hidden sm:block">{label}</span> | ||
</div> | ||
{endIcon} | ||
</div> | ||
</CoreButton> | ||
); | ||
} | ||
); | ||
|
||
Button.displayName = CoreButton.displayName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion
1
frontend/app/chat/[chatId]/components/ActionsBar/components/ChatInput/components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from "./ConfigModal"; | ||
export * from "./OnboardingQuestions"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
frontend/app/user/components/LanguageDropDown/LanguageDropDown.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,29 @@ | ||
"use client"; | ||
import * as PopoverPrimitive from "@radix-ui/react-popover"; | ||
import { AnimatePresence, motion } from "framer-motion"; | ||
import { ReactNode, useState } from "react"; | ||
import * as React from "react"; | ||
|
||
import Button from "./Button"; | ||
import { cn } from "@/lib/utils"; | ||
|
||
interface PopoverProps { | ||
children?: ReactNode; | ||
Trigger: ReactNode; | ||
ActionTrigger?: ReactNode; | ||
CloseTrigger?: ReactNode; | ||
} | ||
const Popover = PopoverPrimitive.Root; | ||
|
||
const Popover = ({ | ||
children, | ||
Trigger, | ||
ActionTrigger, | ||
CloseTrigger, | ||
}: PopoverProps): JSX.Element => { | ||
const [open, setOpen] = useState(false); | ||
const PopoverTrigger = PopoverPrimitive.Trigger; | ||
|
||
return ( | ||
<PopoverPrimitive.Root open={open} onOpenChange={setOpen}> | ||
<PopoverPrimitive.Trigger asChild>{Trigger}</PopoverPrimitive.Trigger> | ||
<AnimatePresence> | ||
{open && ( | ||
<PopoverPrimitive.Portal forceMount> | ||
<PopoverPrimitive.Content forceMount asChild sideOffset={5}> | ||
<motion.div | ||
initial={{ opacity: 0, y: -32 }} | ||
animate={{ | ||
opacity: 1, | ||
y: 0, | ||
}} | ||
exit={{ opacity: 0, y: -32 }} | ||
transition={{ duration: 0.2, ease: "easeInOut" }} | ||
className="relative flex flex-col p-4 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-700 rounded-lg shadow-lg z-50 md:z-40" | ||
> | ||
<div className="flex-1">{children}</div> | ||
<div className="mt-4 self-end flex gap-4"> | ||
{ActionTrigger !== undefined && ( | ||
<PopoverPrimitive.Close asChild> | ||
{ActionTrigger} | ||
</PopoverPrimitive.Close> | ||
)} | ||
<PopoverPrimitive.Close asChild> | ||
{CloseTrigger === undefined ? ( | ||
<Button | ||
variant={"secondary"} | ||
className="px-3 py-2" | ||
aria-label="Close" | ||
> | ||
Close | ||
</Button> | ||
) : ( | ||
CloseTrigger | ||
)} | ||
</PopoverPrimitive.Close> | ||
</div> | ||
<PopoverPrimitive.Arrow className="fill-white stroke-gray-300 stroke-2" /> | ||
</motion.div> | ||
</PopoverPrimitive.Content> | ||
</PopoverPrimitive.Portal> | ||
)} | ||
</AnimatePresence> | ||
</PopoverPrimitive.Root> | ||
); | ||
}; | ||
const PopoverContent = React.forwardRef< | ||
React.ElementRef<typeof PopoverPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> | ||
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( | ||
<PopoverPrimitive.Portal> | ||
<PopoverPrimitive.Content | ||
ref={ref} | ||
align={align} | ||
sideOffset={sideOffset} | ||
className={cn( | ||
"z-50 w-72 rounded-md border bg-white p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
</PopoverPrimitive.Portal> | ||
)); | ||
PopoverContent.displayName = PopoverPrimitive.Content.displayName; | ||
|
||
export default Popover; | ||
export { Popover, PopoverContent, PopoverTrigger }; |
Oops, something went wrong.