2
0

🐛 (share) Fix clipboard for updated typebot ID

Closes #215
This commit is contained in:
Baptiste Arnaud
2023-01-06 14:45:09 +01:00
parent 6cc3cbf182
commit fadf34ad61
4 changed files with 9 additions and 5 deletions

View File

@ -9,7 +9,7 @@
"start": "next start",
"lint": "next lint",
"test": "pnpm playwright test",
"test:report": "pnpm playwright show-report"
"test:show-report": "pnpm playwright show-report src/test/reporters"
},
"dependencies": {
"@chakra-ui/anatomy": "^2.1.1",

View File

@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import { ButtonProps, Button, useClipboard } from '@chakra-ui/react'
interface CopyButtonProps extends ButtonProps {
@ -8,7 +8,11 @@ interface CopyButtonProps extends ButtonProps {
export const CopyButton = (props: CopyButtonProps) => {
const { textToCopy, onCopied, ...buttonProps } = props
const { hasCopied, onCopy } = useClipboard(textToCopy)
const { hasCopied, onCopy, setValue } = useClipboard(textToCopy)
useEffect(() => {
setValue(textToCopy)
}, [setValue, textToCopy])
return (
<Button

View File

@ -63,7 +63,7 @@ export const EditableUrl = ({
<HStack>
<EditButton size="xs" />
<CopyButton size="xs" textToCopy={`${hostname}/${pathname ?? ''}`} />
<CopyButton size="xs" textToCopy={`${hostname}/${value ?? ''}`} />
</HStack>
</Editable>
)

View File

@ -22,7 +22,7 @@ if (fs.existsSync(localViewerEnvPath))
export const playwrightBaseConfig: PlaywrightTestConfig = {
globalSetup: require.resolve(path.join(__dirname, 'globalSetup')),
timeout: process.env.CI ? 50 * 1000 : 20 * 1000,
timeout: process.env.CI ? 50 * 1000 : 40 * 1000,
expect: {
timeout: process.env.CI ? 10 * 1000 : 5 * 1000,
},