Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove TextWithTooltip with Tooltip #697

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
*/
import React, { FC, ReactElement, useMemo } from 'react';

import { getColor, TextWithTooltip } from '@zextras/carbonio-design-system';
import { getColor, Tooltip, Text } from '@zextras/carbonio-design-system';
import { t } from '@zextras/carbonio-shell-ui';
import { capitalize } from 'lodash';
import styled from 'styled-components';

import type { Participant, MailMessage } from '../../../../../types';

const StyledText = styled.span<{ isRead?: string | boolean; color?: string }>`
Expand Down Expand Up @@ -37,18 +38,28 @@ const OnBehalfOfDisplayer: FC<{
);

const behalfOfLabel = useMemo(() => t('label.behalf_of', 'behalf of'), []);

const messageLabel = useMemo(
(): React.JSX.Element => (
<>
<StyledText isRead={message.read ?? ''}>{fullName}</StyledText>
<StyledText color="secondary" isRead={message.read}>
{` <${address}> `}
</StyledText>
<StyledText color="text">{behalfOfLabel}</StyledText>
<StyledText isRead={message.read}>{mainContactFullName}</StyledText>
<StyledText color="secondary" isRead={message.read}>
{` <${mainContactAddress}> `}
</StyledText>
</>
),
[address, behalfOfLabel, fullName, mainContactAddress, mainContactFullName, message.read]
);

return (
<TextWithTooltip>
<StyledText isRead={message.read ?? ''}>{fullName}</StyledText>
<StyledText color="secondary" isRead={message.read}>
{` <${address}> `}
</StyledText>
<StyledText color="text">{behalfOfLabel}</StyledText>
<StyledText isRead={message.read}>{mainContactFullName}</StyledText>
<StyledText color="secondary" isRead={message.read}>
{` <${mainContactAddress}> `}
</StyledText>
</TextWithTooltip>
<Tooltip label={messageLabel} overflowTooltip>
<Text>{messageLabel}</Text>
</Tooltip>
);
};

Expand Down
9 changes: 6 additions & 3 deletions src/views/search/advanced-filter-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import {
CustomModal,
Icon,
Row,
TextWithTooltip,
Padding,
ModalHeader,
Divider,
ModalFooter
ModalFooter,
Tooltip,
Text
} from '@zextras/carbonio-design-system';
import { getTags, QueryChip, t } from '@zextras/carbonio-shell-ui';
import { concat, filter, includes, map } from 'lodash';
Expand Down Expand Up @@ -74,7 +75,9 @@ export const AdvancedFilterModal = ({
</Padding>
</Row>
<Row takeAvailableSpace mainAlignment="flex-start">
<TextWithTooltip>{item.name}</TextWithTooltip>
<Tooltip label={item.name} overflowTooltip>
<Text>{item.name}</Text>
</Tooltip>
</Row>
</Row>
</Row>
Expand Down
5 changes: 3 additions & 2 deletions src/views/settings/senders-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import React, { useMemo, useState, useCallback } from 'react';
import {
Container,
Divider,
TextWithTooltip,
Padding,
Tooltip,
Button,
Expand Down Expand Up @@ -131,7 +130,9 @@ export const SendersList = ({
<Heading title={sectionTitle.label} size="medium" />
</Container>
<Container crossAlignment="flex-start" padding={'none'}>
<TextWithTooltip size="extrasmall">{message}</TextWithTooltip>
<Tooltip label={message} overflowTooltip>
<Text size="extrasmall">{message}</Text>
</Tooltip>
</Container>
</Container>
<Divider />
Expand Down
9 changes: 6 additions & 3 deletions src/views/settings/signature-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import React, { useMemo, useState, useEffect, useCallback, FC, ReactElement, use
import {
Container,
FormSubSection,
TextWithTooltip,
Input,
Row,
Button,
Padding,
SelectItem,
ButtonProps
ButtonProps,
Tooltip,
Text
} from '@zextras/carbonio-design-system';
import { t, useIntegratedComponent } from '@zextras/carbonio-shell-ui';
import { map, reject, concat } from 'lodash';
Expand Down Expand Up @@ -166,7 +167,9 @@ const SignatureSettings: FC<SignatureSettingsPropsType> = ({
>
<Row height="2.5rem" padding={{ all: 'small' }}>
<Container orientation="horizontal" mainAlignment="space-between">
<TextWithTooltip weight="bold">{item.label}</TextWithTooltip>
<Tooltip label={item.label} overflowTooltip>
<Text weight="bold">{item.label}</Text>
</Tooltip>
<DeleteButton
label={t('label.delete', 'Delete')}
type="outlined"
Expand Down
8 changes: 5 additions & 3 deletions src/views/settings/trustee-addresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
Divider,
Button,
Tooltip,
TextWithTooltip,
Row,
ListV2
ListV2,

Check warning on line 16 in src/views/settings/trustee-addresses.tsx

View check run for this annotation

Sonarqube Zextras / carbonio-mails-ui Sonarqube Results

src/views/settings/trustee-addresses.tsx#L16

'ListV2' is deprecated.
Text
} from '@zextras/carbonio-design-system';
import { t } from '@zextras/carbonio-shell-ui';
import { filter, find } from 'lodash';
Expand Down Expand Up @@ -95,7 +95,9 @@
<Heading title={sectionTitle.label} size="medium" />
</Container>
<Container width="auto" crossAlignment="flex-end">
<TextWithTooltip size="extrasmall">{message}</TextWithTooltip>
<Tooltip label={message} overflowTooltip>
<Text size="extrasmall">{message}</Text>
</Tooltip>
</Container>
</Container>
<Divider />
Expand Down