Sort by recency then alphabetically everywhere
This commit is contained in:
parent
9aff86f02b
commit
53ae88c777
11 changed files with 195 additions and 177 deletions
|
@ -8,7 +8,7 @@ import type { ListRowProps } from 'react-virtualized';
|
|||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
import type { LocalizerType } from '../types/Util';
|
||||
import { ToastType } from '../types/Toast';
|
||||
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
||||
import { filterAndSortConversations } from '../util/filterAndSortConversations';
|
||||
import { ConfirmationDialog } from './ConfirmationDialog';
|
||||
import type { GroupListItemConversationType } from './conversationList/GroupListItem';
|
||||
import {
|
||||
|
@ -56,7 +56,7 @@ export function AddUserToAnotherGroupModal({
|
|||
}: Props): JSX.Element | null {
|
||||
const [searchTerm, setSearchTerm] = React.useState('');
|
||||
const [filteredConversations, setFilteredConversations] = React.useState(
|
||||
filterAndSortConversationsByRecent(candidateConversations, '', undefined)
|
||||
filterAndSortConversations(candidateConversations, '', undefined)
|
||||
);
|
||||
|
||||
const [selectedGroupId, setSelectedGroupId] = React.useState<
|
||||
|
@ -78,7 +78,7 @@ export function AddUserToAnotherGroupModal({
|
|||
React.useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
setFilteredConversations(
|
||||
filterAndSortConversationsByRecent(
|
||||
filterAndSortConversations(
|
||||
candidateConversations,
|
||||
normalizedSearchTerm,
|
||||
regionCode
|
||||
|
|
|
@ -9,7 +9,7 @@ import { List } from 'react-virtualized';
|
|||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
import type { LocalizerType } from '../types/I18N';
|
||||
import { SearchInput } from './SearchInput';
|
||||
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
||||
import { filterAndSortConversations } from '../util/filterAndSortConversations';
|
||||
import { NavSidebarSearchHeader } from './NavSidebar';
|
||||
import { ListTile } from './ListTile';
|
||||
import { strictAssert } from '../util/assert';
|
||||
|
@ -89,11 +89,7 @@ export function CallsNewCall({
|
|||
if (query === '') {
|
||||
return activeConversations;
|
||||
}
|
||||
return filterAndSortConversationsByRecent(
|
||||
activeConversations,
|
||||
query,
|
||||
regionCode
|
||||
);
|
||||
return filterAndSortConversations(activeConversations, query, regionCode);
|
||||
}, [activeConversations, query, regionCode]);
|
||||
|
||||
const [groupConversations, directConversations] = useMemo(() => {
|
||||
|
|
|
@ -23,7 +23,7 @@ import type { LocalizerType, ThemeType } from '../types/Util';
|
|||
import type { SmartCompositionTextAreaProps } from '../state/smart/CompositionTextArea';
|
||||
import { SearchInput } from './SearchInput';
|
||||
import { StagedLinkPreview } from './conversation/StagedLinkPreview';
|
||||
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
||||
import { filterAndSortConversations } from '../util/filterAndSortConversations';
|
||||
import {
|
||||
shouldNeverBeCalled,
|
||||
asyncShouldNeverBeCalled,
|
||||
|
@ -96,7 +96,7 @@ export function ForwardMessagesModal({
|
|||
>([]);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const [filteredConversations, setFilteredConversations] = useState(
|
||||
filterAndSortConversationsByRecent(candidateConversations, '', regionCode)
|
||||
filterAndSortConversations(candidateConversations, '', regionCode)
|
||||
);
|
||||
const [isEditingMessage, setIsEditingMessage] = useState(false);
|
||||
const [cannotMessage, setCannotMessage] = useState(false);
|
||||
|
@ -169,7 +169,7 @@ export function ForwardMessagesModal({
|
|||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
setFilteredConversations(
|
||||
filterAndSortConversationsByRecent(
|
||||
filterAndSortConversations(
|
||||
candidateConversations,
|
||||
normalizedSearchTerm,
|
||||
regionCode
|
||||
|
|
|
@ -5,7 +5,7 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|||
import { noop, sortBy } from 'lodash';
|
||||
|
||||
import { SearchInput } from './SearchInput';
|
||||
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
||||
import { filterAndSortConversations } from '../util/filterAndSortConversations';
|
||||
|
||||
import type { ConversationType } from '../state/ducks/conversations';
|
||||
import type { ConversationWithStoriesType } from '../state/selectors/conversations';
|
||||
|
@ -175,11 +175,7 @@ export function SendStoryModal({
|
|||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
const [filteredConversations, setFilteredConversations] = useState(
|
||||
filterAndSortConversationsByRecent(
|
||||
groupConversations,
|
||||
searchTerm,
|
||||
undefined
|
||||
)
|
||||
filterAndSortConversations(groupConversations, searchTerm, undefined)
|
||||
);
|
||||
|
||||
const normalizedSearchTerm = searchTerm.trim();
|
||||
|
@ -187,7 +183,7 @@ export function SendStoryModal({
|
|||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
setFilteredConversations(
|
||||
filterAndSortConversationsByRecent(
|
||||
filterAndSortConversations(
|
||||
groupConversations,
|
||||
normalizedSearchTerm,
|
||||
undefined
|
||||
|
|
|
@ -27,7 +27,7 @@ import { MY_STORY_ID, getStoryDistributionListName } from '../types/Stories';
|
|||
import { PagedModal, ModalPage } from './Modal';
|
||||
import { SearchInput } from './SearchInput';
|
||||
import { StoryDistributionListName } from './StoryDistributionListName';
|
||||
import { filterAndSortConversationsByRecent } from '../util/filterAndSortConversations';
|
||||
import { filterAndSortConversations } from '../util/filterAndSortConversations';
|
||||
import { isNotNil } from '../util/isNotNil';
|
||||
import {
|
||||
shouldNeverBeCalled,
|
||||
|
@ -89,7 +89,7 @@ function filterConversations(
|
|||
conversations: ReadonlyArray<ConversationType>,
|
||||
searchTerm: string
|
||||
) {
|
||||
return filterAndSortConversationsByRecent(
|
||||
return filterAndSortConversations(
|
||||
conversations,
|
||||
searchTerm,
|
||||
undefined
|
||||
|
|
|
@ -19,7 +19,7 @@ import { missingCaseError } from '../../../../util/missingCaseError';
|
|||
import type { LookupConversationWithoutServiceIdActionsType } from '../../../../util/lookupConversationWithoutServiceId';
|
||||
import { parseAndFormatPhoneNumber } from '../../../../util/libphonenumberInstance';
|
||||
import type { ParsedE164Type } from '../../../../util/libphonenumberInstance';
|
||||
import { filterAndSortConversationsByRecent } from '../../../../util/filterAndSortConversations';
|
||||
import { filterAndSortConversations } from '../../../../util/filterAndSortConversations';
|
||||
import type { ConversationType } from '../../../../state/ducks/conversations';
|
||||
import type {
|
||||
UUIDFetchStateKeyType,
|
||||
|
@ -140,13 +140,13 @@ export function ChooseGroupMembersModal({
|
|||
const canContinue = Boolean(selectedContacts.length);
|
||||
|
||||
const [filteredContacts, setFilteredContacts] = useState(
|
||||
filterAndSortConversationsByRecent(candidateContacts, '', regionCode)
|
||||
filterAndSortConversations(candidateContacts, '', regionCode)
|
||||
);
|
||||
const normalizedSearchTerm = searchTerm.trim();
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
setFilteredContacts(
|
||||
filterAndSortConversationsByRecent(
|
||||
filterAndSortConversations(
|
||||
candidateContacts,
|
||||
normalizedSearchTerm,
|
||||
regionCode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue