Skip to content

Commit 3b42b20

Browse files
authored
update demo form (#47)
* update demo form * add dialog
1 parent 09b03a0 commit 3b42b20

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed

reflex_ui/blocks/demo_form.py

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
2727
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
2828
CAL_REQUEST_DEMO_URL = os.getenv(
29-
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
29+
"CAL_REQUEST_DEMO_URL", "https://cal.com/team/reflex/reflex-intro-call"
3030
)
3131
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
3232
"CAL_ENTERPRISE_FOLLOW_UP_URL",
33-
"https://app.lemcal.com/@alek/reflex-demo?back=1",
33+
"https://cal.com/team/reflex/reflex-intro",
3434
)
3535
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
3636
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@@ -62,6 +62,7 @@ class DemoEvent(PosthogEvent):
6262
company_name: str
6363
num_employees: str
6464
internal_tools: str
65+
technical_level: str
6566
referral_source: str
6667

6768

@@ -266,16 +267,14 @@ async def on_submit(self, form_data: dict[str, Any]):
266267
# Send to PostHog and Slack for all submissions
267268
await self.send_demo_event(form_data)
268269

269-
yield rx.call_script(
270-
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
271-
)
272270
notes_content = f"""
273271
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
274272
Business Email: {form_data.get("email", "")}
275273
Job Title: {form_data.get("job_title", "")}
276274
Company Name: {form_data.get("company_name", "")}
277275
Number of Employees: {form_data.get("number_of_employees", "")}
278276
Internal Tools to Build: {form_data.get("internal_tools", "")}
277+
Technical Level: {form_data.get("technical_level", "")}
279278
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
280279
params = {
281280
"email": form_data.get("email", ""),
@@ -313,6 +312,7 @@ async def send_demo_event(self, form_data: dict[str, Any]):
313312
company_name=form_data.get("company_name", ""),
314313
num_employees=form_data.get("number_of_employees", ""),
315314
internal_tools=form_data.get("internal_tools", ""),
315+
technical_level=form_data.get("technical_level", ""),
316316
referral_source=form_data.get("how_did_you_hear_about_us", ""),
317317
)
318318

@@ -460,7 +460,13 @@ def get_component(cls, **props):
460460
"Other",
461461
],
462462
),
463-
class_name="grid @max-md:grid-cols-1 grid-cols-2 gap-4",
463+
class_name="grid grid-cols-2 gap-4",
464+
),
465+
select_field(
466+
"How technical are you?",
467+
"technical_level",
468+
["Non-technical", "Neutral", "Technical"],
469+
True,
464470
),
465471
rx.cond(
466472
demo_form_error_message.value,
@@ -485,3 +491,39 @@ def get_component(cls, **props):
485491

486492

487493
demo_form = DemoForm.create
494+
495+
496+
def demo_form_dialog(trigger: rx.Component, **props) -> rx.Component:
497+
"""Return a demo form dialog container element.
498+
499+
Args:
500+
trigger: The component that triggers the dialog
501+
**props: Additional properties to pass to the dialog root
502+
503+
Returns:
504+
A Reflex dialog component containing the demo form
505+
"""
506+
class_name = ui.cn("w-auto", props.pop("class_name", ""))
507+
return ui.dialog.root(
508+
ui.dialog.trigger(render_=trigger),
509+
ui.dialog.portal(
510+
ui.dialog.backdrop(),
511+
ui.dialog.popup(
512+
rx.el.div(
513+
ui.dialog.close(
514+
render_=ui.button(
515+
ui.hi("Cancel01Icon"),
516+
variant="ghost",
517+
size="icon-sm",
518+
class_name="text-secondary-11 absolute top-2 right-2 z-10",
519+
),
520+
),
521+
demo_form(class_name="w-full max-w-md"),
522+
class_name="relative isolate overflow-hidden -m-px w-full max-w-md",
523+
),
524+
class_name="h-fit w-auto mt-1 overflow-hidden w-full max-w-md",
525+
),
526+
),
527+
class_name=class_name,
528+
**props,
529+
)

0 commit comments

Comments
 (0)