From b5203f3db6f8d5e518913900a722ce2b5f0dd4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98rjan=20Aare=20J=C3=B8rgensen?= Date: Thu, 19 Dec 2024 15:04:36 +0100 Subject: [PATCH 1/3] Fix: remove pagination from models page --- src/features/ModelTable/ModelTable.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/features/ModelTable/ModelTable.tsx b/src/features/ModelTable/ModelTable.tsx index 057f37c7..389bac0f 100644 --- a/src/features/ModelTable/ModelTable.tsx +++ b/src/features/ModelTable/ModelTable.tsx @@ -86,12 +86,10 @@ export const ModelTable = () => { Date: Fri, 20 Dec 2024 11:24:56 +0100 Subject: [PATCH 2/3] Fix: improve flexible table size with scrolling and pinned action column --- src/features/ModelTable/ModelTable.styled.ts | 39 +++++--------------- src/features/ModelTable/ModelTable.tsx | 14 ++++++- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/features/ModelTable/ModelTable.styled.ts b/src/features/ModelTable/ModelTable.styled.ts index c5c15ed4..760543a6 100644 --- a/src/features/ModelTable/ModelTable.styled.ts +++ b/src/features/ModelTable/ModelTable.styled.ts @@ -1,36 +1,17 @@ import styled from 'styled-components'; import { spacings } from '../../tokens/spacings'; +import { theme } from '../../tokens/theme'; export const Table = styled.div` - padding-bottom: ${spacings.MEDIUM}; - max-width: 1750px; - > div { - height: 100%; - overflow-y: hidden; - > table { - min-width: 90% !important; - - > thead { - > tr { - > th { - vertical-align: middle !important; - } - } - } - } - > div { - margin-top: 2rem; - min-width: 90% !important; - } - - @media (max-width: 1500px) { - > table { - min-width: 100% !important; - } - > div { - min-width: 100% !important; - } - } + .table-wrapper { + border: 1px solid ${theme.light.ui.background.medium}; + max-height: calc( + 100vh - 64px - 48px - 30px - 16px - 36px - 16px - 48px - 64px + ); + } + table { + table-layout: auto !important; + width: 100% !important; } `; diff --git a/src/features/ModelTable/ModelTable.tsx b/src/features/ModelTable/ModelTable.tsx index 389bac0f..545a872b 100644 --- a/src/features/ModelTable/ModelTable.tsx +++ b/src/features/ModelTable/ModelTable.tsx @@ -1,5 +1,6 @@ /* eslint-disable no-empty-pattern */ /* eslint-disable max-lines-per-function */ +import { CSSProperties } from 'react'; import { useMsal } from '@azure/msal-react'; import { Button } from '@equinor/eds-core-react'; import { EdsDataGrid } from '@equinor/eds-data-grid-react'; @@ -82,6 +83,9 @@ export const ModelTable = () => { return status; }; + /* Make sure the header row in EdsDataGrid is vertically middle-aligned when filter icons are shown */ + const headerStyle = (): CSSProperties => ({ verticalAlign: 'middle' }); + return ( { emptyMessage="Empty :(" columnResizeMode="onChange" rows={data.data} + columnPinState={{ + right: ['navigate'], + }} scrollbarHorizontal + stickyHeader + headerStyle={headerStyle} + width="min(calc(100vw - 64px), 1400px)" columns={[ - { accessorKey: 'name', header: 'Model name', id: 'name' }, + { accessorKey: 'name', header: 'Model name', id: 'name', size: 200 }, { id: 'outcrops', header: 'Outcrop', @@ -169,7 +179,7 @@ export const ModelTable = () => { id: 'isProcessed', header: 'Status', enableColumnFilter: false, - size: 100, + size: 160, cell: ({ row }) => ( <>{getModelStatus(row.original.analogueModelId)} ), From 37cf48abfa5458399bd4cb5999bd42bc83a9efe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98rjan=20Aare=20J=C3=B8rgensen?= Date: Fri, 20 Dec 2024 11:28:55 +0100 Subject: [PATCH 3/3] Fix: make slightly more space for the models table --- src/pages/Browse/Browse.styled.tsx | 14 +++++++------- src/pages/Browse/Browse.tsx | 7 +++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pages/Browse/Browse.styled.tsx b/src/pages/Browse/Browse.styled.tsx index e6ae564e..bbac7c95 100644 --- a/src/pages/Browse/Browse.styled.tsx +++ b/src/pages/Browse/Browse.styled.tsx @@ -3,16 +3,16 @@ import { spacings } from '../../tokens/spacings'; export const BrowseWrapper = styled.div` column-gap: ${spacings.X_LARGE}; - padding: ${spacings.XXX_LARGE} ${spacings.X_LARGE}; + padding: ${spacings.XXX_LARGE} ${spacings.X_LARGE} ${spacings.X_LARGE}; display: flex; flex-direction: column; - row-gap: ${spacings.X_LARGE}; + row-gap: ${spacings.MEDIUM}; - > .btn-div { - > button { - width: 136px; - margin-right: 50px; - } + .actions { + display: flex; + column-gap: 16px; + align-items: center; + margin-block-start: ${spacings.MEDIUM}; } `; diff --git a/src/pages/Browse/Browse.tsx b/src/pages/Browse/Browse.tsx index 0a6064ae..a44b9b31 100644 --- a/src/pages/Browse/Browse.tsx +++ b/src/pages/Browse/Browse.tsx @@ -33,12 +33,15 @@ export const Browse = () => { return ( <> - Browse all models + + Browse all models + {isOwnerOrAdmin ? ( -
+
+ {/* TODO Add the export button */}
) : ( <>