Skip to content

Commit 9b7c658

Browse files
CarinaWolliCarinaWolli
andauthored
fix: add variables dropdown UI (calcom#23214)
* Ui fixes for variables dropdown * remove other translation keys * fix test --------- Co-authored-by: CarinaWolli <wollencarina@gmail.com>
1 parent 58930c4 commit 9b7c658

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

apps/web/public/static/locales/en/common.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,9 @@
16021602
"event_duration_info": "The event duration",
16031603
"event_time_info": "The event start time",
16041604
"event_type_not_found": "EventType not Found",
1605+
"location_variable": "Location",
16051606
"location_info": "The location of the event",
1607+
"additional_notes_variable": "Additional notes",
16061608
"additional_notes_info": "The additional notes of booking",
16071609
"attendee_name_info": "The person booking's name",
16081610
"organizer_name_info": "Organizer's name",
@@ -2115,6 +2117,7 @@
21152117
"can_you_try_again": "Can you try again with a different time?",
21162118
"verify": "Verify",
21172119
"timezone_info": "The timezone of the person receiving",
2120+
"timezone_variable": "Timezone",
21182121
"event_end_time_variable": "Event end time",
21192122
"event_end_time_info": "The event end time",
21202123
"cancel_url_variable": "Cancel URL",
@@ -2730,7 +2733,9 @@
27302733
"review": "Review",
27312734
"reviewed": "Reviewed",
27322735
"unreviewed": "Unreviewed",
2736+
"rating_url_variable": "Rating url",
27332737
"rating_url_info": "The URL for Rating Feedback Form",
2738+
"no_show_url_variable": "No Show url",
27342739
"no_show_url_info": "The URL for No Show Feedback",
27352740
"no_support_needed": "No Support Needed?",
27362741
"hide_support": "Hide Support",
@@ -2920,8 +2925,10 @@
29202925
"row": "row",
29212926
"rows": "rows",
29222927
"attendee_timezone_variable": "Attendee Timezone",
2928+
"event_start_time_in_attendee_timezone_variable": "Event Start Time In Attendee Timezone",
29232929
"event_start_time_in_attendee_timezone_info": "Event Start Time In Attendee Timezone",
29242930
"event_end_time_in_attendee_timezone_info": "Event End Time In Attendee Timezone",
2931+
"event_end_time_in_attendee_timezone_variable": "Event End Time In Attendee Timezone",
29252932
"salesforce_create_event_on_contact": "Create event on contact, if it exists. Else fallback to lead",
29262933
"salesforce_owner_name_to_change": "Owner name to change",
29272934
"no_filter_set": "No filter set",

packages/ui/components/editor/plugins/AddVariablesDropdown.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe("AddVariablesDropdown", () => {
3636
render(<AddVariablesDropdown addVariable={mockAddVariable} variables={variables} />);
3737
fireEvent.click(screen.getByText("add_variable"));
3838
await waitFor(() => {
39-
expect(screen.getByText("add_dynamic_variables".toLocaleUpperCase())).toBeInTheDocument();
39+
expect(screen.getByText("add_dynamic_variables")).toBeInTheDocument();
4040
});
4141
});
4242

packages/ui/components/editor/plugins/AddVariablesDropdown.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const AddVariablesDropdown = (props: IAddVariablesDropdown) => {
1616
return (
1717
<Dropdown>
1818
<DropdownMenuTrigger aria-label="Add variable" className="focus:bg-muted pt-[6px]">
19-
<div className="items-center ">
19+
<div className="items-center">
2020
{props.isTextEditor ? (
2121
<>
2222
<div className="hidden sm:flex">
@@ -42,24 +42,26 @@ export const AddVariablesDropdown = (props: IAddVariablesDropdown) => {
4242
)}
4343
</div>
4444
</DropdownMenuTrigger>
45-
<DropdownMenuContent>
46-
<div className="pb-1 pt-4">
47-
<div className="text-subtle mb-2 px-4 text-left text-xs">
48-
{t("add_dynamic_variables").toLocaleUpperCase()}
45+
<DropdownMenuContent className="w-96">
46+
<div className="p-4">
47+
<div className="text-subtle mb-3 text-left text-xs font-medium uppercase tracking-wide">
48+
{t("add_dynamic_variables")}
4949
</div>
50-
<div className="h-64 overflow-scroll md:h-80">
50+
<div className="max-h-64 overflow-y-auto md:max-h-80">
5151
{props.variables.map((variable) => (
5252
<DropdownMenuItem key={variable} className="hover:ring-0">
5353
<button
5454
key={variable}
5555
type="button"
56-
className="w-full px-4 py-2"
56+
className="hover:bg-muted w-full rounded-md px-3 py-2 text-left transition-colors"
5757
onClick={() => props.addVariable(t(`${variable}_variable`))}>
58-
<div className="flex flex-col">
59-
<div className="mr-text-left">
58+
<div className="flex flex-col space-y-1">
59+
<div className="text-default font-mono text-sm">
6060
{`{${t(`${variable}_variable`).toUpperCase().replace(/ /g, "_")}}`}
6161
</div>
62-
<div className="text-default hidden text-left sm:flex">{t(`${variable}_info`)}</div>
62+
<div className="text-muted-foreground hidden text-xs sm:block">
63+
{t(`${variable}_info`)}
64+
</div>
6365
</div>
6466
</button>
6567
</DropdownMenuItem>

0 commit comments

Comments
 (0)