mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-12-01 03:47:55 +08:00
chore: replace popoveer
This commit is contained in:
@@ -2,7 +2,7 @@ import { useChatContext } from '@/components/chat/chat/context';
|
|||||||
import { SpaceList } from '../add-messages-to-page-wrapper/space-list';
|
import { SpaceList } from '../add-messages-to-page-wrapper/space-list';
|
||||||
import { Label } from '@/components/ui/label';
|
import { Label } from '@/components/ui/label';
|
||||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { useViewContentInserter } from '@/components/chat/hooks/use-view-content-inserter';
|
import { useViewContentInserter } from '@/components/chat/hooks/use-view-content-inserter';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { AskAnything } from '@/components/chat/components/ai-writer/tools/ask-an
|
|||||||
import { Explain } from '@/components/chat/components/ai-writer/tools/explain';
|
import { Explain } from '@/components/chat/components/ai-writer/tools/explain';
|
||||||
import { FixSpelling } from '@/components/chat/components/ai-writer/tools/fix-spelling';
|
import { FixSpelling } from '@/components/chat/components/ai-writer/tools/fix-spelling';
|
||||||
import { ImproveWriting } from '@/components/chat/components/ai-writer/tools/improve-writing';
|
import { ImproveWriting } from '@/components/chat/components/ai-writer/tools/improve-writing';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { useTranslation } from '@/components/chat/i18n';
|
import { useTranslation } from '@/components/chat/i18n';
|
||||||
import { AIAssistantType } from '@/components/chat/types';
|
import { AIAssistantType } from '@/components/chat/types';
|
||||||
import { useWriterContext } from '@/components/chat/writer/context';
|
import { useWriterContext } from '@/components/chat/writer/context';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Spaces } from './spaces';
|
|||||||
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
import { useCheckboxTree } from '@/components/chat/hooks/use-checkbox-tree';
|
import { useCheckboxTree } from '@/components/chat/hooks/use-checkbox-tree';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { AiWriterMenuContent } from '../ai-writer/ai-writer-menu-content';
|
import { AiWriterMenuContent } from '../ai-writer/ai-writer-menu-content';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { useTranslation } from '@/components/chat/i18n';
|
import { useTranslation } from '@/components/chat/i18n';
|
||||||
import { AIAssistantType } from '@/components/chat/types';
|
import { AIAssistantType } from '@/components/chat/types';
|
||||||
import { useWriterContext } from '@/components/chat/writer/context';
|
import { useWriterContext } from '@/components/chat/writer/context';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
Popover,
|
Popover,
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from '@/components/chat/components/ui/popover';
|
} from '@/components/ui/popover';
|
||||||
import { useModelSelectorContext } from '@/components/chat/contexts/model-selector-context';
|
import { useModelSelectorContext } from '@/components/chat/contexts/model-selector-context';
|
||||||
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
import { MESSAGE_VARIANTS } from '@/components/chat/lib/animations';
|
||||||
import { ModelCache } from '@/components/chat/lib/model-cache';
|
import { ModelCache } from '@/components/chat/lib/model-cache';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
Popover,
|
Popover,
|
||||||
PopoverContent,
|
PopoverContent,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
} from '@/components/chat/components/ui/popover';
|
} from '@/components/ui/popover';
|
||||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
import { ReactNode, useState } from 'react';
|
import { ReactNode, useState } from 'react';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import LoadingDots from '@/components/chat/components/ui/loading-dots';
|
|||||||
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
import { SearchInput } from '@/components/chat/components/ui/search-input';
|
||||||
import { Spaces } from './spaces';
|
import { Spaces } from './spaces';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { motion } from 'framer-motion';
|
import { motion } from 'framer-motion';
|
||||||
import { ReactComponent as DocIcon } from '@/components/chat/assets/icons/doc.svg';
|
import { ReactComponent as DocIcon } from '@/components/chat/assets/icons/doc.svg';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ReactComponent as RegenerateCircleIcon } from '@/components/chat/assets
|
|||||||
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
import { ReactComponent as TryAgainIcon } from '@/components/chat/assets/icons/undo.svg';
|
||||||
import { FormatGroup } from '@/components/chat/components/ui/format-group';
|
import { FormatGroup } from '@/components/chat/components/ui/format-group';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
||||||
import { useTranslation } from '@/components/chat/i18n';
|
import { useTranslation } from '@/components/chat/i18n';
|
||||||
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
import { useMessagesHandlerContext } from '@/components/chat/provider/messages-handler-provider';
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
||||||
import { forwardRef } from 'react';
|
|
||||||
|
|
||||||
import { cn } from '@/components/chat/lib/utils';
|
|
||||||
|
|
||||||
function Popover({
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
|
|
||||||
return <PopoverPrimitive.Root data-slot='popover' {...props} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
const PopoverTrigger = forwardRef<
|
|
||||||
HTMLButtonElement,
|
|
||||||
React.ComponentProps<typeof PopoverPrimitive.Trigger>
|
|
||||||
>(({ ...props }, ref) => {
|
|
||||||
return (
|
|
||||||
<PopoverPrimitive.Trigger
|
|
||||||
data-slot='popover-trigger'
|
|
||||||
{...props}
|
|
||||||
ref={ref}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
function PopoverContent({
|
|
||||||
className,
|
|
||||||
align = 'center',
|
|
||||||
sideOffset = 4,
|
|
||||||
container,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Content> & {
|
|
||||||
container?: React.ComponentProps<typeof PopoverPrimitive.Portal>['container'];
|
|
||||||
disableOutsidePointerEvents?: boolean;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<PopoverPrimitive.Portal container={container}>
|
|
||||||
<PopoverPrimitive.Content
|
|
||||||
data-slot='popover-content'
|
|
||||||
align={align}
|
|
||||||
sideOffset={sideOffset}
|
|
||||||
className={cn(
|
|
||||||
'z-50 min-w-[240px] rounded-400 bg-background-primary p-0 shadow-popover',
|
|
||||||
|
|
||||||
'origin-(--radix-popover-content-transform-origin)',
|
|
||||||
|
|
||||||
'data-[state=open]:animate-in',
|
|
||||||
'data-[state=closed]:animate-out',
|
|
||||||
|
|
||||||
'data-[state=open]:fade-in-0',
|
|
||||||
'data-[state=closed]:fade-out-0',
|
|
||||||
|
|
||||||
'data-[state=open]:zoom-in-95',
|
|
||||||
'data-[state=closed]:zoom-out-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',
|
|
||||||
|
|
||||||
'focus:outline-none focus-visible:outline-none',
|
|
||||||
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
</PopoverPrimitive.Portal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function PopoverAnchor({
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
|
|
||||||
return <PopoverPrimitive.Anchor data-slot='popover-anchor' {...props} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger };
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { AiWriterMenuContent } from '@/components/chat/components/ai-writer/ai-writer-menu-content';
|
import { AiWriterMenuContent } from '@/components/chat/components/ai-writer/ai-writer-menu-content';
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/chat/components/ui/popover';
|
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||||
import { AIAssistantType } from '@/components/chat/types';
|
import { AIAssistantType } from '@/components/chat/types';
|
||||||
|
|
||||||
interface AIWriterMenuProps {
|
interface AIWriterMenuProps {
|
||||||
|
|||||||
Reference in New Issue
Block a user