1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-19 01:17:18 +02:00

fix: mobile view (#801)

* fix: mobile view project roles

* fix: mobile view users
This commit is contained in:
Youssef Khedher 2022-03-24 14:04:42 +01:00 committed by GitHub
parent fe23fe8472
commit 4f0ef3d761
6 changed files with 50 additions and 13 deletions

View File

@ -17,12 +17,14 @@ import useProjectRolesApi from '../../../../../hooks/api/actions/useProjectRoles
import useToast from '../../../../../hooks/useToast'; import useToast from '../../../../../hooks/useToast';
import ProjectRoleDeleteConfirm from '../ProjectRoleDeleteConfirm/ProjectRoleDeleteConfirm'; import ProjectRoleDeleteConfirm from '../ProjectRoleDeleteConfirm/ProjectRoleDeleteConfirm';
import { formatUnknownError } from '../../../../../utils/format-unknown-error'; import { formatUnknownError } from '../../../../../utils/format-unknown-error';
import { useStyles } from './ProjectRoleListItem/ProjectRoleListItem.styles';
const ROOTROLE = 'root'; const ROOTROLE = 'root';
const ProjectRoleList = () => { const ProjectRoleList = () => {
const { hasAccess } = useContext(AccessContext); const { hasAccess } = useContext(AccessContext);
const { roles } = useProjectRoles(); const { roles } = useProjectRoles();
const styles = useStyles();
const paginationFilter = (role: IRole) => role?.type !== ROOTROLE; const paginationFilter = (role: IRole) => role?.type !== ROOTROLE;
@ -76,9 +78,11 @@ const ProjectRoleList = () => {
<Table> <Table>
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell></TableCell> <TableCell className={styles.hideXS}></TableCell>
<TableCell>Project Role</TableCell> <TableCell>Project Role</TableCell>
<TableCell>Description</TableCell> <TableCell className={styles.hideSM}>
Description
</TableCell>
<TableCell align="right"> <TableCell align="right">
{hasAccess(ADMIN) ? 'Action' : ''} {hasAccess(ADMIN) ? 'Action' : ''}
</TableCell> </TableCell>

View File

@ -13,4 +13,21 @@ export const useStyles = makeStyles(theme => ({
icon: { icon: {
color: theme.palette.grey[600], color: theme.palette.grey[600],
}, },
description: {
textAlign: 'left',
maxWidth: '300px',
[theme.breakpoints.down('sm')]: {
display: 'none',
},
},
hideSM: {
[theme.breakpoints.down('sm')]: {
display: 'none',
},
},
hideXS: {
[theme.breakpoints.down('xs')]: {
display: 'none',
},
},
})); }));

View File

@ -33,7 +33,7 @@ const RoleListItem = ({
return ( return (
<> <>
<TableRow className={styles.tableRow}> <TableRow className={styles.tableRow}>
<TableCell> <TableCell className={styles.hideXS}>
<SupervisedUserCircleIcon className={styles.icon} /> <SupervisedUserCircleIcon className={styles.icon} />
</TableCell> </TableCell>
<TableCell className={styles.leftTableCell}> <TableCell className={styles.leftTableCell}>
@ -41,7 +41,7 @@ const RoleListItem = ({
{name} {name}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell className={styles.leftTableCell}> <TableCell className={styles.description}>
<Typography variant="body2" data-loading> <Typography variant="body2" data-loading>
{description} {description}
</Typography> </Typography>

View File

@ -9,4 +9,14 @@ export const useStyles = makeStyles(theme => ({
leftTableCell: { leftTableCell: {
textAlign: 'left', textAlign: 'left',
}, },
hideSM: {
[theme.breakpoints.down('sm')]: {
display: 'none',
},
},
hideXS: {
[theme.breakpoints.down('xs')]: {
display: 'none',
},
},
})); }));

View File

@ -37,7 +37,7 @@ const UserListItem = ({
return ( return (
<TableRow key={user.id} className={styles.tableRow}> <TableRow key={user.id} className={styles.tableRow}>
<TableCell> <TableCell className={styles.hideXS}>
<Avatar <Avatar
data-loading data-loading
alt={user.name} alt={user.name}
@ -47,7 +47,7 @@ const UserListItem = ({
})`} })`}
/> />
</TableCell> </TableCell>
<TableCell> <TableCell className={styles.hideSM}>
<span data-loading> <span data-loading>
{formatDateYMD(user.createdAt, locationSettings.locale)} {formatDateYMD(user.createdAt, locationSettings.locale)}
</span> </span>
@ -57,12 +57,12 @@ const UserListItem = ({
{user.name} {user.name}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell className={styles.leftTableCell}> <TableCell className={`${styles.leftTableCell} ${styles.hideSM}`}>
<Typography variant="body2" data-loading> <Typography variant="body2" data-loading>
{user.username || user.email} {user.username || user.email}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center" className={styles.hideXS}>
<Typography variant="body2" data-loading> <Typography variant="body2" data-loading>
{renderRole(user.rootRole)} {renderRole(user.rootRole)}
</Typography> </Typography>

View File

@ -25,8 +25,10 @@ import IRole from '../../../../interfaces/role';
import useToast from '../../../../hooks/useToast'; import useToast from '../../../../hooks/useToast';
import { useLocationSettings } from '../../../../hooks/useLocationSettings'; import { useLocationSettings } from '../../../../hooks/useLocationSettings';
import { formatUnknownError } from '../../../../utils/format-unknown-error'; import { formatUnknownError } from '../../../../utils/format-unknown-error';
import { useStyles } from './UserListItem/UserListItem.styles';
const UsersList = () => { const UsersList = () => {
const styles = useStyles();
const { users, roles, refetch, loading } = useUsers(); const { users, roles, refetch, loading } = useUsers();
const { setToastData, setToastApiError } = useToast(); const { setToastData, setToastApiError } = useToast();
const { const {
@ -133,13 +135,17 @@ const UsersList = () => {
<Table> <Table>
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell></TableCell> <TableCell className={styles.hideXS}></TableCell>
<TableCell>Created</TableCell> <TableCell className={styles.hideSM}>Created</TableCell>
<TableCell>Name</TableCell> <TableCell>Name</TableCell>
<TableCell>Username</TableCell> <TableCell className={styles.hideSM}>
<TableCell align="center">Role</TableCell> Username
</TableCell>
<TableCell align="center" className={styles.hideXS}>
Role
</TableCell>
<TableCell align="right"> <TableCell align="right">
{hasAccess(ADMIN) ? 'Action' : ''} {hasAccess(ADMIN) ? 'Actions' : ''}
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableHead> </TableHead>