From 3c5aab26b4a7e380223e9c2426c1f3ea70fabf35 Mon Sep 17 00:00:00 2001 From: Cody O'Donnell Date: Mon, 25 Mar 2024 19:55:18 -0700 Subject: [PATCH 01/10] Move context tabs into detail header and filters into main container --- src/features/collections/CollectionDetail.tsx | 55 ++++++++++++------- .../collections/CollectionOverview.tsx | 9 +++ .../collections/Collections.module.scss | 17 +++++- .../data_products/GenomeAttribs.tsx | 6 +- 4 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/features/collections/CollectionDetail.tsx b/src/features/collections/CollectionDetail.tsx index 3284da3e..b96f6997 100644 --- a/src/features/collections/CollectionDetail.tsx +++ b/src/features/collections/CollectionDetail.tsx @@ -11,7 +11,7 @@ import { Button, Input } from '../../common/components'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faArrowRightArrowLeft, - faFilter, + faSliders, faAngleRight, faX, faCircleXmark, @@ -130,6 +130,7 @@ export const CollectionDetail = () => { const { filterPanelOpen } = useFilters(collection?.id); const filterMenuRef = useRef(null); + const { filterEntries } = useFilterEntries(collection?.id || ''); const handleToggleFilters = () => { if (collection?.id) { @@ -182,14 +183,6 @@ export const CollectionDetail = () => { className={styles['search-box']} placeholder="Search genomes by classification" /> - -
- +
+
)} @@ -231,12 +224,34 @@ export const CollectionDetail = () => { open={filterPanelOpen ?? false} onClose={() => { if (collection?.id) { - dispatch(setFilterPanelOpen(filterPanelOpen)); + dispatch(setFilterPanelOpen(false)); } }} />
- + + +
+ {filterEntries ? filterEntries.length : '0'} active{' '} + {filterEntries && filterEntries.length !== 1 + ? 'filters' + : 'filter'} + {filterEntries && filterEntries.length > 0 ? ':' : ''} +
+ +
{showOverview ? ( { ); // Use same filter order if ignoring categories for consistency + // Only include filters who have a non-undefined value const filterEntries = categorizedFilters.reduce<[string, FilterState][]>( (filterEntires, category) => { - filterEntires.push(...category.filters); + const activeFilters = category.filters.filter( + (f) => f[1].value !== undefined + ); + filterEntires.push(...activeFilters); return filterEntires; }, [] @@ -333,13 +352,7 @@ const FilterChips = ({ collectionId }: { collectionId: string }) => { const { filterEntries, clearFilterState } = useFilterEntries(collectionId); if (filterEntries.length === 0) return <>; return ( - + {filterEntries.map(([column, filter]) => { return ( + + Collection Name + +
{collection.name}
+

- + Date: Mon, 25 Mar 2024 20:03:56 -0700 Subject: [PATCH 02/10] Move filter controls out of overview page --- src/features/collections/CollectionDetail.tsx | 56 ++++++++++--------- .../data_products/GenomeAttribs.tsx | 4 +- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/features/collections/CollectionDetail.tsx b/src/features/collections/CollectionDetail.tsx index b96f6997..ff34a672 100644 --- a/src/features/collections/CollectionDetail.tsx +++ b/src/features/collections/CollectionDetail.tsx @@ -229,29 +229,6 @@ export const CollectionDetail = () => { }} />
- - -
- {filterEntries ? filterEntries.length : '0'} active{' '} - {filterEntries && filterEntries.length !== 1 - ? 'filters' - : 'filter'} - {filterEntries && filterEntries.length > 0 ? ':' : ''} -
- -
{showOverview ? ( { modal={modal} /> ) : currDataProduct ? ( - + <> + + +
+ {filterEntries ? filterEntries.length : '0'} active{' '} + {filterEntries && filterEntries.length !== 1 + ? 'filters' + : 'filter'} + {filterEntries && filterEntries.length > 0 ? ':' : ''} +
+ +
+ + ) : ( <> )} diff --git a/src/features/collections/data_products/GenomeAttribs.tsx b/src/features/collections/data_products/GenomeAttribs.tsx index 56a0f8db..992e4aa9 100644 --- a/src/features/collections/data_products/GenomeAttribs.tsx +++ b/src/features/collections/data_products/GenomeAttribs.tsx @@ -279,7 +279,7 @@ export const GenomeAttribs: FC<{ Date: Tue, 26 Mar 2024 08:29:52 -0700 Subject: [PATCH 03/10] Quick fix to text in match button and modal --- src/features/collections/CollectionDetail.tsx | 4 ++-- src/features/collections/MatchModal.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/collections/CollectionDetail.tsx b/src/features/collections/CollectionDetail.tsx index ff34a672..7f3c6967 100644 --- a/src/features/collections/CollectionDetail.tsx +++ b/src/features/collections/CollectionDetail.tsx @@ -186,7 +186,7 @@ export const CollectionDetail = () => { + {showSearch && ( + + )} + {showMatchButton && ( + + )} -
- {filterEntries ? filterEntries.length : '0'} active{' '} - {filterEntries && filterEntries.length !== 1 - ? 'filters' - : 'filter'} - {filterEntries && filterEntries.length > 0 ? ':' : ''} -
- - + +
+ {filterEntries ? filterEntries.length : '0'} active{' '} + {filterEntries && filterEntries.length !== 1 + ? 'filters' + : 'filter'} + {filterEntries && filterEntries.length > 0 ? ':' : ''} +
+ + + )} Date: Tue, 26 Mar 2024 08:54:49 -0700 Subject: [PATCH 05/10] Modify matched bar color and modify padding --- src/features/collections/data_products/TaxaCount.module.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/collections/data_products/TaxaCount.module.scss b/src/features/collections/data_products/TaxaCount.module.scss index b498e740..ea1a3488 100644 --- a/src/features/collections/data_products/TaxaCount.module.scss +++ b/src/features/collections/data_products/TaxaCount.module.scss @@ -7,7 +7,7 @@ $gaps: 5px; display: flex; flex-flow: row nowrap; gap: $gaps; - padding: 0.5rem; + padding: 0 1rem 1rem; width: 100%; } @@ -59,7 +59,7 @@ $gaps: 5px; &.matched { .bar { - background: use-color("secondary"); + background: use-color("accent-warm"); } } From 7f001fe797615895e47774c8f1678a666e3cb945 Mon Sep 17 00:00:00 2001 From: Cody O'Donnell Date: Tue, 26 Mar 2024 09:45:12 -0700 Subject: [PATCH 06/10] Style pagination and duplicate it on top of table --- src/common/components/Table.module.scss | 27 +++++++----- src/common/components/Table.tsx | 14 ++++--- .../data_products/GenomeAttribs.tsx | 3 ++ .../data_products/SampleAttribs.tsx | 41 +++++++++++-------- 4 files changed, 50 insertions(+), 35 deletions(-) diff --git a/src/common/components/Table.module.scss b/src/common/components/Table.module.scss index bcb9ee14..774c7a39 100644 --- a/src/common/components/Table.module.scss +++ b/src/common/components/Table.module.scss @@ -34,21 +34,26 @@ $header-height: 2em; } .pagination { - align-items: stretch; - display: flex; - flex-flow: row nowrap; - gap: 0.333em; - justify-content: flex-start; - max-width: 20em; + display: block; + text-align: right; * { - flex: 1 1 2.25em; - min-width: fit-content; + display: inline-block; + margin-left: 0.5rem; + } + + *:first-child { + margin-left: 0; + } + + [disabled] { + color: #000; } - *:first-child, - *:last-child { - flex: 0 1 2.25em; + .selected { + background-color: use-color("mid-green-light"); + color: #000; + opacity: 1; } } diff --git a/src/common/components/Table.tsx b/src/common/components/Table.tsx index 69d42f87..d514e5e3 100644 --- a/src/common/components/Table.tsx +++ b/src/common/components/Table.tsx @@ -165,7 +165,7 @@ export const Pagination = ({ if (buttons[0] !== start) { buttons[0] = start; buttons[1] = ( - ); @@ -173,7 +173,7 @@ export const Pagination = ({ buttons.unshift(