Fix: "Not shared" label not visible due to extra long email subject (#11492)
Closes #11408 - Added `min-width: 100px` in `EmailThreadNotShared` - Added `isShared` prop to `StyledSubject` for better subject handling in shared visibility scenarios --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
committed by
GitHub
parent
04168e720c
commit
d34ec7b253
@ -1,13 +1,18 @@
|
|||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { IconLock } from 'twenty-ui/display';
|
import { AppTooltip, IconLock, TooltipDelay } from 'twenty-ui/display';
|
||||||
|
import { MessageChannelVisibility } from '~/generated/graphql';
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div<{ isCompact?: boolean }>`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 0 0;
|
flex: ${({ isCompact }) => (isCompact ? '0 0 auto' : '1 0 0')};
|
||||||
gap: ${({ theme }) => theme.spacing(1)};
|
gap: ${({ theme }) => theme.spacing(1)};
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
margin-left: auto;
|
||||||
|
width: ${({ isCompact }) => (isCompact ? 'auto' : '100%')};
|
||||||
|
min-width: ${({ theme }) =>
|
||||||
|
`calc(${theme.icon.size.md} + ${theme.spacing(2)})`};
|
||||||
padding: ${({ theme }) => theme.spacing(0, 1)};
|
padding: ${({ theme }) => theme.spacing(0, 1)};
|
||||||
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@ -18,12 +23,33 @@ const StyledContainer = styled.div`
|
|||||||
font-weight: ${({ theme }) => theme.font.weight.regular};
|
font-weight: ${({ theme }) => theme.font.weight.regular};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const EmailThreadNotShared = () => {
|
type EmailThreadNotSharedProps = {
|
||||||
|
visibility: MessageChannelVisibility;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const EmailThreadNotShared = ({
|
||||||
|
visibility,
|
||||||
|
}: EmailThreadNotSharedProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const containerId = 'email-thread-not-shared';
|
||||||
|
const isCompact = visibility === MessageChannelVisibility.SUBJECT;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledContainer>
|
<>
|
||||||
<IconLock size={theme.icon.size.md} />
|
<StyledContainer id={containerId} isCompact={isCompact}>
|
||||||
Not shared
|
<IconLock size={theme.icon.size.md} />
|
||||||
</StyledContainer>
|
{visibility === MessageChannelVisibility.METADATA && 'Not shared'}
|
||||||
|
</StyledContainer>
|
||||||
|
{visibility === MessageChannelVisibility.SUBJECT && (
|
||||||
|
<AppTooltip
|
||||||
|
anchorSelect={`#${containerId}`}
|
||||||
|
content="Only the subject is shared"
|
||||||
|
delay={TooltipDelay.mediumDelay}
|
||||||
|
noArrow
|
||||||
|
place="bottom"
|
||||||
|
positionStrategy="fixed"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,15 +3,16 @@ import styled from '@emotion/styled';
|
|||||||
import { ActivityRow } from '@/activities/components/ActivityRow';
|
import { ActivityRow } from '@/activities/components/ActivityRow';
|
||||||
import { EmailThreadNotShared } from '@/activities/emails/components/EmailThreadNotShared';
|
import { EmailThreadNotShared } from '@/activities/emails/components/EmailThreadNotShared';
|
||||||
import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu';
|
import { useOpenEmailThreadInCommandMenu } from '@/command-menu/hooks/useOpenEmailThreadInCommandMenu';
|
||||||
import { MessageChannelVisibility, TimelineThread } from '~/generated/graphql';
|
|
||||||
import { formatToHumanReadableDate } from '~/utils/date-utils';
|
|
||||||
import { Avatar } from 'twenty-ui/display';
|
import { Avatar } from 'twenty-ui/display';
|
||||||
import { GRAY_SCALE } from 'twenty-ui/theme';
|
import { GRAY_SCALE } from 'twenty-ui/theme';
|
||||||
|
import { MessageChannelVisibility, TimelineThread } from '~/generated/graphql';
|
||||||
|
import { formatToHumanReadableDate } from '~/utils/date-utils';
|
||||||
|
|
||||||
const StyledHeading = styled.div<{ unread: boolean }>`
|
const StyledHeading = styled.div<{ unread: boolean }>`
|
||||||
display: flex;
|
display: flex;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: 20%;
|
width: fit-content;
|
||||||
|
max-width: 20%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledParticipantsContainer = styled.div`
|
const StyledParticipantsContainer = styled.div`
|
||||||
@ -43,12 +44,14 @@ const StyledSubjectAndBody = styled.div`
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledSubject = styled.span`
|
const StyledSubject = styled.span<{ flex: number }>`
|
||||||
color: ${({ theme }) => theme.font.color.primary};
|
color: ${({ theme }) => theme.font.color.primary};
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
flex: ${({ flex }) => flex};
|
||||||
|
max-width: max-content;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledBody = styled.span`
|
const StyledBody = styled.span`
|
||||||
@ -143,13 +146,19 @@ export const EmailThreadPreview = ({ thread }: EmailThreadPreviewProps) => {
|
|||||||
|
|
||||||
<StyledSubjectAndBody>
|
<StyledSubjectAndBody>
|
||||||
{visibility !== MessageChannelVisibility.METADATA && (
|
{visibility !== MessageChannelVisibility.METADATA && (
|
||||||
<StyledSubject>{thread.subject}</StyledSubject>
|
<StyledSubject
|
||||||
|
flex={
|
||||||
|
visibility === MessageChannelVisibility.SHARE_EVERYTHING ? 0 : 1
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{thread.subject}
|
||||||
|
</StyledSubject>
|
||||||
)}
|
)}
|
||||||
{visibility === MessageChannelVisibility.SHARE_EVERYTHING && (
|
{visibility === MessageChannelVisibility.SHARE_EVERYTHING && (
|
||||||
<StyledBody>{thread.lastMessageBody}</StyledBody>
|
<StyledBody>{thread.lastMessageBody}</StyledBody>
|
||||||
)}
|
)}
|
||||||
{visibility !== MessageChannelVisibility.SHARE_EVERYTHING && (
|
{visibility !== MessageChannelVisibility.SHARE_EVERYTHING && (
|
||||||
<EmailThreadNotShared />
|
<EmailThreadNotShared visibility={visibility} />
|
||||||
)}
|
)}
|
||||||
</StyledSubjectAndBody>
|
</StyledSubjectAndBody>
|
||||||
<StyledReceivedAt>
|
<StyledReceivedAt>
|
||||||
|
|||||||
Reference in New Issue
Block a user