Skip to content

Commit

Permalink
Use ListTile in username/e164 compose
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and indutny-signal committed Mar 9, 2023
1 parent d3f624b commit 1b83436
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 26 deletions.
43 changes: 30 additions & 13 deletions ts/components/conversationList/StartNewConversation.tsx
Expand Up @@ -6,7 +6,10 @@ import React, { useCallback, useState } from 'react';

import { ButtonVariant } from '../Button';
import { ConfirmationDialog } from '../ConfirmationDialog';
import { BaseConversationListItem } from './BaseConversationListItem';
import { SPINNER_CLASS_NAME } from './BaseConversationListItem';
import { ListTile } from '../ListTile';
import { Avatar, AvatarSize } from '../Avatar';
import { Spinner } from '../Spinner';

import type { ParsedE164Type } from '../../util/libphonenumberInstance';
import type { LookupConversationWithoutUuidActionsType } from '../../util/lookupConversationWithoutUuid';
Expand Down Expand Up @@ -87,19 +90,33 @@ export const StartNewConversation: FunctionComponent<Props> = React.memo(

return (
<>
<BaseConversationListItem
acceptedMessageRequest={false}
color={AvatarColors[0]}
conversationType="direct"
headerName={phoneNumber.userInput}
i18n={i18n}
isMe={false}
isSelected={false}
onClick={boundOnClick}
phoneNumber={phoneNumber.userInput}
shouldShowSpinner={isFetching}
sharedGroupNames={[]}
<ListTile
leading={
<Avatar
acceptedMessageRequest={false}
color={AvatarColors[0]}
conversationType="direct"
searchResult
i18n={i18n}
isMe={false}
title={phoneNumber.userInput}
size={AvatarSize.THIRTY_TWO}
badge={undefined}
sharedGroupNames={[]}
/>
}
title={phoneNumber.userInput}
onClick={boundOnClick}
trailing={
isFetching ? (
<Spinner
size="20px"
svgSize="small"
moduleClassName={SPINNER_CLASS_NAME}
direction="on-progress-dialog"
/>
) : undefined
}
/>
{modal}
</>
Expand Down
41 changes: 29 additions & 12 deletions ts/components/conversationList/UsernameSearchResultListItem.tsx
Expand Up @@ -3,7 +3,10 @@

import React, { useCallback } from 'react';

import { BaseConversationListItem } from './BaseConversationListItem';
import { SPINNER_CLASS_NAME } from './BaseConversationListItem';
import { ListTile } from '../ListTile';
import { Avatar, AvatarSize } from '../Avatar';
import { Spinner } from '../Spinner';

import type { LocalizerType } from '../../types/Util';
import type { LookupConversationWithoutUuidActionsType } from '../../util/lookupConversationWithoutUuid';
Expand Down Expand Up @@ -55,18 +58,32 @@ export function UsernameSearchResultListItem({
]);

return (
<BaseConversationListItem
acceptedMessageRequest={false}
conversationType="direct"
headerName={username}
i18n={i18n}
isMe={false}
isSelected={false}
isUsernameSearchResult
shouldShowSpinner={isFetchingUsername}
onClick={boundOnClick}
sharedGroupNames={[]}
<ListTile
leading={
<Avatar
acceptedMessageRequest={false}
conversationType="direct"
searchResult
i18n={i18n}
isMe={false}
title={username}
size={AvatarSize.THIRTY_TWO}
badge={undefined}
sharedGroupNames={[]}
/>
}
title={username}
onClick={boundOnClick}
trailing={
isFetchingUsername ? (
<Spinner
size="20px"
svgSize="small"
moduleClassName={SPINNER_CLASS_NAME}
direction="on-progress-dialog"
/>
) : undefined
}
/>
);
}
2 changes: 1 addition & 1 deletion ts/test-mock/pnp/username_test.ts
Expand Up @@ -261,7 +261,7 @@ describe('pnp/username', function needsName() {
await searchInput.type(`@${CARL_USERNAME}`);

debug('starting lookup');
await window.locator(`button >> "${CARL_USERNAME}"`).click();
await window.locator(`div.ListTile >> "${CARL_USERNAME}"`).click();

debug('sending a message');
{
Expand Down

0 comments on commit 1b83436

Please sign in to comment.