33 lines · 855 B · TypeScript
RawDownload
export const CHAT_LIST_ANCHOR_OFFSET = 16; export interface ChatListAnchoredEndSpace {  readonly anchorIndex: number;  readonly anchorOffset: number;} export interface ChatListAnchorOptions {  readonly anchorOffset?: number;} export function resolveChatListAnchoredEndSpace<Item, AnchorId>(  items: ReadonlyArray<Item>,  anchorId: AnchorId | null,  getAnchorId: (item: Item) => AnchorId | null,  options: ChatListAnchorOptions = {},): ChatListAnchoredEndSpace | undefined {  if (anchorId === null) {    return undefined;  }   for (let index = items.length - 1; index >= 0; index -= 1) {    const item = items[index];    if (item !== undefined && getAnchorId(item) === anchorId) {      return {        anchorIndex: index,        anchorOffset: options.anchorOffset ?? CHAT_LIST_ANCHOR_OFFSET,      };    }  }   return undefined;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t