From 65be619d51bc3771bd1dec37c7132f8d107cc552 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 17 Mar 2022 16:07:11 +0100 Subject: [PATCH] Showing data nav by default + empty message update --- .../components/DataView/DataView.tsx | 183 ++++++++++-------- .../components/Header/Tabs.tsx | 18 +- .../components/Layout/PageLayout.tsx | 2 +- .../components/SnippetsView/Snippets.tsx | 5 +- 4 files changed, 110 insertions(+), 98 deletions(-) diff --git a/src/dashboardWebView/components/DataView/DataView.tsx b/src/dashboardWebView/components/DataView/DataView.tsx index 02173f25..8551d79c 100644 --- a/src/dashboardWebView/components/DataView/DataView.tsx +++ b/src/dashboardWebView/components/DataView/DataView.tsx @@ -15,7 +15,7 @@ import { arrayMoveImmutable } from 'array-move'; import { EmptyView } from './EmptyView'; import { Container } from './SortableContainer'; import { SortableItem } from './SortableItem'; -import { ChevronRightIcon } from '@heroicons/react/outline'; +import { ChevronRightIcon, DatabaseIcon } from '@heroicons/react/outline'; import { ToastContainer, toast, Slide } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import { DataType } from '../../../models/DataType'; @@ -136,96 +136,109 @@ export const DataView: React.FunctionComponent = (props: React.P
-
+ { + (settings?.dataFiles && settings.dataFiles.length > 0) ? ( +
-
+
-
- -
- { - selectedData ? ( - <> -
-

Your {selectedData.title.toLowerCase()} data items

- -
+
-
-

Create or modify your {selectedData.title.toLowerCase()} data

- { - selectedData ? ( - setSelectedIndex(null)} /> - ) : ( -

Select a data type to get started

- ) - } -
- - ) : ( - - ) - } -
-
+ + + +
+ +
+ { + selectedData ? ( + <> +
+

Your {selectedData.title.toLowerCase()} data items

+ +
+ { + (dataEntries && dataEntries.length > 0) ? ( + <> + + { + (dataEntries || []).map((dataEntry, idx) => ( + setSelectedIndex(index)} + onDeleteItem={deleteItem} + /> + )) + } + + + + ) : ( +
+

No {selectedData.title.toLowerCase()} data entries found

+
+ ) + } +
+
+
+

Create or modify your {selectedData.title.toLowerCase()} data

+ { + selectedData ? ( + setSelectedIndex(null)} /> + ) : ( +

Select a data type to get started

+ ) + } +
+ + ) : ( + + ) + } +
+
+ ) : ( +
+
+ +

No data files found

+

+ Read read more to get started using data files

+
+
+ ) + } diff --git a/src/dashboardWebView/components/Header/Tabs.tsx b/src/dashboardWebView/components/Header/Tabs.tsx index fefe21a0..f26b1a16 100644 --- a/src/dashboardWebView/components/Header/Tabs.tsx +++ b/src/dashboardWebView/components/Header/Tabs.tsx @@ -36,17 +36,13 @@ export const Tabs: React.FunctionComponent = ({ onNavigate }: React. Snippets - { - (settings?.dataFiles && settings.dataFiles.length > 0) && ( -
  • - - Data - -
  • - ) - } +
  • + + Data + +
  • ); }; \ No newline at end of file diff --git a/src/dashboardWebView/components/Layout/PageLayout.tsx b/src/dashboardWebView/components/Layout/PageLayout.tsx index 634bf70e..0efa4599 100644 --- a/src/dashboardWebView/components/Layout/PageLayout.tsx +++ b/src/dashboardWebView/components/Layout/PageLayout.tsx @@ -20,7 +20,7 @@ export const PageLayout: React.FunctionComponent = ({ header, totalPages={totalPages} settings={settings} /> -
    +
    { children }
    diff --git a/src/dashboardWebView/components/SnippetsView/Snippets.tsx b/src/dashboardWebView/components/SnippetsView/Snippets.tsx index 47a34232..2815198c 100644 --- a/src/dashboardWebView/components/SnippetsView/Snippets.tsx +++ b/src/dashboardWebView/components/SnippetsView/Snippets.tsx @@ -9,6 +9,7 @@ import { DashboardMessage } from '../../DashboardMessage'; import { SettingsSelector, ViewDataSelector } from '../../state'; import { PageLayout } from '../Layout/PageLayout'; import { FormDialog } from '../Modals/FormDialog'; +import { SponsorMsg } from '../SponsorMsg'; import { Item } from './Item'; import { NewForm } from './NewForm'; @@ -97,7 +98,7 @@ export const Snippets: React.FunctionComponent = (props: React.P ) : (
    -
    +

    No snippets found

    @@ -127,6 +128,8 @@ export const Snippets: React.FunctionComponent = (props: React.P ) } + + ); }; \ No newline at end of file