-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡ (imageBubble) Add redirect on image click option
Closes #448
- Loading branch information
1 parent
ee14228
commit e06f818
Showing
7 changed files
with
121 additions
and
26 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
apps/builder/src/features/blocks/bubbles/image/components/ImageBubbleSettings.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,80 @@ | ||
import { ImageUploadContent } from '@/components/ImageUploadContent' | ||
import { TextInput } from '@/components/inputs' | ||
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel' | ||
import { Stack } from '@chakra-ui/react' | ||
import { isDefined, isNotEmpty } from '@typebot.io/lib' | ||
import { ImageBubbleBlock } from '@typebot.io/schemas' | ||
import React, { useState } from 'react' | ||
|
||
type Props = { | ||
typebotId: string | ||
block: ImageBubbleBlock | ||
onContentChange: (content: ImageBubbleBlock['content']) => void | ||
} | ||
|
||
export const ImageBubbleSettings = ({ | ||
typebotId, | ||
block, | ||
onContentChange, | ||
}: Props) => { | ||
const [showClickLinkInput, setShowClickLinkInput] = useState( | ||
isNotEmpty(block.content.clickLink?.url) | ||
) | ||
|
||
const updateImage = (url: string) => { | ||
onContentChange({ ...block.content, url }) | ||
} | ||
|
||
const updateClickLinkUrl = (url: string) => { | ||
onContentChange({ | ||
...block.content, | ||
clickLink: { ...block.content.clickLink, url }, | ||
}) | ||
} | ||
|
||
const updateClickLinkAltText = (alt: string) => { | ||
onContentChange({ | ||
...block.content, | ||
clickLink: { ...block.content.clickLink, alt }, | ||
}) | ||
} | ||
|
||
const toggleClickLink = () => { | ||
if (isDefined(block.content.clickLink) && showClickLinkInput) { | ||
onContentChange({ ...block.content, clickLink: undefined }) | ||
} | ||
setShowClickLinkInput(!showClickLinkInput) | ||
} | ||
|
||
return ( | ||
<Stack p="2" spacing={4}> | ||
<ImageUploadContent | ||
filePath={`typebots/${typebotId}/blocks/${block.id}`} | ||
defaultUrl={block.content?.url} | ||
onSubmit={updateImage} | ||
/> | ||
<Stack> | ||
<SwitchWithLabel | ||
label={'On click link'} | ||
initialValue={showClickLinkInput} | ||
onCheckChange={toggleClickLink} | ||
/> | ||
{showClickLinkInput && ( | ||
<> | ||
<TextInput | ||
autoFocus | ||
placeholder="https://example.com" | ||
onChange={updateClickLinkUrl} | ||
defaultValue={block.content.clickLink?.url} | ||
/> | ||
<TextInput | ||
placeholder="Link alt text (description)" | ||
onChange={updateClickLinkAltText} | ||
defaultValue={block.content.clickLink?.alt} | ||
/> | ||
</> | ||
)} | ||
</Stack> | ||
</Stack> | ||
) | ||
} |
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
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
e06f818
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:
landing-page-v2 – ./apps/landing-page
landing-page-v2-typebot-io.vercel.app
www.typebot.io
typebot.io
landing-page-v2-git-main-typebot-io.vercel.app
www.get-typebot.com
get-typebot.com
e06f818
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:
docs – ./apps/docs
docs.typebot.io
docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app
e06f818
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
e06f818
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
goldorayo.com
rabbit.cr8.ai
signup.cr8.ai
start.taxt.co
turkey.cr8.ai
vhpage.cr8.ai
vitamyway.com
am.nigerias.io
an.nigerias.io
app.yvon.earth
ar.nigerias.io
bot.enreso.org
bot.rslabs.pro
bots.bridge.ai
chat.hayuri.id
chatgpt.lam.ee
chicken.cr8.ai
gollum.riku.ai
gsbulletin.com
journey.cr8.ai
panther.cr7.ai
panther.cr8.ai
pay.sifuim.com
penguin.cr8.ai
talk.gocare.io
test.bot.gives
ticketfute.com
unicorn.cr8.ai
apo.nigerias.io
apr.nigerias.io
aso.nigerias.io
blackcan.cr8.ai
bot.ageenda.com
bot.artiweb.app
bot.devitus.com
bot.jesopizz.it
bot.reeplai.com
bot.scayver.com
bot.tc-mail.com
chat.lalmon.com
chat.sureb4.com
eventhub.com.au
fitness.riku.ai
games.klujo.com
sakuranembro.it
typebot.aloe.do
bot.contakit.com
bot.piccinato.co
bot.sv-energy.it
botc.ceox.com.br
clo.closeer.work
cockroach.cr8.ai
faqs.nigerias.io
form.syncwin.com
haymanevents.com
kw.wpwakanda.com
myrentalhost.com
stan.vselise.com
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.bouclidom.com
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
chat.gaswadern.de
chat.rojie.online
fmm.wpwakanda.com
footballmeetup.ie
gentleman-shop.fr
k1.kandabrand.com
kp.pedroknoll.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
support.triplo.ai
viewer.typebot.io
welcome.triplo.ai
1988.bouclidom.com
andreimayer.com.br
bot.danyservice.it
bot.iconicbrows.it
bot.lucide.contact
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
chat.tuanpakya.com
newsletter.itshcormeos.com
rsvp.virtuesocialmedia.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com