Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Oct 13, 2024
1 parent d97e466 commit b8ef702
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Link } from 'react-router-dom';
import isPropValid from '@emotion/is-prop-valid';
import styled from '@emotion/styled';
import { Link } from 'react-router-dom';
import { MOBILE_VIEWPORT } from 'twenty-ui';

const StyledTableRow = styled('div', {
shouldForwardProp: (prop) =>
Expand All @@ -10,12 +11,19 @@ const StyledTableRow = styled('div', {
onClick?: () => void;
to?: string;
gridAutoColumns?: string;
mobileGridAutoColumns?: string;
}>`
background-color: ${({ isSelected, theme }) =>
isSelected ? theme.accent.quaternary : 'transparent'};
border-radius: ${({ theme }) => theme.border.radius.sm};
display: grid;
grid-auto-columns: ${({ gridAutoColumns }) => gridAutoColumns ?? '1fr'};
@media (max-width: ${MOBILE_VIEWPORT}px) {
grid-auto-columns: ${({ mobileGridAutoColumns, gridAutoColumns }) =>
mobileGridAutoColumns ?? gridAutoColumns ?? '1fr'};
}
grid-auto-flow: column;
transition: background-color
${({ theme }) => theme.animation.duration.normal}s;
Expand All @@ -35,6 +43,7 @@ type TableRowProps = {
to?: string;
className?: string;
gridAutoColumns?: string;
mobileGridAutoColumns?: string;
};

export const TableRow = ({
Expand All @@ -44,12 +53,14 @@ export const TableRow = ({
className,
children,
gridAutoColumns,
mobileGridAutoColumns,
}: React.PropsWithChildren<TableRowProps>) => (
<StyledTableRow
isSelected={isSelected}
onClick={onClick}
gridAutoColumns={gridAutoColumns}
className={className}
mobileGridAutoColumns={mobileGridAutoColumns}
to={to}
as={to ? Link : 'div'}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
IconMail,
IconReload,
IconTrash,
MOBILE_VIEWPORT,
TooltipDelay,
} from 'twenty-ui';

Expand Down Expand Up @@ -54,40 +53,20 @@ const StyledTable = styled(Table)`
margin-top: ${({ theme }) => theme.spacing(0.5)};
`;

const StyledTableCell = styled(TableCell)`
padding: ${({ theme }) => theme.spacing(1)};
@media (max-width: ${MOBILE_VIEWPORT}px) {
&:first-child {
max-width: 100%;
padding-top: 2px;
white-space: nowrap;
overflow: scroll;
scroll-behavior: smooth;
}
}
const StyledTableHeaderRow = styled(Table)`
margin-bottom: ${({ theme }) => theme.spacing(1.5)};
`;

const StyledIconWrapper = styled.div`
left: 2px;
display: flex;
align-items: center;
margin-right: ${({ theme }) => theme.spacing(2)};
position: relative;
top: 1px;
`;

const StyledScrollableTextContainer = styled.div`
white-space: nowrap;
const StyledTextContainerWithEllipsis = styled.div`
overflow: hidden;
text-overflow: ellipsis;
width: content-fit;
`;

const StyledTextContainer = styled.div`
color: ${({ theme }) => theme.font.color.secondary};
max-width: max-content;
overflow-x: auto;
position: absolute;
`;
const StyledTableHeaderRow = styled(Table)`
margin-bottom: ${({ theme }) => theme.spacing(1.5)};
white-space: nowrap;
`;

export const SettingsWorkspaceMembers = () => {
Expand Down Expand Up @@ -187,15 +166,21 @@ export const SettingsWorkspaceMembers = () => {
/>
<Table>
<StyledTableHeaderRow>
<TableRow gridAutoColumns="150px 2fr 1fr">
<TableRow
gridAutoColumns="150px 1fr 1fr"
mobileGridAutoColumns="100px 1fr 1fr"
>
<TableHeader>Name</TableHeader>
<TableHeader>Email</TableHeader>
<TableHeader align={'right'}></TableHeader>
</TableRow>
</StyledTableHeaderRow>
{workspaceMembers?.map((workspaceMember) => (
<StyledTable key={workspaceMember.id}>
<TableRow gridAutoColumns="150px 2fr 1fr">
<TableRow
gridAutoColumns="150px 1fr 1fr"
mobileGridAutoColumns="100px 1fr 1fr"
>
<TableCell>
<StyledIconWrapper>
<Avatar
Expand All @@ -206,13 +191,13 @@ export const SettingsWorkspaceMembers = () => {
size="sm"
/>
</StyledIconWrapper>
<StyledScrollableTextContainer
<StyledTextContainerWithEllipsis
id={`hover-text-${workspaceMember.id}`}
>
{workspaceMember.name.firstName +
' ' +
workspaceMember.name.lastName}
</StyledScrollableTextContainer>
</StyledTextContainerWithEllipsis>
<AppTooltip
anchorSelect={`#hover-text-${workspaceMember.id}`}
content={`${workspaceMember.name.firstName} ${workspaceMember.name.lastName}`}
Expand All @@ -223,9 +208,9 @@ export const SettingsWorkspaceMembers = () => {
/>
</TableCell>
<TableCell>
<StyledTextContainer>
<StyledTextContainerWithEllipsis>
{workspaceMember.userEmail}
</StyledTextContainer>
</StyledTextContainerWithEllipsis>
</TableCell>
<TableCell align={'right'}>
{currentWorkspaceMember?.id !== workspaceMember.id && (
Expand Down Expand Up @@ -256,33 +241,39 @@ export const SettingsWorkspaceMembers = () => {
{isNonEmptyArray(workspaceInvitations) && (
<Table>
<StyledTableHeaderRow>
<TableRow gridAutoColumns={`1fr 1fr 1fr`}>
<TableRow
gridAutoColumns="150px 1fr 1fr"
mobileGridAutoColumns="100px 1fr 1fr"
>
<TableHeader>Email</TableHeader>
<TableHeader align={'right'}>Expires in</TableHeader>
<TableHeader></TableHeader>
</TableRow>
</StyledTableHeaderRow>
{workspaceInvitations?.map((workspaceInvitation) => (
<StyledTable key={workspaceInvitation.id}>
<TableRow gridAutoColumns={`1fr 1fr 1fr`}>
<StyledTableCell>
<TableRow
gridAutoColumns="150px 1fr 1fr"
mobileGridAutoColumns="100px 1fr 1fr"
>
<TableCell>
<StyledIconWrapper>
<IconMail
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
/>
</StyledIconWrapper>
<StyledScrollableTextContainer>
<StyledTextContainerWithEllipsis>
{workspaceInvitation.email}
</StyledScrollableTextContainer>
</StyledTableCell>
<StyledTableCell align={'right'}>
</StyledTextContainerWithEllipsis>
</TableCell>
<TableCell align={'right'}>
<Status
color={'gray'}
text={getExpiresAtText(workspaceInvitation.expiresAt)}
/>
</StyledTableCell>
<StyledTableCell align={'right'}>
</TableCell>
<TableCell align={'right'}>
<StyledButtonContainer>
<IconButton
onClick={() => {
Expand All @@ -305,7 +296,7 @@ export const SettingsWorkspaceMembers = () => {
Icon={IconTrash}
/>
</StyledButtonContainer>
</StyledTableCell>
</TableCell>
</TableRow>
</StyledTable>
))}
Expand Down

0 comments on commit b8ef702

Please sign in to comment.