TeactN: Force full state return in withGlobal (#6240)
This commit is contained in:
parent
c7bf1ebd72
commit
8b1358dd8b
@ -250,7 +250,7 @@ const Component = ({ id, className, stateValue, onClick }: OwnProps & StateProps
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global, { id }): StateProps => {
|
export default memo(withGlobal<OwnProps>((global, { id }): Complete<StateProps> => {
|
||||||
|
|
||||||
const stateValue = selectValue(global, id);
|
const stateValue = selectValue(global, id);
|
||||||
return {
|
return {
|
||||||
@ -311,6 +311,7 @@ Global State is our single, app-wide store, similar to Redux or Zustand. All its
|
|||||||
* Wrap `withGlobal` in `memo` so the component re-renders only on real data changes.
|
* Wrap `withGlobal` in `memo` so the component re-renders only on real data changes.
|
||||||
* **Don't** return new arrays or objects inside `withGlobal`; that defeats memoization.
|
* **Don't** return new arrays or objects inside `withGlobal`; that defeats memoization.
|
||||||
* If you need to filter or map a list, **pass IDs as props** and do the heavy work in a `useMemo` hook.
|
* If you need to filter or map a list, **pass IDs as props** and do the heavy work in a `useMemo` hook.
|
||||||
|
* Force `Complete<StateProps>` return type for `withGlobal` parameter, as it ensures that all defined properties are passed.
|
||||||
|
|
||||||
### 3. Example Component
|
### 3. Example Component
|
||||||
|
|
||||||
|
|||||||
4
src/@types/global.d.ts
vendored
4
src/@types/global.d.ts
vendored
@ -47,6 +47,10 @@ type AnyToVoidFunction = (...args: any[]) => void;
|
|||||||
type BooleanToVoidFunction = (value: boolean) => void;
|
type BooleanToVoidFunction = (value: boolean) => void;
|
||||||
type NoneToVoidFunction = () => void;
|
type NoneToVoidFunction = () => void;
|
||||||
|
|
||||||
|
type Complete<T> = {
|
||||||
|
[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : (T[P] | undefined);
|
||||||
|
};
|
||||||
|
|
||||||
type EmojiCategory = {
|
type EmojiCategory = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@ -250,7 +250,7 @@ const App: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default withGlobal(
|
export default withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
authState: global.authState,
|
authState: global.authState,
|
||||||
isScreenLocked: global.passcode?.isScreenLocked,
|
isScreenLocked: global.passcode?.isScreenLocked,
|
||||||
|
|||||||
@ -99,7 +99,7 @@ const Auth: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
authState: global.authState,
|
authState: global.authState,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -132,5 +132,7 @@ const AuthCode: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => pick(global, ['authPhoneNumber', 'authIsCodeViaApp', 'authIsLoading', 'authErrorKey']),
|
(global): Complete<StateProps> => (
|
||||||
|
pick(global, ['authPhoneNumber', 'authIsCodeViaApp', 'authIsLoading', 'authErrorKey']) as Complete<StateProps>
|
||||||
|
),
|
||||||
)(AuthCode));
|
)(AuthCode));
|
||||||
|
|||||||
@ -50,5 +50,7 @@ const AuthPassword: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => pick(global, ['authIsLoading', 'authErrorKey', 'authHint']),
|
(global): Complete<StateProps> => (
|
||||||
|
pick(global, ['authIsLoading', 'authErrorKey', 'authHint']) as Complete<StateProps>
|
||||||
|
),
|
||||||
)(AuthPassword));
|
)(AuthPassword));
|
||||||
|
|||||||
@ -314,7 +314,7 @@ const AuthPhoneNumber: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
sharedState: { settings: { language } },
|
sharedState: { settings: { language } },
|
||||||
countryList: { phoneCodes: phoneCodeList },
|
countryList: { phoneCodes: phoneCodeList },
|
||||||
@ -335,6 +335,6 @@ export default memo(withGlobal(
|
|||||||
language,
|
language,
|
||||||
phoneCodeList,
|
phoneCodeList,
|
||||||
isTestServer: config?.isTestServer,
|
isTestServer: config?.isTestServer,
|
||||||
};
|
} as Complete<StateProps>;
|
||||||
},
|
},
|
||||||
)(AuthPhoneNumber));
|
)(AuthPhoneNumber));
|
||||||
|
|||||||
@ -205,7 +205,7 @@ const AuthCode = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
connectionState, authState, authQrCode,
|
connectionState, authState, authQrCode,
|
||||||
} = global;
|
} = global;
|
||||||
|
|||||||
@ -86,5 +86,7 @@ const AuthRegister: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => pick(global, ['authIsLoading', 'authErrorKey']),
|
(global): Complete<StateProps> => (
|
||||||
|
pick(global, ['authIsLoading', 'authErrorKey']) as Complete<StateProps>
|
||||||
|
),
|
||||||
)(AuthRegister));
|
)(AuthRegister));
|
||||||
|
|||||||
@ -182,7 +182,7 @@ function getFilteredList(countryList: ApiCountryCode[], filter = ''): ApiCountry
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { countryList: { phoneCodes: phoneCodeList } } = global;
|
const { countryList: { phoneCodes: phoneCodeList } } = global;
|
||||||
return {
|
return {
|
||||||
phoneCodeList,
|
phoneCodeList,
|
||||||
|
|||||||
@ -57,7 +57,7 @@ const ActiveCallHeader: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const tabState = selectTabState(global);
|
const tabState = selectTabState(global);
|
||||||
return {
|
return {
|
||||||
groupCall: tabState.isMasterTab ? selectActiveGroupCall(global) : undefined,
|
groupCall: tabState.isMasterTab ? selectActiveGroupCall(global) : undefined,
|
||||||
|
|||||||
@ -552,7 +552,7 @@ const GroupCall: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { groupCallId }): StateProps => {
|
(global, { groupCallId }): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
connectionState, title, participants, participantsCount, chatId,
|
connectionState, title, participants, participantsCount, chatId,
|
||||||
} = selectGroupCall(global, groupCallId) || {};
|
} = selectGroupCall(global, groupCallId) || {};
|
||||||
|
|||||||
@ -149,7 +149,7 @@ const GroupCallParticipant: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { participant }): StateProps => {
|
(global, { participant }): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
peer: selectUser(global, participant.id) || selectChat(global, participant.id),
|
peer: selectUser(global, participant.id) || selectChat(global, participant.id),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -24,7 +24,6 @@ type OwnProps = {
|
|||||||
type StateProps = {
|
type StateProps = {
|
||||||
participantsCount: number;
|
participantsCount: number;
|
||||||
participants?: Record<string, TypeGroupCallParticipant>;
|
participants?: Record<string, TypeGroupCallParticipant>;
|
||||||
canInvite?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const GroupCallParticipantList: FC<OwnProps & StateProps> = ({
|
const GroupCallParticipantList: FC<OwnProps & StateProps> = ({
|
||||||
@ -81,7 +80,7 @@ function compareParticipants(a: TypeGroupCallParticipant, b: TypeGroupCallPartic
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { participantsCount, participants } = selectActiveGroupCall(global) || {};
|
const { participantsCount, participants } = selectActiveGroupCall(global) || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -250,7 +250,7 @@ const GroupCallParticipantMenu: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
isAdmin: selectIsAdminInActiveGroupCall(global),
|
isAdmin: selectIsAdminInActiveGroupCall(global),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -317,7 +317,7 @@ const GroupCallParticipantVideo: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { participant }): StateProps => {
|
(global, { participant }): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
user: participant.isUser ? selectUser(global, participant.id) : undefined,
|
user: participant.isUser ? selectUser(global, participant.id) : undefined,
|
||||||
chat: !participant.isUser ? selectChat(global, participant.id) : undefined,
|
chat: !participant.isUser ? selectChat(global, participant.id) : undefined,
|
||||||
|
|||||||
@ -104,7 +104,7 @@ const GroupCallTopPane: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId }): StateProps => {
|
(global, { chatId }): Complete<StateProps> => {
|
||||||
const chat = selectChat(global, chatId)!;
|
const chat = selectChat(global, chatId)!;
|
||||||
const groupCall = selectChatGroupCall(global, chatId);
|
const groupCall = selectChatGroupCall(global, chatId);
|
||||||
const activeGroupCallId = selectTabState(global).isMasterTab ? global.groupCalls.activeGroupCallId : undefined;
|
const activeGroupCallId = selectTabState(global).isMasterTab ? global.groupCalls.activeGroupCallId : undefined;
|
||||||
|
|||||||
@ -161,7 +161,7 @@ const MicrophoneButton: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const groupCall = selectActiveGroupCall(global);
|
const groupCall = selectActiveGroupCall(global);
|
||||||
|
|
||||||
const { connectionState } = groupCall || {};
|
const { connectionState } = groupCall || {};
|
||||||
|
|||||||
@ -363,7 +363,7 @@ const PhoneCall: FC<StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { phoneCall, currentUserId } = global;
|
const { phoneCall, currentUserId } = global;
|
||||||
const { isCallPanelVisible, isMasterTab } = selectTabState(global);
|
const { isCallPanelVisible, isMasterTab } = selectTabState(global);
|
||||||
const user = selectPhoneCallUser(global);
|
const user = selectPhoneCallUser(global);
|
||||||
|
|||||||
@ -728,7 +728,7 @@ function renderSeekline(
|
|||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, {
|
(global, {
|
||||||
message,
|
message,
|
||||||
}): StateProps => {
|
}): Complete<StateProps> => {
|
||||||
const webPage = selectWebPageFromMessage(global, message);
|
const webPage = selectWebPageFromMessage(global, message);
|
||||||
const mediaDuration = selectMessageMediaDuration(global, message);
|
const mediaDuration = selectMessageMediaDuration(global, message);
|
||||||
|
|
||||||
|
|||||||
@ -115,7 +115,7 @@ function AvatarStoryCircle({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global, { peerId }): StateProps => {
|
export default memo(withGlobal<OwnProps>((global, { peerId }): Complete<StateProps> => {
|
||||||
const peerStories = selectPeerStories(global, peerId);
|
const peerStories = selectPeerStories(global, peerId);
|
||||||
const appTheme = selectTheme(global);
|
const appTheme = selectTheme(global);
|
||||||
|
|
||||||
|
|||||||
@ -2466,7 +2466,7 @@ const Composer: FC<OwnProps & StateProps> = ({
|
|||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, {
|
(global, {
|
||||||
chatId, threadId, storyId, messageListType, isMobile, type,
|
chatId, threadId, storyId, messageListType, isMobile, type,
|
||||||
}): StateProps => {
|
}): Complete<StateProps> => {
|
||||||
const appConfig = global.appConfig;
|
const appConfig = global.appConfig;
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
const chatBot = !isSystemBot(chatId) ? selectBot(global, chatId) : undefined;
|
const chatBot = !isSystemBot(chatId) ? selectBot(global, chatId) : undefined;
|
||||||
|
|||||||
@ -481,7 +481,7 @@ const CustomEmojiPicker: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId, isStatusPicker, isReactionPicker }): StateProps => {
|
(global, { chatId, isStatusPicker, isReactionPicker }): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
stickers: {
|
stickers: {
|
||||||
setsById: stickerSetsById,
|
setsById: stickerSetsById,
|
||||||
|
|||||||
@ -83,7 +83,7 @@ const CustomEmojiSetsModal: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
canPlayAnimatedEmojis: selectCanPlayAnimatedEmojis(global),
|
canPlayAnimatedEmojis: selectCanPlayAnimatedEmojis(global),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -239,7 +239,7 @@ const DeleteChatModal: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chat, isSavedDialog }): StateProps => {
|
(global, { chat, isSavedDialog }): Complete<StateProps> => {
|
||||||
const isPrivateChat = isUserId(chat.id);
|
const isPrivateChat = isUserId(chat.id);
|
||||||
const isChatWithSelf = selectIsChatWithSelf(global, chat.id);
|
const isChatWithSelf = selectIsChatWithSelf(global, chat.id);
|
||||||
const user = isPrivateChat && selectUser(global, getPrivateChatUserId(chat)!);
|
const user = isPrivateChat && selectUser(global, getPrivateChatUserId(chat)!);
|
||||||
|
|||||||
@ -59,7 +59,6 @@ export type OwnProps = {
|
|||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
chat?: ApiChat;
|
chat?: ApiChat;
|
||||||
isGroup?: boolean;
|
|
||||||
isChannel?: boolean;
|
isChannel?: boolean;
|
||||||
isSuperGroup?: boolean;
|
isSuperGroup?: boolean;
|
||||||
messageIds?: number[];
|
messageIds?: number[];
|
||||||
@ -492,7 +491,7 @@ const DeleteMessageModal: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
deleteMessageModal,
|
deleteMessageModal,
|
||||||
} = selectTabState(global);
|
} = selectTabState(global);
|
||||||
|
|||||||
@ -288,7 +288,7 @@ const GroupChatInfo: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId, threadId }): StateProps => {
|
(global, { chatId, threadId }): Complete<StateProps> => {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
const threadInfo = threadId ? selectThreadInfo(global, chatId, threadId) : undefined;
|
const threadInfo = threadId ? selectThreadInfo(global, chatId, threadId) : undefined;
|
||||||
const onlineCount = chat ? selectChatOnlineCount(global, chat) : undefined;
|
const onlineCount = chat ? selectChatOnlineCount(global, chat) : undefined;
|
||||||
|
|||||||
@ -119,7 +119,7 @@ function MessageSummary({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { message }): StateProps => {
|
(global, { message }): Complete<StateProps> => {
|
||||||
const poll = selectPollFromMessage(global, message);
|
const poll = selectPollFromMessage(global, message);
|
||||||
const webPage = selectWebPageFromMessage(global, message);
|
const webPage = selectWebPageFromMessage(global, message);
|
||||||
const storyData = message.content.storyData;
|
const storyData = message.content.storyData;
|
||||||
|
|||||||
@ -130,9 +130,12 @@ const PeerChip = <T,>({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { peerId, forceShowSelf }): StateProps => {
|
(global, { peerId, forceShowSelf }): Complete<StateProps> => {
|
||||||
if (!peerId) {
|
if (!peerId) {
|
||||||
return {};
|
return {
|
||||||
|
peer: undefined,
|
||||||
|
isSavedMessages: undefined,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const peer = selectPeer(global, peerId);
|
const peer = selectPeer(global, peerId);
|
||||||
|
|||||||
@ -104,7 +104,7 @@ const PinMessageModal = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId }): StateProps => {
|
(global, { chatId }): Complete<StateProps> => {
|
||||||
const isPrivateChat = isUserId(chatId);
|
const isPrivateChat = isUserId(chatId);
|
||||||
const isChatWithSelf = selectIsChatWithSelf(global, chatId);
|
const isChatWithSelf = selectIsChatWithSelf(global, chatId);
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
|
|||||||
@ -136,7 +136,7 @@ const PrivacySettingsNoticeModal = ({ isOpen, isReadDate, user }: OwnProps & Sta
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(
|
export default memo(
|
||||||
withGlobal<OwnProps>((global): StateProps => {
|
withGlobal<OwnProps>((global): Complete<StateProps> => {
|
||||||
const { chatId, isReadDate } = selectTabState(global).privacySettingsNoticeModal || {};
|
const { chatId, isReadDate } = selectTabState(global).privacySettingsNoticeModal || {};
|
||||||
const user = chatId ? selectUser(global, chatId) : undefined;
|
const user = chatId ? selectUser(global, chatId) : undefined;
|
||||||
|
|
||||||
|
|||||||
@ -262,7 +262,7 @@ const PrivateChatInfo: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { userId, forceShowSelf }): StateProps => {
|
(global, { userId, forceShowSelf }): Complete<StateProps> => {
|
||||||
const { isSynced } = global;
|
const { isSynced } = global;
|
||||||
const user = userId ? selectUser(global, userId) : undefined;
|
const user = userId ? selectUser(global, userId) : undefined;
|
||||||
const userStatus = userId ? selectUserStatus(global, userId) : undefined;
|
const userStatus = userId ? selectUserStatus(global, userId) : undefined;
|
||||||
|
|||||||
@ -450,7 +450,7 @@ const ProfileInfo: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { peerId }): StateProps => {
|
(global, { peerId }): Complete<StateProps> => {
|
||||||
const user = selectUser(global, peerId);
|
const user = selectUser(global, peerId);
|
||||||
const userFullInfo = user ? selectUserFullInfo(global, peerId) : undefined;
|
const userFullInfo = user ? selectUserFullInfo(global, peerId) : undefined;
|
||||||
const userStatus = selectUserStatus(global, peerId);
|
const userStatus = selectUserStatus(global, peerId);
|
||||||
@ -477,10 +477,8 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
emojiStatusSticker,
|
emojiStatusSticker,
|
||||||
emojiStatusSlug,
|
emojiStatusSlug,
|
||||||
profilePhotos,
|
profilePhotos,
|
||||||
...(topic && {
|
topic,
|
||||||
topic,
|
messagesCount: topic ? selectThreadMessagesCount(global, peerId, currentTopicId!) : undefined,
|
||||||
messagesCount: selectThreadMessagesCount(global, peerId, currentTopicId!),
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
)(ProfileInfo));
|
)(ProfileInfo));
|
||||||
|
|||||||
@ -143,7 +143,7 @@ const RecipientPicker: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
chats: {
|
chats: {
|
||||||
listIds,
|
listIds,
|
||||||
|
|||||||
@ -99,10 +99,12 @@ function SeenByModal({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { chatId, messageId } = selectTabState(global).seenByModal || {};
|
const { chatId, messageId } = selectTabState(global).seenByModal || {};
|
||||||
if (!chatId || !messageId) {
|
if (!chatId || !messageId) {
|
||||||
return {};
|
return {
|
||||||
|
seenByDates: undefined,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -51,7 +51,7 @@ const SensitiveContentConfirmModal = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global): StateProps => {
|
export default memo(withGlobal<OwnProps>((global): Complete<StateProps> => {
|
||||||
const appConfig = global.appConfig;
|
const appConfig = global.appConfig;
|
||||||
const verifyAgeMin = appConfig.verifyAgeMin;
|
const verifyAgeMin = appConfig.verifyAgeMin;
|
||||||
|
|
||||||
|
|||||||
@ -444,7 +444,7 @@ const StickerSet: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const collectibleStatuses = global.collectibleEmojiStatuses?.statuses;
|
const collectibleStatuses = global.collectibleEmojiStatuses?.statuses;
|
||||||
|
|
||||||
return { collectibleStatuses };
|
return { collectibleStatuses };
|
||||||
|
|||||||
@ -256,7 +256,7 @@ const StickerSetModal: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { fromSticker, stickerSetShortName }): StateProps => {
|
(global, { fromSticker, stickerSetShortName }): Complete<StateProps> => {
|
||||||
const currentMessageList = selectCurrentMessageList(global);
|
const currentMessageList = selectCurrentMessageList(global);
|
||||||
const { chatId, threadId } = currentMessageList || {};
|
const { chatId, threadId } = currentMessageList || {};
|
||||||
const chat = chatId && selectChat(global, chatId);
|
const chat = chatId && selectChat(global, chatId);
|
||||||
|
|||||||
@ -41,9 +41,9 @@ const TypingStatus: FC<OwnProps & StateProps> = ({ typingStatus, typingUser }) =
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { typingStatus }): StateProps => {
|
(global, { typingStatus }): Complete<StateProps> => {
|
||||||
if (!typingStatus.userId) {
|
if (!typingStatus.userId) {
|
||||||
return {};
|
return { typingUser: undefined };
|
||||||
}
|
}
|
||||||
|
|
||||||
const typingUser = selectUser(global, typingStatus.userId);
|
const typingUser = selectUser(global, typingStatus.userId);
|
||||||
|
|||||||
@ -171,7 +171,7 @@ const UiLoader: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default withGlobal<OwnProps>(
|
export default withGlobal<OwnProps>(
|
||||||
(global, { isMobile }): StateProps => {
|
(global, { isMobile }): Complete<StateProps> => {
|
||||||
const tabState = selectTabState(global);
|
const tabState = selectTabState(global);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -88,7 +88,7 @@ const VerificationMonetizationModal = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
twoFaSettings: {
|
twoFaSettings: {
|
||||||
hint: passwordHint,
|
hint: passwordHint,
|
||||||
|
|||||||
@ -139,7 +139,7 @@ const WebLink = ({
|
|||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, {
|
(global, {
|
||||||
message,
|
message,
|
||||||
}): StateProps => {
|
}): Complete<StateProps> => {
|
||||||
const webPage = selectWebPageFromMessage(global, message);
|
const webPage = selectWebPageFromMessage(global, message);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -134,7 +134,7 @@ const EmbeddedStoryForward: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { forwardInfo }): StateProps => {
|
(global, { forwardInfo }): Complete<StateProps> => {
|
||||||
const sender = forwardInfo.fromPeerId ? selectPeer(global, forwardInfo.fromPeerId) : undefined;
|
const sender = forwardInfo.fromPeerId ? selectPeer(global, forwardInfo.fromPeerId) : undefined;
|
||||||
const story = forwardInfo.storyId && forwardInfo.fromPeerId
|
const story = forwardInfo.storyId && forwardInfo.fromPeerId
|
||||||
? selectPeerStory(global, forwardInfo.fromPeerId, forwardInfo.storyId) : undefined;
|
? selectPeerStory(global, forwardInfo.fromPeerId, forwardInfo.storyId) : undefined;
|
||||||
|
|||||||
@ -69,7 +69,7 @@ const GiftRibbon = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
theme: selectTheme(global),
|
theme: selectTheme(global),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -229,7 +229,7 @@ const SavedGift = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { peerId, gift }): StateProps => {
|
(global, { peerId, gift }): Complete<StateProps> => {
|
||||||
const fromPeer = gift.fromId ? selectPeer(global, gift.fromId) : undefined;
|
const fromPeer = gift.fromId ? selectPeer(global, gift.fromId) : undefined;
|
||||||
const chat = selectChat(global, peerId);
|
const chat = selectChat(global, peerId);
|
||||||
const hasAdminRights = chat && getHasAdminRight(chat, 'postMessages');
|
const hasAdminRights = chat && getHasAdminRight(chat, 'postMessages');
|
||||||
|
|||||||
@ -98,7 +98,7 @@ function PaidMessagePrice({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const starsUsdWithdrawRateX1000 = global.appConfig.starsUsdWithdrawRateX1000;
|
const starsUsdWithdrawRateX1000 = global.appConfig.starsUsdWithdrawRateX1000;
|
||||||
const starsUsdWithdrawRate = starsUsdWithdrawRateX1000 ? starsUsdWithdrawRateX1000 / 1000 : 1;
|
const starsUsdWithdrawRate = starsUsdWithdrawRateX1000 ? starsUsdWithdrawRateX1000 / 1000 : 1;
|
||||||
const configStarsPaidMessageCommissionPermille = global.appConfig.starsPaidMessageCommissionPermille;
|
const configStarsPaidMessageCommissionPermille = global.appConfig.starsPaidMessageCommissionPermille;
|
||||||
|
|||||||
@ -484,7 +484,7 @@ const ChatExtra: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatOrUserId, isSavedDialog }): StateProps => {
|
(global, { chatOrUserId, isSavedDialog }): Complete<StateProps> => {
|
||||||
const { countryList: { phoneCodes: phoneCodeList } } = global;
|
const { countryList: { phoneCodes: phoneCodeList } } = global;
|
||||||
|
|
||||||
const chat = chatOrUserId ? selectChat(global, chatOrUserId) : undefined;
|
const chat = chatOrUserId ? selectChat(global, chatOrUserId) : undefined;
|
||||||
|
|||||||
@ -218,7 +218,7 @@ const UserBirthday = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { birthdayNumbers, animatedEmojiEffects } = global;
|
const { birthdayNumbers, animatedEmojiEffects } = global;
|
||||||
return {
|
return {
|
||||||
birthdayNumbers,
|
birthdayNumbers,
|
||||||
|
|||||||
@ -117,7 +117,7 @@ const ChatFolderModal: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { byId: foldersById, orderedIds: folderOrderedIds } = global.chatFolders;
|
const { byId: foldersById, orderedIds: folderOrderedIds } = global.chatFolders;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -565,7 +565,7 @@ function LeftColumn({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const tabState = selectTabState(global);
|
const tabState = selectTabState(global);
|
||||||
const {
|
const {
|
||||||
globalSearch: {
|
globalSearch: {
|
||||||
|
|||||||
@ -496,13 +496,13 @@ const Chat: FC<OwnProps & StateProps> = ({
|
|||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, {
|
(global, {
|
||||||
chatId, isSavedDialog, isPreview, previewMessageId,
|
chatId, isSavedDialog, isPreview, previewMessageId,
|
||||||
}): StateProps => {
|
}): Complete<StateProps> => {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
const user = selectUser(global, chatId);
|
const user = selectUser(global, chatId);
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
return {
|
return {
|
||||||
currentUserId: global.currentUserId!,
|
currentUserId: global.currentUserId!,
|
||||||
};
|
} as Complete<StateProps>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const folderIds = getChatFolderIds(chatId);
|
const folderIds = getChatFolderIds(chatId);
|
||||||
@ -553,9 +553,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
isForumPanelOpen: selectIsForumPanelOpen(global),
|
isForumPanelOpen: selectIsForumPanelOpen(global),
|
||||||
canScrollDown: isSelected && messageListType === 'thread',
|
canScrollDown: isSelected && messageListType === 'thread',
|
||||||
canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1,
|
canChangeFolder: (global.chatFolders.orderedIds?.length || 0) > 1,
|
||||||
...(isOutgoing && lastMessage && {
|
lastMessageOutgoingStatus: isOutgoing && lastMessage ? selectOutgoingStatus(global, lastMessage) : undefined,
|
||||||
lastMessageOutgoingStatus: selectOutgoingStatus(global, lastMessage),
|
|
||||||
}),
|
|
||||||
user,
|
user,
|
||||||
userStatus,
|
userStatus,
|
||||||
lastMessageTopic,
|
lastMessageTopic,
|
||||||
|
|||||||
@ -408,7 +408,7 @@ const ChatFolders: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
chatFolders: {
|
chatFolders: {
|
||||||
byId: chatFoldersById,
|
byId: chatFoldersById,
|
||||||
|
|||||||
@ -108,7 +108,7 @@ const ContactList: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { userIds: contactIds } = global.contactList || {};
|
const { userIds: contactIds } = global.contactList || {};
|
||||||
const { byId: usersById, statusesById: userStatusesById } = global.users;
|
const { byId: usersById, statusesById: userStatusesById } = global.users;
|
||||||
|
|
||||||
|
|||||||
@ -69,7 +69,7 @@ const EmptyFolder: FC<OwnProps & StateProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global, { folderId, folderType }): StateProps => {
|
export default memo(withGlobal<OwnProps>((global, { folderId, folderType }): Complete<StateProps> => {
|
||||||
const chatFolder = folderId && folderType === 'folder' ? selectChatFolder(global, folderId) : undefined;
|
const chatFolder = folderId && folderType === 'folder' ? selectChatFolder(global, folderId) : undefined;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -65,7 +65,7 @@ const EmptyForum: FC<OwnProps & StateProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global, { chatId }): StateProps => {
|
export default memo(withGlobal<OwnProps>((global, { chatId }): Complete<StateProps> => {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
const canManageTopics = chat && (chat.isCreator || getHasAdminRight(chat, 'manageTopics'));
|
const canManageTopics = chat && (chat.isCreator || getHasAdminRight(chat, 'manageTopics'));
|
||||||
|
|
||||||
|
|||||||
@ -288,7 +288,7 @@ const ForumPanel: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const chatId = selectTabState(global).forumPanelChatId;
|
const chatId = selectTabState(global).forumPanelChatId;
|
||||||
const chat = chatId ? selectChat(global, chatId) : undefined;
|
const chat = chatId ? selectChat(global, chatId) : undefined;
|
||||||
const {
|
const {
|
||||||
|
|||||||
@ -354,7 +354,7 @@ const LeftMainHeader: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const tabState = selectTabState(global);
|
const tabState = selectTabState(global);
|
||||||
const {
|
const {
|
||||||
query: searchQuery, fetchingStatus, chatId, minDate,
|
query: searchQuery, fetchingStatus, chatId, minDate,
|
||||||
|
|||||||
@ -258,7 +258,7 @@ const LeftSideMenuItems = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const tabState = selectTabState(global);
|
const tabState = selectTabState(global);
|
||||||
const {
|
const {
|
||||||
currentUserId, archiveSettings,
|
currentUserId, archiveSettings,
|
||||||
|
|||||||
@ -105,7 +105,7 @@ const StatusButton: FC<StateProps> = ({ emojiStatus, collectibleStatuses, isAcco
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal((global): StateProps => {
|
export default memo(withGlobal((global): Complete<StateProps> => {
|
||||||
const { currentUserId } = global;
|
const { currentUserId } = global;
|
||||||
const currentUser = currentUserId ? selectUser(global, currentUserId) : undefined;
|
const currentUser = currentUserId ? selectUser(global, currentUserId) : undefined;
|
||||||
const collectibleStatuses = global.collectibleEmojiStatuses?.statuses;
|
const collectibleStatuses = global.collectibleEmojiStatuses?.statuses;
|
||||||
|
|||||||
@ -82,7 +82,7 @@ const StatusPickerMenu: FC<OwnProps & StateProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global): StateProps => {
|
export default memo(withGlobal<OwnProps>((global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
areFeaturedStickersLoaded: Boolean(global.customEmojis.featuredIds?.length),
|
areFeaturedStickersLoaded: Boolean(global.customEmojis.featuredIds?.length),
|
||||||
isTranslucent: selectIsContextMenuTranslucent(global),
|
isTranslucent: selectIsContextMenuTranslucent(global),
|
||||||
|
|||||||
@ -131,7 +131,7 @@ const NewChatStep1: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { userIds: localContactIds } = global.contactList || {};
|
const { userIds: localContactIds } = global.contactList || {};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@ -222,7 +222,7 @@ const NewChatStep2: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
progress: creationProgress,
|
progress: creationProgress,
|
||||||
error: creationError,
|
error: creationError,
|
||||||
|
|||||||
@ -145,7 +145,7 @@ const BotAppResults: FC<OwnProps & StateProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global) => {
|
export default memo(withGlobal<OwnProps>((global): Complete<StateProps> => {
|
||||||
const globalSearch = selectTabState(global).globalSearch;
|
const globalSearch = selectTabState(global).globalSearch;
|
||||||
const foundIds = globalSearch.popularBotApps?.peerIds;
|
const foundIds = globalSearch.popularBotApps?.peerIds;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { memo } from '../../../lib/teact/teact';
|
|||||||
import { getActions, withGlobal } from '../../../global';
|
import { getActions, withGlobal } from '../../../global';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ApiChat, ApiMessage, ApiMessageOutgoingStatus,
|
ApiChat, ApiMessage,
|
||||||
ApiUser,
|
ApiUser,
|
||||||
} from '../../../api/types';
|
} from '../../../api/types';
|
||||||
|
|
||||||
@ -46,7 +46,6 @@ type OwnProps = {
|
|||||||
type StateProps = {
|
type StateProps = {
|
||||||
chat?: ApiChat;
|
chat?: ApiChat;
|
||||||
privateChatUser?: ApiUser;
|
privateChatUser?: ApiUser;
|
||||||
lastMessageOutgoingStatus?: ApiMessageOutgoingStatus;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ChatMessage: FC<OwnProps & StateProps> = ({
|
const ChatMessage: FC<OwnProps & StateProps> = ({
|
||||||
@ -141,10 +140,10 @@ function renderSummary(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId }): StateProps => {
|
(global, { chatId }): Complete<StateProps> => {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
if (!chat) {
|
if (!chat) {
|
||||||
return {};
|
return {} as Complete<StateProps>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const privateChatUserId = getPrivateChatUserId(chat);
|
const privateChatUserId = getPrivateChatUserId(chat);
|
||||||
@ -152,7 +151,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
chat,
|
chat,
|
||||||
...(privateChatUserId && { privateChatUser }),
|
privateChatUser,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
)(ChatMessage));
|
)(ChatMessage));
|
||||||
|
|||||||
@ -167,7 +167,7 @@ const ChatMessageResults: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { byId: chatsById } = global.chats;
|
const { byId: chatsById } = global.chats;
|
||||||
const { currentUserId, messages: { byChatId: globalMessagesByChatId } } = global;
|
const { currentUserId, messages: { byChatId: globalMessagesByChatId } } = global;
|
||||||
const {
|
const {
|
||||||
|
|||||||
@ -498,14 +498,14 @@ const ChatResults: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { isChannelList }): StateProps => {
|
(global, { isChannelList }): Complete<StateProps> => {
|
||||||
const { userIds: contactIds } = global.contactList || {};
|
const { userIds: contactIds } = global.contactList || {};
|
||||||
const {
|
const {
|
||||||
currentUserId, messages,
|
currentUserId, messages,
|
||||||
} = global;
|
} = global;
|
||||||
|
|
||||||
if (!contactIds) {
|
if (!contactIds) {
|
||||||
return {};
|
return {} as Complete<StateProps>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@ -197,7 +197,7 @@ const LeftSearch: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { currentContent, chatId } = selectTabState(global).globalSearch;
|
const { currentContent, chatId } = selectTabState(global).globalSearch;
|
||||||
const { animationLevel } = selectSharedSettings(global);
|
const { animationLevel } = selectSharedSettings(global);
|
||||||
|
|
||||||
|
|||||||
@ -158,7 +158,7 @@ const LeftSearchResultChat: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId }): StateProps => {
|
(global, { chatId }): Complete<StateProps> => {
|
||||||
const chat = selectChat(global, chatId);
|
const chat = selectChat(global, chatId);
|
||||||
const user = selectUser(global, chatId);
|
const user = selectUser(global, chatId);
|
||||||
const isPinned = selectIsChatPinned(global, chatId);
|
const isPinned = selectIsChatPinned(global, chatId);
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const LeftSearchResultTopic: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { chatId, topicId }): StateProps => {
|
(global, { chatId, topicId }): Complete<StateProps> => {
|
||||||
const topic = selectTopic(global, chatId, topicId);
|
const topic = selectTopic(global, chatId, topicId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -149,7 +149,7 @@ const PublicPostsResults = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { messages: { byChatId: globalMessagesByChatId } } = global;
|
const { messages: { byChatId: globalMessagesByChatId } } = global;
|
||||||
const { resultsByType, searchFlood, fetchingStatus } = selectTabState(global).globalSearch;
|
const { resultsByType, searchFlood, fetchingStatus } = selectTabState(global).globalSearch;
|
||||||
const publicPostsResult = resultsByType?.publicPosts;
|
const publicPostsResult = resultsByType?.publicPosts;
|
||||||
|
|||||||
@ -270,7 +270,7 @@ const PublicPostsSearchLauncher = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global): StateProps => ({
|
export default memo(withGlobal<OwnProps>((global): Complete<StateProps> => ({
|
||||||
isCurrentUserPremium: selectIsCurrentUserPremium(global),
|
isCurrentUserPremium: selectIsCurrentUserPremium(global),
|
||||||
starsBalance: global.stars?.balance?.amount || 0,
|
starsBalance: global.stars?.balance?.amount || 0,
|
||||||
}))(PublicPostsSearchLauncher));
|
}))(PublicPostsSearchLauncher));
|
||||||
|
|||||||
@ -130,7 +130,7 @@ const RecentContacts: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { userIds: topUserIds } = global.topPeers;
|
const { userIds: topUserIds } = global.topPeers;
|
||||||
const usersById = global.users.byId;
|
const usersById = global.users.byId;
|
||||||
const { recentlyFoundChatIds } = global;
|
const { recentlyFoundChatIds } = global;
|
||||||
|
|||||||
@ -86,7 +86,7 @@ const BlockUserModal: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
users: {
|
users: {
|
||||||
byId: usersById,
|
byId: usersById,
|
||||||
|
|||||||
@ -226,7 +226,7 @@ function PrivacyMessages({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global): StateProps => {
|
export default memo(withGlobal<OwnProps>((global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
settings: {
|
settings: {
|
||||||
privacy,
|
privacy,
|
||||||
|
|||||||
@ -141,7 +141,7 @@ const SettingsAcceptedGift = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
settings: {
|
settings: {
|
||||||
byKey: {
|
byKey: {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import {
|
|||||||
import { getActions, withGlobal } from '../../../global';
|
import { getActions, withGlobal } from '../../../global';
|
||||||
|
|
||||||
import type { ApiSession } from '../../../api/types';
|
import type { ApiSession } from '../../../api/types';
|
||||||
|
import type { GlobalState } from '../../../global/types';
|
||||||
|
|
||||||
import { formatPastTimeShort } from '../../../util/dates/dateFormat';
|
import { formatPastTimeShort } from '../../../util/dates/dateFormat';
|
||||||
import getSessionIcon from './helpers/getSessionIcon';
|
import getSessionIcon from './helpers/getSessionIcon';
|
||||||
@ -26,11 +27,7 @@ type OwnProps = {
|
|||||||
onReset: () => void;
|
onReset: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StateProps = {
|
type StateProps = GlobalState['activeSessions'];
|
||||||
byHash: Record<string, ApiSession>;
|
|
||||||
orderedHashes: string[];
|
|
||||||
ttlDays?: number;
|
|
||||||
};
|
|
||||||
|
|
||||||
const SettingsActiveSessions: FC<OwnProps & StateProps> = ({
|
const SettingsActiveSessions: FC<OwnProps & StateProps> = ({
|
||||||
isActive,
|
isActive,
|
||||||
@ -286,5 +283,5 @@ function getLocation(session: ApiSession) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => global.activeSessions,
|
(global): Complete<StateProps> => global.activeSessions as Complete<StateProps>,
|
||||||
)(SettingsActiveSessions));
|
)(SettingsActiveSessions));
|
||||||
|
|||||||
@ -101,7 +101,7 @@ const SettingsActiveWebsite: FC<OwnProps & StateProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global, { hash }): StateProps => {
|
export default memo(withGlobal<OwnProps>((global, { hash }): Complete<StateProps> => {
|
||||||
const session = hash ? global.activeWebSessions.byHash[hash] : undefined;
|
const session = hash ? global.activeWebSessions.byHash[hash] : undefined;
|
||||||
const bot = session ? global.users.byId[session.botId] : undefined;
|
const bot = session ? global.users.byId[session.botId] : undefined;
|
||||||
|
|
||||||
|
|||||||
@ -164,7 +164,7 @@ const SettingsActiveWebsites: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { byHash, orderedHashes } = global.activeWebSessions;
|
const { byHash, orderedHashes } = global.activeWebSessions;
|
||||||
return {
|
return {
|
||||||
byHash,
|
byHash,
|
||||||
|
|||||||
@ -94,7 +94,7 @@ const SettingsCustomEmoji: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
...pick(global.settings.byKey, [
|
...pick(global.settings.byKey, [
|
||||||
'shouldSuggestCustomEmoji',
|
'shouldSuggestCustomEmoji',
|
||||||
|
|||||||
@ -161,7 +161,7 @@ const SettingsDataStorage: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return pick(global.settings.byKey, [
|
return pick(global.settings.byKey, [
|
||||||
'canAutoLoadPhotoFromContacts',
|
'canAutoLoadPhotoFromContacts',
|
||||||
'canAutoLoadPhotoInPrivateChats',
|
'canAutoLoadPhotoInPrivateChats',
|
||||||
|
|||||||
@ -132,7 +132,7 @@ const SettingsDoNotTranslate: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
doNotTranslate,
|
doNotTranslate,
|
||||||
} = global.settings.byKey;
|
} = global.settings.byKey;
|
||||||
|
|||||||
@ -301,7 +301,7 @@ const SettingsEditProfile: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { currentUserId } = global;
|
const { currentUserId } = global;
|
||||||
const {
|
const {
|
||||||
progress, isUsernameAvailable, checkedUsername, error: editUsernameError,
|
progress, isUsernameAvailable, checkedUsername, error: editUsernameError,
|
||||||
@ -310,23 +310,13 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
|
|
||||||
const maxBioLength = selectCurrentLimit(global, 'aboutLength');
|
const maxBioLength = selectCurrentLimit(global, 'aboutLength');
|
||||||
|
|
||||||
if (!currentUser) {
|
|
||||||
return {
|
|
||||||
progress,
|
|
||||||
checkedUsername,
|
|
||||||
isUsernameAvailable,
|
|
||||||
editUsernameError,
|
|
||||||
maxBioLength,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
firstName: currentFirstName,
|
firstName: currentFirstName,
|
||||||
lastName: currentLastName,
|
lastName: currentLastName,
|
||||||
usernames,
|
usernames,
|
||||||
} = currentUser;
|
} = currentUser || {};
|
||||||
const currentUserFullInfo = currentUserId ? selectUserFullInfo(global, currentUserId) : undefined;
|
const currentUserFullInfo = currentUserId ? selectUserFullInfo(global, currentUserId) : undefined;
|
||||||
const currentAvatarHash = getChatAvatarHash(currentUser);
|
const currentAvatarHash = currentUser && getChatAvatarHash(currentUser);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentAvatarHash,
|
currentAvatarHash,
|
||||||
|
|||||||
@ -185,7 +185,7 @@ const SettingsExperimental = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
shouldForceHttpTransport,
|
shouldForceHttpTransport,
|
||||||
shouldAllowHttpTransport,
|
shouldAllowHttpTransport,
|
||||||
|
|||||||
@ -182,7 +182,7 @@ const SettingsGeneral: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
theme,
|
theme,
|
||||||
shouldUseSystemTheme,
|
shouldUseSystemTheme,
|
||||||
|
|||||||
@ -171,7 +171,7 @@ const SettingsGeneralBackground: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const theme = selectTheme(global);
|
const theme = selectTheme(global);
|
||||||
const { background, isBlurred } = selectThemeValues(global, theme) || {};
|
const { background, isBlurred } = selectThemeValues(global, theme) || {};
|
||||||
const { loadedWallpapers } = global.settings;
|
const { loadedWallpapers } = global.settings;
|
||||||
|
|||||||
@ -347,7 +347,7 @@ function drawHue(canvas: HTMLCanvasElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const theme = selectTheme(global);
|
const theme = selectTheme(global);
|
||||||
const { backgroundColor } = selectThemeValues(global, theme) || {};
|
const { backgroundColor } = selectThemeValues(global, theme) || {};
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -181,7 +181,7 @@ const SettingsLanguage: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
canTranslate, canTranslateChats, doNotTranslate,
|
canTranslate, canTranslateChats, doNotTranslate,
|
||||||
} = global.settings.byKey;
|
} = global.settings.byKey;
|
||||||
|
|||||||
@ -257,7 +257,7 @@ const SettingsMain: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const { currentUserId } = global;
|
const { currentUserId } = global;
|
||||||
const isGiveawayAvailable = selectIsGiveawayGiftsPurchaseAvailable(global);
|
const isGiveawayAvailable = selectIsGiveawayGiftsPurchaseAvailable(global);
|
||||||
const starsBalance = global.stars?.balance;
|
const starsBalance = global.stars?.balance;
|
||||||
|
|||||||
@ -239,7 +239,7 @@ const SettingsNotifications: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
hasContactJoinedNotifications: Boolean(global.settings.byKey.hasContactJoinedNotifications),
|
hasContactJoinedNotifications: Boolean(global.settings.byKey.hasContactJoinedNotifications),
|
||||||
hasWebNotifications: global.settings.byKey.hasWebNotifications,
|
hasWebNotifications: global.settings.byKey.hasWebNotifications,
|
||||||
|
|||||||
@ -226,7 +226,7 @@ function SettingsPerformance({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>((global): StateProps => {
|
export default memo(withGlobal<OwnProps>((global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
performanceSettings: selectPerformanceSettings(global),
|
performanceSettings: selectPerformanceSettings(global),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -461,7 +461,7 @@ const SettingsPrivacy: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
settings: {
|
settings: {
|
||||||
byKey: {
|
byKey: {
|
||||||
|
|||||||
@ -156,7 +156,7 @@ const SettingsPrivacyBlockedUsers: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
chats: {
|
chats: {
|
||||||
byId: chatsByIds,
|
byId: chatsByIds,
|
||||||
|
|||||||
@ -74,7 +74,7 @@ const SettingsPrivacyLastSeen = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
isCurrentUserPremium: selectIsCurrentUserPremium(global),
|
isCurrentUserPremium: selectIsCurrentUserPremium(global),
|
||||||
shouldHideReadMarks: Boolean(selectShouldHideReadMarks(global)),
|
shouldHideReadMarks: Boolean(selectShouldHideReadMarks(global)),
|
||||||
|
|||||||
@ -402,7 +402,7 @@ function PrivacySubsection({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { screen }): StateProps => {
|
(global, { screen }): Complete<StateProps> => {
|
||||||
let primaryPrivacy: ApiPrivacySettings | undefined;
|
let primaryPrivacy: ApiPrivacySettings | undefined;
|
||||||
let secondaryPrivacy: ApiPrivacySettings | undefined;
|
let secondaryPrivacy: ApiPrivacySettings | undefined;
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
currentUserId: currentUserId!,
|
currentUserId: currentUserId!,
|
||||||
hasCurrentUserFullInfo: Boolean(currentUserFullInfo),
|
hasCurrentUserFullInfo: Boolean(currentUserFullInfo),
|
||||||
currentUserFallbackPhoto: currentUserFullInfo?.fallbackPhoto,
|
currentUserFallbackPhoto: currentUserFullInfo?.fallbackPhoto,
|
||||||
};
|
} as Complete<StateProps>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -259,7 +259,7 @@ function getCurrentPrivacySettings(global: GlobalState, screen: SettingsScreens)
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { screen }): StateProps => {
|
(global, { screen }): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
currentUserId: global.currentUserId,
|
currentUserId: global.currentUserId,
|
||||||
settings: getCurrentPrivacySettings(global, screen),
|
settings: getCurrentPrivacySettings(global, screen),
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import type { FC } from '../../../lib/teact/teact';
|
|||||||
import { memo, useCallback, useMemo } from '../../../lib/teact/teact';
|
import { memo, useCallback, useMemo } from '../../../lib/teact/teact';
|
||||||
import { getActions, withGlobal } from '../../../global';
|
import { getActions, withGlobal } from '../../../global';
|
||||||
|
|
||||||
import type { ApiAvailableReaction } from '../../../api/types';
|
import type { ApiAvailableReaction, ApiReaction } from '../../../api/types';
|
||||||
|
|
||||||
import useHistoryBack from '../../../hooks/useHistoryBack';
|
import useHistoryBack from '../../../hooks/useHistoryBack';
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ type OwnProps = {
|
|||||||
|
|
||||||
type StateProps = {
|
type StateProps = {
|
||||||
availableReactions?: ApiAvailableReaction[];
|
availableReactions?: ApiAvailableReaction[];
|
||||||
selectedReaction?: string;
|
selectedReaction?: ApiReaction;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SettingsQuickReaction: FC<OwnProps & StateProps> = ({
|
const SettingsQuickReaction: FC<OwnProps & StateProps> = ({
|
||||||
@ -56,7 +56,7 @@ const SettingsQuickReaction: FC<OwnProps & StateProps> = ({
|
|||||||
<RadioGroup
|
<RadioGroup
|
||||||
name="quick-reaction-settings"
|
name="quick-reaction-settings"
|
||||||
options={options}
|
options={options}
|
||||||
selected={selectedReaction}
|
selected={selectedReaction?.type === 'emoji' ? selectedReaction.emoticon : undefined}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
withIcon
|
withIcon
|
||||||
/>
|
/>
|
||||||
@ -65,7 +65,7 @@ const SettingsQuickReaction: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global) => {
|
(global): Complete<StateProps> => {
|
||||||
const { config, reactions } = global;
|
const { config, reactions } = global;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -164,7 +164,7 @@ const SettingsStickers: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
...pick(global.settings.byKey, [
|
...pick(global.settings.byKey, [
|
||||||
'shouldSuggestStickers',
|
'shouldSuggestStickers',
|
||||||
|
|||||||
@ -170,7 +170,7 @@ const SettingsFoldersChatFilters: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
return {
|
return {
|
||||||
maxChats: selectCurrentLimit(global, 'dialogFiltersChats'),
|
maxChats: selectCurrentLimit(global, 'dialogFiltersChats'),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -472,7 +472,7 @@ const SettingsFoldersEdit: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global, { state }): StateProps => {
|
(global, { state }): Complete<StateProps> => {
|
||||||
const { listIds } = global.chats;
|
const { listIds } = global.chats;
|
||||||
const { byId, invites } = global.chatFolders;
|
const { byId, invites } = global.chatFolders;
|
||||||
const chatListCount = Object.values(byId).reduce((acc, el) => acc + (el.isChatList ? 1 : 0), 0);
|
const chatListCount = Object.values(byId).reduce((acc, el) => acc + (el.isChatList ? 1 : 0), 0);
|
||||||
|
|||||||
@ -416,7 +416,7 @@ const SettingsFoldersMain: FC<OwnProps & StateProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default memo(withGlobal<OwnProps>(
|
export default memo(withGlobal<OwnProps>(
|
||||||
(global): StateProps => {
|
(global): Complete<StateProps> => {
|
||||||
const {
|
const {
|
||||||
orderedIds: folderIds,
|
orderedIds: folderIds,
|
||||||
byId: foldersById,
|
byId: foldersById,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user