Filter chats by Unread

This commit is contained in:
yash-signal 2024-11-13 13:33:41 -06:00 committed by GitHub
parent 45e9c07125
commit a56e7d0ade
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 883 additions and 438 deletions

View file

@ -36,11 +36,13 @@ import { SearchResultsLoadingFakeRow as SearchResultsLoadingFakeRowComponent } f
import { UsernameSearchResultListItem } from './conversationList/UsernameSearchResultListItem';
import { GroupListItem } from './conversationList/GroupListItem';
import { ListView } from './ListView';
import { Button, ButtonVariant } from './Button';
export enum RowType {
ArchiveButton = 'ArchiveButton',
Blank = 'Blank',
Contact = 'Contact',
ClearFilterButton = 'ClearFilterButton',
ContactCheckbox = 'ContactCheckbox',
PhoneNumberCheckbox = 'PhoneNumberCheckbox',
UsernameCheckbox = 'UsernameCheckbox',
@ -72,6 +74,11 @@ type ContactRowType = {
hasContextMenu?: boolean;
};
type ClearFilterButtonRowType = {
type: RowType.ClearFilterButton;
isOnNoResultsPage: boolean;
};
type ContactCheckboxRowType = {
type: RowType.ContactCheckbox;
contact: ContactListItemPropsType;
@ -158,6 +165,7 @@ export type Row =
| BlankRowType
| ContactRowType
| ContactCheckboxRowType
| ClearFilterButtonRowType
| PhoneNumberCheckboxRowType
| UsernameCheckboxRowType
| ConversationRowType
@ -197,6 +205,7 @@ export type PropsType = {
conversationId: string,
disabledReason: undefined | ContactCheckboxDisabledReason
) => void;
onClickClearFilterButton: () => void;
onPreloadConversation: (conversationId: string, messageId?: string) => void;
onSelectConversation: (conversationId: string, messageId?: string) => void;
onOutgoingAudioCallInConversation: (conversationId: string) => void;
@ -221,6 +230,7 @@ export function ConversationList({
blockConversation,
onClickArchiveButton,
onClickContactCheckbox,
onClickClearFilterButton,
onPreloadConversation,
onSelectConversation,
onOutgoingAudioCallInConversation,
@ -332,6 +342,24 @@ export function ConversationList({
/>
);
break;
case RowType.ClearFilterButton:
result = (
<div className="ClearFilterButton module-conversation-list__item--clear-filter-button">
<Button
variant={ButtonVariant.SecondaryAffirmative}
className={classNames('ClearFilterButton__inner', {
// The clear filter button should be closer to the empty state
// text than to the search results.
'ClearFilterButton__inner-vertical-center':
!row.isOnNoResultsPage,
})}
onClick={onClickClearFilterButton}
>
{i18n('icu:clearFilterButton')}
</Button>
</div>
);
break;
case RowType.PhoneNumberCheckbox:
result = (
<PhoneNumberCheckboxComponent
@ -527,6 +555,7 @@ export function ConversationList({
i18n,
lookupConversationWithoutServiceId,
onClickArchiveButton,
onClickClearFilterButton,
onClickContactCheckbox,
onOutgoingAudioCallInConversation,
onOutgoingVideoCallInConversation,