From 7cc39cdc3eb8c553fd5e0fbe62a24751eef510e6 Mon Sep 17 00:00:00 2001 From: Jacob Shandling <61553566+jacobshandling@users.noreply.github.com> Date: Thu, 16 May 2024 12:52:39 -0700 Subject: [PATCH] =?UTF-8?q?UI=20=E2=80=93=20Only=20render=20SW=20version?= =?UTF-8?q?=20tooltip=20for=20>=201=20version=20(#19003)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Addresses #18852 ![Screenshot-2024-05-14-at-41502PM](https://github.com/fleetdm/fleet/assets/61553566/04e2ae9c-613e-49ba-95df-e2915e1427df) - [x] Changes file added for user-visible changes in `changes/` - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling --- changes/18852-sw-versions-tooltips-bug | 1 + .../components/forms/fields/SearchField/SearchField.tsx | 3 --- .../SoftwarePage/components/VersionCell/VersionCell.tsx | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 changes/18852-sw-versions-tooltips-bug diff --git a/changes/18852-sw-versions-tooltips-bug b/changes/18852-sw-versions-tooltips-bug new file mode 100644 index 0000000000..798bbc7c4d --- /dev/null +++ b/changes/18852-sw-versions-tooltips-bug @@ -0,0 +1 @@ +- Fix a bug where a singular software version in the Software table generated a tooltip unnecessarily. diff --git a/frontend/components/forms/fields/SearchField/SearchField.tsx b/frontend/components/forms/fields/SearchField/SearchField.tsx index ed8a1240f1..d487d89324 100644 --- a/frontend/components/forms/fields/SearchField/SearchField.tsx +++ b/frontend/components/forms/fields/SearchField/SearchField.tsx @@ -4,8 +4,6 @@ import { IconNames } from "components/icons"; // @ts-ignore import InputFieldWithIcon from "../InputFieldWithIcon"; -const baseClass = "search-field"; - export interface ISearchFieldProps { placeholder: string; defaultValue?: string; @@ -37,7 +35,6 @@ const SearchField = ({ name={icon} placeholder={placeholder} value={searchQueryInput} - // inputWrapperClass={`${baseClass}__input-wrapper`} onChange={onInputChange} onClick={onClick} iconPosition="start" diff --git a/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx b/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx index a8d563a700..6f27c43791 100644 --- a/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx +++ b/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx @@ -44,14 +44,14 @@ interface IVersionCellProps { } const VersionCell = ({ versions }: IVersionCellProps) => { - const tooltipId = uniqueId(); - // only one version, no need for tooltip const cellText = generateText(versions); - if (!versions) { + if (!versions || versions.length <= 1) { return <>{cellText}; } + const tooltipId = uniqueId(); + const versionTooltip = generateTooltip(versions, tooltipId); return ( <>