-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(editor): ✨ Restore published version button
Had to migrate webhooks into a standalone table
- Loading branch information
1 parent
0df719d
commit e17a1a0
Showing
46 changed files
with
578 additions
and
348 deletions.
There are no files selected for viewing
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
7 changes: 6 additions & 1 deletion
7
...uilder/components/shared/Graph/Nodes/StepNode/StepNodeContent/contents/WebhookContent.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
12 changes: 8 additions & 4 deletions
12
...builder/components/shared/Graph/Nodes/StepNode/StepNodeContent/contents/ZapierContent.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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import { Text } from '@chakra-ui/react' | ||
import { useTypebot } from 'contexts/TypebotContext' | ||
import { ZapierStep } from 'models' | ||
import { isNotDefined } from 'utils' | ||
import { byId, isNotDefined } from 'utils' | ||
|
||
type Props = { | ||
step: ZapierStep | ||
} | ||
|
||
export const ZapierContent = ({ step }: Props) => { | ||
if (isNotDefined(step.webhook.body)) | ||
export const ZapierContent = ({ step: { webhookId } }: Props) => { | ||
const { webhooks } = useTypebot() | ||
const webhook = webhooks.find(byId(webhookId)) | ||
|
||
if (isNotDefined(webhook?.body)) | ||
return <Text color="gray.500">Configure...</Text> | ||
return ( | ||
<Text isTruncated pr="6"> | ||
{step.webhook.url ? 'Enabled' : 'Disabled'} | ||
{webhook?.url ? 'Enabled' : 'Disabled'} | ||
</Text> | ||
) | ||
} |
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,18 +1,75 @@ | ||
import { Button } from '@chakra-ui/react' | ||
import { | ||
Button, | ||
HStack, | ||
IconButton, | ||
Stack, | ||
Tooltip, | ||
Text, | ||
Menu, | ||
MenuButton, | ||
MenuList, | ||
MenuItem, | ||
} from '@chakra-ui/react' | ||
import { ChevronLeftIcon } from 'assets/icons' | ||
import { useTypebot } from 'contexts/TypebotContext/TypebotContext' | ||
import { timeSince } from 'services/utils' | ||
import { isNotDefined } from 'utils' | ||
|
||
export const PublishButton = () => { | ||
const { isPublishing, isPublished, publishTypebot } = useTypebot() | ||
const { | ||
isPublishing, | ||
isPublished, | ||
publishTypebot, | ||
publishedTypebot, | ||
restorePublishedTypebot, | ||
} = useTypebot() | ||
|
||
return ( | ||
<Button | ||
ml={2} | ||
colorScheme="blue" | ||
isLoading={isPublishing} | ||
isDisabled={isPublished} | ||
onClick={publishTypebot} | ||
> | ||
{isPublished ? 'Published' : 'Publish'} | ||
</Button> | ||
<HStack spacing="1px"> | ||
<Tooltip | ||
borderRadius="md" | ||
hasArrow | ||
placement="bottom-end" | ||
label={ | ||
<Stack> | ||
<Text>There are non published changes.</Text> | ||
<Text fontStyle="italic"> | ||
Published version from{' '} | ||
{publishedTypebot && | ||
timeSince(publishedTypebot.updatedAt.toString())}{' '} | ||
ago | ||
</Text> | ||
</Stack> | ||
} | ||
isDisabled={isNotDefined(publishedTypebot)} | ||
> | ||
<Button | ||
colorScheme="blue" | ||
isLoading={isPublishing} | ||
isDisabled={isPublished} | ||
onClick={publishTypebot} | ||
borderRightRadius={publishedTypebot && !isPublished ? 0 : undefined} | ||
> | ||
{isPublished ? 'Published' : 'Publish'} | ||
</Button> | ||
</Tooltip> | ||
|
||
{publishedTypebot && !isPublished && ( | ||
<Menu> | ||
<MenuButton | ||
as={IconButton} | ||
colorScheme="blue" | ||
borderLeftRadius={0} | ||
icon={<ChevronLeftIcon transform="rotate(-90deg)" />} | ||
aria-label="Show published version" | ||
/> | ||
<MenuList> | ||
<MenuItem onClick={restorePublishedTypebot}> | ||
Restore published version | ||
</MenuItem> | ||
</MenuList> | ||
</Menu> | ||
)} | ||
</HStack> | ||
) | ||
} |
Oops, something went wrong.
e17a1a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
viewer-v2 – ./apps/viewer
zap.fundviser.in
bot.matthesv.de
demo.wemakebots.xyz
chat.hayuri.id
bot.outstandbrand.com
chat.matthesv.de
app.yvon.earth
viewer.typebot.io
92109660.therpm.club
88584434.therpm.club
criar.somaperuzzo.com
link.venturasuceder.com
chat.thehomebuyersusa.com
typebot-viewer.vercel.app
bot.pratikmandalia.com
bot.adventureconsulting.hu
bot.pinpointinteractive.com
chat.atlasoutfittersk9.com
viewer-v2-typebot-io.vercel.app
tarian.theiofoundation.org
viewer-v2-git-main-typebot-io.vercel.app
e17a1a0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
builder-v2 – ./apps/builder
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app