Skip to content

Commit

Permalink
CR feedback - Griffin
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-rasmussen committed Jan 21, 2025
1 parent 23d1504 commit 8e5fca1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {GridPaginationModel} from '@mui/x-data-grid-pro';

const MAX_PAGE_SIZE = 100;
export const DEFAULT_PAGE_SIZE = 100;
export const DEFAULT_PAGE_SIZE = 50;

export const getValidPaginationModel = (
queryPage: string | undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export const CallDetails: FC<{
entity={call.entity}
project={call.project}
allowedColumnPatterns={ALLOWED_COLUMN_PATTERNS}
paginationModel={isPeeking ? {page: 0, pageSize: 10} : undefined}
/>
);
if (isPeeking) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,7 @@ export const CallsTable: FC<{
rowSelectionModel={rowSelectionModel}
// columnGroupingModel={groupingModel}
columnGroupingModel={columns.colGroupingModel}
hideFooter={!callsLoading && callsTotal === 0}
hideFooterSelectedRowCount
onColumnWidthChange={newCol => {
setUserDefinedColumnWidths(curr => {
Expand Down Expand Up @@ -1021,7 +1022,7 @@ export const CallsTable: FC<{
);
},
columnMenu: CallsCustomColumnMenu,
pagination: PaginationButtons,
pagination: () => <PaginationButtons hideControls={hideControls} />,
columnMenuSortDescendingIcon: IconSortDescending,
columnMenuSortAscendingIcon: IconSortAscending,
columnMenuHideIcon: IconNotVisible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,11 @@ type PageSizeOption = {
readonly label: string;
};

export const PaginationButtons = () => {
type PaginationButtonsProps = {
hideControls?: boolean;
};

export const PaginationButtons = ({hideControls}: PaginationButtonsProps) => {
const apiRef = useGridApiContext();
const page = useGridSelector(apiRef, gridPageSelector);
const pageCount = useGridSelector(apiRef, gridPageCountSelector);
Expand Down Expand Up @@ -719,25 +723,29 @@ export const PaginationButtons = () => {
icon="chevron-next"
/>
</Box>
<Box
sx={{
fontSize: '14px',
fontWeight: '400',
color: MOON_500,
display: 'flex',
alignItems: 'center',
gap: '8px',
}}>
Per page:
<Select<PageSizeOption>
size="small"
menuPlacement="top"
options={pageSizeOptions}
value={pageSizeValue}
isSearchable={false}
onChange={onPageSizeChange}
/>
</Box>
{hideControls ? null : (
<Box
sx={{
fontSize: '14px',
fontWeight: '400',
color: MOON_500,
display: 'flex',
alignItems: 'center',
gap: '8px',
// Regrettable hack to appear over Material scrollbar's z-index of 6.
zIndex: 7,
}}>
Per page:
<Select<PageSizeOption>
size="small"
menuPlacement="top"
options={pageSizeOptions}
value={pageSizeValue}
isSearchable={false}
onChange={onPageSizeChange}
/>
</Box>
)}
</Box>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export const LeaderboardGrid: React.FC<LeaderboardGridProps> = ({
},
}}
slots={{
pagination: PaginationButtons,
pagination: () => <PaginationButtons />,
}}
/>
</Box>
Expand Down

0 comments on commit 8e5fca1

Please sign in to comment.