perf(e2e): ⚡️ Migrate to Playwright
This commit is contained in:
@ -1,22 +1,30 @@
|
||||
import { Button } from '@chakra-ui/react'
|
||||
import { useDroppable } from '@dnd-kit/core'
|
||||
import { ChevronLeftIcon } from 'assets/icons'
|
||||
import { NextChakraLink } from 'components/nextChakra/NextChakraLink'
|
||||
import React from 'react'
|
||||
import { useTypebotDnd } from 'contexts/TypebotDndContext'
|
||||
import React, { useMemo } from 'react'
|
||||
|
||||
export const BackButton = ({ id }: { id: string | null }) => {
|
||||
const { setNodeRef, isOver } = useDroppable({
|
||||
id: id?.toString() ?? 'root',
|
||||
})
|
||||
const { draggedTypebot, setMouseOverFolderId, mouseOverFolderId } =
|
||||
useTypebotDnd()
|
||||
|
||||
const isTypebotOver = useMemo(
|
||||
() => draggedTypebot && mouseOverFolderId === id,
|
||||
[draggedTypebot, id, mouseOverFolderId]
|
||||
)
|
||||
|
||||
const handleMouseEnter = () => setMouseOverFolderId(id)
|
||||
const handleMouseLeave = () => setMouseOverFolderId(undefined)
|
||||
return (
|
||||
<Button
|
||||
as={NextChakraLink}
|
||||
href={id ? `/typebots/folders/${id}` : '/typebots'}
|
||||
leftIcon={<ChevronLeftIcon />}
|
||||
variant={'outline'}
|
||||
colorScheme={isOver ? 'blue' : 'gray'}
|
||||
borderWidth={isOver ? '3px' : '1px'}
|
||||
ref={setNodeRef}
|
||||
colorScheme={isTypebotOver ? 'blue' : 'gray'}
|
||||
borderWidth={isTypebotOver ? '3px' : '1px'}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
>
|
||||
Back
|
||||
</Button>
|
||||
|
Reference in New Issue
Block a user