From f137aea34b358a23c997e39aa732edaaaec4cd6b Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Thu, 20 Jun 2024 18:08:13 -0700 Subject: [PATCH 1/2] Set defaultGroupLinks to true [#870] This causes the group name to be rendered as a link to the group page. This still uses the default tooltip, which is (IMO) wrong for the links on the `/groups` page. --- static-site/src/pages/groups.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/static-site/src/pages/groups.jsx b/static-site/src/pages/groups.jsx index 7b3000a33..e1d454768 100644 --- a/static-site/src/pages/groups.jsx +++ b/static-site/src/pages/groups.jsx @@ -115,6 +115,7 @@ class GroupsPage extends React.Component { From 875c35223201223d97541daee6d20f606f56d3d0 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Thu, 20 Jun 2024 18:09:44 -0700 Subject: [PATCH 2/2] Add `tooltipText` prop to ResourceGroupHeader [#870] * If not provided, defaults to the former hard-coded tooltip value * Includes changes to all `tooltipText` to be provided at to the `ListResources` component, as that's the level that knows what the tooltip for all the card should be As noted in the `FIXME` comment: I'm not wild about the text I came up with for the groups page and would welcome a better phrasing. --- .../src/components/ListResources/ResourceGroup.tsx | 11 +++++++---- static-site/src/components/ListResources/index.tsx | 3 +++ static-site/src/pages/groups.jsx | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/static-site/src/components/ListResources/ResourceGroup.tsx b/static-site/src/components/ListResources/ResourceGroup.tsx index b0a801af4..694deab09 100644 --- a/static-site/src/components/ListResources/ResourceGroup.tsx +++ b/static-site/src/components/ListResources/ResourceGroup.tsx @@ -15,9 +15,11 @@ interface ResourceGroupHeaderProps { isCollapsed: boolean resourcesToShowWhenCollapsed: number quickLinks: QuickLink[] + tooltipText: string } -const ResourceGroupHeader = ({group, isMobile, setCollapsed, collapsible, isCollapsed, resourcesToShowWhenCollapsed, quickLinks}: ResourceGroupHeaderProps) => { +const ResourceGroupHeader = ({group, isMobile, setCollapsed, collapsible, isCollapsed, resourcesToShowWhenCollapsed, quickLinks, tooltipText}: ResourceGroupHeaderProps) => { + if (!tooltipText) tooltipText="Click to load the default (and most recent) analysis"; const setModalResource = useContext(SetModalResourceContext); if (!setModalResource) throw new Error("Context not provided!") @@ -34,7 +36,7 @@ const ResourceGroupHeader = ({group, isMobile, setCollapsed, collapsible, isColl {group.groupUrl ? ( - + {group.groupDisplayName || group.groupName} @@ -118,12 +120,13 @@ interface ResourceGroupProps { numGroups: number sortMethod: string quickLinks: QuickLink[] + tooltipText: string } /** * Displays a single resource group (e.g. a single pathogen) */ -export const ResourceGroup = ({group, elWidth, numGroups, sortMethod, quickLinks}: ResourceGroupProps) => { +export const ResourceGroup = ({group, elWidth, numGroups, sortMethod, quickLinks, tooltipText}: ResourceGroupProps) => { const {collapseThreshold, resourcesToShowWhenCollapsed} = collapseThresolds(numGroups); const collapsible = group.resources.length > collapseThreshold; const [isCollapsed, setCollapsed] = useState(collapsible); // if it is collapsible, start collapsed @@ -140,7 +143,7 @@ export const ResourceGroup = ({group, elWidth, numGroups, sortMethod, quickLinks diff --git a/static-site/src/components/ListResources/index.tsx b/static-site/src/components/ListResources/index.tsx index 10a2765b7..614d3c727 100644 --- a/static-site/src/components/ListResources/index.tsx +++ b/static-site/src/components/ListResources/index.tsx @@ -40,6 +40,7 @@ function ListResources({ groupDisplayNames, showcase, resourceListingCallback: resourceListingCallback, + tooltipText, }: ListResourcesProps) { const {groups, dataFetchError} = useDataFetch( versioned, @@ -105,6 +106,7 @@ function ListResources({ elWidth={elWidth} numGroups={resourceGroups.length} sortMethod={sortMethod} + tooltipText={tooltipText} /> ))} @@ -133,6 +135,7 @@ interface ListResourcesResponsiveProps { groupDisplayNames: Record showcase: FilterCard[] resourceListingCallback: () => Promise; + tooltipText: string } /** diff --git a/static-site/src/pages/groups.jsx b/static-site/src/pages/groups.jsx index e1d454768..14a4fab2a 100644 --- a/static-site/src/pages/groups.jsx +++ b/static-site/src/pages/groups.jsx @@ -117,7 +117,10 @@ class GroupsPage extends React.Component { resourceType="dataset" defaultGroupLinks={true} versioned={false} - resourceListingCallback={resourceListingCallback}/> + resourceListingCallback={resourceListingCallback} + // FIXME I do not love this text string; suggestions welcome + tooltipText="Click to load the group page" + />