From a4c552e88f412aae9f598f508da4896b55fd85cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98rjan=20Aare=20J=C3=B8rgensen?= Date: Thu, 2 Jan 2025 09:53:10 +0100 Subject: [PATCH] fix: Remove pagination and fix scrolling on models page (#417) * Fix: remove pagination from models page * Fix: improve flexible table size with scrolling and pinned action column * Fix: make slightly more space for the models table --- src/features/ModelTable/ModelTable.styled.ts | 39 +++++--------------- src/features/ModelTable/ModelTable.tsx | 16 ++++++-- src/pages/Browse/Browse.styled.tsx | 14 +++---- src/pages/Browse/Browse.tsx | 7 +++- 4 files changed, 34 insertions(+), 42 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 057f37c7..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,19 +83,26 @@ 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 ( { id: 'isProcessed', header: 'Status', enableColumnFilter: false, - size: 100, + size: 160, cell: ({ row }) => ( <>{getModelStatus(row.original.analogueModelId)} ), 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 */}
) : ( <>