diff --git a/examples/catalog/components/_shared/Table.tsx b/examples/catalog/components/_shared/Table.tsx index d5ef20c2..deccbf49 100644 --- a/examples/catalog/components/_shared/Table.tsx +++ b/examples/catalog/components/_shared/Table.tsx @@ -6,30 +6,47 @@ interface TableProps { const Table: React.FC = ({ columns, data, className }) => { return ( - - - - {columns.map(({ key, name }) => ( - - ))} - - - - {data.map((item) => ( - - {columns.map(({ key, render }) => ( - - ))} - - ))} - -
- {name} -
- {(render && typeof render === 'function' && render(item)) || - item[key] || - ''} -
+
+
+
+ + + + {columns.map(({ key, name }) => ( + + ))} + + + + {data.map((item) => ( + + {columns.map(({ key, render }) => ( + + ))} + + ))} + +
+ {name} +
+ {(render && + typeof render === 'function' && + render(item)) || + item[key] || + ''} +
+
+
+
); }; diff --git a/examples/catalog/components/dataset/About.tsx b/examples/catalog/components/dataset/About.tsx index 1cf2ee23..ea6910a7 100644 --- a/examples/catalog/components/dataset/About.tsx +++ b/examples/catalog/components/dataset/About.tsx @@ -1,7 +1,7 @@ import { useQuery } from '@apollo/react-hooks'; +import * as timeago from 'timeago.js'; import { ErrorMessage } from '../_shared'; import { GET_DATASET_QUERY } from '../../graphql/queries'; -import { KeyInfo } from 'portal'; const About: React.FC<{ variables: any }> = ({ variables }) => { const { loading, error, data } = useQuery(GET_DATASET_QUERY, { @@ -16,7 +16,68 @@ const About: React.FC<{ variables: any }> = ({ variables }) => { if (loading) return
Loading
; const { result } = data.dataset; - return ; + + const stats = [ + { name: 'Files', stat: result.resources.length }, + { name: 'Size', stat: result.size || 'N/A' }, + { + name: 'Formats', + stat: result.resources.map((item) => item.format).join(', '), + }, + { + name: 'Created', + stat: result.created && timeago.format(result.created), + }, + { + name: 'Updated', + stat: result.updated && timeago.format(result.updated), + }, + { + name: 'Licenses', + stat: result.licenses?.length + ? result.licenses.map((item, index) => ( + + {item.name} + + )) + : 'N/A', + }, + ]; + + return ( + <> +
+

+ {result.title || result.name} +

+

+ {result.description || 'This dataset does not have a description.'} +

+
+
+
+ {stats.map((item) => ( +
+
+ {item.name} +
+
+ {item.stat} +
+
+ ))} +
+
+ + ); }; export default About; diff --git a/examples/catalog/components/dataset/Resources.tsx b/examples/catalog/components/dataset/Resources.tsx index 9a210032..2df8a4ca 100644 --- a/examples/catalog/components/dataset/Resources.tsx +++ b/examples/catalog/components/dataset/Resources.tsx @@ -56,8 +56,12 @@ const Resources: React.FC<{ variables: any }> = ({ variables }) => { const { result } = data.dataset; return ( - <> -

Data Files

+
+
+

+ Data files +

+
({ @@ -65,7 +69,7 @@ const Resources: React.FC<{ variables: any }> = ({ variables }) => { parentName: result.name, }))} /> - + ); }; diff --git a/examples/catalog/pages/[org]/[dataset]/index.tsx b/examples/catalog/pages/[org]/[dataset]/index.tsx index f0cee809..3642e46b 100644 --- a/examples/catalog/pages/[org]/[dataset]/index.tsx +++ b/examples/catalog/pages/[org]/[dataset]/index.tsx @@ -6,6 +6,7 @@ import Nav from '../../../components/home/Nav'; import About from '../../../components/dataset/About'; import Org from '../../../components/dataset/Org'; import Resources from '../../../components/dataset/Resources'; +import Footer from '../../../components/home/Footer'; import { GET_DATASET_QUERY } from '../../../graphql/queries'; const Dataset: React.FC<{ variables: any }> = ({ variables }) => { @@ -21,13 +22,10 @@ const Dataset: React.FC<{ variables: any }> = ({ variables }) => {