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
27 changed files with 883 additions and 438 deletions

View File

@@ -62,6 +62,7 @@ const defaultConversations: Array<ConversationType> = [
];
const defaultSearchProps = {
filterByUnread: false,
isSearchingGlobally: true,
searchConversation: undefined,
searchDisabled: false,
@@ -110,6 +111,7 @@ const pinnedConversations: Array<ConversationType> = [
const defaultModeSpecificProps = {
...defaultSearchProps,
filterByUnread: false,
mode: LeftPaneMode.Inbox as const,
pinnedConversations,
conversations: defaultConversations,
@@ -153,7 +155,7 @@ const useProps = (overrideProps: OverridePropsType = {}): PropsType => {
},
clearConversationSearch: action('clearConversationSearch'),
clearGroupCreationError: action('clearGroupCreationError'),
clearSearch: action('clearSearch'),
clearSearchQuery: action('clearSearchQuery'),
closeMaximumGroupSizeModal: action('closeMaximumGroupSizeModal'),
closeRecommendedGroupSizeModal: action('closeRecommendedGroupSizeModal'),
composeDeleteAvatarFromDisk: action('composeDeleteAvatarFromDisk'),
@@ -316,6 +318,7 @@ const useProps = (overrideProps: OverridePropsType = {}): PropsType => {
),
toggleNavTabsCollapse: action('toggleNavTabsCollapse'),
toggleProfileEditor: action('toggleProfileEditor'),
updateFilterByUnread: action('updateFilterByUnread'),
updateSearchTerm: action('updateSearchTerm'),
...overrideProps,
@@ -600,6 +603,43 @@ export function SearchNoResultsWhenSearchingInAConversation(): JSX.Element {
);
}
export function SearchNoResultsUnreadFilterAndQuery(): JSX.Element {
return (
<LeftPaneInContainer
{...useProps({
modeSpecificProps: {
...defaultSearchProps,
filterByUnread: true,
mode: LeftPaneMode.Search,
conversationResults: emptySearchResultsGroup,
contactResults: emptySearchResultsGroup,
messageResults: emptySearchResultsGroup,
primarySendsSms: false,
},
})}
/>
);
}
export function SearchNoResultsUnreadFilterWithoutQuery(): JSX.Element {
return (
<LeftPaneInContainer
{...useProps({
modeSpecificProps: {
...defaultSearchProps,
searchTerm: '',
filterByUnread: true,
mode: LeftPaneMode.Search,
conversationResults: emptySearchResultsGroup,
contactResults: emptySearchResultsGroup,
messageResults: emptySearchResultsGroup,
primarySendsSms: false,
},
})}
/>
);
}
export function SearchAllResultsLoading(): JSX.Element {
return (
<LeftPaneInContainer
@@ -683,6 +723,30 @@ export function SearchAllResults(): JSX.Element {
);
}
export function SearchAllResultsUnreadFilter(): JSX.Element {
return (
<LeftPaneInContainer
{...useProps({
modeSpecificProps: {
...defaultSearchProps,
filterByUnread: true,
mode: LeftPaneMode.Search,
conversationResults: {
isLoading: false,
results: defaultConversations,
},
contactResults: { isLoading: false, results: [] },
messageResults: {
isLoading: false,
results: [],
},
primarySendsSms: false,
},
})}
/>
);
}
export function ArchiveNoArchivedConversations(): JSX.Element {
return (
<LeftPaneInContainer