From 65b8ca573ceb91e81ae5c688c029c6ab20e5ae8f Mon Sep 17 00:00:00 2001 From: Austen Money Date: Mon, 3 Feb 2025 12:40:35 -0500 Subject: [PATCH 1/3] add empty banner --- .../app/static/js/pages/Template/Template.tsx | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/context/app/static/js/pages/Template/Template.tsx b/context/app/static/js/pages/Template/Template.tsx index 393f9f39e1..1e047371a8 100644 --- a/context/app/static/js/pages/Template/Template.tsx +++ b/context/app/static/js/pages/Template/Template.tsx @@ -25,6 +25,27 @@ import { DEFAULT_JOB_TYPE } from 'js/components/workspaces/constants'; import { useAppContext } from 'js/components/Contexts'; import { buildSearchLink } from 'js/components/search/store'; +interface SampleWorkspacesInfoBannerProps { + hasSampleWorkspaces: boolean; +} +function SampleWorkspacesInfoBanner({ hasSampleWorkspaces }: SampleWorkspacesInfoBannerProps) { + if (!hasSampleWorkspaces) { + return No sample workspaces are currently available for this template.; + } + + return isAuthenticated ? ( + + Sample workspaces are provided to help you get started with this template and to better understand the types of + data that are compatible with it. + + ) : ( + + Sample workspaces are available to help you get started with this template and better understand the types of + compatible data. Please log in to explore a sample workspace. + + ); +} + interface ExampleAccordionProps { example: TemplateExample; templateKey: string; @@ -170,33 +191,20 @@ function Template({ templateKey }: TemplatePageProps) { )} - {template.examples && ( - - Sample Workspaces - {isAuthenticated ? ( - - Sample workspaces are provided to help you get started with this template and to better understand the - types of data that are compatible with it. - - ) : ( - - Sample workspaces are available to help you get started with this template and better understand the types - of compatible data. Please log in to explore a sample - workspace. - - )} - {template.examples.map((example, idx) => ( - - ))} - - )} + + Sample Workspaces + 0} /> + {template.examples?.map((example, idx) => ( + + ))} + ); } From 2128f3d2a643038559eba9e8f909c3f2aa0151c4 Mon Sep 17 00:00:00 2001 From: Austen Money Date: Mon, 3 Feb 2025 12:43:36 -0500 Subject: [PATCH 2/3] add changelog --- CHANGELOG-add-sample-workspace-banner.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 CHANGELOG-add-sample-workspace-banner.md diff --git a/CHANGELOG-add-sample-workspace-banner.md b/CHANGELOG-add-sample-workspace-banner.md new file mode 100644 index 0000000000..caab94e26f --- /dev/null +++ b/CHANGELOG-add-sample-workspace-banner.md @@ -0,0 +1 @@ +- Add an info banner to template pages without sample workspaces. \ No newline at end of file From 132c231b4637ea82f17d5916e138a9cae50a7190 Mon Sep 17 00:00:00 2001 From: Austen Money Date: Mon, 3 Feb 2025 13:37:48 -0500 Subject: [PATCH 3/3] separate out description text --- .../app/static/js/pages/Template/Template.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/context/app/static/js/pages/Template/Template.tsx b/context/app/static/js/pages/Template/Template.tsx index 1e047371a8..4ac227550b 100644 --- a/context/app/static/js/pages/Template/Template.tsx +++ b/context/app/static/js/pages/Template/Template.tsx @@ -25,6 +25,9 @@ import { DEFAULT_JOB_TYPE } from 'js/components/workspaces/constants'; import { useAppContext } from 'js/components/Contexts'; import { buildSearchLink } from 'js/components/search/store'; +const sampleWorkspacesDescription = + 'Sample workspaces are provided to help you get started with this template and to better understand the types of data that are compatible with it.'; + interface SampleWorkspacesInfoBannerProps { hasSampleWorkspaces: boolean; } @@ -33,15 +36,14 @@ function SampleWorkspacesInfoBanner({ hasSampleWorkspaces }: SampleWorkspacesInf return No sample workspaces are currently available for this template.; } - return isAuthenticated ? ( - - Sample workspaces are provided to help you get started with this template and to better understand the types of - data that are compatible with it. - - ) : ( + if (isAuthenticated) { + return {sampleWorkspacesDescription}; + } + + return ( - Sample workspaces are available to help you get started with this template and better understand the types of - compatible data. Please log in to explore a sample workspace. + {sampleWorkspacesDescription} Please log in to explore a sample + workspace. ); }