/
LeftPaneHelper.tsx
143 lines (125 loc) · 3.9 KB
/
LeftPaneHelper.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ChangeEvent, ReactChild } from 'react';
import type { Row } from '../ConversationList';
import type { LocalizerType } from '../../types/Util';
import type {
DeleteAvatarFromDiskActionType,
ReplaceAvatarActionType,
SaveAvatarToDiskActionType,
} from '../../types/Avatar';
import type { DurationInSeconds } from '../../util/durations';
import type { LookupConversationWithoutServiceIdActionsType } from '../../util/lookupConversationWithoutServiceId';
import type { ShowConversationType } from '../../state/ducks/conversations';
export enum FindDirection {
Up,
Down,
}
export type ToFindType = {
direction: FindDirection;
unreadOnly: boolean;
};
export abstract class LeftPaneHelper<T> {
getHeaderContents(
_: Readonly<{
i18n: LocalizerType;
showInbox: () => void;
startComposing: () => void;
showChooseGroupMembers: () => void;
}>
): null | ReactChild {
return null;
}
getSearchInput(
_: Readonly<{
clearConversationSearch: () => unknown;
clearSearch: () => unknown;
i18n: LocalizerType;
onChangeComposeSearchTerm: (
event: ChangeEvent<HTMLInputElement>
) => unknown;
onChangeComposeSelectedRegion: (newRegion: string) => void;
updateSearchTerm: (searchTerm: string) => unknown;
showConversation: ShowConversationType;
showInbox: () => void;
}> &
LookupConversationWithoutServiceIdActionsType
): null | ReactChild {
return null;
}
getBackAction(
_: Readonly<{
showInbox: () => void;
startComposing: () => void;
showChooseGroupMembers: () => void;
}>
): undefined | (() => void) {
return undefined;
}
getPreRowsNode(
_: Readonly<{
clearConversationSearch: () => unknown;
clearGroupCreationError: () => void;
clearSearch: () => unknown;
closeMaximumGroupSizeModal: () => unknown;
closeRecommendedGroupSizeModal: () => unknown;
composeDeleteAvatarFromDisk: DeleteAvatarFromDiskActionType;
composeReplaceAvatar: ReplaceAvatarActionType;
composeSaveAvatarToDisk: SaveAvatarToDiskActionType;
createGroup: () => unknown;
i18n: LocalizerType;
removeSelectedContact: (_: string) => unknown;
setComposeGroupAvatar: (_: undefined | Uint8Array) => unknown;
setComposeGroupExpireTimer: (_: DurationInSeconds) => void;
setComposeGroupName: (_: string) => unknown;
toggleComposeEditingAvatar: () => unknown;
}>
): null | ReactChild {
return null;
}
getFooterContents(
_: Readonly<
{
i18n: LocalizerType;
startSettingGroupMetadata: () => void;
createGroup: () => unknown;
showInbox: () => void;
showConversation: ShowConversationType;
} & LookupConversationWithoutServiceIdActionsType
>
): null | ReactChild {
return null;
}
abstract getRowCount(): number;
abstract getRow(rowIndex: number): undefined | Row;
getRowIndexToScrollTo(
_selectedConversationId: undefined | string
): undefined | number {
return undefined;
}
isScrollable(): boolean {
return true;
}
requiresFullWidth(): boolean {
return true;
}
onKeyDown(
_event: KeyboardEvent,
_options: Readonly<{
searchInConversation: (conversationId: string) => unknown;
selectedConversationId: undefined | string;
startSearch: () => unknown;
}>
): void {
return undefined;
}
abstract getConversationAndMessageAtIndex(
conversationIndex: number
): undefined | { conversationId: string; messageId?: string };
abstract getConversationAndMessageInDirection(
toFind: Readonly<ToFindType>,
selectedConversationId: undefined | string,
targetedMessageId: undefined | string
): undefined | { conversationId: string; messageId?: string };
abstract shouldRecomputeRowHeights(old: Readonly<T>): boolean;
}