dynamic window size of user list

This commit is contained in:
Yinyin Liu 2026-06-02 13:43:52 +02:00
parent 2cc8eebf37
commit 67d5091093
1 changed files with 15 additions and 7 deletions

View File

@ -48,12 +48,20 @@ const FlatUsersView = (props: FlatUsersViewProps) => {
const isMobile = window.innerWidth <= 1490; const isMobile = window.innerWidth <= 1490;
// Only show the detail pane once a real user is picked; until then let the
// list span the full width so long emails aren't clipped by a reserved-but-
// empty pane.
const selectedUserObj = findUser(selectedUser);
const hasSelection = selectedUser !== -1 && selectedUserObj !== undefined;
return ( return (
<Grid container spacing={1} sx={{ marginTop: '1px' }}> <Grid container spacing={1} sx={{ marginTop: '1px' }}>
<Grid item xs={6} md={5}> <Grid item xs={12} md={hasSelection ? 5 : 12}>
<Card> <Card>
<Divider /> <Divider />
<TableContainer sx={{ maxHeight: '520px', overflowY: 'auto' }}> <TableContainer
sx={{ maxHeight: 'calc(100vh - 260px)', overflowY: 'auto' }}
>
<Table> <Table>
<TableHead> <TableHead>
<TableRow> <TableRow>
@ -114,14 +122,14 @@ const FlatUsersView = (props: FlatUsersViewProps) => {
</TableContainer> </TableContainer>
</Card> </Card>
</Grid> </Grid>
<Grid item xs={6} md={7}> {hasSelection && (
{selectedUser && ( <Grid item xs={12} md={7}>
<User <User
current_user={findUser(selectedUser)} current_user={selectedUserObj}
fetchDataAgain={props.fetchDataAgain} fetchDataAgain={props.fetchDataAgain}
></User> ></User>
)}
</Grid> </Grid>
)}
</Grid> </Grid>
); );
}; };