Skip to content

Commit 0206b36

Browse files
hariombalharadevin-ai-integration[bot]Udit-takkar
authored
feat: add tooltip to Group Options label in attributes form (calcom#25063)
* feat: add tooltip to Group Options label in attributes form - Add InfoBadge component to Group Options label with descriptive tooltip - Add translation keys 'group_options' and 'group_options_description' to common.json - Update label to use flex layout for proper InfoBadge alignment - Tooltip explains that group options create logical groupings of regular options Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> * fix: wrap AttributeForm tests with TooltipProvider - Add Tooltip.Provider wrapper from @radix-ui/react-tooltip to test renders - Fixes failing tests caused by InfoBadge component requiring tooltip context - All AttributeForm tests now pass locally Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
1 parent 8635319 commit 0206b36

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3249,6 +3249,8 @@
32493249
"lock_attribute_for_assignment": "Lock for assignment",
32503250
"lock_attribute_for_assignment_description": "Locking would only allow assignments from Directory Sync",
32513251
"attribute_edited_successfully": "Attribute edited successfully",
3252+
"group_options": "Group Options",
3253+
"group_options_description": "When a group option is assigned to a user, they behave as if all options within that group are assigned to them.",
32523254
"new_group_option": "New group option",
32533255
"attribute_weight_enabled": "Weights enabled",
32543256
"attribute_weight_enabled_description": "By enabling weights, it would be possible to assign higher priority to certain attributes per user. The higher the weight, the higher the priority.",

packages/features/ee/organizations/pages/settings/attributes/AttributesForm.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { z } from "zod";
66

77
import { Dialog } from "@calcom/features/components/controlled-dialog";
88
import { useLocale } from "@calcom/lib/hooks/useLocale";
9+
import { InfoBadge } from "@calcom/ui/components/badge";
910
import { Button } from "@calcom/ui/components/button";
1011
import { ConfirmationDialogContent } from "@calcom/ui/components/dialog";
1112
import { SettingsToggle, SelectField, Input, InputField, Form, Label } from "@calcom/ui/components/form";
@@ -261,7 +262,10 @@ const GroupOptions = ({
261262
const { t } = useLocale();
262263
return (
263264
<>
264-
<Label>{t("Group Options")}</Label>
265+
<Label className="flex items-center">
266+
{t("group_options")}
267+
<InfoBadge content={t("group_options_description")} />
268+
</Label>
265269
<div>
266270
{fields.map((option, index) => {
267271
const isAGroupOption = option.isGroup;

packages/features/ee/organizations/pages/settings/attributes/__tests__/AttributeForm.test.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { render, screen, waitFor } from "@testing-library/react";
22
import userEvent from "@testing-library/user-event";
3+
import * as Tooltip from "@radix-ui/react-tooltip";
34
import React from "react";
45
import type { Mock } from "vitest";
56
import { vi } from "vitest";
@@ -44,6 +45,10 @@ const AttributeFormActions = {
4445
},
4546

4647
render: (initialOptions: InitialOption[], mockOnSubmit: Mock) => {
48+
const wrapper = ({ children }: { children: React.ReactNode }) => (
49+
<Tooltip.Provider>{children}</Tooltip.Provider>
50+
);
51+
4752
return render(
4853
<AttributeForm
4954
onSubmit={mockOnSubmit}
@@ -53,7 +58,8 @@ const AttributeFormActions = {
5358
options: initialOptions,
5459
}}
5560
header={<Button type="submit">Save</Button>}
56-
/>
61+
/>,
62+
{ wrapper }
5763
);
5864
},
5965

0 commit comments

Comments
 (0)