stream-chat-react
Version:
React components to create chat conversations or livestream style chat
56 lines (55 loc) • 2.27 kB
TypeScript
import type { Channel, ChannelSort, ChannelSortBase } from 'stream-chat';
import type { ChannelListProps } from './ChannelList';
export declare const MAX_QUERY_CHANNELS_LIMIT = 30;
type MoveChannelUpParams = {
channels: Array<Channel>;
cid: string;
activeChannel?: Channel;
};
/**
* @deprecated
*/
export declare const moveChannelUp: ({ activeChannel, channels, cid }: MoveChannelUpParams) => Channel[];
/**
* Expects channel array sorted by `{ pinned_at: -1 }`.
*
* TODO: add support for the `{ pinned_at: 1 }`
*/
export declare function findLastPinnedChannelIndex({ channels }: {
channels: Channel[];
}): number | null;
type MoveChannelUpwardsParams = {
channels: Array<Channel>;
channelToMove: Channel;
sort: ChannelSort;
/**
* If the index of the channel within `channels` list which is being moved upwards
* (`channelToMove`) is known, you can supply it to skip extra calculation.
*/
channelToMoveIndexWithinChannels?: number;
};
export declare const moveChannelUpwards: ({ channels, channelToMove, channelToMoveIndexWithinChannels, sort, }: MoveChannelUpwardsParams) => Channel[];
/**
* Returns `true` only if object with `pinned_at` property is first within the `sort` array
* or if `pinned_at` key of the `sort` object gets picked first when using `for...in` looping mechanism
* and value of the `pinned_at` is either `1` or `-1`.
*/
export declare const shouldConsiderPinnedChannels: (sort: ChannelListProps['sort']) => boolean;
export declare const extractSortValue: ({ atIndex, sort, targetKey, }: {
atIndex: number;
targetKey: keyof ChannelSortBase;
sort?: ChannelListProps['sort'];
}) => import("stream-chat").AscDesc | null;
/**
* Returns `true` only if `archived` property is of type `boolean` within `filters` object.
*/
export declare const shouldConsiderArchivedChannels: (filters: ChannelListProps['filters']) => boolean;
/**
* Returns `true` only if `pinned_at` property is of type `string` within `membership` object.
*/
export declare const isChannelPinned: (channel: Channel) => boolean;
/**
* Returns `true` only if `archived_at` property is of type `string` within `membership` object.
*/
export declare const isChannelArchived: (channel: Channel) => boolean;
export {};