From fb614840f6ad225c1402f3c161db281a636edc63 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 13 Sep 2023 12:21:39 +0200 Subject: [PATCH] Refactoring: Introduce eslint-plugin-simple-import-sort plugin (#3802) --- .eslintrc | 54 +++- package-lock.json | 241 ++++++++++++++++-- package.json | 1 + src/api/gramjs/apiBuilders/appConfig.ts | 8 +- src/api/gramjs/apiBuilders/bots.ts | 9 +- src/api/gramjs/apiBuilders/calls.ts | 4 +- src/api/gramjs/apiBuilders/chats.ts | 26 +- src/api/gramjs/apiBuilders/common.ts | 15 +- src/api/gramjs/apiBuilders/messageContent.ts | 30 +-- src/api/gramjs/apiBuilders/messages.ts | 41 +-- src/api/gramjs/apiBuilders/misc.ts | 15 +- src/api/gramjs/apiBuilders/payments.ts | 8 +- src/api/gramjs/apiBuilders/reactions.ts | 2 + src/api/gramjs/apiBuilders/statistics.ts | 3 +- src/api/gramjs/apiBuilders/stories.ts | 2 +- src/api/gramjs/apiBuilders/symbols.ts | 7 +- src/api/gramjs/apiBuilders/users.ts | 4 +- src/api/gramjs/gramjsBuilders/index.ts | 28 +- src/api/gramjs/helpers.ts | 4 +- src/api/gramjs/localDb.ts | 8 +- src/api/gramjs/methods/account.ts | 6 +- src/api/gramjs/methods/auth.ts | 3 +- src/api/gramjs/methods/bots.ts | 26 +- src/api/gramjs/methods/calls.ts | 29 ++- src/api/gramjs/methods/chats.ts | 84 +++--- src/api/gramjs/methods/client.ts | 33 +-- src/api/gramjs/methods/init.ts | 22 +- src/api/gramjs/methods/management.ts | 8 +- src/api/gramjs/methods/media.ts | 5 +- src/api/gramjs/methods/messages.ts | 59 ++--- src/api/gramjs/methods/payments.ts | 19 +- src/api/gramjs/methods/phoneCallState.ts | 6 +- src/api/gramjs/methods/reactions.ts | 12 +- src/api/gramjs/methods/settings.ts | 25 +- src/api/gramjs/methods/statistics.ts | 11 +- src/api/gramjs/methods/stories.ts | 24 +- src/api/gramjs/methods/symbols.ts | 12 +- src/api/gramjs/methods/twoFaSettings.ts | 2 +- src/api/gramjs/methods/users.ts | 28 +- src/api/gramjs/scheduleUnmute.ts | 3 +- src/api/gramjs/updateManager.ts | 15 +- src/api/gramjs/updater.ts | 119 ++++----- src/api/gramjs/worker/connector.ts | 12 +- src/api/gramjs/worker/types.ts | 6 +- src/api/gramjs/worker/worker.ts | 6 +- src/api/types/calls.ts | 7 +- src/api/types/chats.ts | 2 +- src/api/types/misc.ts | 2 +- src/api/types/payments.ts | 4 +- src/api/types/stories.ts | 2 +- src/api/types/updates.ts | 26 +- src/api/types/users.ts | 4 +- src/bundles/calls.ts | 2 +- src/bundles/main.ts | 2 +- src/components/App.tsx | 24 +- src/components/auth/Auth.tsx | 10 +- src/components/auth/AuthCode.async.tsx | 2 + src/components/auth/AuthCode.tsx | 8 +- src/components/auth/AuthPassword.async.tsx | 2 + src/components/auth/AuthPassword.tsx | 3 +- src/components/auth/AuthPhoneNumber.tsx | 20 +- src/components/auth/AuthQrCode.tsx | 18 +- src/components/auth/AuthRegister.async.tsx | 2 + src/components/auth/AuthRegister.tsx | 5 +- src/components/auth/CountryCodeInput.tsx | 9 +- .../calls/ActiveCallHeader.async.tsx | 4 +- src/components/calls/ActiveCallHeader.tsx | 3 +- .../calls/group/GroupCall.async.tsx | 7 +- src/components/calls/group/GroupCall.tsx | 26 +- .../calls/group/GroupCallParticipant.tsx | 12 +- .../calls/group/GroupCallParticipantList.tsx | 7 +- .../calls/group/GroupCallParticipantMenu.tsx | 14 +- .../calls/group/GroupCallParticipantVideo.tsx | 26 +- .../calls/group/GroupCallTopPane.tsx | 7 +- .../calls/group/MicrophoneButton.tsx | 10 +- .../calls/group/OutlinedMicrophoneIcon.tsx | 6 +- .../group/helpers/formatGroupCallVolume.ts | 1 + .../group/hooks/useGroupCallVideoLayout.ts | 5 +- .../calls/phone/PhoneCall.async.tsx | 4 +- src/components/calls/phone/PhoneCall.tsx | 32 +-- .../calls/phone/RatePhoneCallModal.async.tsx | 1 + .../calls/phone/RatePhoneCallModal.tsx | 10 +- src/components/common/AboutAdsModal.async.tsx | 2 + src/components/common/AboutAdsModal.tsx | 3 +- src/components/common/AnimatedCounter.tsx | 5 +- src/components/common/AnimatedIcon.tsx | 2 +- .../common/AnimatedIconFromSticker.tsx | 2 +- .../common/AnimatedIconWithPreview.tsx | 5 +- src/components/common/AnimatedSticker.tsx | 23 +- src/components/common/Audio.tsx | 30 +-- src/components/common/Avatar.tsx | 14 +- src/components/common/AvatarList.tsx | 3 +- src/components/common/AvatarStoryCircle.tsx | 6 +- src/components/common/CalendarModal.async.tsx | 2 + src/components/common/CalendarModal.tsx | 12 +- src/components/common/ChatExtra.tsx | 24 +- .../common/ChatForumLastMessage.tsx | 13 +- src/components/common/ChatLink.tsx | 3 +- src/components/common/ChatOrUserPicker.tsx | 20 +- src/components/common/Composer.tsx | 128 +++++----- src/components/common/CustomEmoji.tsx | 9 +- src/components/common/CustomEmojiPicker.tsx | 30 +-- .../common/CustomEmojiSetsModal.async.tsx | 2 + .../common/CustomEmojiSetsModal.tsx | 7 +- src/components/common/DeleteChatModal.tsx | 25 +- .../common/DeleteMessageModal.async.tsx | 2 + src/components/common/DeleteMessageModal.tsx | 19 +- .../common/DeleteProfilePhotoModal.tsx | 8 +- src/components/common/Document.tsx | 14 +- src/components/common/DotAnimation.tsx | 3 +- src/components/common/EmbeddedMessage.tsx | 25 +- src/components/common/EmbeddedStory.tsx | 16 +- src/components/common/File.tsx | 19 +- src/components/common/FullNameTitle.tsx | 10 +- src/components/common/GifButton.tsx | 16 +- src/components/common/GroupCallLink.tsx | 2 +- src/components/common/GroupChatInfo.tsx | 13 +- src/components/common/InviteLink.tsx | 10 +- src/components/common/LastMessageMeta.tsx | 1 + src/components/common/ManageUsernames.tsx | 11 +- src/components/common/Media.tsx | 10 +- src/components/common/MediaSpoiler.tsx | 5 +- src/components/common/MessageSummary.tsx | 6 +- src/components/common/MessageText.tsx | 5 +- src/components/common/NothingFound.tsx | 3 +- src/components/common/PasswordForm.tsx | 7 +- src/components/common/PasswordMonkey.tsx | 10 +- src/components/common/Picker.tsx | 18 +- src/components/common/PickerSelectedItem.tsx | 7 +- .../common/PinMessageModal.async.tsx | 2 + src/components/common/PinMessageModal.tsx | 15 +- src/components/common/PrivateChatInfo.tsx | 16 +- src/components/common/ProfileInfo.tsx | 27 +- src/components/common/ProfilePhoto.tsx | 26 +- src/components/common/ReactionEmoji.tsx | 10 +- src/components/common/ReactionStaticEmoji.tsx | 9 +- src/components/common/RecipientPicker.tsx | 8 +- src/components/common/ReportModal.tsx | 10 +- src/components/common/SafeLink.tsx | 5 +- src/components/common/SeenByModal.async.tsx | 2 + src/components/common/SeenByModal.tsx | 10 +- src/components/common/SliderDots.tsx | 5 +- src/components/common/StickerButton.tsx | 19 +- src/components/common/StickerSet.tsx | 20 +- src/components/common/StickerSetCard.tsx | 8 +- .../common/StickerSetModal.async.tsx | 2 + src/components/common/StickerSetModal.tsx | 18 +- src/components/common/StickerView.tsx | 26 +- src/components/common/TopicChip.tsx | 5 +- src/components/common/TopicDefaultIcon.tsx | 7 +- src/components/common/TopicIcon.tsx | 4 +- src/components/common/TrackingMonkey.tsx | 2 +- src/components/common/TypingStatus.tsx | 5 +- src/components/common/UiLoader.tsx | 17 +- .../common/UnpinAllMessagesModal.async.tsx | 2 + .../common/UnpinAllMessagesModal.tsx | 2 +- src/components/common/UnreadCounter.tsx | 7 +- src/components/common/UserLink.tsx | 2 +- src/components/common/UsernameInput.tsx | 5 +- src/components/common/VerifiedIcon.tsx | 2 +- src/components/common/WebLink.tsx | 10 +- src/components/common/code/CodeBlock.tsx | 4 +- src/components/common/code/CodeOverlay.tsx | 4 +- .../common/helpers/animatedAssets.ts | 30 +-- .../common/helpers/mediaDimensions.ts | 4 +- .../helpers/renderActionMessageText.tsx | 14 +- .../common/helpers/renderMessageText.ts | 6 +- src/components/common/helpers/renderText.tsx | 8 +- .../common/helpers/renderTextWithEntities.tsx | 10 +- .../common/hooks/useAnimatedEmoji.ts | 3 +- src/components/common/hooks/useCustomEmoji.ts | 4 +- .../common/hooks/usePhotosPreload.ts | 4 +- .../common/hooks/useStickerPickerObservers.ts | 2 +- src/components/common/spoiler/Spoiler.tsx | 4 +- src/components/left/ArchivedChats.async.tsx | 3 + src/components/left/ArchivedChats.tsx | 25 +- src/components/left/ChatFolderModal.async.tsx | 4 +- src/components/left/ChatFolderModal.tsx | 5 +- .../left/ConnectionStatusOverlay.tsx | 7 +- src/components/left/LeftColumn.tsx | 16 +- src/components/left/MuteChatModal.async.tsx | 4 +- src/components/left/MuteChatModal.tsx | 5 +- src/components/left/NewChatButton.tsx | 3 +- src/components/left/main/Archive.tsx | 8 +- src/components/left/main/Chat.tsx | 28 +- src/components/left/main/ChatBadge.tsx | 8 +- src/components/left/main/ChatCallStatus.tsx | 1 + src/components/left/main/ChatFolders.tsx | 26 +- src/components/left/main/ChatList.tsx | 32 +-- .../left/main/ContactList.async.tsx | 5 +- src/components/left/main/ContactList.tsx | 11 +- src/components/left/main/EmptyFolder.tsx | 9 +- src/components/left/main/EmptyForum.tsx | 13 +- src/components/left/main/ForumPanel.tsx | 28 +- src/components/left/main/LeftMain.tsx | 20 +- src/components/left/main/LeftMainHeader.tsx | 36 +-- src/components/left/main/StatusButton.tsx | 13 +- .../left/main/StatusPickerMenu.async.tsx | 1 + src/components/left/main/StatusPickerMenu.tsx | 7 +- src/components/left/main/Topic.tsx | 22 +- .../left/main/hooks/useChatListEntry.tsx | 19 +- .../useLeftHeaderButtonRtlForumTransition.ts | 3 +- .../left/main/hooks/useOrderDiff.ts | 4 +- .../left/main/hooks/useTopicContextActions.ts | 2 +- src/components/left/newChat/NewChat.async.tsx | 4 +- .../left/newChat/NewChatStep1.async.tsx | 4 +- src/components/left/newChat/NewChatStep1.tsx | 9 +- .../left/newChat/NewChatStep2.async.tsx | 4 +- src/components/left/newChat/NewChatStep2.tsx | 16 +- src/components/left/search/AudioResults.tsx | 18 +- src/components/left/search/ChatMessage.tsx | 17 +- .../left/search/ChatMessageResults.tsx | 6 +- src/components/left/search/ChatResults.tsx | 26 +- src/components/left/search/DateSuggest.tsx | 1 + src/components/left/search/FileResults.tsx | 18 +- .../left/search/LeftSearch.async.tsx | 5 +- src/components/left/search/LeftSearch.tsx | 16 +- .../left/search/LeftSearchResultChat.tsx | 12 +- .../left/search/LeftSearchResultTopic.tsx | 5 +- src/components/left/search/LinkResults.tsx | 22 +- src/components/left/search/MediaResults.tsx | 12 +- src/components/left/search/RecentContacts.tsx | 10 +- .../search/helpers/createMapStateToProps.ts | 2 +- .../left/search/helpers/getSenderName.ts | 5 +- .../left/settings/BlockUserModal.tsx | 6 +- .../left/settings/Settings.async.tsx | 4 +- src/components/left/settings/Settings.tsx | 38 +-- .../left/settings/SettingsActiveSession.tsx | 11 +- .../left/settings/SettingsActiveSessions.tsx | 9 +- .../left/settings/SettingsActiveWebsite.tsx | 8 +- .../left/settings/SettingsActiveWebsites.tsx | 12 +- .../left/settings/SettingsCustomEmoji.tsx | 8 +- .../left/settings/SettingsDataStorage.tsx | 3 +- .../left/settings/SettingsDoNotTranslate.tsx | 6 +- .../left/settings/SettingsEditProfile.tsx | 26 +- .../left/settings/SettingsExperimental.tsx | 9 +- .../left/settings/SettingsGeneral.tsx | 18 +- .../settings/SettingsGeneralBackground.tsx | 19 +- .../SettingsGeneralBackgroundColor.tsx | 11 +- .../left/settings/SettingsHeader.tsx | 6 +- .../left/settings/SettingsLanguage.tsx | 12 +- src/components/left/settings/SettingsMain.tsx | 11 +- .../left/settings/SettingsNotifications.tsx | 9 +- .../left/settings/SettingsPasswordForm.tsx | 4 +- .../left/settings/SettingsPerformance.tsx | 9 +- .../left/settings/SettingsPrivacy.tsx | 4 +- .../settings/SettingsPrivacyBlockedUsers.tsx | 15 +- .../SettingsPrivacyPublicProfilePhoto.tsx | 6 +- .../settings/SettingsPrivacyVisibility.tsx | 5 +- ...SettingsPrivacyVisibilityExceptionList.tsx | 9 +- .../left/settings/SettingsQuickReaction.tsx | 2 +- .../left/settings/SettingsStickers.tsx | 18 +- .../left/settings/WallpaperTile.tsx | 11 +- .../left/settings/folders/SettingsFolders.tsx | 8 +- .../folders/SettingsFoldersChatFilters.tsx | 21 +- .../folders/SettingsFoldersChatsPicker.tsx | 30 ++- .../settings/folders/SettingsFoldersEdit.tsx | 33 +-- .../settings/folders/SettingsFoldersMain.tsx | 23 +- .../folders/SettingsShareChatlist.tsx | 18 +- .../settings/passcode/SettingsPasscode.tsx | 7 +- .../SettingsPasscodeCongratulations.tsx | 7 +- .../passcode/SettingsPasscodeEnabled.tsx | 9 +- .../passcode/SettingsPasscodeStart.tsx | 7 +- .../left/settings/twoFa/SettingsTwoFa.tsx | 8 +- .../twoFa/SettingsTwoFaCongratulations.tsx | 7 +- .../settings/twoFa/SettingsTwoFaEmailCode.tsx | 11 +- .../settings/twoFa/SettingsTwoFaEnabled.tsx | 9 +- .../twoFa/SettingsTwoFaSkippableForm.tsx | 17 +- .../settings/twoFa/SettingsTwoFaStart.tsx | 9 +- src/components/main/AppInactive.tsx | 3 +- .../main/AttachBotRecipientPicker.async.tsx | 4 +- .../main/AttachBotRecipientPicker.tsx | 4 +- src/components/main/BotTrustModal.async.tsx | 3 +- src/components/main/BotTrustModal.tsx | 2 +- src/components/main/ConfettiContainer.tsx | 14 +- .../main/DeleteFolderDialog.async.tsx | 3 +- src/components/main/DeleteFolderDialog.tsx | 4 +- src/components/main/Dialogs.async.tsx | 1 + src/components/main/Dialogs.tsx | 9 +- src/components/main/DownloadManager.tsx | 10 +- .../main/DraftRecipientPicker.async.tsx | 4 +- src/components/main/DraftRecipientPicker.tsx | 2 +- .../main/ForwardRecipientPicker.async.tsx | 4 +- .../main/ForwardRecipientPicker.tsx | 7 +- src/components/main/GameModal.tsx | 8 +- src/components/main/HistoryCalendar.async.tsx | 3 +- src/components/main/HistoryCalendar.tsx | 1 + src/components/main/LockScreen.async.tsx | 3 +- src/components/main/LockScreen.tsx | 10 +- src/components/main/Main.async.tsx | 3 +- src/components/main/Main.tsx | 100 ++++---- src/components/main/NewContactModal.async.tsx | 3 +- src/components/main/NewContactModal.tsx | 17 +- src/components/main/Notifications.async.tsx | 1 + src/components/main/SafeLinkModal.async.tsx | 3 +- src/components/main/SafeLinkModal.tsx | 3 +- src/components/main/premium/GiftOption.tsx | 5 +- .../main/premium/GiftPremiumModal.async.tsx | 3 +- .../main/premium/GiftPremiumModal.tsx | 10 +- .../main/premium/PremiumFeatureItem.tsx | 4 +- .../main/premium/PremiumFeatureModal.tsx | 15 +- .../main/premium/PremiumMainModal.async.tsx | 3 +- .../main/premium/PremiumMainModal.tsx | 75 +++--- .../common/PremiumLimitReachedModal.async.tsx | 3 +- .../common/PremiumLimitReachedModal.tsx | 15 +- .../premium/common/PremiumLimitsCompare.tsx | 3 +- .../PremiumFeaturePreviewStickers.tsx | 5 +- .../previews/PremiumFeaturePreviewStories.tsx | 6 +- .../previews/PremiumFeaturePreviewVideo.tsx | 6 +- .../mediaViewer/MediaViewer.async.tsx | 1 + src/components/mediaViewer/MediaViewer.tsx | 30 +-- .../mediaViewer/MediaViewerActions.tsx | 22 +- .../mediaViewer/MediaViewerContent.tsx | 12 +- .../mediaViewer/MediaViewerFooter.tsx | 7 +- .../mediaViewer/MediaViewerSlides.tsx | 16 +- src/components/mediaViewer/SeekLine.tsx | 24 +- src/components/mediaViewer/SenderInfo.tsx | 8 +- .../mediaViewer/SlideTransition.tsx | 3 +- src/components/mediaViewer/VideoPlayer.tsx | 12 +- .../mediaViewer/VideoPlayerControls.tsx | 29 ++- .../mediaViewer/helpers/ghostAnimation.ts | 13 +- .../mediaViewer/hooks/useControlsSignal.ts | 1 + .../mediaViewer/hooks/useMediaProps.ts | 31 ++- .../hooks/useVideoWaitingSignal.ts | 3 +- .../mediaViewer/hooks/useZoomChangeSignal.ts | 3 +- src/components/middle/ActionMessage.tsx | 23 +- .../middle/ActionMessageSuggestedAvatar.tsx | 10 +- src/components/middle/AudioPlayer.tsx | 23 +- .../middle/ChatLanguageModal.async.tsx | 2 + src/components/middle/ChatLanguageModal.tsx | 11 +- src/components/middle/ChatReportPanel.tsx | 10 +- src/components/middle/ContactGreeting.tsx | 4 +- .../middle/DeleteSelectedMessageModal.tsx | 14 +- .../EmojiInteractionAnimation.async.tsx | 2 + .../middle/EmojiInteractionAnimation.tsx | 13 +- .../middle/FloatingActionButtons.tsx | 4 +- src/components/middle/HeaderActions.tsx | 14 +- .../middle/HeaderMenuContainer.async.tsx | 2 + src/components/middle/HeaderMenuContainer.tsx | 48 ++-- src/components/middle/HeaderPinnedMessage.tsx | 22 +- src/components/middle/MessageList.tsx | 75 +++--- src/components/middle/MessageListBotInfo.tsx | 13 +- src/components/middle/MessageListContent.tsx | 25 +- .../middle/MessageListHistoryHandler.tsx | 5 +- .../middle/MessageSelectToolbar.async.tsx | 4 +- .../middle/MessageSelectToolbar.tsx | 12 +- src/components/middle/MiddleColumn.tsx | 106 ++++---- src/components/middle/MiddleHeader.tsx | 44 ++-- src/components/middle/MobileSearch.async.tsx | 2 + src/components/middle/MobileSearch.tsx | 13 +- src/components/middle/NoMessages.tsx | 5 +- .../middle/PinnedMessageNavigation.tsx | 4 +- .../middle/ReactorListModal.async.tsx | 2 + src/components/middle/ReactorListModal.tsx | 27 +- src/components/middle/ScrollDownButton.tsx | 9 +- .../middle/composer/AttachBotIcon.tsx | 3 +- .../middle/composer/AttachBotItem.tsx | 6 +- src/components/middle/composer/AttachMenu.tsx | 19 +- .../middle/composer/AttachmentModal.async.tsx | 2 + .../middle/composer/AttachmentModal.tsx | 44 ++-- .../middle/composer/AttachmentModalItem.tsx | 4 +- src/components/middle/composer/BotCommand.tsx | 4 +- .../middle/composer/BotCommandMenu.async.tsx | 2 + .../middle/composer/BotCommandMenu.tsx | 4 +- .../composer/BotCommandTooltip.async.tsx | 2 + .../middle/composer/BotCommandTooltip.tsx | 6 +- .../middle/composer/BotKeyboardMenu.tsx | 5 +- .../composer/ComposerEmbeddedMessage.tsx | 30 +-- .../middle/composer/CustomEmojiButton.tsx | 2 +- .../composer/CustomEmojiTooltip.async.tsx | 2 + .../middle/composer/CustomEmojiTooltip.tsx | 12 +- .../middle/composer/CustomSendMenu.async.tsx | 2 + .../middle/composer/CustomSendMenu.tsx | 5 +- .../middle/composer/DropArea.async.tsx | 2 + src/components/middle/composer/DropArea.tsx | 5 +- src/components/middle/composer/DropTarget.tsx | 3 +- .../middle/composer/EmojiButton.tsx | 7 +- .../middle/composer/EmojiCategory.tsx | 10 +- .../middle/composer/EmojiPicker.tsx | 31 +-- .../middle/composer/EmojiTooltip.async.tsx | 2 + .../middle/composer/EmojiTooltip.tsx | 14 +- src/components/middle/composer/GifPicker.tsx | 10 +- .../composer/InlineBotTooltip.async.tsx | 2 + .../middle/composer/InlineBotTooltip.tsx | 22 +- .../middle/composer/MentionTooltip.async.tsx | 2 + .../middle/composer/MentionTooltip.tsx | 4 +- .../middle/composer/MessageInput.tsx | 27 +- .../middle/composer/PollModal.async.tsx | 2 + src/components/middle/composer/PollModal.tsx | 8 +- .../middle/composer/SendAsMenu.async.tsx | 2 + src/components/middle/composer/SendAsMenu.tsx | 16 +- .../middle/composer/StickerPicker.tsx | 31 +-- .../middle/composer/StickerSetCover.tsx | 16 +- .../middle/composer/StickerTooltip.async.tsx | 2 + .../middle/composer/StickerTooltip.tsx | 7 +- .../middle/composer/SymbolMenu.async.tsx | 2 + src/components/middle/composer/SymbolMenu.tsx | 22 +- .../middle/composer/SymbolMenuButton.tsx | 8 +- .../middle/composer/SymbolMenuFooter.tsx | 2 +- .../middle/composer/TextFormatter.async.tsx | 2 + .../middle/composer/TextFormatter.tsx | 8 +- .../middle/composer/WebPagePreview.tsx | 20 +- .../composer/helpers/buildAttachment.ts | 3 +- .../middle/composer/helpers/customEmoji.ts | 7 +- .../composer/hooks/useAttachmentModal.ts | 4 +- .../composer/hooks/useBotCommandTooltip.ts | 5 +- .../composer/hooks/useClipboardPaste.ts | 8 +- .../composer/hooks/useCustomEmojiTooltip.ts | 16 +- .../middle/composer/hooks/useDraft.ts | 16 +- .../middle/composer/hooks/useEditing.ts | 12 +- .../middle/composer/hooks/useEmojiTooltip.ts | 16 +- .../composer/hooks/useInlineBotTooltip.ts | 10 +- .../composer/hooks/useInputCustomEmojis.ts | 18 +- .../composer/hooks/useMentionTooltip.ts | 12 +- .../composer/hooks/useStickerTooltip.ts | 8 +- .../composer/hooks/useVoiceRecording.ts | 6 +- .../composer/inlineResults/BaseResult.tsx | 3 +- .../composer/inlineResults/GifResult.tsx | 1 - .../composer/inlineResults/StickerResult.tsx | 2 +- .../middle/helpers/groupMessages.ts | 2 +- src/components/middle/hooks/useAuthorWidth.ts | 1 + .../middle/hooks/useContainerHeight.ts | 2 +- .../middle/hooks/useMessageObservers.ts | 5 +- .../middle/hooks/usePinnedMessage.ts | 4 +- src/components/middle/hooks/useScrollHooks.ts | 16 +- src/components/middle/hooks/useStickyDates.ts | 2 +- src/components/middle/message/Album.tsx | 10 +- .../middle/message/AnimatedCustomEmoji.tsx | 3 +- .../middle/message/AnimatedEmoji.tsx | 3 +- src/components/middle/message/BaseStory.tsx | 10 +- .../middle/message/CommentButton.tsx | 6 +- src/components/middle/message/Contact.tsx | 4 +- .../message/ContextMenuContainer.async.tsx | 2 + .../middle/message/ContextMenuContainer.tsx | 40 +-- .../middle/message/CustomEmojiEffect.tsx | 5 +- src/components/middle/message/Game.tsx | 2 +- .../middle/message/InlineButtons.tsx | 3 +- src/components/middle/message/Invoice.tsx | 6 +- .../middle/message/InvoiceMediaPreview.tsx | 10 +- src/components/middle/message/Location.tsx | 16 +- src/components/middle/message/Message.tsx | 161 ++++++------ .../middle/message/MessageContextMenu.tsx | 22 +- src/components/middle/message/MessageMeta.tsx | 10 +- .../middle/message/MessagePhoneCall.tsx | 4 +- src/components/middle/message/Photo.tsx | 30 +-- src/components/middle/message/Poll.tsx | 20 +- src/components/middle/message/PollOption.tsx | 3 +- .../middle/message/ReactionAnimatedEmoji.tsx | 14 +- .../middle/message/ReactionButton.tsx | 12 +- .../middle/message/ReactionPicker.async.tsx | 2 + .../middle/message/ReactionPicker.tsx | 16 +- .../middle/message/ReactionPickerLimited.tsx | 12 +- .../middle/message/ReactionSelector.tsx | 10 +- .../message/ReactionSelectorReaction.tsx | 7 +- src/components/middle/message/Reactions.tsx | 3 +- src/components/middle/message/RoundVideo.tsx | 28 +- .../middle/message/SponsoredMessage.tsx | 14 +- ...soredMessageContextMenuContainer.async.tsx | 2 + .../SponsoredMessageContextMenuContainer.tsx | 2 +- src/components/middle/message/Sticker.tsx | 18 +- .../middle/message/StoryMention.tsx | 6 +- src/components/middle/message/Video.tsx | 36 +-- src/components/middle/message/WebPage.tsx | 16 +- .../message/helpers/calculateAlbumLayout.ts | 4 +- .../middle/message/helpers/copyOptions.ts | 5 +- .../middle/message/helpers/mediaDimensions.ts | 9 +- .../middle/message/hocs/withSelectControl.tsx | 5 +- .../message/hooks/useBlurredMediaThumbRef.ts | 5 +- .../message/hooks/useDetectChatLanguage.ts | 5 +- .../middle/message/hooks/useFocusMessage.ts | 2 +- .../middle/message/hooks/useInnerHandlers.ts | 9 +- .../message/hooks/useMessageTranslation.ts | 2 + .../middle/message/hooks/useOuterHandlers.ts | 15 +- .../middle/message/hooks/useVideoAutoPause.ts | 3 +- .../AttachBotInstallModal.async.tsx | 3 +- .../AttachBotInstallModal.tsx | 4 +- .../modals/chatlist/ChatlistAlready.tsx | 6 +- .../modals/chatlist/ChatlistDelete.tsx | 10 +- .../modals/chatlist/ChatlistModal.async.tsx | 3 +- .../modals/chatlist/ChatlistModal.tsx | 12 +- .../modals/chatlist/ChatlistNew.tsx | 6 +- src/components/modals/map/MapModal.async.tsx | 3 +- src/components/modals/map/MapModal.tsx | 4 +- .../modals/urlAuth/UrlAuthModal.async.tsx | 4 +- .../modals/urlAuth/UrlAuthModal.tsx | 8 +- .../modals/webApp/WebAppModal.async.tsx | 3 +- src/components/modals/webApp/WebAppModal.tsx | 20 +- .../modals/webApp/hooks/usePopupLimit.ts | 1 + src/components/payment/CardInput.tsx | 8 +- src/components/payment/Checkout.tsx | 14 +- src/components/payment/ConfirmPayment.tsx | 4 +- src/components/payment/ExpiryInput.tsx | 3 +- src/components/payment/PasswordConfirm.tsx | 5 +- src/components/payment/PaymentInfo.tsx | 9 +- src/components/payment/PaymentModal.async.tsx | 2 + src/components/payment/PaymentModal.tsx | 27 +- src/components/payment/ReceiptModal.async.tsx | 2 + src/components/payment/ReceiptModal.tsx | 16 +- .../payment/SavedPaymentCredentials.tsx | 5 +- src/components/payment/Shipping.tsx | 6 +- src/components/payment/ShippingInfo.tsx | 7 +- src/components/right/AddChatMembers.tsx | 9 +- src/components/right/CreateTopic.async.tsx | 3 + src/components/right/CreateTopic.tsx | 16 +- src/components/right/DeleteMemberModal.tsx | 5 +- src/components/right/EditTopic.async.tsx | 3 + src/components/right/EditTopic.tsx | 16 +- src/components/right/GifSearch.async.tsx | 2 + src/components/right/GifSearch.tsx | 19 +- src/components/right/PollAnswerResults.tsx | 21 +- src/components/right/PollResults.async.tsx | 2 + src/components/right/PollResults.tsx | 10 +- src/components/right/Profile.tsx | 61 ++--- src/components/right/RightColumn.tsx | 26 +- src/components/right/RightHeader.tsx | 24 +- src/components/right/RightSearch.async.tsx | 3 + src/components/right/RightSearch.tsx | 24 +- src/components/right/StickerSearch.async.tsx | 2 + src/components/right/StickerSearch.tsx | 5 +- src/components/right/StickerSetResult.tsx | 5 +- .../right/hooks/useAsyncRendering.ts | 2 +- src/components/right/hooks/useProfileState.ts | 2 +- .../right/hooks/useProfileViewportIds.ts | 3 +- .../right/hooks/useTransitionFixes.ts | 3 +- .../right/management/JoinRequest.tsx | 3 +- .../right/management/ManageChannel.tsx | 17 +- .../management/ManageChatAdministrators.tsx | 9 +- .../management/ManageChatPrivacyType.tsx | 21 +- .../management/ManageChatRemovedUsers.tsx | 11 +- .../right/management/ManageDiscussion.tsx | 25 +- .../right/management/ManageGroup.tsx | 17 +- .../management/ManageGroupAdminRights.tsx | 11 +- .../right/management/ManageGroupMembers.tsx | 18 +- .../management/ManageGroupPermissions.tsx | 13 +- .../management/ManageGroupUserPermissions.tsx | 13 +- .../ManageGroupUserPermissionsCreate.tsx | 5 +- .../right/management/ManageInvite.tsx | 15 +- .../right/management/ManageInviteInfo.tsx | 13 +- .../right/management/ManageInvites.tsx | 23 +- .../right/management/ManageJoinRequests.tsx | 15 +- .../right/management/ManageReactions.tsx | 8 +- .../right/management/ManageUser.tsx | 21 +- .../right/management/Management.async.tsx | 3 +- .../right/management/Management.tsx | 18 +- .../right/management/RemoveGroupUserModal.tsx | 4 +- .../statistics/MessageStatistics.async.tsx | 4 +- .../right/statistics/MessageStatistics.tsx | 10 +- .../right/statistics/Statistics.async.tsx | 4 +- .../right/statistics/Statistics.tsx | 14 +- .../right/statistics/StatisticsOverview.tsx | 5 +- .../statistics/StatisticsPublicForward.tsx | 8 +- .../statistics/StatisticsRecentMessage.tsx | 12 +- src/components/story/MediaAreaOverlay.tsx | 2 +- src/components/story/MediaStory.tsx | 6 +- src/components/story/StealthModeModal.tsx | 2 +- src/components/story/Story.tsx | 43 ++-- src/components/story/StoryCaption.tsx | 4 +- .../story/StoryDeleteConfirmModal.tsx | 1 - src/components/story/StoryPreview.tsx | 3 +- src/components/story/StoryRibbon.tsx | 5 +- src/components/story/StoryRibbonButton.tsx | 4 +- src/components/story/StorySettings.tsx | 14 +- src/components/story/StorySlides.tsx | 8 +- src/components/story/StoryToggler.tsx | 2 +- src/components/story/StoryView.tsx | 10 +- src/components/story/StoryViewModal.tsx | 14 +- src/components/story/StoryViewer.async.tsx | 1 + src/components/story/StoryViewer.tsx | 26 +- .../story/helpers/ghostAnimation.ts | 14 +- src/components/story/hooks/useSlideSizes.ts | 4 +- .../story/hooks/useStoryPreloader.ts | 2 +- src/components/story/hooks/useStoryProps.ts | 6 +- .../story/privacy/AllowDenyList.tsx | 12 +- src/components/story/privacy/CloseFriends.tsx | 2 +- src/components/test/SubTest.tsx | 1 + src/components/test/Test.tsx | 3 +- src/components/test/TestCleanupOrder.tsx | 2 +- src/components/test/TestNoRedundancy.tsx | 1 + src/components/ui/AvatarEditable.tsx | 2 +- src/components/ui/Badge.tsx | 3 +- src/components/ui/Button.tsx | 5 +- src/components/ui/Checkbox.tsx | 3 +- src/components/ui/CheckboxGroup.tsx | 2 +- src/components/ui/ConfirmDialog.tsx | 7 +- src/components/ui/CropModal.tsx | 7 +- src/components/ui/Draggable.tsx | 8 +- src/components/ui/DropdownMenu.tsx | 8 +- src/components/ui/FloatingActionButton.tsx | 3 +- src/components/ui/InfiniteScroll.tsx | 11 +- src/components/ui/InputText.tsx | 1 + src/components/ui/ListItem.tsx | 14 +- src/components/ui/Menu.tsx | 18 +- src/components/ui/MenuItem.tsx | 4 +- src/components/ui/MenuSeparator.tsx | 3 +- src/components/ui/Modal.tsx | 18 +- src/components/ui/Notification.tsx | 7 +- src/components/ui/OptimizedVideo.tsx | 6 +- src/components/ui/Portal.ts | 2 +- src/components/ui/ProgressSpinner.tsx | 9 +- src/components/ui/Radio.tsx | 1 + src/components/ui/RadioGroup.tsx | 2 +- src/components/ui/RangeSlider.tsx | 3 +- src/components/ui/RippleEffect.tsx | 3 +- src/components/ui/SearchInput.tsx | 11 +- src/components/ui/SelectAvatar.tsx | 4 +- src/components/ui/ShowTransition.tsx | 5 +- src/components/ui/Tab.tsx | 10 +- src/components/ui/TabList.tsx | 8 +- src/components/ui/TextArea.tsx | 6 +- src/components/ui/TextTimer.tsx | 4 +- src/components/ui/Transition.tsx | 12 +- src/components/ui/placeholder/Skeleton.tsx | 3 +- src/electron/autoUpdates.ts | 7 +- src/electron/main.ts | 2 +- src/electron/preload.ts | 2 +- src/electron/utils.ts | 2 +- src/electron/window.ts | 5 +- src/electron/windowState.ts | 1 - src/global/actions/all.ts | 2 - src/global/actions/api/accounts.ts | 12 +- src/global/actions/api/bots.ts | 33 ++- src/global/actions/api/calls.async.ts | 35 ++- src/global/actions/api/chats.ts | 116 ++++----- src/global/actions/api/globalSearch.ts | 21 +- src/global/actions/api/initial.ts | 51 ++-- src/global/actions/api/localSearch.ts | 31 ++- src/global/actions/api/management.ts | 13 +- src/global/actions/api/messages.ts | 47 ++-- src/global/actions/api/payments.ts | 59 +++-- src/global/actions/api/reactions.ts | 28 +- src/global/actions/api/settings.ts | 32 +-- src/global/actions/api/statistics.ts | 16 +- src/global/actions/api/stories.ts | 13 +- src/global/actions/api/symbols.ts | 38 +-- src/global/actions/api/sync.ts | 16 +- src/global/actions/api/twoFaSettings.ts | 4 +- src/global/actions/api/users.ts | 31 ++- src/global/actions/apiUpdaters/calls.async.ts | 21 +- src/global/actions/apiUpdaters/calls.ts | 19 +- src/global/actions/apiUpdaters/chats.ts | 27 +- src/global/actions/apiUpdaters/initial.ts | 41 ++- src/global/actions/apiUpdaters/messages.ts | 88 +++---- src/global/actions/apiUpdaters/misc.ts | 3 +- src/global/actions/apiUpdaters/payments.ts | 16 +- src/global/actions/apiUpdaters/settings.ts | 11 +- src/global/actions/apiUpdaters/symbols.ts | 6 +- .../actions/apiUpdaters/twoFaSettings.ts | 3 +- src/global/actions/apiUpdaters/users.ts | 7 +- src/global/actions/ui/calls.ts | 35 ++- src/global/actions/ui/chats.ts | 13 +- src/global/actions/ui/globalSearch.ts | 6 +- src/global/actions/ui/initial.ts | 35 +-- src/global/actions/ui/localSearch.ts | 12 +- src/global/actions/ui/mediaViewer.ts | 7 +- src/global/actions/ui/messages.ts | 66 ++--- src/global/actions/ui/misc.ts | 40 +-- src/global/actions/ui/passcode.ts | 16 +- src/global/actions/ui/payments.ts | 10 +- src/global/actions/ui/reactions.ts | 3 +- src/global/actions/ui/settings.ts | 22 +- src/global/actions/ui/stickerSearch.ts | 5 +- src/global/actions/ui/stories.ts | 17 +- src/global/actions/ui/users.ts | 8 +- src/global/cache.ts | 36 +-- src/global/helpers/chats.ts | 13 +- .../helpers/getEmojiOnlyCountForMessage.ts | 1 + src/global/helpers/media.ts | 1 + src/global/helpers/messageMedia.ts | 2 +- src/global/helpers/messageSummary.ts | 8 +- src/global/helpers/messages.ts | 10 +- src/global/helpers/reactions.ts | 4 +- .../helpers/renderMessageSummaryHtml.ts | 3 +- src/global/helpers/users.ts | 6 +- src/global/index.ts | 3 +- src/global/init.ts | 30 +-- src/global/initialState.ts | 2 +- src/global/intervals.ts | 3 +- src/global/reducers/bots.ts | 7 +- src/global/reducers/calls.ts | 7 +- src/global/reducers/chats.ts | 4 +- src/global/reducers/globalSearch.ts | 11 +- src/global/reducers/localSearch.ts | 12 +- src/global/reducers/management.ts | 7 +- src/global/reducers/messages.ts | 43 ++-- src/global/reducers/passcode.ts | 1 + src/global/reducers/payments.ts | 9 +- src/global/reducers/reactions.ts | 11 +- src/global/reducers/settings.ts | 10 +- src/global/reducers/statistics.ts | 7 +- src/global/reducers/stories.ts | 14 +- src/global/reducers/symbols.ts | 9 +- src/global/reducers/tabs.ts | 3 +- src/global/reducers/translations.ts | 2 +- src/global/reducers/users.ts | 8 +- src/global/selectors/calls.ts | 3 +- src/global/selectors/chats.ts | 32 +-- src/global/selectors/globalSearch.ts | 3 +- src/global/selectors/limits.ts | 3 +- src/global/selectors/localSearch.ts | 7 +- src/global/selectors/management.ts | 6 +- src/global/selectors/messages.ts | 47 ++-- src/global/selectors/payments.ts | 3 +- src/global/selectors/statistics.ts | 6 +- src/global/selectors/stories.ts | 3 +- src/global/selectors/symbols.ts | 6 +- src/global/selectors/tabs.ts | 4 +- src/global/selectors/ui.ts | 14 +- src/global/selectors/users.ts | 3 +- src/global/types.ts | 28 +- src/hooks/media/useUnsupportedMedia.ts | 5 +- src/hooks/reducers/useFoldersReducer.ts | 4 +- src/hooks/reducers/usePaymentReducer.ts | 3 +- src/hooks/reducers/useTwoFaReducer.ts | 3 +- src/hooks/scroll/useTopOverscroll.tsx | 7 +- src/hooks/stickers/useColorFilter.ts | 1 + src/hooks/stickers/useDynamicColorListener.ts | 2 +- src/hooks/useAppLayout.ts | 6 +- src/hooks/useAsyncResolvers.ts | 4 +- src/hooks/useAudioPlayer.ts | 12 +- src/hooks/useBeforeUnload.ts | 1 - src/hooks/useBlurSync.ts | 4 +- src/hooks/useBuffering.ts | 6 +- src/hooks/useCanvasBlur.ts | 4 +- src/hooks/useChatContextActions.ts | 5 +- src/hooks/useConnectionStatus.ts | 2 +- src/hooks/useContextMenuHandlers.ts | 10 +- src/hooks/useCoordsInSharedCanvas.ts | 3 +- src/hooks/useCurrentTimeSignal.ts | 3 +- src/hooks/useDebouncedMemo.ts | 4 +- src/hooks/useDerivedSignal.ts | 4 +- src/hooks/useDerivedState.ts | 4 +- src/hooks/useElectronDrag.ts | 1 + src/hooks/useEnsureCustomEmoji.ts | 2 +- src/hooks/useFocusAfterAnimation.tsx | 6 +- src/hooks/useFolderManager.ts | 8 +- src/hooks/useForumPanelRender.ts | 2 +- src/hooks/useFullscreen.ts | 5 +- src/hooks/useHeavyAnimationCheck.ts | 1 - src/hooks/useHistoryBack.ts | 5 +- src/hooks/useHotkeys.ts | 3 +- src/hooks/useInfiniteScroll.ts | 4 +- src/hooks/useInputFocusOnOpen.ts | 2 +- src/hooks/useIntersectionObserver.ts | 2 +- src/hooks/useKeyboardListNavigation.ts | 2 +- src/hooks/useLang.ts | 3 +- src/hooks/useMediaWithLoadProgress.ts | 5 +- src/hooks/useMenuPosition.ts | 3 +- src/hooks/useMessageMediaMetadata.ts | 5 +- src/hooks/useModuleLoader.ts | 2 +- src/hooks/useMouseInside.ts | 1 - src/hooks/useNativeCopySelectedMessages.ts | 2 +- src/hooks/usePictureInPicture.ts | 5 +- src/hooks/usePrevDuringAnimation.ts | 2 +- src/hooks/usePreventPinchZoomGesture.ts | 1 + src/hooks/usePriorityPlaybackCheck.ts | 1 - src/hooks/useResize.ts | 6 +- src/hooks/useSchedule.tsx | 3 +- src/hooks/useSelectorSignal.ts | 6 +- src/hooks/useShowTransition.ts | 1 + src/hooks/useSignal.ts | 1 + src/hooks/useSignalEffect.ts | 1 + src/hooks/useSyncEffect.ts | 3 +- src/hooks/useThrottledCallback.ts | 1 + src/hooks/useThumbnail.ts | 6 +- src/hooks/useUniqueId.ts | 1 + src/hooks/useVideoCleanup.ts | 1 + src/index.tsx | 11 +- src/lib/croppie.ts | 1 + src/lib/fasterdom/fasterdom.ts | 3 +- src/lib/gramjs/client/downloadFile.ts | 12 +- src/lib/mediaWorker/index.worker.ts | 6 +- src/lib/rlottie/RLottie.ts | 12 +- src/lib/rlottie/rlottie.worker.ts | 4 +- src/lib/teact/teact-dom.ts | 8 +- src/lib/teact/teactn.tsx | 10 +- src/lib/video-preview/MP4Demuxer.ts | 3 +- src/lib/video-preview/VideoPreview.ts | 8 +- src/lib/video-preview/video-preview.worker.ts | 4 +- src/serviceWorker/index.ts | 19 +- src/serviceWorker/progressive.ts | 4 +- src/styles/index.scss | 1 - src/types/icons/index.ts | 2 +- src/types/index.ts | 1 + src/util/animateHorizontalScroll.ts | 2 +- src/util/animateScroll.ts | 13 +- src/util/animation.ts | 1 + src/util/appBadge.ts | 3 +- src/util/audioPlayer.ts | 12 +- src/util/captureEvents.ts | 2 +- src/util/createPostMessageInterface.ts | 3 +- src/util/customEmojiManager.ts | 12 +- src/util/dateFormat.ts | 1 + src/util/emoji.ts | 1 - src/util/establishMultitabRole.ts | 4 +- src/util/focusEditableElement.ts | 2 +- src/util/folderManager.ts | 10 +- src/util/handleError.ts | 2 +- src/util/hoc/freezeWhenClosed.ts | 2 +- src/util/langProvider.ts | 4 +- src/util/languageDetection.ts | 3 +- src/util/launchMediaWorkers.ts | 1 + src/util/mediaLoader.ts | 7 +- src/util/multitab.ts | 8 +- src/util/notifications.ts | 19 +- src/util/parseMessageInput.ts | 3 +- src/util/passcode.ts | 2 +- src/util/requestActionTimeout.ts | 1 + src/util/resetScroll.ts | 2 +- src/util/routing.ts | 1 + src/util/setTooltipItemVisible.ts | 2 +- src/util/setupServiceWorker.ts | 5 +- src/util/signals.ts | 1 + src/util/switchTheme.ts | 6 +- src/util/textFormat.ts | 1 + src/util/voiceRecording.ts | 1 + src/util/webpToPng.ts | 4 +- src/util/websync.ts | 8 +- src/util/windowEnvironment.ts | 2 +- src/util/windowSize.ts | 3 +- webpack.config.ts | 16 +- 820 files changed, 4985 insertions(+), 4250 deletions(-) diff --git a/.eslintrc b/.eslintrc index 0090c982f..1852cac33 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,6 +10,7 @@ "no-async-without-await", "teactn", "no-null", + "simple-import-sort", "react-hooks-static-deps", "eslint-multitab-tt" ], @@ -149,7 +150,58 @@ "disallowTypeAnnotations": false } ], - "teactn/prefer-separate-component-file": "off" + "teactn/prefer-separate-component-file": "off", + "simple-import-sort/imports": [ + "error", + { + "groups": [ + // Side effect imports + ["^\\u0000"], + // Lib and global imports + [ + "^react", + "^@?\\w", + "dist(/.*|$)", + "^(\\.+/)+(lib/(teact|gramjs))(/.*|$)", + "^(\\.+/)+global$" + ], + // Type imports + [ + "^(\\.+/)+.+\\u0000$", + "^(\\.+/|\\w+/)+(types)(/.*|$)", + "^(\\.+/|\\w+/)+(types)\\u0000" + ], + // Config, utils, helpers + [ + "^(\\.+/)+config", + "^(\\.+/)+(lib)(?!/(gramjs|teact))(/.*|$)", + "^(\\.+/)+global/.+", + "^(\\.+/)+(util)(/.*|$)", + "^\\.\\.(?!/?$)", + "^\\.\\./?$", + "^\\./(?=.*/)(?!/?$)", + "^\\.(?!/?$)", + "^\\./?$" + ], + // Hooks + [ + ".+(/hooks/)(.*|$)" + ], + // Components + [ + "\/[A-Z](([a-z]+[A-Z]?)*)" + ], + // Styles and CSS modules + [ + "^.+\\.s?css$" + ], + // Assets: images, stickers, etc + [ + "^(\\.+/)+(assets)(/.*|$)" + ] + ] + } + ] }, "settings": { "import/resolver": "webpack", diff --git a/package-lock.json b/package-lock.json index 73702d428..6f35f10de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,6 @@ "license": "GPL-3.0-or-later", "dependencies": { "@cryptography/aes": "^0.1.1", - "@twbs/fantasticon": "^2.7.1", "async-mutex": "^0.4.0", "big-integer": "github:painor/BigInteger.js", "croppie": "^2.6.5", @@ -41,6 +40,7 @@ "@statoscope/cli": "^5.26.1", "@statoscope/webpack-plugin": "^5.25.1", "@testing-library/jest-dom": "^5.16.5", + "@twbs/fantasticon": "^2.7.1", "@types/croppie": "^2.6.1", "@types/hast": "^2.3.4", "@types/jest": "^29.5.0", @@ -81,6 +81,7 @@ "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks-static-deps": "^1.0.7", + "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-teactn": "git+https://github.com/korenskoy/eslint-plugin-teactn#c2c39dd005d58c07c24c4361de804dce1c6261b5", "git-revision-webpack-plugin": "^5.0.0", "gitlog": "^4.0.4", @@ -5195,6 +5196,7 @@ "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -5211,6 +5213,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, "engines": { "node": ">=12" }, @@ -5222,6 +5225,7 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, "engines": { "node": ">=12" }, @@ -5233,6 +5237,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, "dependencies": { "ansi-regex": "^6.0.1" }, @@ -5247,6 +5252,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -6181,6 +6187,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz", "integrity": "sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==", + "dev": true, "dependencies": { "semver": "^7.3.5" }, @@ -6192,6 +6199,7 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -6206,6 +6214,7 @@ "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, "optional": true, "engines": { "node": ">=14" @@ -6746,6 +6755,7 @@ }, "node_modules/@tootallnate/once": { "version": "2.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">= 10" @@ -6755,6 +6765,7 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/@twbs/fantasticon/-/fantasticon-2.7.1.tgz", "integrity": "sha512-fCfmXnmVXs8TNV5qi4UJxJ8qJd/bvMujcpg597CWKm/m84/kEg6BB4g8pvl+fvg1LwhGvhQ0m3O4qnj0Qm9wjA==", + "dev": true, "dependencies": { "change-case": "^4.1.2", "commander": "^10.0.1", @@ -6780,6 +6791,7 @@ "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", + "dev": true, "engines": { "node": ">=14" } @@ -7996,6 +8008,7 @@ "version": "0.7.13", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.13.tgz", "integrity": "sha512-lm2GW5PkosIzccsaZIz7tp8cPADSIlIHWDFTR1N0SzfinhhYgeIQjFMz4rYzanCScr3DqQLeomUDArp6MWKm+g==", + "dev": true, "engines": { "node": ">=10.0.0" } @@ -8030,7 +8043,8 @@ "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true }, "node_modules/accepts": { "version": "1.3.8", @@ -8091,6 +8105,7 @@ }, "node_modules/agent-base": { "version": "6.0.2", + "dev": true, "license": "MIT", "dependencies": { "debug": "4" @@ -8103,6 +8118,7 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "dev": true, "dependencies": { "humanize-ms": "^1.2.1" }, @@ -8112,6 +8128,7 @@ }, "node_modules/aggregate-error": { "version": "3.1.0", + "dev": true, "license": "MIT", "dependencies": { "clean-stack": "^2.0.0", @@ -8242,6 +8259,7 @@ }, "node_modules/ansi-regex": { "version": "5.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -8367,7 +8385,8 @@ "node_modules/aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", + "dev": true }, "node_modules/arch": { "version": "2.2.0", @@ -8398,6 +8417,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz", "integrity": "sha512-QZW4EDmGwlYur0Yyf/b2uGucHQMa8aFUP7eu9ddR73vvhFyt4V0Vl3QHPcTNJ8l6qYOBdxgXdnBXQrHilfRQBg==", + "dev": true, "dependencies": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -8413,6 +8433,7 @@ }, "node_modules/argparse": { "version": "2.0.1", + "dev": true, "license": "Python-2.0" }, "node_modules/aria-query": { @@ -8914,6 +8935,7 @@ }, "node_modules/balanced-match": { "version": "1.0.2", + "dev": true, "license": "MIT" }, "node_modules/base64-js": { @@ -8960,6 +8982,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, "dependencies": { "file-uri-to-path": "1.0.0" } @@ -9153,6 +9176,7 @@ }, "node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -9271,6 +9295,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/bufferstreams/-/bufferstreams-3.0.0.tgz", "integrity": "sha512-Qg0ggJUWJq90vtg4lDsGN9CDWvzBMQxhiEkSOD/sJfYt6BLect3eV1/S6K7SCSKJ34n60rf6U5eUPmQENVE4UA==", + "dev": true, "dependencies": { "readable-stream": "^3.4.0" }, @@ -9420,6 +9445,7 @@ "version": "17.1.4", "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz", "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==", + "dev": true, "dependencies": { "@npmcli/fs": "^3.1.0", "fs-minipass": "^3.0.0", @@ -9442,6 +9468,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -9450,6 +9477,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "dev": true, "dependencies": { "minipass": "^7.0.3" }, @@ -9461,6 +9489,7 @@ "version": "10.3.4", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.4.tgz", "integrity": "sha512-6LFElP3A+i/Q8XQKEvZjkEWEOTgAIALR9AO2rwT8bgPhDd1anmqDJDZ6lLddI4ehxxxR1S5RIqKe1uapMQfYaQ==", + "dev": true, "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^2.0.3", @@ -9482,6 +9511,7 @@ "version": "7.18.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, "engines": { "node": ">=12" } @@ -9490,6 +9520,7 @@ "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, @@ -9504,6 +9535,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -9572,6 +9604,7 @@ }, "node_modules/camel-case": { "version": "4.1.2", + "dev": true, "license": "MIT", "dependencies": { "pascal-case": "^3.1.2", @@ -9626,6 +9659,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", + "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -9727,6 +9761,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", + "dev": true, "dependencies": { "camel-case": "^4.1.2", "capital-case": "^1.0.4", @@ -9800,6 +9835,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true, "engines": { "node": ">=10" } @@ -9845,6 +9881,7 @@ }, "node_modules/clean-stack": { "version": "2.2.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -10011,6 +10048,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true, "bin": { "color-support": "bin.js" } @@ -10101,6 +10139,7 @@ }, "node_modules/concat-map": { "version": "0.0.1", + "dev": true, "license": "MIT" }, "node_modules/concurrently": { @@ -10315,12 +10354,14 @@ "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", + "dev": true }, "node_modules/constant-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", + "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -10451,6 +10492,7 @@ }, "node_modules/cross-spawn": { "version": "7.0.3", + "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -10589,7 +10631,8 @@ "node_modules/cubic2quad": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/cubic2quad/-/cubic2quad-1.2.1.tgz", - "integrity": "sha512-wT5Y7mO8abrV16gnssKdmIhIbA9wSkeMzhh27jAguKrV82i24wER0vL5TGhUJ9dbJNDcigoRZ0IAHFEEEI4THQ==" + "integrity": "sha512-wT5Y7mO8abrV16gnssKdmIhIbA9wSkeMzhh27jAguKrV82i24wER0vL5TGhUJ9dbJNDcigoRZ0IAHFEEEI4THQ==", + "dev": true }, "node_modules/damerau-levenshtein": { "version": "1.0.8", @@ -10648,6 +10691,7 @@ }, "node_modules/debug": { "version": "4.3.4", + "dev": true, "license": "MIT", "dependencies": { "ms": "2.1.2" @@ -10831,7 +10875,8 @@ "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==" + "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", + "dev": true }, "node_modules/depd": { "version": "2.0.0", @@ -11074,6 +11119,7 @@ }, "node_modules/dot-case": { "version": "3.0.4", + "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -11117,6 +11163,7 @@ }, "node_modules/eastasianwidth": { "version": "0.2.0", + "dev": true, "license": "MIT" }, "node_modules/ee-first": { @@ -11678,6 +11725,7 @@ }, "node_modules/emoji-regex": { "version": "9.2.2", + "dev": true, "license": "MIT" }, "node_modules/encodeurl": { @@ -11692,6 +11740,7 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "dev": true, "optional": true, "dependencies": { "iconv-lite": "^0.6.2" @@ -11701,6 +11750,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, "optional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" @@ -11745,6 +11795,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, "engines": { "node": ">=6" } @@ -11764,7 +11815,8 @@ "node_modules/err-code": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz", - "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==" + "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", + "dev": true }, "node_modules/error-ex": { "version": "1.3.2", @@ -11889,6 +11941,7 @@ }, "node_modules/escape-string-regexp": { "version": "1.0.5", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.0" @@ -12415,6 +12468,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-plugin-teactn": { "version": "0.1.0-development", "resolved": "git+ssh://git@github.com/korenskoy/eslint-plugin-teactn.git#c2c39dd005d58c07c24c4361de804dce1c6261b5", @@ -12761,7 +12823,8 @@ "node_modules/exponential-backoff": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", - "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==" + "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==", + "dev": true }, "node_modules/express": { "version": "4.18.2", @@ -13044,6 +13107,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -13068,7 +13132,8 @@ "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true }, "node_modules/filelist": { "version": "1.0.4", @@ -13225,6 +13290,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^4.0.1" @@ -13240,6 +13306,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, "engines": { "node": ">=14" }, @@ -13333,6 +13400,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dev": true, "dependencies": { "minipass": "^3.0.0" }, @@ -13347,6 +13415,7 @@ }, "node_modules/fs.realpath": { "version": "1.0.0", + "dev": true, "license": "ISC" }, "node_modules/fsevents": { @@ -13394,6 +13463,7 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.4.tgz", "integrity": "sha512-f9m+BEN5jkg6a0fZjleidjN51VE1X+mPFQ2DJ0uv1V39oCLCbsGe6yjbBnp7eK7z/+GAon99a3nHuqbuuthyPg==", + "dev": true, "dependencies": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.3", @@ -13411,12 +13481,14 @@ "node_modules/gauge/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/gauge/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -13425,6 +13497,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -13536,6 +13609,7 @@ }, "node_modules/glob": { "version": "7.2.3", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -13722,6 +13796,7 @@ }, "node_modules/graceful-fs": { "version": "4.2.10", + "dev": true, "license": "ISC" }, "node_modules/grapheme-splitter": { @@ -13753,6 +13828,7 @@ "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dev": true, "dependencies": { "minimist": "^1.2.5", "neo-async": "^2.6.2", @@ -13843,7 +13919,8 @@ "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", + "dev": true }, "node_modules/he": { "version": "1.2.0", @@ -13857,6 +13934,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", + "dev": true, "dependencies": { "capital-case": "^1.0.4", "tslib": "^2.0.3" @@ -14030,7 +14108,8 @@ "node_modules/http-cache-semantics": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==" + "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "dev": true }, "node_modules/http-deceiver": { "version": "1.2.7", @@ -14072,6 +14151,7 @@ }, "node_modules/http-proxy-agent": { "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { "@tootallnate/once": "2", @@ -14143,6 +14223,7 @@ }, "node_modules/https-proxy-agent": { "version": "5.0.1", + "dev": true, "license": "MIT", "dependencies": { "agent-base": "6", @@ -14164,6 +14245,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dev": true, "dependencies": { "ms": "^2.0.0" } @@ -14425,6 +14507,7 @@ }, "node_modules/imurmurhash": { "version": "0.1.4", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.19" @@ -14432,6 +14515,7 @@ }, "node_modules/indent-string": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -14439,6 +14523,7 @@ }, "node_modules/inflight": { "version": "1.0.6", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -14447,6 +14532,7 @@ }, "node_modules/inherits": { "version": "2.0.4", + "dev": true, "license": "ISC" }, "node_modules/ini": { @@ -14478,7 +14564,8 @@ "node_modules/ip": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz", - "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==" + "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==", + "dev": true }, "node_modules/ipaddr.js": { "version": "2.0.1", @@ -14654,7 +14741,8 @@ "node_modules/is-lambda": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz", - "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==" + "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", + "dev": true }, "node_modules/is-map": { "version": "2.0.2", @@ -14898,6 +14986,7 @@ }, "node_modules/isexe": { "version": "2.0.0", + "dev": true, "license": "ISC" }, "node_modules/isobject": { @@ -14999,6 +15088,7 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.3.tgz", "integrity": "sha512-R2bUw+kVZFS/h1AZqBKrSgDmdmjApzgY0AlCPumopFiAlbUxE2gf+SCuBzQ0cP5hHmUmFYF5yw55T97Th5Kstg==", + "dev": true, "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -17255,6 +17345,7 @@ }, "node_modules/lodash": { "version": "4.17.21", + "dev": true, "license": "MIT" }, "node_modules/lodash.camelcase": { @@ -17419,6 +17510,7 @@ }, "node_modules/lower-case": { "version": "2.0.2", + "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -17449,6 +17541,7 @@ }, "node_modules/lru-cache": { "version": "6.0.0", + "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -17475,6 +17568,7 @@ "version": "11.1.1", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", + "dev": true, "dependencies": { "agentkeepalive": "^4.2.1", "cacache": "^17.0.0", @@ -17500,6 +17594,7 @@ "version": "7.18.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, "engines": { "node": ">=12" } @@ -17508,6 +17603,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -17666,7 +17762,8 @@ "node_modules/microbuffer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/microbuffer/-/microbuffer-1.0.0.tgz", - "integrity": "sha512-O/SUXauVN4x6RaEJFqSPcXNtLFL+QzJHKZlyDVYFwcDDRVca3Fa/37QXXC+4zAGGa4YhHrHxKXuuHvLDIQECtA==" + "integrity": "sha512-O/SUXauVN4x6RaEJFqSPcXNtLFL+QzJHKZlyDVYFwcDDRVca3Fa/37QXXC+4zAGGa4YhHrHxKXuuHvLDIQECtA==", + "dev": true }, "node_modules/micromatch": { "version": "4.0.5", @@ -17761,6 +17858,7 @@ }, "node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -17771,6 +17869,7 @@ }, "node_modules/minimist": { "version": "1.2.7", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -17793,6 +17892,7 @@ "version": "3.3.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -17804,6 +17904,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-1.0.2.tgz", "integrity": "sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==", + "dev": true, "dependencies": { "minipass": "^3.0.0" }, @@ -17815,6 +17916,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz", "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==", + "dev": true, "dependencies": { "minipass": "^7.0.3", "minipass-sized": "^1.0.3", @@ -17831,6 +17933,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -17839,6 +17942,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "dev": true, "dependencies": { "minipass": "^3.0.0" }, @@ -17850,6 +17954,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==", + "dev": true, "dependencies": { "minipass": "^3.0.0" }, @@ -17861,6 +17966,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==", + "dev": true, "dependencies": { "minipass": "^3.0.0" }, @@ -17872,6 +17978,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -17896,6 +18003,7 @@ }, "node_modules/ms": { "version": "2.1.2", + "dev": true, "license": "MIT" }, "node_modules/multicast-dns": { @@ -17913,7 +18021,8 @@ "node_modules/nan": { "version": "2.17.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", - "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==" + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "dev": true }, "node_modules/nanoid": { "version": "3.3.4", @@ -17938,6 +18047,7 @@ }, "node_modules/negotiator": { "version": "0.6.3", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.6" @@ -17945,10 +18055,12 @@ }, "node_modules/neo-async": { "version": "2.6.2", + "dev": true, "license": "MIT" }, "node_modules/no-case": { "version": "3.0.4", + "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -17974,6 +18086,7 @@ "version": "9.4.0", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz", "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==", + "dev": true, "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", @@ -17998,6 +18111,7 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -18024,6 +18138,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", + "dev": true, "dependencies": { "abbrev": "^1.0.0" }, @@ -18106,6 +18221,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", "integrity": "sha512-/vBvz5Jfr9dT/aFWd0FIRf+T/Q2WBsLENygUaFUqstqsycmZAP/t5BvFJTK0viFmSUxiUKTUplWy5vt+rvKIxg==", + "dev": true, "dependencies": { "are-we-there-yet": "^3.0.0", "console-control-strings": "^1.1.0", @@ -18272,6 +18388,7 @@ }, "node_modules/once": { "version": "1.4.0", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -18371,6 +18488,7 @@ }, "node_modules/p-map": { "version": "4.0.0", + "dev": true, "license": "MIT", "dependencies": { "aggregate-error": "^3.0.0" @@ -18408,6 +18526,7 @@ }, "node_modules/param-case": { "version": "3.0.4", + "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -18463,6 +18582,7 @@ }, "node_modules/pascal-case": { "version": "3.1.2", + "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -18477,6 +18597,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", + "dev": true, "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -18492,6 +18613,7 @@ }, "node_modules/path-is-absolute": { "version": "1.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -18504,6 +18626,7 @@ }, "node_modules/path-key": { "version": "3.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -18518,6 +18641,7 @@ "version": "1.10.1", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, "dependencies": { "lru-cache": "^9.1.1 || ^10.0.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" @@ -18533,6 +18657,7 @@ "version": "10.0.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "dev": true, "engines": { "node": "14 || >=16.14" } @@ -18541,6 +18666,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -18566,6 +18692,7 @@ }, "node_modules/picocolors": { "version": "1.0.0", + "dev": true, "license": "ISC" }, "node_modules/picomatch": { @@ -19049,6 +19176,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==", + "dev": true, "dependencies": { "err-code": "^2.0.2", "retry": "^0.12.0" @@ -19061,6 +19189,7 @@ "version": "0.12.0", "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "dev": true, "engines": { "node": ">= 4" } @@ -19448,6 +19577,7 @@ }, "node_modules/readable-stream": { "version": "3.6.0", + "dev": true, "license": "MIT", "dependencies": { "inherits": "^2.0.3", @@ -19751,6 +19881,7 @@ }, "node_modules/rimraf": { "version": "3.0.2", + "dev": true, "license": "ISC", "dependencies": { "glob": "^7.1.3" @@ -19851,7 +19982,7 @@ }, "node_modules/safer-buffer": { "version": "2.1.2", - "devOptional": true, + "dev": true, "license": "MIT" }, "node_modules/sanitize-filename": { @@ -19921,7 +20052,8 @@ "node_modules/sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true }, "node_modules/saxes": { "version": "6.0.0", @@ -20077,6 +20209,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", + "dev": true, "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", @@ -20297,7 +20430,8 @@ "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true }, "node_modules/setprototypeof": { "version": "1.2.0", @@ -20317,6 +20451,7 @@ }, "node_modules/shebang-command": { "version": "2.0.0", + "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -20327,6 +20462,7 @@ }, "node_modules/shebang-regex": { "version": "3.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -20355,6 +20491,7 @@ }, "node_modules/signal-exit": { "version": "3.0.7", + "dev": true, "license": "ISC" }, "node_modules/simple-update-notifier": { @@ -20428,6 +20565,7 @@ "version": "1.6.6", "resolved": "https://registry.npmjs.org/slugify/-/slugify-1.6.6.tgz", "integrity": "sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==", + "dev": true, "engines": { "node": ">=8.0.0" } @@ -20436,6 +20574,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -20445,6 +20584,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "dev": true, "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -20464,6 +20604,7 @@ "version": "2.7.1", "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz", "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==", + "dev": true, "dependencies": { "ip": "^2.0.0", "smart-buffer": "^4.2.0" @@ -20477,6 +20618,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz", "integrity": "sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==", + "dev": true, "dependencies": { "agent-base": "^6.0.2", "debug": "^4.3.3", @@ -20512,6 +20654,7 @@ }, "node_modules/source-map": { "version": "0.6.1", + "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -20607,6 +20750,7 @@ "version": "10.0.5", "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", "integrity": "sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==", + "dev": true, "dependencies": { "minipass": "^7.0.3" }, @@ -20618,6 +20762,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "dev": true, "engines": { "node": ">=16 || 14 >=14.17" } @@ -20660,6 +20805,7 @@ }, "node_modules/string_decoder": { "version": "1.3.0", + "dev": true, "license": "MIT", "dependencies": { "safe-buffer": "~5.2.0" @@ -20667,6 +20813,7 @@ }, "node_modules/string_decoder/node_modules/safe-buffer": { "version": "5.2.1", + "dev": true, "funding": [ { "type": "github", @@ -20716,6 +20863,7 @@ }, "node_modules/string-width": { "version": "5.1.2", + "dev": true, "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", @@ -20734,6 +20882,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -20746,18 +20895,21 @@ "node_modules/string-width-cjs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } }, "node_modules/string-width/node_modules/ansi-regex": { "version": "6.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -20768,6 +20920,7 @@ }, "node_modules/string-width/node_modules/strip-ansi": { "version": "7.0.1", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -20825,6 +20978,7 @@ }, "node_modules/strip-ansi": { "version": "6.0.1", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -20838,6 +20992,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -21158,6 +21313,7 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz", "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==", + "dev": true, "engines": { "node": ">=12.0.0" } @@ -21170,6 +21326,7 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/svg2ttf/-/svg2ttf-6.0.3.tgz", "integrity": "sha512-CgqMyZrbOPpc+WqH7aga4JWkDPso23EgypLsbQ6gN3uoPWwwiLjXvzgrwGADBExvCRJrWFzAeK1bSoSpE7ixSQ==", + "dev": true, "dependencies": { "@xmldom/xmldom": "^0.7.2", "argparse": "^2.0.1", @@ -21186,6 +21343,7 @@ "version": "12.0.0", "resolved": "https://registry.npmjs.org/svgicons2svgfont/-/svgicons2svgfont-12.0.0.tgz", "integrity": "sha512-fjyDkhiG0M1TPBtZzD12QV3yDcG2fUgiqHPOCYzf7hHE40Hl3GhnE6P1njsJCCByhwM7MiufyDW3L7IOR5dg9w==", + "dev": true, "dependencies": { "commander": "^9.3.0", "glob": "^8.0.3", @@ -21203,6 +21361,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0" } @@ -21211,6 +21370,7 @@ "version": "9.5.0", "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "dev": true, "engines": { "node": "^12.20.0 || >=14" } @@ -21219,6 +21379,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -21237,6 +21398,7 @@ "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, "dependencies": { "brace-expansion": "^2.0.1" }, @@ -21248,6 +21410,7 @@ "version": "2.6.0", "resolved": "https://registry.npmjs.org/svgpath/-/svgpath-2.6.0.tgz", "integrity": "sha512-OIWR6bKzXvdXYyO4DK/UWa1VA1JeKq8E+0ug2DG98Y/vOmMpfZNj+TIG988HjfYSqtcy/hFOtZq/n/j5GSESNg==", + "dev": true, "funding": { "url": "https://github.com/fontello/svg2ttf?sponsor=1" } @@ -21376,6 +21539,7 @@ "version": "6.1.13", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.13.tgz", "integrity": "sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==", + "dev": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -21392,6 +21556,7 @@ "version": "4.2.4", "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.4.tgz", "integrity": "sha512-lwycX3cBMTvcejsHITUgYj6Gy6A7Nh4Q6h9NP4sTHY1ccJlC7yKzDmiShEHsJ16Jf1nKGDEaiHxiltsJEvk0nQ==", + "dev": true, "engines": { "node": ">=8" } @@ -21400,6 +21565,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -21757,6 +21923,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/ttf2eot/-/ttf2eot-3.1.0.tgz", "integrity": "sha512-aHTbcYosNHVqb2Qtt9Xfta77ae/5y0VfdwNLUS6sGBeGr22cX2JDMo/i5h3uuOf+FAD3akYOr17+fYd5NK8aXw==", + "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -21768,6 +21935,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/ttf2woff/-/ttf2woff-3.0.0.tgz", "integrity": "sha512-OvmFcj70PhmAsVQKfC15XoKH55cRWuaRzvr2fpTNhTNer6JBpG8n6vOhRrIgxMjcikyYt88xqYXMMVapJ4Rjvg==", + "dev": true, "dependencies": { "argparse": "^2.0.1", "pako": "^1.0.0" @@ -21779,12 +21947,14 @@ "node_modules/ttf2woff/node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true }, "node_modules/ttf2woff2": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ttf2woff2/-/ttf2woff2-5.0.0.tgz", "integrity": "sha512-FplhShJd3rT8JGa8N04YWQuP7xRvwr9AIq+9/z5O/5ubqNiCADshKl8v51zJDFkhDVcYpdUqUpm7T4M53Z2JoQ==", + "dev": true, "hasInstallScript": true, "dependencies": { "bindings": "^1.5.0", @@ -21869,6 +22039,7 @@ "version": "3.17.4", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "dev": true, "optional": true, "bin": { "uglifyjs": "bin/uglifyjs" @@ -21931,6 +22102,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", + "dev": true, "dependencies": { "unique-slug": "^4.0.0" }, @@ -21942,6 +22114,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", + "dev": true, "dependencies": { "imurmurhash": "^0.1.4" }, @@ -22040,6 +22213,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", + "dev": true, "dependencies": { "tslib": "^2.0.3" } @@ -22048,6 +22222,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", + "dev": true, "dependencies": { "tslib": "^2.0.3" } @@ -22085,6 +22260,7 @@ }, "node_modules/util-deprecate": { "version": "1.0.2", + "dev": true, "license": "MIT" }, "node_modules/utila": { @@ -22555,6 +22731,7 @@ }, "node_modules/which": { "version": "2.0.2", + "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -22618,6 +22795,7 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "dev": true, "dependencies": { "string-width": "^1.0.2 || 2 || 3 || 4" } @@ -22625,12 +22803,14 @@ "node_modules/wide-align/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/wide-align/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -22639,6 +22819,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -22680,7 +22861,8 @@ "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dev": true }, "node_modules/wrap-ansi": { "version": "7.0.0", @@ -22703,6 +22885,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -22719,6 +22902,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -22733,6 +22917,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -22743,17 +22928,20 @@ "node_modules/wrap-ansi-cjs/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -22762,6 +22950,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -22829,6 +23018,7 @@ }, "node_modules/wrappy": { "version": "1.0.2", + "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { @@ -22896,6 +23086,7 @@ }, "node_modules/yallist": { "version": "4.0.0", + "dev": true, "license": "ISC" }, "node_modules/yaml": { diff --git a/package.json b/package.json index 10d2a6455..1960955b7 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks-static-deps": "^1.0.7", + "eslint-plugin-simple-import-sort": "^10.0.0", "eslint-plugin-teactn": "git+https://github.com/korenskoy/eslint-plugin-teactn#c2c39dd005d58c07c24c4361de804dce1c6261b5", "git-revision-webpack-plugin": "^5.0.0", "gitlog": "^4.0.4", diff --git a/src/api/gramjs/apiBuilders/appConfig.ts b/src/api/gramjs/apiBuilders/appConfig.ts index 343037000..bbc0b7288 100644 --- a/src/api/gramjs/apiBuilders/appConfig.ts +++ b/src/api/gramjs/apiBuilders/appConfig.ts @@ -1,16 +1,18 @@ /* eslint-disable @typescript-eslint/naming-convention */ import BigInt from 'big-integer'; -import localDb from '../localDb'; import { Api as GramJs } from '../../../lib/gramjs'; -import type { ApiAppConfig } from '../../types'; + import type { ApiLimitType } from '../../../global/types'; -import { buildJson } from './misc'; +import type { ApiAppConfig } from '../../types'; + import { DEFAULT_LIMITS, SERVICE_NOTIFICATIONS_USER_ID, STORY_EXPIRE_PERIOD, STORY_VIEWERS_EXPIRE_PERIOD, } from '../../../config'; +import localDb from '../localDb'; +import { buildJson } from './misc'; type LimitType = 'default' | 'premium'; type Limit = 'upload_max_fileparts' | 'stickers_faved_limit' | 'saved_gifs_limit' | 'dialog_filters_chats_limit' | diff --git a/src/api/gramjs/apiBuilders/bots.ts b/src/api/gramjs/apiBuilders/bots.ts index 41d04b8ae..3f284f8d0 100644 --- a/src/api/gramjs/apiBuilders/bots.ts +++ b/src/api/gramjs/apiBuilders/bots.ts @@ -1,4 +1,5 @@ import { Api as GramJs } from '../../../lib/gramjs'; + import type { ApiAttachBot, ApiAttachBotIcon, @@ -15,12 +16,12 @@ import type { } from '../../types'; import { pick } from '../../../util/iteratees'; -import { buildApiPhoto, buildApiThumbnailFromStripped } from './common'; -import { buildApiDocument, buildApiWebDocument, buildVideoFromDocument } from './messageContent'; -import { buildStickerFromDocument } from './symbols'; import localDb from '../localDb'; -import { buildApiPeerId } from './peers'; +import { buildApiPhoto, buildApiThumbnailFromStripped } from './common'; import { omitVirtualClassFields } from './helpers'; +import { buildApiDocument, buildApiWebDocument, buildVideoFromDocument } from './messageContent'; +import { buildApiPeerId } from './peers'; +import { buildStickerFromDocument } from './symbols'; export function buildApiBotInlineResult(result: GramJs.BotInlineResult, queryId: string): ApiBotInlineResult { const { diff --git a/src/api/gramjs/apiBuilders/calls.ts b/src/api/gramjs/apiBuilders/calls.ts index 066257c5e..f26e48043 100644 --- a/src/api/gramjs/apiBuilders/calls.ts +++ b/src/api/gramjs/apiBuilders/calls.ts @@ -1,3 +1,5 @@ +import { Api as GramJs } from '../../../lib/gramjs'; + import type { ApiCallProtocol, ApiPhoneCallConnection, @@ -5,8 +7,8 @@ import type { GroupCallParticipantVideo, SsrcGroup, } from '../../../lib/secret-sauce'; -import { Api as GramJs } from '../../../lib/gramjs'; import type { ApiGroupCall, ApiPhoneCall } from '../../types'; + import { getApiChatIdFromMtpPeer, isPeerUser } from './peers'; export function buildApiGroupCallParticipant(participant: GramJs.GroupCallParticipant): GroupCallParticipant { diff --git a/src/api/gramjs/apiBuilders/chats.ts b/src/api/gramjs/apiBuilders/chats.ts index 86a2e191b..2faa2cd82 100644 --- a/src/api/gramjs/apiBuilders/chats.ts +++ b/src/api/gramjs/apiBuilders/chats.ts @@ -1,30 +1,32 @@ import type BigInt from 'big-integer'; import { Api as GramJs } from '../../../lib/gramjs'; + import type { + ApiBotCommand, ApiChat, ApiChatAdminRights, ApiChatBannedRights, - ApiBotCommand, ApiChatFolder, - ApiChatMember, - ApiRestrictionReason, - ApiExportedInvite, ApiChatInviteImporter, - ApiChatSettings, - ApiTopic, - ApiSendAsPeerId, - ApiChatReactions, - ApiChatlistInvite, ApiChatlistExportedInvite, + ApiChatlistInvite, + ApiChatMember, + ApiChatReactions, + ApiChatSettings, + ApiExportedInvite, + ApiRestrictionReason, + ApiSendAsPeerId, + ApiTopic, } from '../../types'; + import { pick, pickTruthy } from '../../../util/iteratees'; +import { getServerTime, getServerTimeOffset } from '../../../util/serverTime'; +import { buildApiUsernames } from './common'; +import { omitVirtualClassFields } from './helpers'; import { buildApiPeerId, getApiChatIdFromMtpPeer, isPeerChat, isPeerUser, } from './peers'; -import { omitVirtualClassFields } from './helpers'; -import { getServerTime, getServerTimeOffset } from '../../../util/serverTime'; import { buildApiReaction } from './reactions'; -import { buildApiUsernames } from './common'; type PeerEntityApiChatFields = Omit(); diff --git a/src/api/gramjs/updateManager.ts b/src/api/gramjs/updateManager.ts index 608836560..fe27e89d7 100644 --- a/src/api/gramjs/updateManager.ts +++ b/src/api/gramjs/updateManager.ts @@ -1,15 +1,16 @@ import { Api as GramJs } from '../../lib/gramjs'; -import type { Update } from './updater'; -import type { invokeRequest } from './methods/client'; - import { UpdateConnectionState, UpdateServerTimeOffset } from '../../lib/gramjs/network'; + +import type { invokeRequest } from './methods/client'; +import type { Update } from './updater'; + import { DEBUG } from '../../config'; -import localDb from './localDb'; import SortedQueue from '../../util/SortedQueue'; -import { dispatchUserAndChatUpdates, sendUpdate, updater } from './updater'; -import { addEntitiesToLocalDb } from './helpers'; -import { buildInputEntity } from './gramjsBuilders'; import { buildApiPeerId } from './apiBuilders/peers'; +import { buildInputEntity } from './gramjsBuilders'; +import { addEntitiesToLocalDb } from './helpers'; +import localDb from './localDb'; +import { dispatchUserAndChatUpdates, sendUpdate, updater } from './updater'; export type State = { seq: number; diff --git a/src/api/gramjs/updater.ts b/src/api/gramjs/updater.ts index a7eddc83f..a0f28120a 100644 --- a/src/api/gramjs/updater.ts +++ b/src/api/gramjs/updater.ts @@ -1,79 +1,80 @@ -import type { GroupCallConnectionData } from '../../lib/secret-sauce'; import { Api as GramJs, connection } from '../../lib/gramjs'; + +import type { GroupCallConnectionData } from '../../lib/secret-sauce'; import type { - ApiMessage, ApiMessageExtendedMediaPreview, ApiUpdate, ApiUpdateConnectionStateType, OnApiUpdate, - ApiStory, ApiStorySkipped, + ApiMessage, ApiMessageExtendedMediaPreview, ApiStory, ApiStorySkipped, + ApiUpdate, ApiUpdateConnectionStateType, OnApiUpdate, } from '../types'; -import localDb from './localDb'; import { DEBUG, GENERAL_TOPIC_ID } from '../../config'; import { omit, pick } from '../../util/iteratees'; import { getServerTimeOffset, setServerTimeOffset } from '../../util/serverTime'; -import { - addMessageToLocalDb, - addEntitiesToLocalDb, - addPhotoToLocalDb, - resolveMessageApiChatId, - serializeBytes, - log, - swapLocalInvoiceMedia, - isChatFolder, - addStoryToLocalDb, -} from './helpers'; -import { scheduleMutedTopicUpdate, scheduleMutedChatUpdate } from './scheduleUnmute'; -import { - buildApiMessage, - buildApiMessageFromShort, - buildApiMessageFromShortChat, - buildApiMessageFromNotification, - buildMessageDraft, -} from './apiBuilders/messages'; -import { - buildApiReaction, - buildMessageReactions, -} from './apiBuilders/reactions'; -import { - buildChatMember, - buildChatMembers, - buildChatTypingStatus, - buildAvatarHash, - buildApiChatFromPreview, - buildApiChatFolder, - buildApiChatSettings, -} from './apiBuilders/chats'; -import { - buildApiUser, - buildApiUserEmojiStatus, - buildApiUserStatus, -} from './apiBuilders/users'; -import { omitVirtualClassFields } from './apiBuilders/helpers'; -import { - buildApiNotifyException, - buildApiNotifyExceptionTopic, - buildPrivacyKey, -} from './apiBuilders/misc'; -import { - buildApiMessageExtendedMediaPreview, - buildMessageMediaContent, - buildPoll, - buildPollResults, -} from './apiBuilders/messageContent'; -import { buildApiStealthMode, buildApiStory } from './apiBuilders/stories'; -import { buildApiPhoto, buildApiUsernames, buildPrivacyRules } from './apiBuilders/common'; +import { buildApiBotMenuButton } from './apiBuilders/bots'; import { buildApiGroupCall, buildApiGroupCallParticipant, buildPhoneCall, getGroupCallId, } from './apiBuilders/calls'; -import { buildApiPeerId, getApiChatIdFromMtpPeer } from './apiBuilders/peers'; -import { buildApiEmojiInteraction, buildStickerSet } from './apiBuilders/symbols'; -import { buildApiBotMenuButton } from './apiBuilders/bots'; import { + buildApiChatFolder, + buildApiChatFromPreview, + buildApiChatSettings, + buildAvatarHash, + buildChatMember, + buildChatMembers, + buildChatTypingStatus, +} from './apiBuilders/chats'; +import { buildApiPhoto, buildApiUsernames, buildPrivacyRules } from './apiBuilders/common'; +import { omitVirtualClassFields } from './apiBuilders/helpers'; +import { + buildApiMessageExtendedMediaPreview, + buildMessageMediaContent, + buildPoll, + buildPollResults, +} from './apiBuilders/messageContent'; +import { + buildApiMessage, + buildApiMessageFromNotification, + buildApiMessageFromShort, + buildApiMessageFromShortChat, + buildMessageDraft, +} from './apiBuilders/messages'; +import { + buildApiNotifyException, + buildApiNotifyExceptionTopic, + buildPrivacyKey, +} from './apiBuilders/misc'; +import { buildApiPeerId, getApiChatIdFromMtpPeer } from './apiBuilders/peers'; +import { + buildApiReaction, + buildMessageReactions, +} from './apiBuilders/reactions'; +import { buildApiStealthMode, buildApiStory } from './apiBuilders/stories'; +import { buildApiEmojiInteraction, buildStickerSet } from './apiBuilders/symbols'; +import { + buildApiUser, + buildApiUserEmojiStatus, + buildApiUserStatus, +} from './apiBuilders/users'; +import { + buildChatPhotoForLocalDb, buildMessageFromUpdate, isMessageWithMedia, - buildChatPhotoForLocalDb, } from './gramjsBuilders'; +import { + addEntitiesToLocalDb, + addMessageToLocalDb, + addPhotoToLocalDb, + addStoryToLocalDb, + isChatFolder, + log, + resolveMessageApiChatId, + serializeBytes, + swapLocalInvoiceMedia, +} from './helpers'; +import localDb from './localDb'; +import { scheduleMutedChatUpdate, scheduleMutedTopicUpdate } from './scheduleUnmute'; export type Update = ( (GramJs.TypeUpdate | GramJs.TypeUpdates) & { _entities?: (GramJs.TypeUser | GramJs.TypeChat)[] } diff --git a/src/api/gramjs/worker/connector.ts b/src/api/gramjs/worker/connector.ts index 6ca7e396d..f1d6fa8a3 100644 --- a/src/api/gramjs/worker/connector.ts +++ b/src/api/gramjs/worker/connector.ts @@ -1,17 +1,17 @@ import type { Api } from '../../../lib/gramjs'; +import type { TypedBroadcastChannel } from '../../../util/multitab'; import type { ApiInitialArgs, ApiOnProgress, OnApiUpdate } from '../../types'; +import type { LocalDb } from '../localDb'; import type { MethodArgs, MethodResponse, Methods } from '../methods/types'; import type { OriginRequest, ThenArg, WorkerMessageEvent } from './types'; -import type { LocalDb } from '../localDb'; -import type { TypedBroadcastChannel } from '../../../util/multitab'; -import { IS_MULTITAB_SUPPORTED } from '../../../util/windowEnvironment'; import { DATA_BROADCAST_CHANNEL_NAME, DEBUG } from '../../../config'; +import { logDebugMessage } from '../../../util/debugConsole'; +import Deferred from '../../../util/Deferred'; +import { getCurrentTabId, subscribeToMasterChange } from '../../../util/establishMultitabRole'; import generateUniqueId from '../../../util/generateUniqueId'; import { pause } from '../../../util/schedulers'; -import { getCurrentTabId, subscribeToMasterChange } from '../../../util/establishMultitabRole'; -import Deferred from '../../../util/Deferred'; -import { logDebugMessage } from '../../../util/debugConsole'; +import { IS_MULTITAB_SUPPORTED } from '../../../util/windowEnvironment'; type RequestStates = { messageId: string; diff --git a/src/api/gramjs/worker/types.ts b/src/api/gramjs/worker/types.ts index 8b54f0028..a50b39097 100644 --- a/src/api/gramjs/worker/types.ts +++ b/src/api/gramjs/worker/types.ts @@ -1,7 +1,7 @@ -import type { ApiInitialArgs, ApiUpdate } from '../../types'; -import type { Methods, MethodArgs, MethodResponse } from '../methods/types'; -import type { LocalDb } from '../localDb'; import type { DebugLevel } from '../../../util/debugConsole'; +import type { ApiInitialArgs, ApiUpdate } from '../../types'; +import type { LocalDb } from '../localDb'; +import type { MethodArgs, MethodResponse, Methods } from '../methods/types'; export type ThenArg = T extends Promise ? U : T; diff --git a/src/api/gramjs/worker/worker.ts b/src/api/gramjs/worker/worker.ts index 59319f2b1..40ff1bd3c 100644 --- a/src/api/gramjs/worker/worker.ts +++ b/src/api/gramjs/worker/worker.ts @@ -1,14 +1,14 @@ /* eslint-disable no-console */ +import type { DebugLevel } from '../../../util/debugConsole'; import type { ApiOnProgress, ApiUpdate } from '../../types'; import type { OriginMessageEvent, WorkerMessageData } from './types'; import { DEBUG } from '../../../config'; -import { callApi, cancelApiProgress, initApi } from '../methods/init'; -import { log } from '../helpers'; -import type { DebugLevel } from '../../../util/debugConsole'; import { DEBUG_LEVELS } from '../../../util/debugConsole'; import { throttleWithTickEnd } from '../../../util/schedulers'; +import { log } from '../helpers'; +import { callApi, cancelApiProgress, initApi } from '../methods/init'; declare const self: WorkerGlobalScope; diff --git a/src/api/types/calls.ts b/src/api/types/calls.ts index 72d33c867..3a1abb0de 100644 --- a/src/api/types/calls.ts +++ b/src/api/types/calls.ts @@ -1,8 +1,9 @@ import type { - GroupCallParticipant, + ApiCallProtocol, ApiPhoneCallConnection, GroupCallConnectionState, - ApiPhoneCallConnection, - ApiCallProtocol, VideoState, VideoRotation, + GroupCallParticipant, + VideoRotation, + VideoState, } from '../../lib/secret-sauce'; export interface ApiGroupCall { diff --git a/src/api/types/chats.ts b/src/api/types/chats.ts index d3cf43a4f..2384052dd 100644 --- a/src/api/types/chats.ts +++ b/src/api/types/chats.ts @@ -1,7 +1,7 @@ +import type { ApiBotCommand } from './bots'; import type { ApiChatReactions, ApiMessage, ApiPhoto, ApiStickerSet, } from './messages'; -import type { ApiBotCommand } from './bots'; import type { ApiChatInviteImporter } from './misc'; import type { ApiFakeType, ApiUsername } from './users'; diff --git a/src/api/types/misc.ts b/src/api/types/misc.ts index 0c7cfb852..ef2536ea5 100644 --- a/src/api/types/misc.ts +++ b/src/api/types/misc.ts @@ -1,6 +1,6 @@ +import type { ApiLimitType, CallbackAction } from '../../global/types'; import type { ApiDocument, ApiPhoto, ApiReaction } from './messages'; import type { ApiUser } from './users'; -import type { ApiLimitType, CallbackAction } from '../../global/types'; export interface ApiInitialArgs { userAgent: string; diff --git a/src/api/types/payments.ts b/src/api/types/payments.ts index e8578f8ea..edc567478 100644 --- a/src/api/types/payments.ts +++ b/src/api/types/payments.ts @@ -1,6 +1,6 @@ -import type { ApiDocument, ApiMessageEntity, ApiPaymentCredentials } from './messages'; -import type { ApiWebDocument } from './bots'; import type { ApiInvoiceContainer } from '../../types'; +import type { ApiWebDocument } from './bots'; +import type { ApiDocument, ApiMessageEntity, ApiPaymentCredentials } from './messages'; export interface ApiShippingAddress { streetLine1: string; diff --git a/src/api/types/stories.ts b/src/api/types/stories.ts index 2afa3c873..ddd9e8787 100644 --- a/src/api/types/stories.ts +++ b/src/api/types/stories.ts @@ -1,5 +1,5 @@ -import type { ApiGeoPoint, ApiMessage, ApiReaction } from './messages'; import type { ApiPrivacySettings } from '../../types'; +import type { ApiGeoPoint, ApiMessage, ApiReaction } from './messages'; export interface ApiStory { '@type'?: 'story'; diff --git a/src/api/types/updates.ts b/src/api/types/updates.ts index 2537d1b3c..fd7a64775 100644 --- a/src/api/types/updates.ts +++ b/src/api/types/updates.ts @@ -1,16 +1,21 @@ import type { GroupCallConnectionData, - GroupCallParticipant, GroupCallConnectionState, - VideoState, + GroupCallParticipant, VideoRotation, + VideoState, } from '../../lib/secret-sauce'; +import type { ApiPrivacyKey, PrivacyVisibility } from '../../types'; +import type { ApiBotMenuButton } from './bots'; +import type { + ApiGroupCall, ApiPhoneCall, +} from './calls'; import type { ApiChat, - ApiChatFullInfo, - ApiTypingStatus, - ApiChatMember, ApiChatFolder, + ApiChatFullInfo, + ApiChatMember, + ApiTypingStatus, } from './chats'; import type { ApiFormattedText, @@ -23,18 +28,13 @@ import type { ApiStickerSet, ApiThreadInfo, } from './messages'; -import type { - ApiEmojiStatus, ApiUser, ApiUserFullInfo, ApiUserStatus, -} from './users'; import type { ApiEmojiInteraction, ApiError, ApiInviteInfo, ApiNotifyException, ApiSessionData, } from './misc'; -import type { - ApiGroupCall, ApiPhoneCall, -} from './calls'; -import type { ApiBotMenuButton } from './bots'; -import type { ApiPrivacyKey, PrivacyVisibility } from '../../types'; import type { ApiStealthMode, ApiStory, ApiStorySkipped } from './stories'; +import type { + ApiEmojiStatus, ApiUser, ApiUserFullInfo, ApiUserStatus, +} from './users'; export type ApiUpdateReady = { '@type': 'updateApiReady'; diff --git a/src/api/types/users.ts b/src/api/types/users.ts index 6e905df3a..e49767068 100644 --- a/src/api/types/users.ts +++ b/src/api/types/users.ts @@ -1,6 +1,6 @@ -import type { ApiDocument, ApiPhoto } from './messages'; -import type { ApiBotInfo } from './bots'; import type { API_CHAT_TYPES } from '../../config'; +import type { ApiBotInfo } from './bots'; +import type { ApiDocument, ApiPhoto } from './messages'; export interface ApiUser { id: string; diff --git a/src/bundles/calls.ts b/src/bundles/calls.ts index 83d8c839f..126bcbfc5 100644 --- a/src/bundles/calls.ts +++ b/src/bundles/calls.ts @@ -1,5 +1,5 @@ -import { IS_IOS, IS_SAFARI } from '../util/windowEnvironment'; import { initializeSoundsForSafari } from '../global/actions/ui/calls'; +import { IS_IOS, IS_SAFARI } from '../util/windowEnvironment'; export { default as GroupCall } from '../components/calls/group/GroupCall'; export { default as ActiveCallHeader } from '../components/calls/ActiveCallHeader'; diff --git a/src/bundles/main.ts b/src/bundles/main.ts index 22608fbe3..e1ee51249 100644 --- a/src/bundles/main.ts +++ b/src/bundles/main.ts @@ -1,7 +1,7 @@ import { getActions, getGlobal } from '../global'; -import { IS_MULTITAB_SUPPORTED } from '../util/windowEnvironment'; import { DEBUG } from '../config'; +import { IS_MULTITAB_SUPPORTED } from '../util/windowEnvironment'; export { default as Main } from '../components/main/Main'; export { default as LockScreen } from '../components/main/LockScreen'; diff --git a/src/components/App.tsx b/src/components/App.tsx index ecedc3ef9..44642114f 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -3,32 +3,32 @@ import React, { useEffect, useLayoutEffect } from '../lib/teact/teact'; import { getActions, withGlobal } from '../global'; import type { GlobalState } from '../global/types'; -import type { UiLoaderPage } from './common/UiLoader'; import type { ThemeKey } from '../types'; +import type { UiLoaderPage } from './common/UiLoader'; -import { IS_INSTALL_PROMPT_SUPPORTED, IS_MULTITAB_SUPPORTED, PLATFORM_ENV } from '../util/windowEnvironment'; import { DARK_THEME_BG_COLOR, INACTIVE_MARKER, LIGHT_THEME_BG_COLOR, PAGE_TITLE, } from '../config'; import { selectTabState, selectTheme } from '../global/selectors'; -import { updateSizes } from '../util/windowSize'; import { addActiveTabChangeListener } from '../util/activeTabMonitor'; -import { hasStoredSession } from '../util/sessions'; import buildClassName from '../util/buildClassName'; -import { parseInitialLocationHash } from '../util/routing'; import { setupBeforeInstallPrompt } from '../util/installPrompt'; +import { parseInitialLocationHash } from '../util/routing'; +import { hasStoredSession } from '../util/sessions'; +import { IS_INSTALL_PROMPT_SUPPORTED, IS_MULTITAB_SUPPORTED, PLATFORM_ENV } from '../util/windowEnvironment'; +import { updateSizes } from '../util/windowSize'; +import useAppLayout from '../hooks/useAppLayout'; import useFlag from '../hooks/useFlag'; import usePrevious from '../hooks/usePrevious'; -import useAppLayout from '../hooks/useAppLayout'; -import Auth from './auth/Auth'; -import Main from './main/Main.async'; -import LockScreen from './main/LockScreen.async'; -import AppInactive from './main/AppInactive'; -import Transition from './ui/Transition'; -import UiLoader from './common/UiLoader'; // import Test from './test/TestSvg'; +import Auth from './auth/Auth'; +import UiLoader from './common/UiLoader'; +import AppInactive from './main/AppInactive'; +import LockScreen from './main/LockScreen.async'; +import Main from './main/Main.async'; +import Transition from './ui/Transition'; import styles from './App.module.scss'; diff --git a/src/components/auth/Auth.tsx b/src/components/auth/Auth.tsx index 63525c83e..dea02d3a8 100644 --- a/src/components/auth/Auth.tsx +++ b/src/components/auth/Auth.tsx @@ -1,21 +1,23 @@ +import '../../global/actions/initial'; + import type { FC } from '../../lib/teact/teact'; import React, { memo, useRef } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { GlobalState } from '../../global/types'; -import '../../global/actions/initial'; import { PLATFORM_ENV } from '../../util/windowEnvironment'; -import useHistoryBack from '../../hooks/useHistoryBack'; + import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; import useElectronDrag from '../../hooks/useElectronDrag'; +import useHistoryBack from '../../hooks/useHistoryBack'; import Transition from '../ui/Transition'; -import AuthPhoneNumber from './AuthPhoneNumber'; import AuthCode from './AuthCode.async'; import AuthPassword from './AuthPassword.async'; -import AuthRegister from './AuthRegister.async'; +import AuthPhoneNumber from './AuthPhoneNumber'; import AuthQrCode from './AuthQrCode'; +import AuthRegister from './AuthRegister.async'; import './Auth.scss'; diff --git a/src/components/auth/AuthCode.async.tsx b/src/components/auth/AuthCode.async.tsx index f980edcbb..c8302efbb 100644 --- a/src/components/auth/AuthCode.async.tsx +++ b/src/components/auth/AuthCode.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const AuthCodeAsync: FC = () => { diff --git a/src/components/auth/AuthCode.tsx b/src/components/auth/AuthCode.tsx index bdb1fc6ea..575abb6b6 100644 --- a/src/components/auth/AuthCode.tsx +++ b/src/components/auth/AuthCode.tsx @@ -1,20 +1,22 @@ import type { FormEvent } from 'react'; import type { FC } from '../../lib/teact/teact'; import React, { - useState, useEffect, useCallback, memo, useRef, + memo, useCallback, useEffect, useRef, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; + import type { GlobalState } from '../../global/types'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { pick } from '../../util/iteratees'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import renderText from '../common/helpers/renderText'; + import useHistoryBack from '../../hooks/useHistoryBack'; import useLang from '../../hooks/useLang'; +import TrackingMonkey from '../common/TrackingMonkey'; import InputText from '../ui/InputText'; import Loading from '../ui/Loading'; -import TrackingMonkey from '../common/TrackingMonkey'; type StateProps = Pick; diff --git a/src/components/auth/AuthPassword.async.tsx b/src/components/auth/AuthPassword.async.tsx index 11eb086ea..9f207c0f1 100644 --- a/src/components/auth/AuthPassword.async.tsx +++ b/src/components/auth/AuthPassword.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const AuthPasswordAsync: FC = () => { diff --git a/src/components/auth/AuthPassword.tsx b/src/components/auth/AuthPassword.tsx index 54b4d485a..4d209936a 100644 --- a/src/components/auth/AuthPassword.tsx +++ b/src/components/auth/AuthPassword.tsx @@ -5,10 +5,11 @@ import { getActions, withGlobal } from '../../global'; import type { GlobalState } from '../../global/types'; import { pick } from '../../util/iteratees'; + import useLang from '../../hooks/useLang'; -import MonkeyPassword from '../common/PasswordMonkey'; import PasswordForm from '../common/PasswordForm'; +import MonkeyPassword from '../common/PasswordMonkey'; type StateProps = Pick; diff --git a/src/components/auth/AuthPhoneNumber.tsx b/src/components/auth/AuthPhoneNumber.tsx index 0f791bfa2..5e2f9469b 100644 --- a/src/components/auth/AuthPhoneNumber.tsx +++ b/src/components/auth/AuthPhoneNumber.tsx @@ -1,35 +1,35 @@ import type { ChangeEvent } from 'react'; -import { requestMeasure } from '../../lib/fasterdom/fasterdom'; - -import monkeyPath from '../../assets/monkey.svg'; - import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useLayoutEffect, useRef, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; +import type { ApiCountryCode } from '../../api/types'; import type { GlobalState } from '../../global/types'; import type { LangCode } from '../../types'; -import type { ApiCountryCode } from '../../api/types'; -import { IS_SAFARI, IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { requestMeasure } from '../../lib/fasterdom/fasterdom'; import { preloadImage } from '../../util/files'; import preloadFonts from '../../util/fonts'; import { pick } from '../../util/iteratees'; -import { formatPhoneNumber, getCountryCodesByIso, getCountryFromPhoneNumber } from '../../util/phoneNumber'; import { setLanguage } from '../../util/langProvider'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import useLangString from '../../hooks/useLangString'; +import { formatPhoneNumber, getCountryCodesByIso, getCountryFromPhoneNumber } from '../../util/phoneNumber'; +import { IS_SAFARI, IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { getSuggestedLanguage } from './helpers/getSuggestedLanguage'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLangString from '../../hooks/useLangString'; + import Button from '../ui/Button'; import Checkbox from '../ui/Checkbox'; import InputText from '../ui/InputText'; import Loading from '../ui/Loading'; import CountryCodeInput from './CountryCodeInput'; +import monkeyPath from '../../assets/monkey.svg'; + type StateProps = Pick { diff --git a/src/components/auth/AuthRegister.tsx b/src/components/auth/AuthRegister.tsx index af96a15cd..d6220ab80 100644 --- a/src/components/auth/AuthRegister.tsx +++ b/src/components/auth/AuthRegister.tsx @@ -1,16 +1,17 @@ import type { ChangeEvent } from 'react'; import type { FC } from '../../lib/teact/teact'; -import React, { useState, memo, useCallback } from '../../lib/teact/teact'; +import React, { memo, useCallback, useState } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { GlobalState } from '../../global/types'; import { pick } from '../../util/iteratees'; + import useLang from '../../hooks/useLang'; +import AvatarEditable from '../ui/AvatarEditable'; import Button from '../ui/Button'; import InputText from '../ui/InputText'; -import AvatarEditable from '../ui/AvatarEditable'; type StateProps = Pick; diff --git a/src/components/auth/CountryCodeInput.tsx b/src/components/auth/CountryCodeInput.tsx index 708df3405..d621ca915 100644 --- a/src/components/auth/CountryCodeInput.tsx +++ b/src/components/auth/CountryCodeInput.tsx @@ -1,17 +1,18 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useState, memo, useCallback, useRef, + memo, useCallback, useRef, useState, } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; import type { ApiCountryCode } from '../../api/types'; import { ANIMATION_END_DELAY } from '../../config'; -import { prepareSearchWordsForNeedle } from '../../util/searchWords'; import buildClassName from '../../util/buildClassName'; -import renderText from '../common/helpers/renderText'; -import useLang from '../../hooks/useLang'; import { isoToEmoji } from '../../util/emoji'; +import { prepareSearchWordsForNeedle } from '../../util/searchWords'; +import renderText from '../common/helpers/renderText'; + +import useLang from '../../hooks/useLang'; import useSyncEffect from '../../hooks/useSyncEffect'; import DropdownMenu from '../ui/DropdownMenu'; diff --git a/src/components/calls/ActiveCallHeader.async.tsx b/src/components/calls/ActiveCallHeader.async.tsx index 01e8dc4d6..a55d51745 100644 --- a/src/components/calls/ActiveCallHeader.async.tsx +++ b/src/components/calls/ActiveCallHeader.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import useModuleLoader from '../../hooks/useModuleLoader'; + import { Bundles } from '../../util/moduleLoader'; +import useModuleLoader from '../../hooks/useModuleLoader'; + type OwnProps = { isActive?: boolean; }; diff --git a/src/components/calls/ActiveCallHeader.tsx b/src/components/calls/ActiveCallHeader.tsx index 97cf922d3..83424bcec 100644 --- a/src/components/calls/ActiveCallHeader.tsx +++ b/src/components/calls/ActiveCallHeader.tsx @@ -4,9 +4,10 @@ import { getActions, withGlobal } from '../../global'; import type { ApiGroupCall, ApiUser } from '../../api/types'; -import { selectActiveGroupCall, selectPhoneCallUser } from '../../global/selectors/calls'; import { selectTabState } from '../../global/selectors'; +import { selectActiveGroupCall, selectPhoneCallUser } from '../../global/selectors/calls'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; import './ActiveCallHeader.scss'; diff --git a/src/components/calls/group/GroupCall.async.tsx b/src/components/calls/group/GroupCall.async.tsx index a08b15bc7..723c024da 100644 --- a/src/components/calls/group/GroupCall.async.tsx +++ b/src/components/calls/group/GroupCall.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import useModuleLoader from '../../../hooks/useModuleLoader'; -import { Bundles } from '../../../util/moduleLoader'; + import type { OwnProps } from './GroupCall'; +import { Bundles } from '../../../util/moduleLoader'; + +import useModuleLoader from '../../../hooks/useModuleLoader'; + const GroupCallAsync: FC = (props) => { const { groupCallId } = props; const GroupCall = useModuleLoader(Bundles.Calls, 'GroupCall', !groupCallId); diff --git a/src/components/calls/group/GroupCall.tsx b/src/components/calls/group/GroupCall.tsx index 04b65108a..b5cc51081 100644 --- a/src/components/calls/group/GroupCall.tsx +++ b/src/components/calls/group/GroupCall.tsx @@ -1,40 +1,42 @@ +import '../../../global/actions/calls'; + +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import '../../../global/actions/calls'; import type { GroupCallConnectionState, GroupCallParticipant as TypeGroupCallParticipant, } from '../../../lib/secret-sauce'; -import type { FC } from '../../../lib/teact/teact'; import type { VideoParticipant } from './hooks/useGroupCallVideoLayout'; import { IS_SCREENSHARE_SUPPORTED } from '../../../lib/secret-sauce'; -import buildClassName from '../../../util/buildClassName'; +import { selectChat, selectTabState } from '../../../global/selectors'; import { selectCanInviteToActiveGroupCall, selectGroupCall, selectGroupCallParticipant, selectIsAdminInActiveGroupCall, } from '../../../global/selectors/calls'; -import { selectChat, selectTabState } from '../../../global/selectors'; +import buildClassName from '../../../util/buildClassName'; import { compact } from '../../../util/iteratees'; -import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; + import useAppLayout from '../../../hooks/useAppLayout'; -import useGroupCallVideoLayout from './hooks/useGroupCallVideoLayout'; -import { useIntersectionObserver, useIsIntersecting } from '../../../hooks/useIntersectionObserver'; -import useLastCallback from '../../../hooks/useLastCallback'; +import useFlag from '../../../hooks/useFlag'; import { useFullscreenStatus } from '../../../hooks/useFullscreen'; +import { useIntersectionObserver, useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useGroupCallVideoLayout from './hooks/useGroupCallVideoLayout'; import Button from '../../ui/Button'; -import Modal from '../../ui/Modal'; -import MicrophoneButton from './MicrophoneButton'; import Checkbox from '../../ui/Checkbox'; -import GroupCallParticipantList from './GroupCallParticipantList'; import FloatingActionButton from '../../ui/FloatingActionButton'; +import Modal from '../../ui/Modal'; +import GroupCallParticipantList from './GroupCallParticipantList'; import GroupCallParticipantVideo from './GroupCallParticipantVideo'; +import MicrophoneButton from './MicrophoneButton'; import styles from './GroupCall.module.scss'; diff --git a/src/components/calls/group/GroupCallParticipant.tsx b/src/components/calls/group/GroupCallParticipant.tsx index bd7935d53..cd5254769 100644 --- a/src/components/calls/group/GroupCallParticipant.tsx +++ b/src/components/calls/group/GroupCallParticipant.tsx @@ -1,5 +1,3 @@ -import type { GroupCallParticipant as TypeGroupCallParticipant } from '../../../lib/secret-sauce'; -import { THRESHOLD } from '../../../lib/secret-sauce'; import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, @@ -7,22 +5,24 @@ import React, { import { withGlobal } from '../../../global'; import type { ApiChat, ApiUser } from '../../../api/types'; +import type { GroupCallParticipant as TypeGroupCallParticipant } from '../../../lib/secret-sauce'; import { GROUP_CALL_DEFAULT_VOLUME } from '../../../config'; +import { THRESHOLD } from '../../../lib/secret-sauce'; +import { selectChat, selectUser } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import renderText from '../../common/helpers/renderText'; -import { selectChat, selectUser } from '../../../global/selectors'; import formatGroupCallVolume from './helpers/formatGroupCallVolume'; -import useLang from '../../../hooks/useLang'; import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; +import useLang from '../../../hooks/useLang'; import useMenuPosition from '../../../hooks/useMenuPosition'; import Avatar from '../../common/Avatar'; -import OutlinedMicrophoneIcon from './OutlinedMicrophoneIcon'; +import FullNameTitle from '../../common/FullNameTitle'; import ListItem from '../../ui/ListItem'; import GroupCallParticipantMenu from './GroupCallParticipantMenu'; -import FullNameTitle from '../../common/FullNameTitle'; +import OutlinedMicrophoneIcon from './OutlinedMicrophoneIcon'; import styles from './GroupCallParticipant.module.scss'; diff --git a/src/components/calls/group/GroupCallParticipantList.tsx b/src/components/calls/group/GroupCallParticipantList.tsx index 61f8404e9..3fb8e9433 100644 --- a/src/components/calls/group/GroupCallParticipantList.tsx +++ b/src/components/calls/group/GroupCallParticipantList.tsx @@ -1,16 +1,17 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { GroupCallParticipant as TypeGroupCallParticipant } from '../../../lib/secret-sauce'; -import type { FC } from '../../../lib/teact/teact'; -import buildClassName from '../../../util/buildClassName'; import { selectActiveGroupCall } from '../../../global/selectors/calls'; +import buildClassName from '../../../util/buildClassName'; + import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; import useLastCallback from '../../../hooks/useLastCallback'; -import GroupCallParticipant from './GroupCallParticipant'; import InfiniteScroll from '../../ui/InfiniteScroll'; +import GroupCallParticipant from './GroupCallParticipant'; import styles from './GroupCallParticipantList.module.scss'; diff --git a/src/components/calls/group/GroupCallParticipantMenu.tsx b/src/components/calls/group/GroupCallParticipantMenu.tsx index 6aff3fdd2..bd6409cf9 100644 --- a/src/components/calls/group/GroupCallParticipantMenu.tsx +++ b/src/components/calls/group/GroupCallParticipantMenu.tsx @@ -1,23 +1,25 @@ -import type { GroupCallParticipant } from '../../../lib/secret-sauce'; import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; +import type { GroupCallParticipant } from '../../../lib/secret-sauce'; + import { GROUP_CALL_DEFAULT_VOLUME, GROUP_CALL_VOLUME_MULTIPLIER } from '../../../config'; -import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; +import { selectIsAdminInActiveGroupCall } from '../../../global/selectors/calls'; import buildClassName from '../../../util/buildClassName'; -import useRunThrottled from '../../../hooks/useRunThrottled'; +import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; + import useFlag from '../../../hooks/useFlag'; import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; -import { selectIsAdminInActiveGroupCall } from '../../../global/selectors/calls'; +import useRunThrottled from '../../../hooks/useRunThrottled'; -import Menu from '../../ui/Menu'; -import MenuItem from '../../ui/MenuItem'; import AnimatedIcon from '../../common/AnimatedIcon'; import DeleteMemberModal from '../../right/DeleteMemberModal'; +import Menu from '../../ui/Menu'; +import MenuItem from '../../ui/MenuItem'; import './GroupCallParticipantMenu.scss'; diff --git a/src/components/calls/group/GroupCallParticipantVideo.tsx b/src/components/calls/group/GroupCallParticipantVideo.tsx index cee19a2be..3ac61eb19 100644 --- a/src/components/calls/group/GroupCallParticipantVideo.tsx +++ b/src/components/calls/group/GroupCallParticipantVideo.tsx @@ -1,35 +1,35 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { VideoLayout, VideoParticipant } from './hooks/useGroupCallVideoLayout'; -import type { GroupCallParticipant as TypeGroupCallParticipant } from '../../../lib/secret-sauce'; import type { ApiChat, ApiUser } from '../../../api/types'; +import type { GroupCallParticipant as TypeGroupCallParticipant } from '../../../lib/secret-sauce'; +import type { VideoLayout, VideoParticipant } from './hooks/useGroupCallVideoLayout'; -import { IS_CANVAS_FILTER_SUPPORTED } from '../../../util/windowEnvironment'; import { GROUP_CALL_DEFAULT_VOLUME } from '../../../config'; +import fastBlur from '../../../lib/fastBlur'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { getUserStreams, THRESHOLD } from '../../../lib/secret-sauce'; -import buildClassName from '../../../util/buildClassName'; import { selectChat, selectUser } from '../../../global/selectors'; import { animate } from '../../../util/animation'; +import buildClassName from '../../../util/buildClassName'; import { fastRaf } from '../../../util/schedulers'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import { IS_CANVAS_FILTER_SUPPORTED } from '../../../util/windowEnvironment'; import formatGroupCallVolume from './helpers/formatGroupCallVolume'; -import fastBlur from '../../../lib/fastBlur'; -import useLang from '../../../hooks/useLang'; import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; -import useMenuPosition from '../../../hooks/useMenuPosition'; -import useLastCallback from '../../../hooks/useLastCallback'; import useInterval from '../../../hooks/useInterval'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMenuPosition from '../../../hooks/useMenuPosition'; -import Button from '../../ui/Button'; -import OutlinedMicrophoneIcon from './OutlinedMicrophoneIcon'; import FullNameTitle from '../../common/FullNameTitle'; -import GroupCallParticipantMenu from './GroupCallParticipantMenu'; +import Button from '../../ui/Button'; import Skeleton from '../../ui/placeholder/Skeleton'; +import GroupCallParticipantMenu from './GroupCallParticipantMenu'; +import OutlinedMicrophoneIcon from './OutlinedMicrophoneIcon'; import styles from './GroupCallParticipantVideo.module.scss'; diff --git a/src/components/calls/group/GroupCallTopPane.tsx b/src/components/calls/group/GroupCallTopPane.tsx index 8cb653ecd..78565aec5 100644 --- a/src/components/calls/group/GroupCallTopPane.tsx +++ b/src/components/calls/group/GroupCallTopPane.tsx @@ -6,15 +6,16 @@ import { getActions, getGlobal, withGlobal } from '../../../global'; import type { ApiGroupCall } from '../../../api/types'; +import { selectChat, selectTabState } from '../../../global/selectors'; import { selectChatGroupCall } from '../../../global/selectors/calls'; import buildClassName from '../../../util/buildClassName'; -import { selectChat, selectTabState } from '../../../global/selectors'; + +import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; import useLang from '../../../hooks/useLang'; import useShowTransition from '../../../hooks/useShowTransition'; -import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; -import Button from '../../ui/Button'; import Avatar from '../../common/Avatar'; +import Button from '../../ui/Button'; import './GroupCallTopPane.scss'; diff --git a/src/components/calls/group/MicrophoneButton.tsx b/src/components/calls/group/MicrophoneButton.tsx index 28550e911..7f1af3afa 100644 --- a/src/components/calls/group/MicrophoneButton.tsx +++ b/src/components/calls/group/MicrophoneButton.tsx @@ -1,16 +1,18 @@ -import type { GroupCallConnectionState } from '../../../lib/secret-sauce'; import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; +import type { GroupCallConnectionState } from '../../../lib/secret-sauce'; + +import { selectActiveGroupCall, selectGroupCallParticipant } from '../../../global/selectors/calls'; import buildClassName from '../../../util/buildClassName'; import { vibrateShort } from '../../../util/vibrate'; -import usePrevious from '../../../hooks/usePrevious'; -import { selectActiveGroupCall, selectGroupCallParticipant } from '../../../global/selectors/calls'; +import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; + import useLang from '../../../hooks/useLang'; +import usePrevious from '../../../hooks/usePrevious'; import AnimatedIcon from '../../common/AnimatedIcon'; import Button from '../../ui/Button'; diff --git a/src/components/calls/group/OutlinedMicrophoneIcon.tsx b/src/components/calls/group/OutlinedMicrophoneIcon.tsx index f0e5d85d9..5b0ae7d21 100644 --- a/src/components/calls/group/OutlinedMicrophoneIcon.tsx +++ b/src/components/calls/group/OutlinedMicrophoneIcon.tsx @@ -1,9 +1,11 @@ -import type { GroupCallParticipant } from '../../../lib/secret-sauce'; -import { THRESHOLD } from '../../../lib/secret-sauce'; import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; +import type { GroupCallParticipant } from '../../../lib/secret-sauce'; + +import { THRESHOLD } from '../../../lib/secret-sauce'; import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; + import usePrevious from '../../../hooks/usePrevious'; import AnimatedIcon from '../../common/AnimatedIcon'; diff --git a/src/components/calls/group/helpers/formatGroupCallVolume.ts b/src/components/calls/group/helpers/formatGroupCallVolume.ts index b37ea9c3d..a416035aa 100644 --- a/src/components/calls/group/helpers/formatGroupCallVolume.ts +++ b/src/components/calls/group/helpers/formatGroupCallVolume.ts @@ -1,4 +1,5 @@ import type { GroupCallParticipant } from '../../../../lib/secret-sauce'; + import { GROUP_CALL_DEFAULT_VOLUME, GROUP_CALL_VOLUME_MULTIPLIER } from '../../../../config'; export default function formatGroupCallVolume(participant: GroupCallParticipant) { diff --git a/src/components/calls/group/hooks/useGroupCallVideoLayout.ts b/src/components/calls/group/hooks/useGroupCallVideoLayout.ts index 4bef926ee..0b67723ab 100644 --- a/src/components/calls/group/hooks/useGroupCallVideoLayout.ts +++ b/src/components/calls/group/hooks/useGroupCallVideoLayout.ts @@ -2,9 +2,10 @@ import type { RefObject } from 'react'; import { useEffect, useMemo, useState, } from '../../../../lib/teact/teact'; -import useResizeObserver from '../../../../hooks/useResizeObserver'; -import usePrevious from '../../../../hooks/usePrevious'; + import useLastCallback from '../../../../hooks/useLastCallback'; +import usePrevious from '../../../../hooks/usePrevious'; +import useResizeObserver from '../../../../hooks/useResizeObserver'; const PADDING_HORIZONTAL = 10; const PADDING_VERTICAL = 8; diff --git a/src/components/calls/phone/PhoneCall.async.tsx b/src/components/calls/phone/PhoneCall.async.tsx index 68cbf9fcc..189902f85 100644 --- a/src/components/calls/phone/PhoneCall.async.tsx +++ b/src/components/calls/phone/PhoneCall.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import useModuleLoader from '../../../hooks/useModuleLoader'; + import { Bundles } from '../../../util/moduleLoader'; +import useModuleLoader from '../../../hooks/useModuleLoader'; + type OwnProps = { isActive?: boolean; }; diff --git a/src/components/calls/phone/PhoneCall.tsx b/src/components/calls/phone/PhoneCall.tsx index bf7e138d8..45880a095 100644 --- a/src/components/calls/phone/PhoneCall.tsx +++ b/src/components/calls/phone/PhoneCall.tsx @@ -1,37 +1,39 @@ +import '../../../global/actions/calls'; + import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import '../../../global/actions/calls'; import type { ApiPhoneCall, ApiUser } from '../../../api/types'; +import { + getStreams, IS_SCREENSHARE_SUPPORTED, switchCameraInputP2p, toggleStreamP2p, +} from '../../../lib/secret-sauce'; +import { selectTabState } from '../../../global/selectors'; +import { selectPhoneCallUser } from '../../../global/selectors/calls'; +import buildClassName from '../../../util/buildClassName'; +import { formatMediaDuration } from '../../../util/dateFormat'; import { IS_ANDROID, IS_IOS, IS_REQUEST_FULLSCREEN_SUPPORTED, } from '../../../util/windowEnvironment'; import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; -import { selectTabState } from '../../../global/selectors'; -import buildClassName from '../../../util/buildClassName'; -import { selectPhoneCallUser } from '../../../global/selectors/calls'; -import useLang from '../../../hooks/useLang'; import renderText from '../../common/helpers/renderText'; -import useFlag from '../../../hooks/useFlag'; -import { formatMediaDuration } from '../../../util/dateFormat'; -import { - getStreams, IS_SCREENSHARE_SUPPORTED, switchCameraInputP2p, toggleStreamP2p, -} from '../../../lib/secret-sauce'; -import useInterval from '../../../hooks/useInterval'; -import useForceUpdate from '../../../hooks/useForceUpdate'; -import useAppLayout from '../../../hooks/useAppLayout'; -import Modal from '../../ui/Modal'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useFlag from '../../../hooks/useFlag'; +import useForceUpdate from '../../../hooks/useForceUpdate'; +import useInterval from '../../../hooks/useInterval'; +import useLang from '../../../hooks/useLang'; + +import AnimatedIcon from '../../common/AnimatedIcon'; import Avatar from '../../common/Avatar'; import Button from '../../ui/Button'; +import Modal from '../../ui/Modal'; import PhoneCallButton from './PhoneCallButton'; -import AnimatedIcon from '../../common/AnimatedIcon'; import styles from './PhoneCall.module.scss'; diff --git a/src/components/calls/phone/RatePhoneCallModal.async.tsx b/src/components/calls/phone/RatePhoneCallModal.async.tsx index 4151cba2d..c14ed8be3 100644 --- a/src/components/calls/phone/RatePhoneCallModal.async.tsx +++ b/src/components/calls/phone/RatePhoneCallModal.async.tsx @@ -2,6 +2,7 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; import type { OwnProps } from './RatePhoneCallModal'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/calls/phone/RatePhoneCallModal.tsx b/src/components/calls/phone/RatePhoneCallModal.tsx index 56776f627..b44a64d9c 100644 --- a/src/components/calls/phone/RatePhoneCallModal.tsx +++ b/src/components/calls/phone/RatePhoneCallModal.tsx @@ -1,16 +1,16 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useRef, useState, useCallback, + memo, useCallback, useRef, useState, } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; - -import useLang from '../../../hooks/useLang'; import buildClassName from '../../../util/buildClassName'; -import Modal from '../../ui/Modal'; +import useLang from '../../../hooks/useLang'; + import Button from '../../ui/Button'; import InputText from '../../ui/InputText'; +import Modal from '../../ui/Modal'; import styles from './RatePhoneCallModal.module.scss'; diff --git a/src/components/common/AboutAdsModal.async.tsx b/src/components/common/AboutAdsModal.async.tsx index 09d76abc8..ff15e3a9d 100644 --- a/src/components/common/AboutAdsModal.async.tsx +++ b/src/components/common/AboutAdsModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './AboutAdsModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/AboutAdsModal.tsx b/src/components/common/AboutAdsModal.tsx index e4b549180..fb9c5afb9 100644 --- a/src/components/common/AboutAdsModal.tsx +++ b/src/components/common/AboutAdsModal.tsx @@ -2,10 +2,11 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import renderText from './helpers/renderText'; + import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; +import Modal from '../ui/Modal'; import SafeLink from './SafeLink'; export type OwnProps = { diff --git a/src/components/common/AnimatedCounter.tsx b/src/components/common/AnimatedCounter.tsx index 7857e8fe2..d59128880 100644 --- a/src/components/common/AnimatedCounter.tsx +++ b/src/components/common/AnimatedCounter.tsx @@ -4,10 +4,11 @@ import React, { } from '../../lib/teact/teact'; import { getGlobal } from '../../global'; -import buildClassName from '../../util/buildClassName'; import { selectCanAnimateInterface } from '../../global/selectors'; -import useLang from '../../hooks/useLang'; +import buildClassName from '../../util/buildClassName'; + import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import styles from './AnimatedCounter.module.scss'; diff --git a/src/components/common/AnimatedIcon.tsx b/src/components/common/AnimatedIcon.tsx index ef283b1c4..860630f37 100644 --- a/src/components/common/AnimatedIcon.tsx +++ b/src/components/common/AnimatedIcon.tsx @@ -4,9 +4,9 @@ import type { OwnProps as AnimatedStickerProps } from './AnimatedSticker'; import buildClassName from '../../util/buildClassName'; +import useFlag from '../../hooks/useFlag'; import useLastCallback from '../../hooks/useLastCallback'; import useMediaTransition from '../../hooks/useMediaTransition'; -import useFlag from '../../hooks/useFlag'; import AnimatedSticker from './AnimatedSticker'; diff --git a/src/components/common/AnimatedIconFromSticker.tsx b/src/components/common/AnimatedIconFromSticker.tsx index 775e1ebc3..9ccf70383 100644 --- a/src/components/common/AnimatedIconFromSticker.tsx +++ b/src/components/common/AnimatedIconFromSticker.tsx @@ -1,7 +1,7 @@ import React, { memo } from '../../lib/teact/teact'; -import type { OwnProps as AnimatedIconProps } from './AnimatedIcon'; import type { ApiSticker } from '../../api/types'; +import type { OwnProps as AnimatedIconProps } from './AnimatedIcon'; import { ApiMediaFormat } from '../../api/types'; import { getStickerPreviewHash } from '../../global/helpers'; diff --git a/src/components/common/AnimatedIconWithPreview.tsx b/src/components/common/AnimatedIconWithPreview.tsx index f13057238..330977aeb 100644 --- a/src/components/common/AnimatedIconWithPreview.tsx +++ b/src/components/common/AnimatedIconWithPreview.tsx @@ -1,14 +1,15 @@ import React, { memo } from '../../lib/teact/teact'; import type { OwnProps as AnimatedIconProps } from './AnimatedIcon'; -import AnimatedIcon from './AnimatedIcon'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; +import useFlag from '../../hooks/useFlag'; import useLastCallback from '../../hooks/useLastCallback'; import useMediaTransition from '../../hooks/useMediaTransition'; -import useFlag from '../../hooks/useFlag'; + +import AnimatedIcon from './AnimatedIcon'; import styles from './AnimatedIconWithPreview.module.scss'; diff --git a/src/components/common/AnimatedSticker.tsx b/src/components/common/AnimatedSticker.tsx index cbf38afbd..e156d31de 100644 --- a/src/components/common/AnimatedSticker.tsx +++ b/src/components/common/AnimatedSticker.tsx @@ -1,30 +1,29 @@ import type { RefObject } from 'react'; import type { FC } from '../../lib/teact/teact'; -import type RLottieInstance from '../../lib/rlottie/RLottie'; -import { requestMeasure } from '../../lib/fasterdom/fasterdom'; -import { ensureRLottie, getRLottie } from '../../lib/rlottie/RLottie.async'; - import React, { - useEffect, useRef, memo, useState, + memo, useEffect, useRef, useState, } from '../../lib/teact/teact'; -import { IS_ELECTRON } from '../../config'; +import type RLottieInstance from '../../lib/rlottie/RLottie'; +import { IS_ELECTRON } from '../../config'; +import { requestMeasure } from '../../lib/fasterdom/fasterdom'; +import { ensureRLottie, getRLottie } from '../../lib/rlottie/RLottie.async'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; import generateUniqueId from '../../util/generateUniqueId'; import { hexToRgb } from '../../util/switchTheme'; -import useLastCallback from '../../hooks/useLastCallback'; -import useHeavyAnimationCheck, { isHeavyAnimating } from '../../hooks/useHeavyAnimationCheck'; -import usePriorityPlaybackCheck, { isPriorityPlaybackActive } from '../../hooks/usePriorityPlaybackCheck'; +import useColorFilter from '../../hooks/stickers/useColorFilter'; import useBackgroundMode, { isBackgroundModeActive } from '../../hooks/useBackgroundMode'; import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; -import { useStateRef } from '../../hooks/useStateRef'; +import useHeavyAnimationCheck, { isHeavyAnimating } from '../../hooks/useHeavyAnimationCheck'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePriorityPlaybackCheck, { isPriorityPlaybackActive } from '../../hooks/usePriorityPlaybackCheck'; import useSharedIntersectionObserver from '../../hooks/useSharedIntersectionObserver'; -import useThrottledCallback from '../../hooks/useThrottledCallback'; -import useColorFilter from '../../hooks/stickers/useColorFilter'; +import { useStateRef } from '../../hooks/useStateRef'; import useSyncEffect from '../../hooks/useSyncEffect'; +import useThrottledCallback from '../../hooks/useThrottledCallback'; import useUniqueId from '../../hooks/useUniqueId'; export type OwnProps = { diff --git a/src/components/common/Audio.tsx b/src/components/common/Audio.tsx index f5975eb86..6b3e86954 100644 --- a/src/components/common/Audio.tsx +++ b/src/components/common/Audio.tsx @@ -5,14 +5,12 @@ import React, { import { getActions } from '../../global'; import type { ApiAudio, ApiMessage, ApiVoice } from '../../api/types'; -import { ApiMediaFormat } from '../../api/types'; -import type { ISettings } from '../../types'; -import { AudioOrigin } from '../../types'; +import type { BufferedRange } from '../../hooks/useBuffering'; import type { LangFn } from '../../hooks/useLang'; +import type { ISettings } from '../../types'; +import { ApiMediaFormat } from '../../api/types'; +import { AudioOrigin } from '../../types'; -import { MAX_EMPTY_WAVEFORM_POINTS, renderWaveform } from './helpers/waveform'; -import renderText from './helpers/renderText'; -import { getFileSizeString } from './helpers/documentInfo'; import { getMediaDuration, getMediaTransferState, @@ -21,25 +19,27 @@ import { isMessageLocal, isOwnMessage, } from '../../global/helpers'; +import { makeTrackId } from '../../util/audioPlayer'; import buildClassName from '../../util/buildClassName'; +import { captureEvents } from '../../util/captureEvents'; import { formatMediaDateTime, formatMediaDuration, formatPastTimeShort } from '../../util/dateFormat'; import { decodeWaveform, interpolateArray } from '../../util/waveform'; -import { makeTrackId } from '../../util/audioPlayer'; +import { getFileSizeString } from './helpers/documentInfo'; +import renderText from './helpers/renderText'; +import { MAX_EMPTY_WAVEFORM_POINTS, renderWaveform } from './helpers/waveform'; +import useAppLayout from '../../hooks/useAppLayout'; +import useAudioPlayer from '../../hooks/useAudioPlayer'; +import useBuffering from '../../hooks/useBuffering'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; +import useMedia from '../../hooks/useMedia'; import useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress'; import useShowTransition from '../../hooks/useShowTransition'; -import type { BufferedRange } from '../../hooks/useBuffering'; -import useBuffering from '../../hooks/useBuffering'; -import useAudioPlayer from '../../hooks/useAudioPlayer'; -import useLang from '../../hooks/useLang'; -import { captureEvents } from '../../util/captureEvents'; -import useMedia from '../../hooks/useMedia'; -import useAppLayout from '../../hooks/useAppLayout'; import Button from '../ui/Button'; -import ProgressSpinner from '../ui/ProgressSpinner'; import Link from '../ui/Link'; +import ProgressSpinner from '../ui/ProgressSpinner'; import './Audio.scss'; diff --git a/src/components/common/Avatar.tsx b/src/components/common/Avatar.tsx index f051c03a8..2921debad 100644 --- a/src/components/common/Avatar.tsx +++ b/src/components/common/Avatar.tsx @@ -1,8 +1,8 @@ import type { MouseEvent as ReactMouseEvent } from 'react'; +import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { memo, useRef } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC, TeactNode } from '../../lib/teact/teact'; import type { ApiChat, ApiPhoto, ApiUser } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import type { StoryViewerOrigin } from '../../types'; @@ -14,20 +14,20 @@ import { getChatTitle, getUserColorKey, getUserFullName, - isUserId, + getUserStoryHtmlId, isChatWithRepliesBot, isDeletedUser, - getUserStoryHtmlId, + isUserId, } from '../../global/helpers'; -import { getFirstLetters } from '../../util/textFormat'; import buildClassName, { createClassNameBuilder } from '../../util/buildClassName'; +import { getFirstLetters } from '../../util/textFormat'; import renderText from './helpers/renderText'; -import useMedia from '../../hooks/useMedia'; -import useMediaTransition from '../../hooks/useMediaTransition'; +import { useFastClick } from '../../hooks/useFastClick'; import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; -import { useFastClick } from '../../hooks/useFastClick'; +import useMedia from '../../hooks/useMedia'; +import useMediaTransition from '../../hooks/useMediaTransition'; import OptimizedVideo from '../ui/OptimizedVideo'; import AvatarStoryCircle from './AvatarStoryCircle'; diff --git a/src/components/common/AvatarList.tsx b/src/components/common/AvatarList.tsx index 61139f00e..61959ba41 100644 --- a/src/components/common/AvatarList.tsx +++ b/src/components/common/AvatarList.tsx @@ -1,10 +1,11 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; -import type { AvatarSize } from './Avatar'; import type { ApiChat, ApiUser } from '../../api/types'; +import type { AvatarSize } from './Avatar'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; import Avatar from './Avatar'; diff --git a/src/components/common/AvatarStoryCircle.tsx b/src/components/common/AvatarStoryCircle.tsx index b6cef93c8..e5f212f1e 100644 --- a/src/components/common/AvatarStoryCircle.tsx +++ b/src/components/common/AvatarStoryCircle.tsx @@ -3,13 +3,13 @@ import React, { } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; -import type { AvatarSize } from './Avatar'; import type { ThemeKey } from '../../types'; +import type { AvatarSize } from './Avatar'; -import { REM } from './helpers/mediaDimensions'; -import { DPR } from '../../util/windowEnvironment'; import { selectTheme, selectUser, selectUserStories } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; +import { DPR } from '../../util/windowEnvironment'; +import { REM } from './helpers/mediaDimensions'; interface OwnProps { // eslint-disable-next-line react/no-unused-prop-types diff --git a/src/components/common/CalendarModal.async.tsx b/src/components/common/CalendarModal.async.tsx index 4544d0e75..ec3b6d523 100644 --- a/src/components/common/CalendarModal.async.tsx +++ b/src/components/common/CalendarModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './CalendarModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/CalendarModal.tsx b/src/components/common/CalendarModal.tsx index 5d8c5496f..dfa975ef0 100644 --- a/src/components/common/CalendarModal.tsx +++ b/src/components/common/CalendarModal.tsx @@ -1,18 +1,20 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useState, useEffect, useMemo, useCallback, + memo, useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; +import type { LangFn } from '../../hooks/useLang'; + import { MAX_INT_32 } from '../../config'; import buildClassName from '../../util/buildClassName'; -import { formatTime, formatDateToString, getDayStart } from '../../util/dateFormat'; -import type { LangFn } from '../../hooks/useLang'; +import { formatDateToString, formatTime, getDayStart } from '../../util/dateFormat'; + +import useFlag from '../../hooks/useFlag'; import useLang from '../../hooks/useLang'; import usePrevious from '../../hooks/usePrevious'; -import useFlag from '../../hooks/useFlag'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; +import Modal from '../ui/Modal'; import './CalendarModal.scss'; diff --git a/src/components/common/ChatExtra.tsx b/src/components/common/ChatExtra.tsx index 2a663f598..79b2c106e 100644 --- a/src/components/common/ChatExtra.tsx +++ b/src/components/common/ChatExtra.tsx @@ -1,15 +1,24 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiChat, ApiCountryCode, ApiUser, ApiUsername, } from '../../api/types'; import { MAIN_THREAD_ID } from '../../api/types'; import { TME_LINK_PREFIX } from '../../config'; +import { + getChatLink, + getHasAdminRight, + getTopicLink, + isChatChannel, + isUserId, + isUserRightBanned, + selectIsChatMuted, +} from '../../global/helpers'; import { selectChat, selectChatFullInfo, @@ -19,23 +28,14 @@ import { selectUser, selectUserFullInfo, } from '../../global/selectors'; -import { - getChatLink, - getTopicLink, - getHasAdminRight, - isChatChannel, - isUserId, - isUserRightBanned, - selectIsChatMuted, -} from '../../global/helpers'; -import renderText from './helpers/renderText'; import { copyTextToClipboard } from '../../util/clipboard'; import { formatPhoneNumberWithCode } from '../../util/phoneNumber'; import { debounce } from '../../util/schedulers'; import stopEvent from '../../util/stopEvent'; +import renderText from './helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import ListItem from '../ui/ListItem'; import Switcher from '../ui/Switcher'; diff --git a/src/components/common/ChatForumLastMessage.tsx b/src/components/common/ChatForumLastMessage.tsx index 277773d82..3f1ec8c26 100644 --- a/src/components/common/ChatForumLastMessage.tsx +++ b/src/components/common/ChatForumLastMessage.tsx @@ -1,3 +1,4 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, @@ -7,18 +8,18 @@ import React, { } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import type { FC } from '../../lib/teact/teact'; import type { ApiChat } from '../../api/types'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import buildClassName from '../../util/buildClassName'; import { getOrderedTopics } from '../../global/helpers'; -import { getIsMobile } from '../../hooks/useAppLayout'; -import useLang from '../../hooks/useLang'; -import { useFastClick } from '../../hooks/useFastClick'; +import buildClassName from '../../util/buildClassName'; import { REM } from './helpers/mediaDimensions'; import renderText from './helpers/renderText'; +import { getIsMobile } from '../../hooks/useAppLayout'; +import { useFastClick } from '../../hooks/useFastClick'; +import useLang from '../../hooks/useLang'; + import TopicIcon from './TopicIcon'; import styles from './ChatForumLastMessage.module.scss'; diff --git a/src/components/common/ChatLink.tsx b/src/components/common/ChatLink.tsx index cf85a67bb..03da3a69f 100644 --- a/src/components/common/ChatLink.tsx +++ b/src/components/common/ChatLink.tsx @@ -1,8 +1,7 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; - import buildClassName from '../../util/buildClassName'; import Link from '../ui/Link'; diff --git a/src/components/common/ChatOrUserPicker.tsx b/src/components/common/ChatOrUserPicker.tsx index 8e4f275b0..d715aa6ad 100644 --- a/src/components/common/ChatOrUserPicker.tsx +++ b/src/components/common/ChatOrUserPicker.tsx @@ -1,32 +1,32 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useRef, useState, useMemo, + memo, useMemo, useRef, useState, } from '../../lib/teact/teact'; import { getActions } from '../../global'; import type { ApiChat, ApiTopic } from '../../api/types'; -import { REM } from './helpers/mediaDimensions'; import { CHAT_HEIGHT_PX } from '../../config'; -import renderText from './helpers/renderText'; import { getCanPostInChat, isUserId } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; +import { REM } from './helpers/mediaDimensions'; +import renderText from './helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useInfiniteScroll from '../../hooks/useInfiniteScroll'; -import useLang from '../../hooks/useLang'; -import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; import useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen'; +import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import Loading from '../ui/Loading'; -import Modal from '../ui/Modal'; -import InputText from '../ui/InputText'; import Button from '../ui/Button'; import InfiniteScroll from '../ui/InfiniteScroll'; +import InputText from '../ui/InputText'; import ListItem from '../ui/ListItem'; +import Loading from '../ui/Loading'; +import Modal from '../ui/Modal'; +import Transition from '../ui/Transition'; import GroupChatInfo from './GroupChatInfo'; import PrivateChatInfo from './PrivateChatInfo'; -import Transition from '../ui/Transition'; import TopicIcon from './TopicIcon'; import './ChatOrUserPicker.scss'; diff --git a/src/components/common/Composer.tsx b/src/components/common/Composer.tsx index c02393cd0..ca2d47807 100644 --- a/src/components/common/Composer.tsx +++ b/src/components/common/Composer.tsx @@ -1,16 +1,12 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../lib/teact/teact'; -import { requestMeasure, requestNextMutation } from '../../lib/fasterdom/fasterdom'; import { getActions, getGlobal, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { - TabState, MessageListType, GlobalState, ApiDraft, MessageList, -} from '../../global/types'; -import type { - ApiAttachMenuPeerType, ApiAttachment, + ApiAttachMenuPeerType, ApiAvailableReaction, ApiBotCommand, ApiBotInlineMediaResult, @@ -29,7 +25,10 @@ import type { ApiUser, ApiVideo, } from '../../api/types'; -import type { InlineBotSettings, ISettings, IAnchorPosition } from '../../types'; +import type { + ApiDraft, GlobalState, MessageList, MessageListType, TabState, +} from '../../global/types'; +import type { IAnchorPosition, InlineBotSettings, ISettings } from '../../types'; import { BASE_EMOJI_KEYWORD_LANG, @@ -39,8 +38,14 @@ import { SCHEDULED_WHEN_ONLINE, SEND_MESSAGE_ACTION_INTERVAL, } from '../../config'; -import { IS_VOICE_RECORDING_SUPPORTED, IS_IOS } from '../../util/windowEnvironment'; -import { MEMO_EMPTY_ARRAY } from '../../util/memo'; +import { requestMeasure, requestNextMutation } from '../../lib/fasterdom/fasterdom'; +import { + getAllowedAttachmentOptions, + isChatAdmin, + isChatChannel, + isChatSuperGroup, + isUserId, +} from '../../global/helpers'; import { selectBot, selectCanPlayAnimatedEmojis, @@ -71,84 +76,79 @@ import { selectUserFullInfo, selectUserStory, } from '../../global/selectors'; -import { - getAllowedAttachmentOptions, - isChatAdmin, - isChatChannel, - isChatSuperGroup, - isUserId, -} from '../../global/helpers'; +import { selectCurrentLimit } from '../../global/selectors/limits'; +import buildClassName from '../../util/buildClassName'; +import { processMessageInputForCustomEmoji } from '../../util/customEmojiManager'; import { formatMediaDuration, formatVoiceRecordDuration } from '../../util/dateFormat'; +import deleteLastCharacterOutsideSelection from '../../util/deleteLastCharacterOutsideSelection'; import focusEditableElement from '../../util/focusEditableElement'; +import { MEMO_EMPTY_ARRAY } from '../../util/memo'; import parseMessageInput from '../../util/parseMessageInput'; import { insertHtmlInSelection } from '../../util/selection'; -import deleteLastCharacterOutsideSelection from '../../util/deleteLastCharacterOutsideSelection'; -import buildClassName from '../../util/buildClassName'; -import windowSize from '../../util/windowSize'; import { getServerTime } from '../../util/serverTime'; -import { selectCurrentLimit } from '../../global/selectors/limits'; -import { processMessageInputForCustomEmoji } from '../../util/customEmojiManager'; -import { isSelectionInsideInput } from '../middle/composer/helpers/selection'; -import { getTextWithEntitiesAsHtml } from './helpers/renderTextWithEntities'; -import { buildCustomEmojiHtml } from '../middle/composer/helpers/customEmoji'; -import buildAttachment, { prepareAttachmentsToSend } from '../middle/composer/helpers/buildAttachment'; +import { IS_IOS, IS_VOICE_RECORDING_SUPPORTED } from '../../util/windowEnvironment'; +import windowSize from '../../util/windowSize'; import applyIosAutoCapitalizationFix from '../middle/composer/helpers/applyIosAutoCapitalizationFix'; -import renderText from './helpers/renderText'; +import buildAttachment, { prepareAttachmentsToSend } from '../middle/composer/helpers/buildAttachment'; +import { buildCustomEmojiHtml } from '../middle/composer/helpers/customEmoji'; +import { isSelectionInsideInput } from '../middle/composer/helpers/selection'; import { REM } from './helpers/mediaDimensions'; +import renderText from './helpers/renderText'; +import { getTextWithEntitiesAsHtml } from './helpers/renderTextWithEntities'; -import useLastCallback from '../../hooks/useLastCallback'; -import useSignal from '../../hooks/useSignal'; -import useFlag from '../../hooks/useFlag'; -import usePrevious from '../../hooks/usePrevious'; import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; -import useLang from '../../hooks/useLang'; -import useSendMessageAction from '../../hooks/useSendMessageAction'; -import useInterval from '../../hooks/useInterval'; -import useSyncEffect from '../../hooks/useSyncEffect'; -import useGetSelectionRange from '../../hooks/useGetSelectionRange'; import useDerivedState from '../../hooks/useDerivedState'; -import { useStateRef } from '../../hooks/useStateRef'; import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; -import useTimeout from '../../hooks/useTimeout'; +import useFlag from '../../hooks/useFlag'; +import useGetSelectionRange from '../../hooks/useGetSelectionRange'; +import useInterval from '../../hooks/useInterval'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePrevious from '../../hooks/usePrevious'; import useSchedule from '../../hooks/useSchedule'; +import useSendMessageAction from '../../hooks/useSendMessageAction'; +import useShowTransition from '../../hooks/useShowTransition'; +import useSignal from '../../hooks/useSignal'; +import { useStateRef } from '../../hooks/useStateRef'; +import useSyncEffect from '../../hooks/useSyncEffect'; +import useTimeout from '../../hooks/useTimeout'; import useAttachmentModal from '../middle/composer/hooks/useAttachmentModal'; -import useVoiceRecording from '../middle/composer/hooks/useVoiceRecording'; -import useEmojiTooltip from '../middle/composer/hooks/useEmojiTooltip'; -import useCustomEmojiTooltip from '../middle/composer/hooks/useCustomEmojiTooltip'; -import useStickerTooltip from '../middle/composer/hooks/useStickerTooltip'; -import useMentionTooltip from '../middle/composer/hooks/useMentionTooltip'; -import useInlineBotTooltip from '../middle/composer/hooks/useInlineBotTooltip'; import useBotCommandTooltip from '../middle/composer/hooks/useBotCommandTooltip'; +import useClipboardPaste from '../middle/composer/hooks/useClipboardPaste'; +import useCustomEmojiTooltip from '../middle/composer/hooks/useCustomEmojiTooltip'; import useDraft from '../middle/composer/hooks/useDraft'; import useEditing from '../middle/composer/hooks/useEditing'; -import useClipboardPaste from '../middle/composer/hooks/useClipboardPaste'; -import useShowTransition from '../../hooks/useShowTransition'; +import useEmojiTooltip from '../middle/composer/hooks/useEmojiTooltip'; +import useInlineBotTooltip from '../middle/composer/hooks/useInlineBotTooltip'; +import useMentionTooltip from '../middle/composer/hooks/useMentionTooltip'; +import useStickerTooltip from '../middle/composer/hooks/useStickerTooltip'; +import useVoiceRecording from '../middle/composer/hooks/useVoiceRecording'; -import DropArea, { DropAreaState } from '../middle/composer/DropArea.async'; import AttachmentModal from '../middle/composer/AttachmentModal.async'; -import PollModal from '../middle/composer/PollModal.async'; -import DeleteMessageModal from './DeleteMessageModal.async'; -import SendAsMenu from '../middle/composer/SendAsMenu.async'; -import MentionTooltip from '../middle/composer/MentionTooltip.async'; -import BotCommandTooltip from '../middle/composer/BotCommandTooltip.async'; -import InlineBotTooltip from '../middle/composer/InlineBotTooltip.async'; -import ComposerEmbeddedMessage from '../middle/composer/ComposerEmbeddedMessage'; -import WebPagePreview from '../middle/composer/WebPagePreview'; -import BotMenuButton from '../middle/composer/BotMenuButton'; -import ResponsiveHoverButton from '../ui/ResponsiveHoverButton'; -import Button from '../ui/Button'; -import Avatar from './Avatar'; -import SymbolMenuButton from '../middle/composer/SymbolMenuButton'; -import MessageInput from '../middle/composer/MessageInput'; -import Spinner from '../ui/Spinner'; import AttachMenu from '../middle/composer/AttachMenu'; -import BotKeyboardMenu from '../middle/composer/BotKeyboardMenu'; import BotCommandMenu from '../middle/composer/BotCommandMenu.async'; +import BotCommandTooltip from '../middle/composer/BotCommandTooltip.async'; +import BotKeyboardMenu from '../middle/composer/BotKeyboardMenu'; +import BotMenuButton from '../middle/composer/BotMenuButton'; +import ComposerEmbeddedMessage from '../middle/composer/ComposerEmbeddedMessage'; import CustomEmojiTooltip from '../middle/composer/CustomEmojiTooltip.async'; -import StickerTooltip from '../middle/composer/StickerTooltip.async'; -import EmojiTooltip from '../middle/composer/EmojiTooltip.async'; import CustomSendMenu from '../middle/composer/CustomSendMenu.async'; +import DropArea, { DropAreaState } from '../middle/composer/DropArea.async'; +import EmojiTooltip from '../middle/composer/EmojiTooltip.async'; +import InlineBotTooltip from '../middle/composer/InlineBotTooltip.async'; +import MentionTooltip from '../middle/composer/MentionTooltip.async'; +import MessageInput from '../middle/composer/MessageInput'; +import PollModal from '../middle/composer/PollModal.async'; +import SendAsMenu from '../middle/composer/SendAsMenu.async'; +import StickerTooltip from '../middle/composer/StickerTooltip.async'; +import SymbolMenuButton from '../middle/composer/SymbolMenuButton'; +import WebPagePreview from '../middle/composer/WebPagePreview'; import ReactionSelector from '../middle/message/ReactionSelector'; +import Button from '../ui/Button'; +import ResponsiveHoverButton from '../ui/ResponsiveHoverButton'; +import Spinner from '../ui/Spinner'; +import Avatar from './Avatar'; +import DeleteMessageModal from './DeleteMessageModal.async'; import ReactionStaticEmoji from './ReactionStaticEmoji'; import './Composer.scss'; diff --git a/src/components/common/CustomEmoji.tsx b/src/components/common/CustomEmoji.tsx index 89f1235d6..9c0b674d2 100644 --- a/src/components/common/CustomEmoji.tsx +++ b/src/components/common/CustomEmoji.tsx @@ -1,23 +1,24 @@ +import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { memo, useRef, useState } from '../../lib/teact/teact'; import { getGlobal } from '../../global'; -import type { FC, TeactNode } from '../../lib/teact/teact'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { ApiMessageEntityTypes } from '../../api/types'; +import { selectIsAlwaysHighPriorityEmoji } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; import safePlay from '../../util/safePlay'; -import { selectIsAlwaysHighPriorityEmoji } from '../../global/selectors'; +import useDynamicColorListener from '../../hooks/stickers/useDynamicColorListener'; import useLastCallback from '../../hooks/useLastCallback'; import useCustomEmoji from './hooks/useCustomEmoji'; -import useDynamicColorListener from '../../hooks/stickers/useDynamicColorListener'; import StickerView from './StickerView'; import styles from './CustomEmoji.module.scss'; -import svgPlaceholder from '../../assets/square.svg'; + import blankImg from '../../assets/blank.png'; +import svgPlaceholder from '../../assets/square.svg'; type OwnProps = { ref?: React.RefObject; diff --git a/src/components/common/CustomEmojiPicker.tsx b/src/components/common/CustomEmojiPicker.tsx index 0b27e5d6c..175bad600 100644 --- a/src/components/common/CustomEmojiPicker.tsx +++ b/src/components/common/CustomEmojiPicker.tsx @@ -1,11 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { - useEffect, memo, useRef, useMemo, + memo, useEffect, useMemo, useRef, } from '../../lib/teact/teact'; import { getGlobal, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { - ApiStickerSet, ApiSticker, ApiReaction, ApiAvailableReaction, + ApiAvailableReaction, ApiReaction, ApiSticker, ApiStickerSet, } from '../../api/types'; import type { StickerSetOrReactionsSetOrRecent } from '../../types'; @@ -20,12 +20,6 @@ import { STICKER_SIZE_PICKER_HEADER, TOP_SYMBOL_SET_ID, } from '../../config'; -import { REM } from './helpers/mediaDimensions'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import { MEMO_EMPTY_ARRAY } from '../../util/memo'; -import buildClassName from '../../util/buildClassName'; -import animateHorizontalScroll from '../../util/animateHorizontalScroll'; -import { pickTruthy, unique } from '../../util/iteratees'; import { isSameReaction } from '../../global/helpers'; import { selectCanPlayAnimatedEmojis, @@ -33,20 +27,26 @@ import { selectIsChatWithSelf, selectIsCurrentUserPremium, } from '../../global/selectors'; +import animateHorizontalScroll from '../../util/animateHorizontalScroll'; +import buildClassName from '../../util/buildClassName'; +import { pickTruthy, unique } from '../../util/iteratees'; +import { MEMO_EMPTY_ARRAY } from '../../util/memo'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { REM } from './helpers/mediaDimensions'; -import useLastCallback from '../../hooks/useLastCallback'; -import useAsyncRendering from '../right/hooks/useAsyncRendering'; +import useAppLayout from '../../hooks/useAppLayout'; import useHorizontalScroll from '../../hooks/useHorizontalScroll'; import useLang from '../../hooks/useLang'; -import useAppLayout from '../../hooks/useAppLayout'; -import { useStickerPickerObservers } from './hooks/useStickerPickerObservers'; +import useLastCallback from '../../hooks/useLastCallback'; import useScrolledState from '../../hooks/useScrolledState'; +import useAsyncRendering from '../right/hooks/useAsyncRendering'; +import { useStickerPickerObservers } from './hooks/useStickerPickerObservers'; -import Loading from '../ui/Loading'; +import StickerSetCover from '../middle/composer/StickerSetCover'; import Button from '../ui/Button'; +import Loading from '../ui/Loading'; import StickerButton from './StickerButton'; import StickerSet from './StickerSet'; -import StickerSetCover from '../middle/composer/StickerSetCover'; import pickerStyles from '../middle/composer/StickerPicker.module.scss'; import styles from './CustomEmojiPicker.module.scss'; diff --git a/src/components/common/CustomEmojiSetsModal.async.tsx b/src/components/common/CustomEmojiSetsModal.async.tsx index f349ff271..d7348db49 100644 --- a/src/components/common/CustomEmojiSetsModal.async.tsx +++ b/src/components/common/CustomEmojiSetsModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './CustomEmojiSetsModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/CustomEmojiSetsModal.tsx b/src/components/common/CustomEmojiSetsModal.tsx index eefb9664e..3494d25b5 100644 --- a/src/components/common/CustomEmojiSetsModal.tsx +++ b/src/components/common/CustomEmojiSetsModal.tsx @@ -1,16 +1,17 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useRef, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiSticker, ApiStickerSet } from '../../api/types'; -import buildClassName from '../../util/buildClassName'; import { selectCanPlayAnimatedEmojis } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; + import { useIntersectionObserver } from '../../hooks/useIntersectionObserver'; -import usePrevious from '../../hooks/usePrevious'; import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; import Modal from '../ui/Modal'; import StickerSetCard from './StickerSetCard'; diff --git a/src/components/common/DeleteChatModal.tsx b/src/components/common/DeleteChatModal.tsx index 30160f629..8d55f0ff1 100644 --- a/src/components/common/DeleteChatModal.tsx +++ b/src/components/common/DeleteChatModal.tsx @@ -1,26 +1,27 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ApiChat } from '../../api/types'; -import { selectIsChatWithSelf, selectUser } from '../../global/selectors'; import { - isUserId, - isUserBot, - getUserFirstOrLastName, - getPrivateChatUserId, - isChatBasicGroup, - isChatSuperGroup, - isChatChannel, getChatTitle, + getPrivateChatUserId, + getUserFirstOrLastName, + isChatBasicGroup, + isChatChannel, + isChatSuperGroup, + isUserBot, + isUserId, } from '../../global/helpers'; -import useLang from '../../hooks/useLang'; +import { selectIsChatWithSelf, selectUser } from '../../global/selectors'; import renderText from './helpers/renderText'; -import Avatar from './Avatar'; -import Modal from '../ui/Modal'; +import useLang from '../../hooks/useLang'; + import Button from '../ui/Button'; +import Modal from '../ui/Modal'; +import Avatar from './Avatar'; import './DeleteChatModal.scss'; diff --git a/src/components/common/DeleteMessageModal.async.tsx b/src/components/common/DeleteMessageModal.async.tsx index 141bb165e..7c92cd8a1 100644 --- a/src/components/common/DeleteMessageModal.async.tsx +++ b/src/components/common/DeleteMessageModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './DeleteMessageModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/DeleteMessageModal.tsx b/src/components/common/DeleteMessageModal.tsx index b4ed5c601..1409fb0e0 100644 --- a/src/components/common/DeleteMessageModal.tsx +++ b/src/components/common/DeleteMessageModal.tsx @@ -1,10 +1,17 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ApiMessage } from '../../api/types'; import type { IAlbum } from '../../types'; +import { + getPrivateChatUserId, + getUserFirstOrLastName, + isChatBasicGroup, + isChatSuperGroup, + isUserId, +} from '../../global/helpers'; import { selectAllowedMessageActions, selectBot, @@ -12,18 +19,12 @@ import { selectCurrentMessageList, selectUser, } from '../../global/selectors'; -import { - isUserId, - getUserFirstOrLastName, - getPrivateChatUserId, - isChatBasicGroup, - isChatSuperGroup, -} from '../../global/helpers'; import renderText from './helpers/renderText'; + import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; +import Modal from '../ui/Modal'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/common/DeleteProfilePhotoModal.tsx b/src/components/common/DeleteProfilePhotoModal.tsx index f8bd5f3a3..30f1c202a 100644 --- a/src/components/common/DeleteProfilePhotoModal.tsx +++ b/src/components/common/DeleteProfilePhotoModal.tsx @@ -1,13 +1,15 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions } from '../../global'; import type { ApiPhoto } from '../../api/types'; + +import { isUserId } from '../../global/helpers'; + import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; -import { isUserId } from '../../global/helpers'; +import Modal from '../ui/Modal'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/common/Document.tsx b/src/components/common/Document.tsx index f02b8bf89..caa13d529 100644 --- a/src/components/common/Document.tsx +++ b/src/components/common/Document.tsx @@ -1,16 +1,16 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useRef, useEffect, useState, + memo, useEffect, useRef, useState, } from '../../lib/teact/teact'; import { getActions } from '../../global'; import type { ApiMessage } from '../../api/types'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES, } from '../../config'; -import { getDocumentExtension, getDocumentHasPreview } from './helpers/documentInfo'; import { getMediaTransferState, getMessageMediaFormat, @@ -18,13 +18,13 @@ import { getMessageMediaThumbDataUri, isMessageDocumentVideo, } from '../../global/helpers'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; +import { getDocumentExtension, getDocumentHasPreview } from './helpers/documentInfo'; -import useLastCallback from '../../hooks/useLastCallback'; -import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; -import useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress'; -import useMedia from '../../hooks/useMedia'; import useFlag from '../../hooks/useFlag'; +import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import useLastCallback from '../../hooks/useLastCallback'; +import useMedia from '../../hooks/useMedia'; +import useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress'; import File from './File'; diff --git a/src/components/common/DotAnimation.tsx b/src/components/common/DotAnimation.tsx index c5e1ddfb7..39ab71e41 100644 --- a/src/components/common/DotAnimation.tsx +++ b/src/components/common/DotAnimation.tsx @@ -1,6 +1,5 @@ -import React from '../../lib/teact/teact'; - import type { FC } from '../../lib/teact/teact'; +import React from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; import renderText from './helpers/renderText'; diff --git a/src/components/common/EmbeddedMessage.tsx b/src/components/common/EmbeddedMessage.tsx index 7558ccdd2..8b8396f82 100644 --- a/src/components/common/EmbeddedMessage.tsx +++ b/src/components/common/EmbeddedMessage.tsx @@ -1,35 +1,36 @@ +import type { FC } from '../../lib/teact/teact'; import React, { useRef } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { - ApiUser, ApiMessage, ApiChat, + ApiChat, + ApiMessage, ApiUser, } from '../../api/types'; import type { ChatTranslatedMessages } from '../../global/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { - getMessageMediaHash, - isActionMessage, - getSenderTitle, - getMessageRoundVideo, - getUserColorKey, getMessageIsSpoiler, + getMessageMediaHash, + getMessageRoundVideo, + getSenderTitle, + getUserColorKey, + isActionMessage, isMessageTranslatable, } from '../../global/helpers'; -import renderText from './helpers/renderText'; -import { getPictogramDimensions } from './helpers/mediaDimensions'; import buildClassName from '../../util/buildClassName'; +import { getPictogramDimensions } from './helpers/mediaDimensions'; +import renderText from './helpers/renderText'; +import { useFastClick } from '../../hooks/useFastClick'; import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import useLang from '../../hooks/useLang'; import useMedia from '../../hooks/useMedia'; import useThumbnail from '../../hooks/useThumbnail'; -import useLang from '../../hooks/useLang'; -import { useFastClick } from '../../hooks/useFastClick'; import useMessageTranslation from '../middle/message/hooks/useMessageTranslation'; import ActionMessage from '../middle/ActionMessage'; -import MessageSummary from './MessageSummary'; import MediaSpoiler from './MediaSpoiler'; +import MessageSummary from './MessageSummary'; import './EmbeddedMessage.scss'; diff --git a/src/components/common/EmbeddedStory.tsx b/src/components/common/EmbeddedStory.tsx index 00dfa715e..147e6f4df 100644 --- a/src/components/common/EmbeddedStory.tsx +++ b/src/components/common/EmbeddedStory.tsx @@ -1,24 +1,24 @@ +import type { FC } from '../../lib/teact/teact'; import React, { useRef } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; -import type { ApiUser, ApiChat, ApiTypeStory } from '../../api/types'; +import type { ApiChat, ApiTypeStory, ApiUser } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { getSenderTitle, - getUserColorKey, getStoryMediaHash, + getUserColorKey, } from '../../global/helpers'; -import renderText from './helpers/renderText'; -import { getPictogramDimensions } from './helpers/mediaDimensions'; import buildClassName from '../../util/buildClassName'; +import { getPictogramDimensions } from './helpers/mediaDimensions'; +import renderText from './helpers/renderText'; -import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; -import useMedia from '../../hooks/useMedia'; -import useLang from '../../hooks/useLang'; import { useFastClick } from '../../hooks/useFastClick'; +import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; +import useMedia from '../../hooks/useMedia'; import './EmbeddedMessage.scss'; diff --git a/src/components/common/File.tsx b/src/components/common/File.tsx index 0459f6634..1999713a1 100644 --- a/src/components/common/File.tsx +++ b/src/components/common/File.tsx @@ -1,24 +1,25 @@ +import type { FC } from '../../lib/teact/teact'; import React, { - memo, useRef, useState, useMemo, + memo, useMemo, useRef, useState, } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { IconName } from '../../types/icons'; -import { IS_CANVAS_FILTER_SUPPORTED } from '../../util/windowEnvironment'; import buildClassName from '../../util/buildClassName'; import { formatMediaDateTime, formatPastTimeShort } from '../../util/dateFormat'; +import { IS_CANVAS_FILTER_SUPPORTED } from '../../util/windowEnvironment'; import { getColorFromExtension, getFileSizeString } from './helpers/documentInfo'; import { getDocumentThumbnailDimensions } from './helpers/mediaDimensions'; import renderText from './helpers/renderText'; -import useShowTransition from '../../hooks/useShowTransition'; -import useMediaTransition from '../../hooks/useMediaTransition'; -import useLang from '../../hooks/useLang'; -import useCanvasBlur from '../../hooks/useCanvasBlur'; -import useAppLayout from '../../hooks/useAppLayout'; -import ProgressSpinner from '../ui/ProgressSpinner'; +import useAppLayout from '../../hooks/useAppLayout'; +import useCanvasBlur from '../../hooks/useCanvasBlur'; +import useLang from '../../hooks/useLang'; +import useMediaTransition from '../../hooks/useMediaTransition'; +import useShowTransition from '../../hooks/useShowTransition'; + import Link from '../ui/Link'; +import ProgressSpinner from '../ui/ProgressSpinner'; import './File.scss'; diff --git a/src/components/common/FullNameTitle.tsx b/src/components/common/FullNameTitle.tsx index 135501345..bae926448 100644 --- a/src/components/common/FullNameTitle.tsx +++ b/src/components/common/FullNameTitle.tsx @@ -1,24 +1,24 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; +import { getActions } from '../../global'; import type { ApiChat, ApiUser } from '../../api/types'; -import type { FC } from '../../lib/teact/teact'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import { getActions } from '../../global'; import { EMOJI_STATUS_LOOP_LIMIT } from '../../config'; -import renderText from './helpers/renderText'; import { getChatTitle, getUserFullName, isUserId } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; import { copyTextToClipboard } from '../../util/clipboard'; import stopEvent from '../../util/stopEvent'; +import renderText from './helpers/renderText'; import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; -import VerifiedIcon from './VerifiedIcon'; -import FakeIcon from './FakeIcon'; import CustomEmoji from './CustomEmoji'; +import FakeIcon from './FakeIcon'; import PremiumIcon from './PremiumIcon'; +import VerifiedIcon from './VerifiedIcon'; import styles from './FullNameTitle.module.scss'; diff --git a/src/components/common/GifButton.tsx b/src/components/common/GifButton.tsx index 15efb7840..0b8c7763b 100644 --- a/src/components/common/GifButton.tsx +++ b/src/components/common/GifButton.tsx @@ -4,29 +4,29 @@ import React, { } from '../../lib/teact/teact'; import type { ApiVideo } from '../../api/types'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { ApiMediaFormat } from '../../api/types'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import buildClassName from '../../util/buildClassName'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; -import useMedia from '../../hooks/useMedia'; import useBuffering from '../../hooks/useBuffering'; import useCanvasBlur from '../../hooks/useCanvasBlur'; -import useLang from '../../hooks/useLang'; -import useMenuPosition from '../../hooks/useMenuPosition'; import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; +import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useMedia from '../../hooks/useMedia'; +import useMenuPosition from '../../hooks/useMenuPosition'; -import Spinner from '../ui/Spinner'; import Button from '../ui/Button'; import Menu from '../ui/Menu'; import MenuItem from '../ui/MenuItem'; import OptimizedVideo from '../ui/OptimizedVideo'; +import Spinner from '../ui/Spinner'; import './GifButton.scss'; -import useLastCallback from '../../hooks/useLastCallback'; type OwnProps = { gif: ApiVideo; diff --git a/src/components/common/GroupCallLink.tsx b/src/components/common/GroupCallLink.tsx index d3fedb317..f76a62860 100644 --- a/src/components/common/GroupCallLink.tsx +++ b/src/components/common/GroupCallLink.tsx @@ -1,12 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React, { useCallback } from '../../lib/teact/teact'; +import { getActions } from '../../global'; import type { ApiGroupCall } from '../../api/types'; import buildClassName from '../../util/buildClassName'; import Link from '../ui/Link'; -import { getActions } from '../../global'; type OwnProps = { className?: string; diff --git a/src/components/common/GroupChatInfo.tsx b/src/components/common/GroupChatInfo.tsx index 870cb0e20..2dca491a7 100644 --- a/src/components/common/GroupChatInfo.tsx +++ b/src/components/common/GroupChatInfo.tsx @@ -1,14 +1,13 @@ -import React, { useEffect, memo, useMemo } from '../../lib/teact/teact'; +import type { FC } from '../../lib/teact/teact'; +import React, { memo, useEffect, useMemo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { - ApiChat, ApiTopic, ApiThreadInfo, ApiTypingStatus, + ApiChat, ApiThreadInfo, ApiTopic, ApiTypingStatus, } from '../../api/types'; import type { LangFn } from '../../hooks/useLang'; import { MediaViewerOrigin } from '../../types'; -import { REM } from './helpers/mediaDimensions'; import { getChatTypeString, getMainUsername, @@ -22,15 +21,17 @@ import { selectThreadMessagesCount, } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; +import { REM } from './helpers/mediaDimensions'; import renderText from './helpers/renderText'; + import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import Avatar from './Avatar'; -import TypingStatus from './TypingStatus'; import DotAnimation from './DotAnimation'; import FullNameTitle from './FullNameTitle'; import TopicIcon from './TopicIcon'; -import useLastCallback from '../../hooks/useLastCallback'; +import TypingStatus from './TypingStatus'; const TOPIC_ICON_SIZE = 2.5 * REM; diff --git a/src/components/common/InviteLink.tsx b/src/components/common/InviteLink.tsx index 188b2007d..5dd72cea6 100644 --- a/src/components/common/InviteLink.tsx +++ b/src/components/common/InviteLink.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; - -import { copyTextToClipboard } from '../../util/clipboard'; import buildClassName from '../../util/buildClassName'; -import useLang from '../../hooks/useLang'; +import { copyTextToClipboard } from '../../util/clipboard'; + import useAppLayout from '../../hooks/useAppLayout'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; +import Button from '../ui/Button'; import DropdownMenu from '../ui/DropdownMenu'; import MenuItem from '../ui/MenuItem'; -import Button from '../ui/Button'; import styles from './InviteLink.module.scss'; diff --git a/src/components/common/LastMessageMeta.tsx b/src/components/common/LastMessageMeta.tsx index a54c38fff..7283f8332 100644 --- a/src/components/common/LastMessageMeta.tsx +++ b/src/components/common/LastMessageMeta.tsx @@ -4,6 +4,7 @@ import React, { memo } from '../../lib/teact/teact'; import type { ApiMessage, ApiMessageOutgoingStatus } from '../../api/types'; import { formatPastTimeShort } from '../../util/dateFormat'; + import useLang from '../../hooks/useLang'; import MessageOutgoingStatus from './MessageOutgoingStatus'; diff --git a/src/components/common/ManageUsernames.tsx b/src/components/common/ManageUsernames.tsx index e61152a1f..dea6fb9b7 100644 --- a/src/components/common/ManageUsernames.tsx +++ b/src/components/common/ManageUsernames.tsx @@ -1,20 +1,21 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiUsername } from '../../api/types'; -import { copyTextToClipboard } from '../../util/clipboard'; import buildClassName from '../../util/buildClassName'; +import { copyTextToClipboard } from '../../util/clipboard'; import { isBetween } from '../../util/math'; -import usePrevious from '../../hooks/usePrevious'; -import useLang from '../../hooks/useLang'; +import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; + +import ConfirmDialog from '../ui/ConfirmDialog'; import Draggable from '../ui/Draggable'; import ListItem from '../ui/ListItem'; -import ConfirmDialog from '../ui/ConfirmDialog'; import styles from './ManageUsernames.module.scss'; diff --git a/src/components/common/Media.tsx b/src/components/common/Media.tsx index 2f67f3d4f..f6ab22aeb 100644 --- a/src/components/common/Media.tsx +++ b/src/components/common/Media.tsx @@ -1,11 +1,9 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useRef } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { ApiMessage } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import { formatMediaDuration } from '../../util/dateFormat'; -import stopEvent from '../../util/stopEvent'; import { getMessageHtmlId, getMessageIsSpoiler, @@ -14,12 +12,14 @@ import { getMessageVideo, } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; +import { formatMediaDuration } from '../../util/dateFormat'; +import stopEvent from '../../util/stopEvent'; +import useFlag from '../../hooks/useFlag'; +import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; import useLastCallback from '../../hooks/useLastCallback'; import useMedia from '../../hooks/useMedia'; import useMediaTransition from '../../hooks/useMediaTransition'; -import useFlag from '../../hooks/useFlag'; -import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; import MediaSpoiler from './MediaSpoiler'; diff --git a/src/components/common/MediaSpoiler.tsx b/src/components/common/MediaSpoiler.tsx index d37c9121a..b8c455f8f 100644 --- a/src/components/common/MediaSpoiler.tsx +++ b/src/components/common/MediaSpoiler.tsx @@ -1,11 +1,10 @@ -import React, { memo, useRef } from '../../lib/teact/teact'; - import type { FC } from '../../lib/teact/teact'; +import React, { memo, useRef } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; import useCanvasBlur from '../../hooks/useCanvasBlur'; +import useLastCallback from '../../hooks/useLastCallback'; import useShowTransition from '../../hooks/useShowTransition'; import styles from './MediaSpoiler.module.scss'; diff --git a/src/components/common/MessageSummary.tsx b/src/components/common/MessageSummary.tsx index 142c56516..555a330f6 100644 --- a/src/components/common/MessageSummary.tsx +++ b/src/components/common/MessageSummary.tsx @@ -3,16 +3,16 @@ import React, { memo } from '../../lib/teact/teact'; import type { ApiFormattedText, ApiMessage } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import type { LangFn } from '../../hooks/useLang'; - import { ApiMessageEntityTypes } from '../../api/types'; -import trimText from '../../util/trimText'; + import { + extractMessageText, getMessageSummaryDescription, getMessageSummaryEmoji, getMessageSummaryText, - extractMessageText, TRUNCATED_SUMMARY_LENGTH, } from '../../global/helpers'; +import trimText from '../../util/trimText'; import renderText from './helpers/renderText'; import MessageText from './MessageText'; diff --git a/src/components/common/MessageText.tsx b/src/components/common/MessageText.tsx index 5805309ee..6115bd030 100644 --- a/src/components/common/MessageText.tsx +++ b/src/components/common/MessageText.tsx @@ -4,11 +4,12 @@ import React, { import type { ApiFormattedText, ApiMessage, ApiStory } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; - import { ApiMessageEntityTypes } from '../../api/types'; -import trimText from '../../util/trimText'; + import { extractMessageText, getMessageText, stripCustomEmoji } from '../../global/helpers'; +import trimText from '../../util/trimText'; import { renderTextWithEntities } from './helpers/renderTextWithEntities'; + import useSyncEffect from '../../hooks/useSyncEffect'; import useUniqueId from '../../hooks/useUniqueId'; diff --git a/src/components/common/NothingFound.tsx b/src/components/common/NothingFound.tsx index 5fd136f83..202ba5104 100644 --- a/src/components/common/NothingFound.tsx +++ b/src/components/common/NothingFound.tsx @@ -2,9 +2,10 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; -import useShowTransition from '../../hooks/useShowTransition'; import renderText from './helpers/renderText'; + import useLang from '../../hooks/useLang'; +import useShowTransition from '../../hooks/useShowTransition'; import './NothingFound.scss'; diff --git a/src/components/common/PasswordForm.tsx b/src/components/common/PasswordForm.tsx index f40a67f55..4f57fe03d 100644 --- a/src/components/common/PasswordForm.tsx +++ b/src/components/common/PasswordForm.tsx @@ -3,15 +3,16 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useRef, useState, } from '../../lib/teact/teact'; -import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { MIN_PASSWORD_LENGTH } from '../../config'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { requestMutation } from '../../lib/fasterdom/fasterdom'; import buildClassName from '../../util/buildClassName'; import stopEvent from '../../util/stopEvent'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; + +import useAppLayout from '../../hooks/useAppLayout'; import useLang from '../../hooks/useLang'; import useTimeout from '../../hooks/useTimeout'; -import useAppLayout from '../../hooks/useAppLayout'; import Button from '../ui/Button'; diff --git a/src/components/common/PasswordMonkey.tsx b/src/components/common/PasswordMonkey.tsx index 27a595c90..eac191d4f 100644 --- a/src/components/common/PasswordMonkey.tsx +++ b/src/components/common/PasswordMonkey.tsx @@ -1,14 +1,14 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import { STICKER_SIZE_AUTH, STICKER_SIZE_AUTH_MOBILE, STICKER_SIZE_TWO_FA } from '../../config'; import { LOCAL_TGS_URLS } from './helpers/animatedAssets'; -import AnimatedSticker from './AnimatedSticker'; - -import useTimeout from '../../hooks/useTimeout'; -import useFlag from '../../hooks/useFlag'; import useAppLayout from '../../hooks/useAppLayout'; +import useFlag from '../../hooks/useFlag'; +import useTimeout from '../../hooks/useTimeout'; + +import AnimatedSticker from './AnimatedSticker'; import './PasswordMonkey.scss'; diff --git a/src/components/common/Picker.tsx b/src/components/common/Picker.tsx index e443e19ef..704bdf66b 100644 --- a/src/components/common/Picker.tsx +++ b/src/components/common/Picker.tsx @@ -1,27 +1,25 @@ -import React, { - useRef, useEffect, memo, useMemo, -} from '../../lib/teact/teact'; -import { requestMutation } from '../../lib/fasterdom/fasterdom'; - import type { FC } from '../../lib/teact/teact'; +import React, { + memo, useEffect, useMemo, useRef, +} from '../../lib/teact/teact'; +import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { isUserId } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; import { MEMO_EMPTY_ARRAY } from '../../util/memo'; -import useLastCallback from '../../hooks/useLastCallback'; import useInfiniteScroll from '../../hooks/useInfiniteScroll'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import InfiniteScroll from '../ui/InfiniteScroll'; import Checkbox from '../ui/Checkbox'; +import InfiniteScroll from '../ui/InfiniteScroll'; import InputText from '../ui/InputText'; import ListItem from '../ui/ListItem'; -import PrivateChatInfo from './PrivateChatInfo'; +import Loading from '../ui/Loading'; import GroupChatInfo from './GroupChatInfo'; import PickerSelectedItem from './PickerSelectedItem'; - -import Loading from '../ui/Loading'; +import PrivateChatInfo from './PrivateChatInfo'; import './Picker.scss'; diff --git a/src/components/common/PickerSelectedItem.tsx b/src/components/common/PickerSelectedItem.tsx index 90200a087..23de1976c 100644 --- a/src/components/common/PickerSelectedItem.tsx +++ b/src/components/common/PickerSelectedItem.tsx @@ -1,14 +1,15 @@ +import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; -import type { FC, TeactNode } from '../../lib/teact/teact'; import type { ApiChat, ApiUser } from '../../api/types'; import type { IconName } from '../../types/icons'; -import { selectChat, selectUser } from '../../global/selectors'; import { getChatTitle, getUserFirstOrLastName, isUserId } from '../../global/helpers'; -import renderText from './helpers/renderText'; +import { selectChat, selectUser } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; +import renderText from './helpers/renderText'; + import useLang from '../../hooks/useLang'; import Avatar from './Avatar'; diff --git a/src/components/common/PinMessageModal.async.tsx b/src/components/common/PinMessageModal.async.tsx index 7eda12416..724454458 100644 --- a/src/components/common/PinMessageModal.async.tsx +++ b/src/components/common/PinMessageModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './PinMessageModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/PinMessageModal.tsx b/src/components/common/PinMessageModal.tsx index c519ae87b..0dc07ccdf 100644 --- a/src/components/common/PinMessageModal.tsx +++ b/src/components/common/PinMessageModal.tsx @@ -1,21 +1,22 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import { selectChat, selectIsChatWithSelf, selectUser } from '../../global/selectors'; import { - isUserId, - getUserFirstOrLastName, getPrivateChatUserId, + getUserFirstOrLastName, isChatBasicGroup, - isChatSuperGroup, isChatChannel, + isChatSuperGroup, + isUserId, } from '../../global/helpers'; -import useLang from '../../hooks/useLang'; +import { selectChat, selectIsChatWithSelf, selectUser } from '../../global/selectors'; import renderText from './helpers/renderText'; -import Modal from '../ui/Modal'; +import useLang from '../../hooks/useLang'; + import Button from '../ui/Button'; +import Modal from '../ui/Modal'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/common/PrivateChatInfo.tsx b/src/components/common/PrivateChatInfo.tsx index 1a710e56e..b7c2c4e43 100644 --- a/src/components/common/PrivateChatInfo.tsx +++ b/src/components/common/PrivateChatInfo.tsx @@ -1,27 +1,27 @@ -import React, { useEffect, memo, useMemo } from '../../lib/teact/teact'; +import type { FC } from '../../lib/teact/teact'; +import React, { memo, useEffect, useMemo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { - ApiUser, ApiTypingStatus, ApiUserStatus, ApiChatMember, + ApiChatMember, ApiTypingStatus, ApiUser, ApiUserStatus, } from '../../api/types'; import type { StoryViewerOrigin } from '../../types'; -import { MediaViewerOrigin } from '../../types'; import type { IconName } from '../../types/icons'; +import { MediaViewerOrigin } from '../../types'; -import { selectChatMessages, selectUser, selectUserStatus } from '../../global/selectors'; import { getMainUsername, getUserStatus, isUserOnline } from '../../global/helpers'; +import { selectChatMessages, selectUser, selectUserStatus } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; import renderText from './helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import RippleEffect from '../ui/RippleEffect'; import Avatar from './Avatar'; -import TypingStatus from './TypingStatus'; import DotAnimation from './DotAnimation'; import FullNameTitle from './FullNameTitle'; -import RippleEffect from '../ui/RippleEffect'; +import TypingStatus from './TypingStatus'; type OwnProps = { userId: string; diff --git a/src/components/common/ProfileInfo.tsx b/src/components/common/ProfileInfo.tsx index ae63d6bef..bbb24850d 100644 --- a/src/components/common/ProfileInfo.tsx +++ b/src/components/common/ProfileInfo.tsx @@ -1,15 +1,16 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useEffect, memo, useState } from '../../lib/teact/teact'; +import React, { memo, useEffect, useState } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { - ApiUser, ApiChat, ApiUserStatus, ApiTopic, ApiPhoto, + ApiChat, ApiPhoto, ApiTopic, ApiUser, ApiUserStatus, } from '../../api/types'; import type { GlobalState } from '../../global/types'; import { MediaViewerOrigin } from '../../types'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import { MEMO_EMPTY_ARRAY } from '../../util/memo'; +import { + getUserStatus, isChatChannel, isUserId, isUserOnline, +} from '../../global/helpers'; import { selectChat, selectChatFullInfo, @@ -20,28 +21,26 @@ import { selectUserFullInfo, selectUserStatus, } from '../../global/selectors'; -import { - getUserStatus, isChatChannel, isUserId, isUserOnline, -} from '../../global/helpers'; -import { captureEvents, SwipeDirection } from '../../util/captureEvents'; import buildClassName from '../../util/buildClassName'; +import { captureEvents, SwipeDirection } from '../../util/captureEvents'; +import { MEMO_EMPTY_ARRAY } from '../../util/memo'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import renderText from './helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; -import usePhotosPreload from './hooks/usePhotosPreload'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import usePrevious from '../../hooks/usePrevious'; +import { useStateRef } from '../../hooks/useStateRef'; +import usePhotosPreload from './hooks/usePhotosPreload'; +import Transition from '../ui/Transition'; +import Avatar from './Avatar'; import FullNameTitle from './FullNameTitle'; import ProfilePhoto from './ProfilePhoto'; -import Transition from '../ui/Transition'; import TopicIcon from './TopicIcon'; -import Avatar from './Avatar'; import './ProfileInfo.scss'; - import styles from './ProfileInfo.module.scss'; -import { useStateRef } from '../../hooks/useStateRef'; type OwnProps = { userId: string; diff --git a/src/components/common/ProfilePhoto.tsx b/src/components/common/ProfilePhoto.tsx index 3a8fa90b5..a5e446c72 100644 --- a/src/components/common/ProfilePhoto.tsx +++ b/src/components/common/ProfilePhoto.tsx @@ -1,30 +1,32 @@ +import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../lib/teact/teact'; -import type { FC, TeactNode } from '../../lib/teact/teact'; import type { ApiChat, ApiPhoto, ApiUser } from '../../api/types'; -import { IS_CANVAS_FILTER_SUPPORTED } from '../../util/windowEnvironment'; import { getChatAvatarHash, getChatTitle, getUserColorKey, getUserFullName, - isUserId, + getVideoAvatarMediaHash, isChatWithRepliesBot, - isDeletedUser, getVideoAvatarMediaHash, + isDeletedUser, + isUserId, } from '../../global/helpers'; -import renderText from './helpers/renderText'; import buildClassName from '../../util/buildClassName'; import { getFirstLetters } from '../../util/textFormat'; -import useMedia from '../../hooks/useMedia'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import useMediaTransition from '../../hooks/useMediaTransition'; -import useCanvasBlur from '../../hooks/useCanvasBlur'; -import useAppLayout from '../../hooks/useAppLayout'; +import { IS_CANVAS_FILTER_SUPPORTED } from '../../util/windowEnvironment'; +import renderText from './helpers/renderText'; + +import useAppLayout from '../../hooks/useAppLayout'; +import useCanvasBlur from '../../hooks/useCanvasBlur'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useMedia from '../../hooks/useMedia'; +import useMediaTransition from '../../hooks/useMediaTransition'; -import Spinner from '../ui/Spinner'; import OptimizedVideo from '../ui/OptimizedVideo'; +import Spinner from '../ui/Spinner'; import './ProfilePhoto.scss'; diff --git a/src/components/common/ReactionEmoji.tsx b/src/components/common/ReactionEmoji.tsx index 59c7d42a1..06dd40a6e 100644 --- a/src/components/common/ReactionEmoji.tsx +++ b/src/components/common/ReactionEmoji.tsx @@ -1,22 +1,22 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo, useRef, } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { ApiAvailableReaction, ApiReaction } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { EMOJI_SIZE_PICKER } from '../../config'; -import buildClassName from '../../util/buildClassName'; import { getDocumentMediaHash, isSameReaction } from '../../global/helpers'; +import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; import useCoordsInSharedCanvas from '../../hooks/useCoordsInSharedCanvas'; -import useMediaTransition from '../../hooks/useMediaTransition'; +import useLastCallback from '../../hooks/useLastCallback'; import useMedia from '../../hooks/useMedia'; +import useMediaTransition from '../../hooks/useMediaTransition'; -import CustomEmoji from './CustomEmoji'; import AnimatedIconWithPreview from './AnimatedIconWithPreview'; +import CustomEmoji from './CustomEmoji'; import styles from './ReactionEmoji.module.scss'; diff --git a/src/components/common/ReactionStaticEmoji.tsx b/src/components/common/ReactionStaticEmoji.tsx index 98e682282..452727be6 100644 --- a/src/components/common/ReactionStaticEmoji.tsx +++ b/src/components/common/ReactionStaticEmoji.tsx @@ -1,21 +1,22 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { ApiAvailableReaction, ApiReaction } from '../../api/types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { ApiMediaFormat } from '../../api/types'; -import buildClassName from '../../util/buildClassName'; import { isSameReaction } from '../../global/helpers'; +import buildClassName from '../../util/buildClassName'; -import useMediaTransition from '../../hooks/useMediaTransition'; import useMedia from '../../hooks/useMedia'; +import useMediaTransition from '../../hooks/useMediaTransition'; import CustomEmoji from './CustomEmoji'; -import blankUrl from '../../assets/blank.png'; import './ReactionStaticEmoji.scss'; +import blankUrl from '../../assets/blank.png'; + type OwnProps = { reaction: ApiReaction; availableReactions?: ApiAvailableReaction[]; diff --git a/src/components/common/RecipientPicker.tsx b/src/components/common/RecipientPicker.tsx index 70cddd70c..84f742c37 100644 --- a/src/components/common/RecipientPicker.tsx +++ b/src/components/common/RecipientPicker.tsx @@ -1,12 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo, useState } from '../../lib/teact/teact'; import { getGlobal, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiChat, ApiChatType } from '../../api/types'; import { MAIN_THREAD_ID } from '../../api/types'; import { API_CHAT_TYPES } from '../../config'; -import { unique } from '../../util/iteratees'; import { filterChatsByName, filterUsersByName, @@ -14,12 +13,13 @@ import { isDeletedUser, sortChatIds, } from '../../global/helpers'; +import { filterChatIdsByType } from '../../global/selectors'; +import { unique } from '../../util/iteratees'; +import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; import useLang from '../../hooks/useLang'; import ChatOrUserPicker from './ChatOrUserPicker'; -import { filterChatIdsByType } from '../../global/selectors'; -import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/common/ReportModal.tsx b/src/components/common/ReportModal.tsx index 1d24e4264..4c3942a34 100644 --- a/src/components/common/ReportModal.tsx +++ b/src/components/common/ReportModal.tsx @@ -1,5 +1,4 @@ import type { ChangeEvent } from 'react'; - import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo, useState } from '../../lib/teact/teact'; import { getActions } from '../../global'; @@ -7,13 +6,14 @@ import { getActions } from '../../global'; import type { ApiPhoto, ApiReportReason } from '../../api/types'; import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; + import Button from '../ui/Button'; -import RadioGroup from '../ui/RadioGroup'; import InputText from '../ui/InputText'; +import Modal from '../ui/Modal'; +import RadioGroup from '../ui/RadioGroup'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/common/SafeLink.tsx b/src/components/common/SafeLink.tsx index 93f2ee019..1f1b17415 100644 --- a/src/components/common/SafeLink.tsx +++ b/src/components/common/SafeLink.tsx @@ -1,15 +1,16 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import convertPunycode from '../../lib/punycode'; -import type { FC } from '../../lib/teact/teact'; import { ApiMessageEntityTypes } from '../../api/types'; import { DEBUG, } from '../../config'; +import convertPunycode from '../../lib/punycode'; import buildClassName from '../../util/buildClassName'; import { ensureProtocol } from '../../util/ensureProtocol'; + import useLastCallback from '../../hooks/useLastCallback'; type OwnProps = { diff --git a/src/components/common/SeenByModal.async.tsx b/src/components/common/SeenByModal.async.tsx index f9ac8a8c5..5433a029d 100644 --- a/src/components/common/SeenByModal.async.tsx +++ b/src/components/common/SeenByModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './SeenByModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/SeenByModal.tsx b/src/components/common/SeenByModal.tsx index f60faa87f..d4c364318 100644 --- a/src/components/common/SeenByModal.tsx +++ b/src/components/common/SeenByModal.tsx @@ -2,17 +2,17 @@ import React, { memo, useMemo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import { selectChatMessage, selectTabState } from '../../global/selectors'; -import { formatDateAtTime } from '../../util/dateFormat'; import buildClassName from '../../util/buildClassName'; +import { formatDateAtTime } from '../../util/dateFormat'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; -import PrivateChatInfo from './PrivateChatInfo'; import ListItem from '../ui/ListItem'; +import Modal from '../ui/Modal'; +import PrivateChatInfo from './PrivateChatInfo'; import styles from './SeenByModal.module.scss'; diff --git a/src/components/common/SliderDots.tsx b/src/components/common/SliderDots.tsx index 1f415054a..94d705589 100644 --- a/src/components/common/SliderDots.tsx +++ b/src/components/common/SliderDots.tsx @@ -2,10 +2,11 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; + +import Button from '../ui/Button'; import styles from './SliderDots.module.scss'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import Button from '../ui/Button'; type OwnProps = { length: number; diff --git a/src/components/common/StickerButton.tsx b/src/components/common/StickerButton.tsx index f3ec789b9..47dccd20b 100644 --- a/src/components/common/StickerButton.tsx +++ b/src/components/common/StickerButton.tsx @@ -5,25 +5,24 @@ import React, { import { getActions } from '../../global'; import type { ApiBotInlineMediaResult, ApiSticker } from '../../api/types'; - -import buildClassName from '../../util/buildClassName'; -import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import { getServerTimeOffset } from '../../util/serverTime'; - import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import useLastCallback from '../../hooks/useLastCallback'; +import buildClassName from '../../util/buildClassName'; +import { getServerTimeOffset } from '../../util/serverTime'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; + +import useDynamicColorListener from '../../hooks/stickers/useDynamicColorListener'; +import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; import useLang from '../../hooks/useLang'; -import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; +import useLastCallback from '../../hooks/useLastCallback'; import useMenuPosition from '../../hooks/useMenuPosition'; -import useDynamicColorListener from '../../hooks/stickers/useDynamicColorListener'; -import StickerView from './StickerView'; import Button from '../ui/Button'; import Menu from '../ui/Menu'; import MenuItem from '../ui/MenuItem'; +import StickerView from './StickerView'; import './StickerButton.scss'; diff --git a/src/components/common/StickerSet.tsx b/src/components/common/StickerSet.tsx index 11ec02e5f..07e12c84a 100644 --- a/src/components/common/StickerSet.tsx +++ b/src/components/common/StickerSet.tsx @@ -1,12 +1,12 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../lib/teact/teact'; import { getActions, getGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiAvailableReaction, ApiReaction, ApiSticker } from '../../api/types'; -import type { StickerSetOrReactionsSetOrRecent } from '../../types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; +import type { StickerSetOrReactionsSetOrRecent } from '../../types'; import { DEFAULT_STATUS_ICON_ID, @@ -17,23 +17,23 @@ import { RECENT_SYMBOL_SET_ID, STICKER_SIZE_PICKER, } from '../../config'; -import buildClassName from '../../util/buildClassName'; -import { selectIsAlwaysHighPriorityEmoji, selectIsSetPremium } from '../../global/selectors'; import { getReactionUniqueKey } from '../../global/helpers'; +import { selectIsAlwaysHighPriorityEmoji, selectIsSetPremium } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; +import useAppLayout from '../../hooks/useAppLayout'; import useFlag from '../../hooks/useFlag'; +import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import useMediaTransition from '../../hooks/useMediaTransition'; import useResizeObserver from '../../hooks/useResizeObserver'; -import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; -import useAppLayout from '../../hooks/useAppLayout'; import useWindowSize from '../../hooks/useWindowSize'; -import StickerButton from './StickerButton'; -import ConfirmDialog from '../ui/ConfirmDialog'; import Button from '../ui/Button'; +import ConfirmDialog from '../ui/ConfirmDialog'; import ReactionEmoji from './ReactionEmoji'; +import StickerButton from './StickerButton'; import grey from '../../assets/icons/forumTopic/grey.svg'; diff --git a/src/components/common/StickerSetCard.tsx b/src/components/common/StickerSetCard.tsx index 550f4d1c7..63f5d44a6 100644 --- a/src/components/common/StickerSetCard.tsx +++ b/src/components/common/StickerSetCard.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback } from '../../lib/teact/teact'; import type { ApiSticker, ApiStickerSet } from '../../api/types'; -import type { FC } from '../../lib/teact/teact'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { STICKER_SIZE_GENERAL_SETTINGS } from '../../config'; import buildClassName from '../../util/buildClassName'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import useLang from '../../hooks/useLang'; -import ListItem from '../ui/ListItem'; -import Button from '../ui/Button'; import StickerSetCover from '../middle/composer/StickerSetCover'; +import Button from '../ui/Button'; +import ListItem from '../ui/ListItem'; import StickerButton from './StickerButton'; import './StickerSetCard.scss'; diff --git a/src/components/common/StickerSetModal.async.tsx b/src/components/common/StickerSetModal.async.tsx index ecf71f282..b1dbecd5c 100644 --- a/src/components/common/StickerSetModal.async.tsx +++ b/src/components/common/StickerSetModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './StickerSetModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/StickerSetModal.tsx b/src/components/common/StickerSetModal.tsx index f5d9c6cf9..aa357c931 100644 --- a/src/components/common/StickerSetModal.tsx +++ b/src/components/common/StickerSetModal.tsx @@ -1,13 +1,14 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useRef, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiSticker, ApiStickerSet } from '../../api/types'; import type { MessageList } from '../../global/types'; import { EMOJI_SIZE_MODAL, STICKER_SIZE_MODAL, TME_LINK_PREFIX } from '../../config'; +import { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers'; import { selectCanScheduleUntilOnline, selectChat, @@ -18,24 +19,23 @@ import { selectStickerSet, selectThreadInfo, } from '../../global/selectors'; -import renderText from './helpers/renderText'; -import { copyTextToClipboard } from '../../util/clipboard'; -import { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; +import { copyTextToClipboard } from '../../util/clipboard'; +import renderText from './helpers/renderText'; +import useAppLayout from '../../hooks/useAppLayout'; import { useIntersectionObserver } from '../../hooks/useIntersectionObserver'; import useLang from '../../hooks/useLang'; -import useAppLayout from '../../hooks/useAppLayout'; -import useSchedule from '../../hooks/useSchedule'; import usePrevious from '../../hooks/usePrevious'; +import useSchedule from '../../hooks/useSchedule'; import useScrolledState from '../../hooks/useScrolledState'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; -import Loading from '../ui/Loading'; -import StickerButton from './StickerButton'; import DropdownMenu from '../ui/DropdownMenu'; +import Loading from '../ui/Loading'; import MenuItem from '../ui/MenuItem'; +import Modal from '../ui/Modal'; +import StickerButton from './StickerButton'; import './StickerSetModal.scss'; diff --git a/src/components/common/StickerView.tsx b/src/components/common/StickerView.tsx index dc46b77ce..d923c96a7 100644 --- a/src/components/common/StickerView.tsx +++ b/src/components/common/StickerView.tsx @@ -1,28 +1,28 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { getGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import type { ApiSticker } from '../../api/types'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import { IS_ANDROID, IS_WEBM_SUPPORTED } from '../../util/windowEnvironment'; -import * as mediaLoader from '../../util/mediaLoader'; -import buildClassName from '../../util/buildClassName'; import { getStickerPreviewHash } from '../../global/helpers'; import { selectIsAlwaysHighPriorityEmoji } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; +import * as mediaLoader from '../../util/mediaLoader'; +import { IS_ANDROID, IS_WEBM_SUPPORTED } from '../../util/windowEnvironment'; -import useMedia from '../../hooks/useMedia'; -import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; -import useThumbnail from '../../hooks/useThumbnail'; -import useMediaTransition from '../../hooks/useMediaTransition'; -import useFlag from '../../hooks/useFlag'; -import useCoordsInSharedCanvas from '../../hooks/useCoordsInSharedCanvas'; -import useHeavyAnimationCheck, { isHeavyAnimating } from '../../hooks/useHeavyAnimationCheck'; import useColorFilter from '../../hooks/stickers/useColorFilter'; +import useCoordsInSharedCanvas from '../../hooks/useCoordsInSharedCanvas'; +import useFlag from '../../hooks/useFlag'; +import useHeavyAnimationCheck, { isHeavyAnimating } from '../../hooks/useHeavyAnimationCheck'; +import { useIsIntersecting } from '../../hooks/useIntersectionObserver'; +import useMedia from '../../hooks/useMedia'; +import useMediaTransition from '../../hooks/useMediaTransition'; +import useThumbnail from '../../hooks/useThumbnail'; import useUniqueId from '../../hooks/useUniqueId'; -import AnimatedSticker from './AnimatedSticker'; import OptimizedVideo from '../ui/OptimizedVideo'; +import AnimatedSticker from './AnimatedSticker'; import styles from './StickerView.module.scss'; diff --git a/src/components/common/TopicChip.tsx b/src/components/common/TopicChip.tsx index d71bcfbc6..9fed4ed8e 100644 --- a/src/components/common/TopicChip.tsx +++ b/src/components/common/TopicChip.tsx @@ -1,11 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import type { ApiTopic } from '../../api/types'; -import type { FC } from '../../lib/teact/teact'; +import buildClassName from '../../util/buildClassName'; import { getTopicColorCssVariable } from '../../util/forumColors'; import { REM } from './helpers/mediaDimensions'; -import buildClassName from '../../util/buildClassName'; import renderText from './helpers/renderText'; import useLang from '../../hooks/useLang'; @@ -13,6 +13,7 @@ import useLang from '../../hooks/useLang'; import TopicIcon from './TopicIcon'; import styles from './TopicChip.module.scss'; + import blankSrc from '../../assets/blank.png'; type OwnProps = { diff --git a/src/components/common/TopicDefaultIcon.tsx b/src/components/common/TopicDefaultIcon.tsx index a1df7065e..0713662bd 100644 --- a/src/components/common/TopicDefaultIcon.tsx +++ b/src/components/common/TopicDefaultIcon.tsx @@ -1,12 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; - import { GENERAL_TOPIC_ID } from '../../config'; -import { getFirstLetters } from '../../util/textFormat'; import buildClassName from '../../util/buildClassName'; -import renderText from './helpers/renderText'; import { getTopicDefaultIcon } from '../../util/forumColors'; +import { getFirstLetters } from '../../util/textFormat'; +import renderText from './helpers/renderText'; import styles from './TopicDefaultIcon.module.scss'; diff --git a/src/components/common/TopicIcon.tsx b/src/components/common/TopicIcon.tsx index 8ff0faefd..ab218d539 100644 --- a/src/components/common/TopicIcon.tsx +++ b/src/components/common/TopicIcon.tsx @@ -1,8 +1,8 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import type { ApiTopic } from '../../api/types'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import CustomEmoji from './CustomEmoji'; import TopicDefaultIcon from './TopicDefaultIcon'; diff --git a/src/components/common/TrackingMonkey.tsx b/src/components/common/TrackingMonkey.tsx index 503d36214..9cad3b81c 100644 --- a/src/components/common/TrackingMonkey.tsx +++ b/src/components/common/TrackingMonkey.tsx @@ -1,5 +1,5 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useState, useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback, useState } from '../../lib/teact/teact'; import { STICKER_SIZE_AUTH, STICKER_SIZE_AUTH_MOBILE, STICKER_SIZE_TWO_FA } from '../../config'; import { LOCAL_TGS_URLS } from './helpers/animatedAssets'; diff --git a/src/components/common/TypingStatus.tsx b/src/components/common/TypingStatus.tsx index 5c3fce1e2..ca75746fd 100644 --- a/src/components/common/TypingStatus.tsx +++ b/src/components/common/TypingStatus.tsx @@ -2,11 +2,12 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; -import type { ApiUser, ApiTypingStatus } from '../../api/types'; +import type { ApiTypingStatus, ApiUser } from '../../api/types'; -import { selectUser } from '../../global/selectors'; import { getUserFirstOrLastName } from '../../global/helpers'; +import { selectUser } from '../../global/selectors'; import renderText from './helpers/renderText'; + import useLang from '../../hooks/useLang'; import DotAnimation from './DotAnimation'; diff --git a/src/components/common/UiLoader.tsx b/src/components/common/UiLoader.tsx index 744c96166..85cc7e70a 100644 --- a/src/components/common/UiLoader.tsx +++ b/src/components/common/UiLoader.tsx @@ -1,34 +1,33 @@ +import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; -import { ApiMediaFormat } from '../../api/types'; import type { TabState } from '../../global/types'; -import type { FC } from '../../lib/teact/teact'; +import { ApiMediaFormat } from '../../api/types'; import { getChatAvatarHash } from '../../global/helpers/chats'; // Direct import for better module splitting import { selectIsRightColumnShown, selectTabState } from '../../global/selectors'; -import { pause } from '../../util/schedulers'; +import buildClassName from '../../util/buildClassName'; import { preloadImage } from '../../util/files'; import preloadFonts from '../../util/fonts'; import * as mediaLoader from '../../util/mediaLoader'; import { Bundles, loadModule } from '../../util/moduleLoader'; -import buildClassName from '../../util/buildClassName'; +import { pause } from '../../util/schedulers'; +import useEffectOnce from '../../hooks/useEffectOnce'; import useFlag from '../../hooks/useFlag'; import useShowTransition from '../../hooks/useShowTransition'; -import useEffectOnce from '../../hooks/useEffectOnce'; - -import styles from './UiLoader.module.scss'; -import appStyles from '../App.module.scss'; // Workaround for incorrect bundling by Webpack: force including in the main chunk import '../ui/Modal.scss'; import './Avatar.scss'; +import appStyles from '../App.module.scss'; +import styles from './UiLoader.module.scss'; -import telegramLogoPath from '../../assets/telegram-logo.svg'; import lockPreviewPath from '../../assets/lock.png'; import monkeyPath from '../../assets/monkey.svg'; import spoilerMaskPath from '../../assets/spoilers/mask.svg'; +import telegramLogoPath from '../../assets/telegram-logo.svg'; export type UiLoaderPage = 'main' diff --git a/src/components/common/UnpinAllMessagesModal.async.tsx b/src/components/common/UnpinAllMessagesModal.async.tsx index c1a0e209d..410c29571 100644 --- a/src/components/common/UnpinAllMessagesModal.async.tsx +++ b/src/components/common/UnpinAllMessagesModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './UnpinAllMessagesModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/common/UnpinAllMessagesModal.tsx b/src/components/common/UnpinAllMessagesModal.tsx index e2d7e6b40..c55028215 100644 --- a/src/components/common/UnpinAllMessagesModal.tsx +++ b/src/components/common/UnpinAllMessagesModal.tsx @@ -3,8 +3,8 @@ import React, { memo } from '../../lib/teact/teact'; import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; +import Modal from '../ui/Modal'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/common/UnreadCounter.tsx b/src/components/common/UnreadCounter.tsx index c2cfb9664..9380f54c6 100644 --- a/src/components/common/UnreadCounter.tsx +++ b/src/components/common/UnreadCounter.tsx @@ -1,10 +1,11 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect } from '../../lib/teact/teact'; -import { formatIntegerCompact } from '../../util/textFormat'; -import { useFolderManagerForUnreadCounters } from '../../hooks/useFolderManager'; -import { getAllNotificationsCount } from '../../util/folderManager'; import { updateAppBadge } from '../../util/appBadge'; +import { getAllNotificationsCount } from '../../util/folderManager'; +import { formatIntegerCompact } from '../../util/textFormat'; + +import { useFolderManagerForUnreadCounters } from '../../hooks/useFolderManager'; interface OwnProps { isForAppBadge?: boolean; diff --git a/src/components/common/UserLink.tsx b/src/components/common/UserLink.tsx index f5d96f5dc..0e37dd566 100644 --- a/src/components/common/UserLink.tsx +++ b/src/components/common/UserLink.tsx @@ -1,12 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React, { useCallback } from '../../lib/teact/teact'; +import { getActions } from '../../global'; import type { ApiChat, ApiUser } from '../../api/types'; import buildClassName from '../../util/buildClassName'; import Link from '../ui/Link'; -import { getActions } from '../../global'; type OwnProps = { className?: string; diff --git a/src/components/common/UsernameInput.tsx b/src/components/common/UsernameInput.tsx index f77066403..87cb635eb 100644 --- a/src/components/common/UsernameInput.tsx +++ b/src/components/common/UsernameInput.tsx @@ -1,10 +1,9 @@ +import type { FC } from '../../lib/teact/teact'; import React, { - useState, useCallback, memo, useEffect, useMemo, + memo, useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; - import { TME_LINK_PREFIX } from '../../config'; import { debounce } from '../../util/schedulers'; diff --git a/src/components/common/VerifiedIcon.tsx b/src/components/common/VerifiedIcon.tsx index f1b9ec3eb..908f8dc92 100644 --- a/src/components/common/VerifiedIcon.tsx +++ b/src/components/common/VerifiedIcon.tsx @@ -1,5 +1,5 @@ -import React from '../../lib/teact/teact'; import type { FC } from '../../lib/teact/teact'; +import React from '../../lib/teact/teact'; import './VerifiedIcon.scss'; diff --git a/src/components/common/WebLink.tsx b/src/components/common/WebLink.tsx index 486b3265a..4db269113 100644 --- a/src/components/common/WebLink.tsx +++ b/src/components/common/WebLink.tsx @@ -2,24 +2,24 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import type { ApiMessage, ApiWebPage } from '../../api/types'; -import type { TextPart } from '../../types'; import type { ObserveFn } from '../../hooks/useIntersectionObserver'; +import type { TextPart } from '../../types'; import { getFirstLinkInMessage, getMessageText, getMessageWebPage, } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; -import trimText from '../../util/trimText'; -import renderText from './helpers/renderText'; import { formatPastTimeShort } from '../../util/dateFormat'; +import trimText from '../../util/trimText'; import { renderMessageSummary } from './helpers/renderMessageText'; +import renderText from './helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import Media from './Media'; import Link from '../ui/Link'; +import Media from './Media'; import SafeLink from './SafeLink'; import './WebLink.scss'; diff --git a/src/components/common/code/CodeBlock.tsx b/src/components/common/code/CodeBlock.tsx index 2235cf61b..26febbcd7 100644 --- a/src/components/common/code/CodeBlock.tsx +++ b/src/components/common/code/CodeBlock.tsx @@ -1,14 +1,14 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useState } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import { ApiMessageEntityTypes } from '../../../api/types'; import buildClassName from '../../../util/buildClassName'; import useAsync from '../../../hooks/useAsync'; -import PreBlock from './PreBlock'; import CodeOverlay from './CodeOverlay'; +import PreBlock from './PreBlock'; import './CodeBlock.scss'; diff --git a/src/components/common/code/CodeOverlay.tsx b/src/components/common/code/CodeOverlay.tsx index 26910a1a2..7d9674394 100644 --- a/src/components/common/code/CodeOverlay.tsx +++ b/src/components/common/code/CodeOverlay.tsx @@ -4,12 +4,12 @@ import React, { } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import { copyTextToClipboard } from '../../../util/clipboard'; import buildClassName from '../../../util/buildClassName'; +import { copyTextToClipboard } from '../../../util/clipboard'; import { areLinesWrapping } from '../helpers/renderText'; -import useWindowSize from '../../../hooks/useWindowSize'; import useLang from '../../../hooks/useLang'; +import useWindowSize from '../../../hooks/useWindowSize'; import styles from './CodeOverlay.module.scss'; diff --git a/src/components/common/helpers/animatedAssets.ts b/src/components/common/helpers/animatedAssets.ts index ce8230212..5f98c1116 100644 --- a/src/components/common/helpers/animatedAssets.ts +++ b/src/components/common/helpers/animatedAssets.ts @@ -1,16 +1,4 @@ -import MonkeyIdle from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyIdle.tgs'; -import MonkeyTracking from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyTracking.tgs'; -import MonkeyClose from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyClose.tgs'; -import MonkeyPeek from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyPeek.tgs'; - -import FoldersAll from '../../../assets/tgs/settings/FoldersAll.tgs'; -import FoldersNew from '../../../assets/tgs/settings/FoldersNew.tgs'; -import FoldersShare from '../../../assets/tgs/settings/FoldersShare.tgs'; -import DiscussionGroups from '../../../assets/tgs/settings/DiscussionGroupsDucks.tgs'; -import Lock from '../../../assets/tgs/settings/Lock.tgs'; -import Congratulations from '../../../assets/tgs/settings/Congratulations.tgs'; -import Experimental from '../../../assets/tgs/settings/Experimental.tgs'; - +import QrPlane from '../../../assets/tgs/auth/QrPlane.tgs'; import CameraFlip from '../../../assets/tgs/calls/CameraFlip.tgs'; import HandFilled from '../../../assets/tgs/calls/HandFilled.tgs'; import HandOutline from '../../../assets/tgs/calls/HandOutline.tgs'; @@ -19,11 +7,19 @@ import VoiceAllowTalk from '../../../assets/tgs/calls/VoiceAllowTalk.tgs'; import VoiceMini from '../../../assets/tgs/calls/VoiceMini.tgs'; import VoiceMuted from '../../../assets/tgs/calls/VoiceMuted.tgs'; import VoiceOutlined from '../../../assets/tgs/calls/VoiceOutlined.tgs'; - -import JoinRequest from '../../../assets/tgs/invites/Requests.tgs'; import Invite from '../../../assets/tgs/invites/Invite.tgs'; - -import QrPlane from '../../../assets/tgs/auth/QrPlane.tgs'; +import JoinRequest from '../../../assets/tgs/invites/Requests.tgs'; +import MonkeyClose from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyClose.tgs'; +import MonkeyIdle from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyIdle.tgs'; +import MonkeyPeek from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyPeek.tgs'; +import MonkeyTracking from '../../../assets/tgs/monkeys/TwoFactorSetupMonkeyTracking.tgs'; +import Congratulations from '../../../assets/tgs/settings/Congratulations.tgs'; +import DiscussionGroups from '../../../assets/tgs/settings/DiscussionGroupsDucks.tgs'; +import Experimental from '../../../assets/tgs/settings/Experimental.tgs'; +import FoldersAll from '../../../assets/tgs/settings/FoldersAll.tgs'; +import FoldersNew from '../../../assets/tgs/settings/FoldersNew.tgs'; +import FoldersShare from '../../../assets/tgs/settings/FoldersShare.tgs'; +import Lock from '../../../assets/tgs/settings/Lock.tgs'; export const LOCAL_TGS_URLS = { MonkeyIdle, diff --git a/src/components/common/helpers/mediaDimensions.ts b/src/components/common/helpers/mediaDimensions.ts index 3620e95f0..f20b50eba 100644 --- a/src/components/common/helpers/mediaDimensions.ts +++ b/src/components/common/helpers/mediaDimensions.ts @@ -1,11 +1,11 @@ import type { - ApiPhoto, ApiVideo, ApiSticker, ApiDimensions, + ApiDimensions, ApiPhoto, ApiSticker, ApiVideo, } from '../../../api/types'; import { STICKER_SIZE_INLINE_DESKTOP_FACTOR, STICKER_SIZE_INLINE_MOBILE_FACTOR } from '../../../config'; +import { getPhotoInlineDimensions, getVideoDimensions } from '../../../global/helpers'; import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import windowSize from '../../../util/windowSize'; -import { getPhotoInlineDimensions, getVideoDimensions } from '../../../global/helpers'; export const MEDIA_VIEWER_MEDIA_QUERY = '(max-height: 640px)'; export const REM = parseInt(getComputedStyle(document.documentElement).fontSize, 10); diff --git a/src/components/common/helpers/renderActionMessageText.tsx b/src/components/common/helpers/renderActionMessageText.tsx index c5f8b79eb..1d876fa95 100644 --- a/src/components/common/helpers/renderActionMessageText.tsx +++ b/src/components/common/helpers/renderActionMessageText.tsx @@ -1,28 +1,28 @@ import React from '../../../lib/teact/teact'; import type { - ApiChat, ApiMessage, ApiUser, ApiGroupCall, ApiTopic, + ApiChat, ApiGroupCall, ApiMessage, ApiTopic, ApiUser, } from '../../../api/types'; -import type { TextPart } from '../../../types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import type { LangFn } from '../../../hooks/useLang'; +import type { TextPart } from '../../../types'; import { getChatTitle, getMessageSummaryText, getUserFullName, } from '../../../global/helpers'; -import trimText from '../../../util/trimText'; import { formatCurrency } from '../../../util/formatCurrency'; +import trimText from '../../../util/trimText'; import renderText from './renderText'; -import UserLink from '../UserLink'; -import MessageLink from '../MessageLink'; import ChatLink from '../ChatLink'; -import GroupCallLink from '../GroupCallLink'; -import MessageSummary from '../MessageSummary'; import CustomEmoji from '../CustomEmoji'; +import GroupCallLink from '../GroupCallLink'; +import MessageLink from '../MessageLink'; +import MessageSummary from '../MessageSummary'; import TopicDefaultIcon from '../TopicDefaultIcon'; +import UserLink from '../UserLink'; interface RenderOptions { asPlainText?: boolean; diff --git a/src/components/common/helpers/renderMessageText.ts b/src/components/common/helpers/renderMessageText.ts index 6a417d6e8..a1523f878 100644 --- a/src/components/common/helpers/renderMessageText.ts +++ b/src/components/common/helpers/renderMessageText.ts @@ -1,7 +1,7 @@ import type { ApiMessage } from '../../../api/types'; -import { ApiMessageEntityTypes } from '../../../api/types'; -import type { TextPart } from '../../../types'; import type { LangFn } from '../../../hooks/useLang'; +import type { TextPart } from '../../../types'; +import { ApiMessageEntityTypes } from '../../../api/types'; import { getMessageKey, @@ -11,9 +11,9 @@ import { getMessageText, TRUNCATED_SUMMARY_LENGTH, } from '../../../global/helpers'; +import trimText from '../../../util/trimText'; import renderText from './renderText'; import { renderTextWithEntities } from './renderTextWithEntities'; -import trimText from '../../../util/trimText'; export function renderMessageText({ message, diff --git a/src/components/common/helpers/renderText.tsx b/src/components/common/helpers/renderText.tsx index 40b9f2fe5..438b96e8a 100644 --- a/src/components/common/helpers/renderText.tsx +++ b/src/components/common/helpers/renderText.tsx @@ -1,21 +1,21 @@ +import type { TeactNode } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import type { TeactNode } from '../../../lib/teact/teact'; import type { TextPart } from '../../../types'; -import EMOJI_REGEX from '../../../lib/twemojiRegex'; import { IS_ELECTRON, PRODUCTION_URL, RE_LINK_TEMPLATE, RE_MENTION_TEMPLATE, } from '../../../config'; -import { IS_EMOJI_SUPPORTED } from '../../../util/windowEnvironment'; +import EMOJI_REGEX from '../../../lib/twemojiRegex'; +import buildClassName from '../../../util/buildClassName'; import { fixNonStandardEmoji, handleEmojiLoad, LOADED_EMOJIS, nativeToUnifiedExtendedWithCache, } from '../../../util/emoji'; -import buildClassName from '../../../util/buildClassName'; import { compact } from '../../../util/iteratees'; +import { IS_EMOJI_SUPPORTED } from '../../../util/windowEnvironment'; import MentionLink from '../../middle/message/MentionLink'; import SafeLink from '../SafeLink'; diff --git a/src/components/common/helpers/renderTextWithEntities.tsx b/src/components/common/helpers/renderTextWithEntities.tsx index e6cf7f19d..fb79c6f21 100644 --- a/src/components/common/helpers/renderTextWithEntities.tsx +++ b/src/components/common/helpers/renderTextWithEntities.tsx @@ -1,23 +1,23 @@ import React from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { TextPart } from '../../../types'; import type { ApiFormattedText, ApiMessageEntity } from '../../../api/types'; -import { ApiMessageEntityTypes } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; +import type { TextPart } from '../../../types'; import type { TextFilter } from './renderText'; +import { ApiMessageEntityTypes } from '../../../api/types'; import buildClassName from '../../../util/buildClassName'; -import renderText from './renderText'; import { copyTextToClipboard } from '../../../util/clipboard'; import { translate } from '../../../util/langProvider'; import { buildCustomEmojiHtmlFromEntity } from '../../middle/composer/helpers/customEmoji'; +import renderText from './renderText'; import MentionLink from '../../middle/message/MentionLink'; +import CodeBlock from '../code/CodeBlock'; +import CustomEmoji from '../CustomEmoji'; import SafeLink from '../SafeLink'; import Spoiler from '../spoiler/Spoiler'; -import CustomEmoji from '../CustomEmoji'; -import CodeBlock from '../code/CodeBlock'; interface IOrganizedEntity { entity: ApiMessageEntity; diff --git a/src/components/common/hooks/useAnimatedEmoji.ts b/src/components/common/hooks/useAnimatedEmoji.ts index ad7c99bfd..036919209 100644 --- a/src/components/common/hooks/useAnimatedEmoji.ts +++ b/src/components/common/hooks/useAnimatedEmoji.ts @@ -4,9 +4,8 @@ import { getActions } from '../../../global'; import type { ActiveEmojiInteraction } from '../../../global/types'; import { IS_ELECTRON } from '../../../config'; - -import safePlay from '../../../util/safePlay'; import buildStyle from '../../../util/buildStyle'; +import safePlay from '../../../util/safePlay'; import { REM } from '../helpers/mediaDimensions'; import useLastCallback from '../../../hooks/useLastCallback'; diff --git a/src/components/common/hooks/useCustomEmoji.ts b/src/components/common/hooks/useCustomEmoji.ts index 9679a216b..2affad2dc 100644 --- a/src/components/common/hooks/useCustomEmoji.ts +++ b/src/components/common/hooks/useCustomEmoji.ts @@ -1,14 +1,14 @@ import { useEffect, useState } from '../../../lib/teact/teact'; import { getGlobal } from '../../../global'; -import type { GlobalState } from '../../../global/types'; import type { ApiSticker } from '../../../api/types'; +import type { GlobalState } from '../../../global/types'; import { selectCanPlayAnimatedEmojis } from '../../../global/selectors'; import { addCustomEmojiCallback, removeCustomEmojiCallback } from '../../../util/customEmojiManager'; -import useLastCallback from '../../../hooks/useLastCallback'; import useEnsureCustomEmoji from '../../../hooks/useEnsureCustomEmoji'; +import useLastCallback from '../../../hooks/useLastCallback'; export default function useCustomEmoji(documentId?: string) { const [customEmoji, setCustomEmoji] = useState( diff --git a/src/components/common/hooks/usePhotosPreload.ts b/src/components/common/hooks/usePhotosPreload.ts index fc04fc34e..3ef7de379 100644 --- a/src/components/common/hooks/usePhotosPreload.ts +++ b/src/components/common/hooks/usePhotosPreload.ts @@ -1,6 +1,8 @@ +import { useEffect } from '../../../lib/teact/teact'; + import type { ApiPhoto } from '../../../api/types'; import { ApiMediaFormat } from '../../../api/types'; -import { useEffect } from '../../../lib/teact/teact'; + import * as mediaLoader from '../../../util/mediaLoader'; const PHOTOS_TO_PRELOAD = 4; diff --git a/src/components/common/hooks/useStickerPickerObservers.ts b/src/components/common/hooks/useStickerPickerObservers.ts index d68889ac4..279f1503e 100644 --- a/src/components/common/hooks/useStickerPickerObservers.ts +++ b/src/components/common/hooks/useStickerPickerObservers.ts @@ -5,8 +5,8 @@ import { ANIMATION_END_DELAY } from '../../../config'; import animateScroll from '../../../util/animateScroll'; import { REM } from '../helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; import useSyncEffect from '../../../hooks/useSyncEffect'; const STICKER_INTERSECTION_THROTTLE = 200; diff --git a/src/components/common/spoiler/Spoiler.tsx b/src/components/common/spoiler/Spoiler.tsx index db83930e6..364625d6f 100644 --- a/src/components/common/spoiler/Spoiler.tsx +++ b/src/components/common/spoiler/Spoiler.tsx @@ -1,12 +1,12 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import { ApiMessageEntityTypes } from '../../../api/types'; import { createClassNameBuilder } from '../../../util/buildClassName'; -import useLastCallback from '../../../hooks/useLastCallback'; import useFlag from '../../../hooks/useFlag'; +import useLastCallback from '../../../hooks/useLastCallback'; import './Spoiler.scss'; diff --git a/src/components/left/ArchivedChats.async.tsx b/src/components/left/ArchivedChats.async.tsx index c79c86879..5cd5f3d62 100644 --- a/src/components/left/ArchivedChats.async.tsx +++ b/src/components/left/ArchivedChats.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './ArchivedChats'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const ArchivedChatsAsync: FC = (props) => { diff --git a/src/components/left/ArchivedChats.tsx b/src/components/left/ArchivedChats.tsx index 2536a1c53..4512d526a 100644 --- a/src/components/left/ArchivedChats.tsx +++ b/src/components/left/ArchivedChats.tsx @@ -1,26 +1,27 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { LeftColumnContent, SettingsScreens } from '../../types'; -import type { FolderEditDispatch } from '../../hooks/reducers/useFoldersReducer'; + import type { GlobalState } from '../../global/types'; +import type { FolderEditDispatch } from '../../hooks/reducers/useFoldersReducer'; +import type { LeftColumnContent, SettingsScreens } from '../../types'; import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; -import useHistoryBack from '../../hooks/useHistoryBack'; -import useLeftHeaderButtonRtlForumTransition from './main/hooks/useLeftHeaderButtonRtlForumTransition'; -import useShowTransition from '../../hooks/useShowTransition'; import useForumPanelRender from '../../hooks/useForumPanelRender'; +import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useShowTransition from '../../hooks/useShowTransition'; +import useLeftHeaderButtonRtlForumTransition from './main/hooks/useLeftHeaderButtonRtlForumTransition'; -import Button from '../ui/Button'; -import ChatList from './main/ChatList'; -import ForumPanel from './main/ForumPanel'; -import DropdownMenu from '../ui/DropdownMenu'; -import MenuItem from '../ui/MenuItem'; import StoryRibbon from '../story/StoryRibbon'; import StoryToggler from '../story/StoryToggler'; +import Button from '../ui/Button'; +import DropdownMenu from '../ui/DropdownMenu'; +import MenuItem from '../ui/MenuItem'; +import ChatList from './main/ChatList'; +import ForumPanel from './main/ForumPanel'; import './ArchivedChats.scss'; diff --git a/src/components/left/ChatFolderModal.async.tsx b/src/components/left/ChatFolderModal.async.tsx index 9b469d162..c4215c4c1 100644 --- a/src/components/left/ChatFolderModal.async.tsx +++ b/src/components/left/ChatFolderModal.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; + import type { OwnProps } from './ChatFolderModal'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const ChatFolderModalAsync: FC = (props) => { diff --git a/src/components/left/ChatFolderModal.tsx b/src/components/left/ChatFolderModal.tsx index 2e1051e03..46eeb1819 100644 --- a/src/components/left/ChatFolderModal.tsx +++ b/src/components/left/ChatFolderModal.tsx @@ -1,17 +1,18 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useCallback, memo, useMemo, useState, + memo, useCallback, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ApiChatFolder } from '../../api/types'; import { ALL_FOLDER_ID } from '../../config'; + import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; import CheckboxGroup from '../ui/CheckboxGroup'; +import Modal from '../ui/Modal'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/left/ConnectionStatusOverlay.tsx b/src/components/left/ConnectionStatusOverlay.tsx index e62141b53..bb48fb9f3 100644 --- a/src/components/left/ConnectionStatusOverlay.tsx +++ b/src/components/left/ConnectionStatusOverlay.tsx @@ -1,12 +1,13 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; -import useLang from '../../hooks/useLang'; import type { ConnectionStatus } from '../../hooks/useConnectionStatus'; -import Transition from '../ui/Transition'; -import Spinner from '../ui/Spinner'; +import useLang from '../../hooks/useLang'; + import Button from '../ui/Button'; +import Spinner from '../ui/Spinner'; +import Transition from '../ui/Transition'; import './ConnectionStatusOverlay.scss'; diff --git a/src/components/left/LeftColumn.tsx b/src/components/left/LeftColumn.tsx index 2bb4b8c63..cb5925f3b 100644 --- a/src/components/left/LeftColumn.tsx +++ b/src/components/left/LeftColumn.tsx @@ -5,24 +5,24 @@ import React, { import { getActions, withGlobal } from '../../global'; import type { GlobalState } from '../../global/types'; -import { LeftColumnContent, SettingsScreens } from '../../types'; -import type { ReducerAction } from '../../hooks/useReducer'; import type { FoldersActions } from '../../hooks/reducers/useFoldersReducer'; +import type { ReducerAction } from '../../hooks/useReducer'; +import { LeftColumnContent, SettingsScreens } from '../../types'; -import { IS_MAC_OS, IS_APP, LAYERS_ANIMATION_NAME } from '../../util/windowEnvironment'; -import captureEscKeyListener from '../../util/captureEscKeyListener'; import { selectCurrentChat, selectIsForumPanelOpen, selectTabState } from '../../global/selectors'; +import captureEscKeyListener from '../../util/captureEscKeyListener'; +import { IS_APP, IS_MAC_OS, LAYERS_ANIMATION_NAME } from '../../util/windowEnvironment'; -import useLastCallback from '../../hooks/useLastCallback'; import useFoldersReducer from '../../hooks/reducers/useFoldersReducer'; import { useHotkeys } from '../../hooks/useHotkeys'; +import useLastCallback from '../../hooks/useLastCallback'; import useSyncEffect from '../../hooks/useSyncEffect'; import Transition from '../ui/Transition'; -import LeftMain from './main/LeftMain'; -import Settings from './settings/Settings.async'; -import NewChat from './newChat/NewChat.async'; import ArchivedChats from './ArchivedChats.async'; +import LeftMain from './main/LeftMain'; +import NewChat from './newChat/NewChat.async'; +import Settings from './settings/Settings.async'; import './LeftColumn.scss'; diff --git a/src/components/left/MuteChatModal.async.tsx b/src/components/left/MuteChatModal.async.tsx index f8fa4b7e6..19844f494 100644 --- a/src/components/left/MuteChatModal.async.tsx +++ b/src/components/left/MuteChatModal.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; + import type { OwnProps } from './MuteChatModal'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const MuteChatModalAsync: FC = (props) => { diff --git a/src/components/left/MuteChatModal.tsx b/src/components/left/MuteChatModal.tsx index d9f065667..0eb1d8385 100644 --- a/src/components/left/MuteChatModal.tsx +++ b/src/components/left/MuteChatModal.tsx @@ -1,14 +1,15 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useCallback, memo, useMemo, useState, + memo, useCallback, useMemo, useState, } from '../../lib/teact/teact'; import { getActions } from '../../global'; import { MAX_INT_32 } from '../../config'; + import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; +import Modal from '../ui/Modal'; import RadioGroup from '../ui/RadioGroup'; export type OwnProps = { diff --git a/src/components/left/NewChatButton.tsx b/src/components/left/NewChatButton.tsx index 122e39b49..7ea00306c 100644 --- a/src/components/left/NewChatButton.tsx +++ b/src/components/left/NewChatButton.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useState, useEffect, useCallback, useMemo, + useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; import Button from '../ui/Button'; diff --git a/src/components/left/main/Archive.tsx b/src/components/left/main/Archive.tsx index 76cb0b48f..82c71f6c0 100644 --- a/src/components/left/main/Archive.tsx +++ b/src/components/left/main/Archive.tsx @@ -1,21 +1,21 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { GlobalState } from '../../../global/types'; import { ARCHIVED_FOLDER_ID } from '../../../config'; +import { getChatTitle } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; import { compact } from '../../../util/iteratees'; import { formatIntegerCompact } from '../../../util/textFormat'; import renderText from '../../common/helpers/renderText'; -import { getChatTitle } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; import { useFolderManagerForOrderedIds, useFolderManagerForUnreadCounters } from '../../../hooks/useFolderManager'; +import useLang from '../../../hooks/useLang'; -import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; import Badge from '../../ui/Badge'; +import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; import styles from './Archive.module.scss'; diff --git a/src/components/left/main/Chat.tsx b/src/components/left/main/Chat.tsx index f4c7f8c19..9efbdedbc 100644 --- a/src/components/left/main/Chat.tsx +++ b/src/components/left/main/Chat.tsx @@ -2,10 +2,6 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; -import { StoryViewerOrigin } from '../../../types'; -import type { ChatAnimationTypes } from './hooks'; -import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; import type { ApiChat, ApiFormattedText, @@ -16,9 +12,11 @@ import type { ApiUser, ApiUserStatus, } from '../../../api/types'; - +import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; +import type { ChatAnimationTypes } from './hooks'; import { MAIN_THREAD_ID } from '../../../api/types'; -import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../util/windowEnvironment'; +import { StoryViewerOrigin } from '../../../types'; + import { getMessageAction, getPrivateChatUserId, @@ -45,25 +43,27 @@ import { } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import { createLocationHash } from '../../../util/routing'; +import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useSelectorSignal from '../../../hooks/useSelectorSignal'; +import useAppLayout from '../../../hooks/useAppLayout'; import useChatContextActions from '../../../hooks/useChatContextActions'; import useFlag from '../../../hooks/useFlag'; -import useChatListEntry from './hooks/useChatListEntry'; -import useAppLayout from '../../../hooks/useAppLayout'; +import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useSelectorSignal from '../../../hooks/useSelectorSignal'; import useShowTransition from '../../../hooks/useShowTransition'; +import useChatListEntry from './hooks/useChatListEntry'; -import ListItem from '../../ui/ListItem'; import Avatar from '../../common/Avatar'; -import LastMessageMeta from '../../common/LastMessageMeta'; import DeleteChatModal from '../../common/DeleteChatModal'; -import ReportModal from '../../common/ReportModal'; import FullNameTitle from '../../common/FullNameTitle'; +import LastMessageMeta from '../../common/LastMessageMeta'; +import ReportModal from '../../common/ReportModal'; +import ListItem from '../../ui/ListItem'; import ChatFolderModal from '../ChatFolderModal.async'; import MuteChatModal from '../MuteChatModal.async'; -import ChatCallStatus from './ChatCallStatus'; import ChatBadge from './ChatBadge'; +import ChatCallStatus from './ChatCallStatus'; import './Chat.scss'; diff --git a/src/components/left/main/ChatBadge.tsx b/src/components/left/main/ChatBadge.tsx index 92ba32821..6106476bf 100644 --- a/src/components/left/main/ChatBadge.tsx +++ b/src/components/left/main/ChatBadge.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; import type { ApiChat, ApiTopic } from '../../../api/types'; -import type { FC } from '../../../lib/teact/teact'; - import type { Signal } from '../../../util/signals'; + +import buildClassName from '../../../util/buildClassName'; import { isSignal } from '../../../util/signals'; import { formatIntegerCompact } from '../../../util/textFormat'; -import buildClassName from '../../../util/buildClassName'; import useDerivedState from '../../../hooks/useDerivedState'; -import ShowTransition from '../../ui/ShowTransition'; import AnimatedCounter from '../../common/AnimatedCounter'; +import ShowTransition from '../../ui/ShowTransition'; import './ChatBadge.scss'; diff --git a/src/components/left/main/ChatCallStatus.tsx b/src/components/left/main/ChatCallStatus.tsx index aab71f96a..717bf5442 100644 --- a/src/components/left/main/ChatCallStatus.tsx +++ b/src/components/left/main/ChatCallStatus.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; + import buildClassName from '../../../util/buildClassName'; import styles from './ChatCallStatus.module.scss'; diff --git a/src/components/left/main/ChatFolders.tsx b/src/components/left/main/ChatFolders.tsx index 993c8484e..0fe6d8f01 100644 --- a/src/components/left/main/ChatFolders.tsx +++ b/src/components/left/main/ChatFolders.tsx @@ -5,30 +5,30 @@ import React, { import { getActions, getGlobal, withGlobal } from '../../../global'; import type { ApiChatFolder, ApiChatlistExportedInvite } from '../../../api/types'; -import type { LeftColumnContent, SettingsScreens } from '../../../types'; -import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; import type { GlobalState } from '../../../global/types'; -import type { TabWithProperties } from '../../ui/TabList'; +import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; +import type { LeftColumnContent, SettingsScreens } from '../../../types'; import type { MenuItemContextAction } from '../../ui/ListItem'; -import TabList from '../../ui/TabList'; +import type { TabWithProperties } from '../../ui/TabList'; import { ALL_FOLDER_ID } from '../../../config'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; -import { captureEvents, SwipeDirection } from '../../../util/captureEvents'; +import { selectCanShareFolder, selectTabState } from '../../../global/selectors'; +import { selectCurrentLimit } from '../../../global/selectors/limits'; import buildClassName from '../../../util/buildClassName'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; -import { selectCurrentLimit } from '../../../global/selectors/limits'; -import { selectCanShareFolder, selectTabState } from '../../../global/selectors'; +import { captureEvents, SwipeDirection } from '../../../util/captureEvents'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import { useFolderManagerForUnreadCounters } from '../../../hooks/useFolderManager'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useShowTransition from '../../../hooks/useShowTransition'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import { useFolderManagerForUnreadCounters } from '../../../hooks/useFolderManager'; -import Transition from '../../ui/Transition'; import StoryRibbon from '../../story/StoryRibbon'; +import TabList from '../../ui/TabList'; +import Transition from '../../ui/Transition'; import ChatList from './ChatList'; type OwnProps = { diff --git a/src/components/left/main/ChatList.tsx b/src/components/left/main/ChatList.tsx index e68a29176..7779b5ddf 100644 --- a/src/components/left/main/ChatList.tsx +++ b/src/components/left/main/ChatList.tsx @@ -1,40 +1,40 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef, } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; -import { LeftColumnContent } from '../../../types'; -import type { SettingsScreens } from '../../../types'; import type { GlobalState } from '../../../global/types'; +import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; +import type { SettingsScreens } from '../../../types'; +import { LeftColumnContent } from '../../../types'; import { ALL_FOLDER_ID, - ARCHIVED_FOLDER_ID, ARCHIVE_MINIMIZED_HEIGHT, + ARCHIVED_FOLDER_ID, CHAT_HEIGHT_PX, CHAT_LIST_SLICE, } from '../../../config'; -import { IS_MAC_OS, IS_APP } from '../../../util/windowEnvironment'; -import { getPinnedChatsCount, getOrderKey } from '../../../util/folderManager'; import buildClassName from '../../../util/buildClassName'; +import { getOrderKey, getPinnedChatsCount } from '../../../util/folderManager'; +import { IS_APP, IS_MAC_OS } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; -import { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import { useHotkeys } from '../../../hooks/useHotkeys'; -import useDebouncedCallback from '../../../hooks/useDebouncedCallback'; -import useOrderDiff from './hooks/useOrderDiff'; import useUserStoriesPolling from '../../../hooks/polling/useUserStoriesPolling'; +import useTopOverscroll from '../../../hooks/scroll/useTopOverscroll'; +import useDebouncedCallback from '../../../hooks/useDebouncedCallback'; +import { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager'; +import { useHotkeys } from '../../../hooks/useHotkeys'; +import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useOrderDiff from './hooks/useOrderDiff'; import InfiniteScroll from '../../ui/InfiniteScroll'; import Loading from '../../ui/Loading'; +import Archive from './Archive'; import Chat from './Chat'; import EmptyFolder from './EmptyFolder'; -import Archive from './Archive'; -import useTopOverscroll from '../../../hooks/scroll/useTopOverscroll'; type OwnProps = { folderType: 'all' | 'archived' | 'folder'; diff --git a/src/components/left/main/ContactList.async.tsx b/src/components/left/main/ContactList.async.tsx index e4db4fef6..dc8dbac93 100644 --- a/src/components/left/main/ContactList.async.tsx +++ b/src/components/left/main/ContactList.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; + import type { OwnProps } from './ContactList'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const ContactListAsync: FC = (props) => { diff --git a/src/components/left/main/ContactList.tsx b/src/components/left/main/ContactList.tsx index e799a994b..137fe9a52 100644 --- a/src/components/left/main/ContactList.tsx +++ b/src/components/left/main/ContactList.tsx @@ -1,21 +1,22 @@ import type { FC } from '../../../lib/teact/teact'; -import React, { useCallback, useMemo, memo } from '../../../lib/teact/teact'; +import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { ApiUser, ApiUserStatus } from '../../../api/types'; import { StoryViewerOrigin } from '../../../types'; import { filterUsersByName, sortUserIds } from '../../../global/helpers'; -import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import useLang from '../../../hooks/useLang'; + import useAppLayout from '../../../hooks/useAppLayout'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; +import useLang from '../../../hooks/useLang'; import PrivateChatInfo from '../../common/PrivateChatInfo'; +import FloatingActionButton from '../../ui/FloatingActionButton'; import InfiniteScroll from '../../ui/InfiniteScroll'; import ListItem from '../../ui/ListItem'; import Loading from '../../ui/Loading'; -import FloatingActionButton from '../../ui/FloatingActionButton'; export type OwnProps = { filter: string; diff --git a/src/components/left/main/EmptyFolder.tsx b/src/components/left/main/EmptyFolder.tsx index 6a12c3d81..6f4bcc8b2 100644 --- a/src/components/left/main/EmptyFolder.tsx +++ b/src/components/left/main/EmptyFolder.tsx @@ -3,15 +3,16 @@ import React, { memo, useCallback } from '../../../lib/teact/teact'; import { withGlobal } from '../../../global'; import type { ApiChatFolder, ApiSticker } from '../../../api/types'; -import { SettingsScreens } from '../../../types'; import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; +import { SettingsScreens } from '../../../types'; import { selectAnimatedEmoji, selectChatFolder } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useAppLayout from '../../../hooks/useAppLayout'; -import Button from '../../ui/Button'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useLang from '../../../hooks/useLang'; + import AnimatedIconFromSticker from '../../common/AnimatedIconFromSticker'; +import Button from '../../ui/Button'; import styles from './EmptyFolder.module.scss'; diff --git a/src/components/left/main/EmptyForum.tsx b/src/components/left/main/EmptyForum.tsx index 0cfec61f5..adbfee248 100644 --- a/src/components/left/main/EmptyForum.tsx +++ b/src/components/left/main/EmptyForum.tsx @@ -1,18 +1,19 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker } from '../../../api/types'; -import { REM } from '../../common/helpers/mediaDimensions'; -import { selectAnimatedEmoji, selectChat } from '../../../global/selectors'; import { getHasAdminRight } from '../../../global/helpers'; +import { selectAnimatedEmoji, selectChat } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; -import useLang from '../../../hooks/useLang'; -import useAppLayout from '../../../hooks/useAppLayout'; +import { REM } from '../../common/helpers/mediaDimensions'; + +import useAppLayout from '../../../hooks/useAppLayout'; +import useLang from '../../../hooks/useLang'; -import Button from '../../ui/Button'; import AnimatedIconFromSticker from '../../common/AnimatedIconFromSticker'; +import Button from '../../ui/Button'; import styles from './EmptyForum.module.scss'; diff --git a/src/components/left/main/ForumPanel.tsx b/src/components/left/main/ForumPanel.tsx index 52b646186..7fa507899 100644 --- a/src/components/left/main/ForumPanel.tsx +++ b/src/components/left/main/ForumPanel.tsx @@ -1,45 +1,45 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { requestNextMutation } from '../../../lib/fasterdom/fasterdom'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChat } from '../../../api/types'; import { MAIN_THREAD_ID } from '../../../api/types'; import { - GENERAL_TOPIC_ID, TOPICS_SLICE, TOPIC_HEIGHT_PX, TOPIC_LIST_SENSITIVE_AREA, + GENERAL_TOPIC_ID, TOPIC_HEIGHT_PX, TOPIC_LIST_SENSITIVE_AREA, TOPICS_SLICE, } from '../../../config'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import { requestNextMutation } from '../../../lib/fasterdom/fasterdom'; +import { getOrderedTopics } from '../../../global/helpers'; import { selectCanAnimateInterface, selectChat, selectCurrentMessageList, selectIsForumPanelOpen, selectTabState, } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; -import { getOrderedTopics } from '../../../global/helpers'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; -import { waitForTransitionEnd } from '../../../util/cssAnimationEndListeners'; import { captureEvents, SwipeDirection } from '../../../util/captureEvents'; +import { waitForTransitionEnd } from '../../../util/cssAnimationEndListeners'; import { createLocationHash } from '../../../util/routing'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; +import useAppLayout from '../../../hooks/useAppLayout'; +import { dispatchHeavyAnimationEvent } from '../../../hooks/useHeavyAnimationCheck'; +import useHistoryBack from '../../../hooks/useHistoryBack'; import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; import { useIntersectionObserver, useOnIntersect } from '../../../hooks/useIntersectionObserver'; -import useOrderDiff from './hooks/useOrderDiff'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import usePrevious from '../../../hooks/usePrevious'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import { dispatchHeavyAnimationEvent } from '../../../hooks/useHeavyAnimationCheck'; -import useAppLayout from '../../../hooks/useAppLayout'; +import useOrderDiff from './hooks/useOrderDiff'; +import GroupCallTopPane from '../../calls/group/GroupCallTopPane'; import GroupChatInfo from '../../common/GroupChatInfo'; +import HeaderActions from '../../middle/HeaderActions'; import Button from '../../ui/Button'; -import Topic from './Topic'; import InfiniteScroll from '../../ui/InfiniteScroll'; import Loading from '../../ui/Loading'; -import HeaderActions from '../../middle/HeaderActions'; -import GroupCallTopPane from '../../calls/group/GroupCallTopPane'; import EmptyForum from './EmptyForum'; +import Topic from './Topic'; import styles from './ForumPanel.module.scss'; diff --git a/src/components/left/main/LeftMain.tsx b/src/components/left/main/LeftMain.tsx index 7a68d5851..b0689af2c 100644 --- a/src/components/left/main/LeftMain.tsx +++ b/src/components/left/main/LeftMain.tsx @@ -4,27 +4,27 @@ import React, { } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; +import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; import type { SettingsScreens } from '../../../types'; import { LeftColumnContent } from '../../../types'; -import type { FolderEditDispatch } from '../../../hooks/reducers/useFoldersReducer'; import { IS_ELECTRON } from '../../../config'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import buildClassName from '../../../util/buildClassName'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import useForumPanelRender from '../../../hooks/useForumPanelRender'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useShowTransition from '../../../hooks/useShowTransition'; -import useLang from '../../../hooks/useLang'; -import useForumPanelRender from '../../../hooks/useForumPanelRender'; -import Transition from '../../ui/Transition'; -import LeftMainHeader from './LeftMainHeader'; -import ChatFolders from './ChatFolders'; -import LeftSearch from '../search/LeftSearch.async'; -import ContactList from './ContactList.async'; -import NewChatButton from '../NewChatButton'; import Button from '../../ui/Button'; +import Transition from '../../ui/Transition'; +import NewChatButton from '../NewChatButton'; +import LeftSearch from '../search/LeftSearch.async'; +import ChatFolders from './ChatFolders'; +import ContactList from './ContactList.async'; import ForumPanel from './ForumPanel'; +import LeftMainHeader from './LeftMainHeader'; import './LeftMain.scss'; diff --git a/src/components/left/main/LeftMainHeader.tsx b/src/components/left/main/LeftMainHeader.tsx index c991377c6..9d0eb7e43 100644 --- a/src/components/left/main/LeftMainHeader.tsx +++ b/src/components/left/main/LeftMainHeader.tsx @@ -21,16 +21,11 @@ import { IS_TEST, PRODUCTION_HOSTNAME, } from '../../../config'; -import { IS_APP, IS_MAC_OS } from '../../../util/windowEnvironment'; import { INITIAL_PERFORMANCE_STATE_MAX, INITIAL_PERFORMANCE_STATE_MID, INITIAL_PERFORMANCE_STATE_MIN, } from '../../../global/initialState'; -import buildClassName from '../../../util/buildClassName'; -import { formatDateToString } from '../../../util/dateFormat'; -import { setPermanentWebVersion } from '../../../util/permanentWebVersion'; -import { clearWebsync } from '../../../util/websync'; import { selectCanSetPasscode, selectCurrentMessageList, @@ -38,30 +33,35 @@ import { selectTabState, selectTheme, } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useConnectionStatus from '../../../hooks/useConnectionStatus'; -import { useHotkeys } from '../../../hooks/useHotkeys'; -import { getPromptInstall } from '../../../util/installPrompt'; +import buildClassName from '../../../util/buildClassName'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; +import { formatDateToString } from '../../../util/dateFormat'; +import { getPromptInstall } from '../../../util/installPrompt'; +import { setPermanentWebVersion } from '../../../util/permanentWebVersion'; +import { clearWebsync } from '../../../util/websync'; +import { IS_APP, IS_MAC_OS } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useLeftHeaderButtonRtlForumTransition from './hooks/useLeftHeaderButtonRtlForumTransition'; -import { useFullscreenStatus } from '../../../hooks/useFullscreen'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useConnectionStatus from '../../../hooks/useConnectionStatus'; import useElectronDrag from '../../../hooks/useElectronDrag'; import { useFolderManagerForUnreadCounters } from '../../../hooks/useFolderManager'; -import useAppLayout from '../../../hooks/useAppLayout'; +import { useFullscreenStatus } from '../../../hooks/useFullscreen'; +import { useHotkeys } from '../../../hooks/useHotkeys'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useLeftHeaderButtonRtlForumTransition from './hooks/useLeftHeaderButtonRtlForumTransition'; +import PickerSelectedItem from '../../common/PickerSelectedItem'; +import StoryToggler from '../../story/StoryToggler'; +import Button from '../../ui/Button'; import DropdownMenu from '../../ui/DropdownMenu'; import MenuItem from '../../ui/MenuItem'; -import Button from '../../ui/Button'; import SearchInput from '../../ui/SearchInput'; -import PickerSelectedItem from '../../common/PickerSelectedItem'; -import Switcher from '../../ui/Switcher'; import ShowTransition from '../../ui/ShowTransition'; +import Switcher from '../../ui/Switcher'; +import Toggle from '../../ui/Toggle'; import ConnectionStatusOverlay from '../ConnectionStatusOverlay'; import StatusButton from './StatusButton'; -import Toggle from '../../ui/Toggle'; -import StoryToggler from '../../story/StoryToggler'; import './LeftMainHeader.scss'; diff --git a/src/components/left/main/StatusButton.tsx b/src/components/left/main/StatusButton.tsx index 1f49421ad..3970c127d 100644 --- a/src/components/left/main/StatusButton.tsx +++ b/src/components/left/main/StatusButton.tsx @@ -1,21 +1,22 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useRef } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiEmojiStatus, ApiSticker } from '../../../api/types'; import { EMOJI_STATUS_LOOP_LIMIT } from '../../../config'; import { selectUser } from '../../../global/selectors'; -import useFlag from '../../../hooks/useFlag'; -import useAppLayout from '../../../hooks/useAppLayout'; -import useTimeout from '../../../hooks/useTimeout'; -import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; import { getServerTimeOffset } from '../../../util/serverTime'; -import Button from '../../ui/Button'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; +import useFlag from '../../../hooks/useFlag'; +import useTimeout from '../../../hooks/useTimeout'; + import CustomEmoji from '../../common/CustomEmoji'; import PremiumIcon from '../../common/PremiumIcon'; import CustomEmojiEffect from '../../middle/message/CustomEmojiEffect'; +import Button from '../../ui/Button'; import StatusPickerMenu from './StatusPickerMenu.async'; interface StateProps { diff --git a/src/components/left/main/StatusPickerMenu.async.tsx b/src/components/left/main/StatusPickerMenu.async.tsx index fbd4e72ea..7e559e868 100644 --- a/src/components/left/main/StatusPickerMenu.async.tsx +++ b/src/components/left/main/StatusPickerMenu.async.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './StatusPickerMenu'; import { Bundles } from '../../../util/moduleLoader'; diff --git a/src/components/left/main/StatusPickerMenu.tsx b/src/components/left/main/StatusPickerMenu.tsx index 39361d4ea..40b46bf4f 100644 --- a/src/components/left/main/StatusPickerMenu.tsx +++ b/src/components/left/main/StatusPickerMenu.tsx @@ -1,18 +1,19 @@ import type { RefObject } from 'react'; +import type { FC } from '../../../lib/teact/teact'; import React, { - useCallback, memo, useEffect, useRef, + memo, useCallback, useEffect, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker } from '../../../api/types'; import { selectIsContextMenuTranslucent } from '../../../global/selectors'; + import useFlag from '../../../hooks/useFlag'; +import CustomEmojiPicker from '../../common/CustomEmojiPicker'; import Menu from '../../ui/Menu'; import Portal from '../../ui/Portal'; -import CustomEmojiPicker from '../../common/CustomEmojiPicker'; import styles from './StatusPickerMenu.module.scss'; diff --git a/src/components/left/main/Topic.tsx b/src/components/left/main/Topic.tsx index 8226379bb..2633360a5 100644 --- a/src/components/left/main/Topic.tsx +++ b/src/components/left/main/Topic.tsx @@ -1,16 +1,16 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { - ApiChat, ApiFormattedText, ApiTopic, ApiMessage, ApiMessageOutgoingStatus, - ApiTypingStatus, + ApiChat, ApiFormattedText, ApiMessage, ApiMessageOutgoingStatus, + ApiTopic, ApiTypingStatus, ApiUser, } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import type { ChatAnimationTypes } from './hooks'; -import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../util/windowEnvironment'; +import { getMessageAction } from '../../../global/helpers'; import { selectCanAnimateInterface, selectCanDeleteTopic, @@ -25,21 +25,21 @@ import { } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import { createLocationHash } from '../../../util/routing'; +import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../util/windowEnvironment'; import renderText from '../../common/helpers/renderText'; -import { getMessageAction } from '../../../global/helpers'; +import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useChatListEntry from './hooks/useChatListEntry'; import useTopicContextActions from './hooks/useTopicContextActions'; -import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; -import ListItem from '../../ui/ListItem'; import LastMessageMeta from '../../common/LastMessageMeta'; -import ChatBadge from './ChatBadge'; -import MuteChatModal from '../MuteChatModal.async'; -import ConfirmDialog from '../../ui/ConfirmDialog'; import TopicIcon from '../../common/TopicIcon'; +import ConfirmDialog from '../../ui/ConfirmDialog'; +import ListItem from '../../ui/ListItem'; +import MuteChatModal from '../MuteChatModal.async'; +import ChatBadge from './ChatBadge'; import styles from './Topic.module.scss'; diff --git a/src/components/left/main/hooks/useChatListEntry.tsx b/src/components/left/main/hooks/useChatListEntry.tsx index c499a32ae..bc37caf1b 100644 --- a/src/components/left/main/hooks/useChatListEntry.tsx +++ b/src/components/left/main/hooks/useChatListEntry.tsx @@ -1,19 +1,17 @@ import React, { useCallback, useLayoutEffect, useMemo, useRef, } from '../../../../lib/teact/teact'; -import { requestMutation } from '../../../../lib/fasterdom/fasterdom'; import { getGlobal } from '../../../../global'; -import type { LangFn } from '../../../../hooks/useLang'; -import useLang from '../../../../hooks/useLang'; import type { ApiChat, ApiMessage, ApiTopic, ApiTypingStatus, ApiUser, } from '../../../../api/types'; -import type { ObserveFn } from '../../../../hooks/useIntersectionObserver'; import type { Thread } from '../../../../global/types'; +import type { ObserveFn } from '../../../../hooks/useIntersectionObserver'; +import type { LangFn } from '../../../../hooks/useLang'; import { ANIMATION_END_DELAY, CHAT_HEIGHT_PX } from '../../../../config'; -import { renderTextWithEntities } from '../../../common/helpers/renderTextWithEntities'; +import { requestMutation } from '../../../../lib/fasterdom/fasterdom'; import { getMessageIsSpoiler, getMessageMediaHash, @@ -25,15 +23,18 @@ import { isActionMessage, isChatChannel, } from '../../../../global/helpers'; +import buildClassName from '../../../../util/buildClassName'; import { renderActionMessageText } from '../../../common/helpers/renderActionMessageText'; import renderText from '../../../common/helpers/renderText'; -import buildClassName from '../../../../util/buildClassName'; -import useEnsureMessage from '../../../../hooks/useEnsureMessage'; -import useMedia from '../../../../hooks/useMedia'; +import { renderTextWithEntities } from '../../../common/helpers/renderTextWithEntities'; import { ChatAnimationTypes } from './useChatAnimationType'; -import MessageSummary from '../../../common/MessageSummary'; +import useEnsureMessage from '../../../../hooks/useEnsureMessage'; +import useLang from '../../../../hooks/useLang'; +import useMedia from '../../../../hooks/useMedia'; + import ChatForumLastMessage from '../../../common/ChatForumLastMessage'; +import MessageSummary from '../../../common/MessageSummary'; import TypingStatus from '../../../common/TypingStatus'; const ANIMATION_DURATION = 200; diff --git a/src/components/left/main/hooks/useLeftHeaderButtonRtlForumTransition.ts b/src/components/left/main/hooks/useLeftHeaderButtonRtlForumTransition.ts index f57de4161..54d9881e8 100644 --- a/src/components/left/main/hooks/useLeftHeaderButtonRtlForumTransition.ts +++ b/src/components/left/main/hooks/useLeftHeaderButtonRtlForumTransition.ts @@ -1,6 +1,7 @@ import { useRef } from '../../../../lib/teact/teact'; -import usePrevious from '../../../../hooks/usePrevious'; + import useForceUpdate from '../../../../hooks/useForceUpdate'; +import usePrevious from '../../../../hooks/usePrevious'; export default function useLeftHeaderButtonRtlForumTransition(shouldHideSearch?: boolean) { const forceUpdate = useForceUpdate(); diff --git a/src/components/left/main/hooks/useOrderDiff.ts b/src/components/left/main/hooks/useOrderDiff.ts index dd647b899..3b79230c8 100644 --- a/src/components/left/main/hooks/useOrderDiff.ts +++ b/src/components/left/main/hooks/useOrderDiff.ts @@ -1,8 +1,10 @@ import { useMemo } from '../../../../lib/teact/teact'; -import usePrevious from '../../../../hooks/usePrevious'; + import { mapValues } from '../../../../util/iteratees'; import { useChatAnimationType } from './useChatAnimationType'; +import usePrevious from '../../../../hooks/usePrevious'; + export default function useOrderDiff(orderedIds: (string | number)[] | undefined, key?: string) { const orderById = useMemo(() => { if (!orderedIds) { diff --git a/src/components/left/main/hooks/useTopicContextActions.ts b/src/components/left/main/hooks/useTopicContextActions.ts index 1ac658e97..3a180f23e 100644 --- a/src/components/left/main/hooks/useTopicContextActions.ts +++ b/src/components/left/main/hooks/useTopicContextActions.ts @@ -4,8 +4,8 @@ import { getActions } from '../../../../global'; import type { ApiChat, ApiTopic } from '../../../../api/types'; import type { MenuItemContextAction } from '../../../ui/ListItem'; -import { compact } from '../../../../util/iteratees'; import { getCanManageTopic, getHasAdminRight } from '../../../../global/helpers'; +import { compact } from '../../../../util/iteratees'; import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../../../../util/windowEnvironment'; import useLang from '../../../../hooks/useLang'; diff --git a/src/components/left/newChat/NewChat.async.tsx b/src/components/left/newChat/NewChat.async.tsx index c6f95f9a5..da6bc5862 100644 --- a/src/components/left/newChat/NewChat.async.tsx +++ b/src/components/left/newChat/NewChat.async.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './NewChat'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const NewChatAsync: FC = (props) => { diff --git a/src/components/left/newChat/NewChatStep1.async.tsx b/src/components/left/newChat/NewChatStep1.async.tsx index 23e54c53c..a4aa54691 100644 --- a/src/components/left/newChat/NewChatStep1.async.tsx +++ b/src/components/left/newChat/NewChatStep1.async.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './NewChatStep1'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const NewChatStep1Async: FC = (props) => { diff --git a/src/components/left/newChat/NewChatStep1.tsx b/src/components/left/newChat/NewChatStep1.tsx index 5c9d18b45..ca8383d07 100644 --- a/src/components/left/newChat/NewChatStep1.tsx +++ b/src/components/left/newChat/NewChatStep1.tsx @@ -1,18 +1,19 @@ import type { FC } from '../../../lib/teact/teact'; -import React, { useCallback, useMemo, memo } from '../../../lib/teact/teact'; +import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; import type { ApiChat } from '../../../api/types'; +import { filterUsersByName, isUserBot, sortChatIds } from '../../../global/helpers'; import { selectTabState } from '../../../global/selectors'; import { unique } from '../../../util/iteratees'; -import { filterUsersByName, isUserBot, sortChatIds } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import Picker from '../../common/Picker'; -import FloatingActionButton from '../../ui/FloatingActionButton'; import Button from '../../ui/Button'; +import FloatingActionButton from '../../ui/FloatingActionButton'; export type OwnProps = { isChannel?: boolean; diff --git a/src/components/left/newChat/NewChatStep2.async.tsx b/src/components/left/newChat/NewChatStep2.async.tsx index 3d1daf0cb..c25829da2 100644 --- a/src/components/left/newChat/NewChatStep2.async.tsx +++ b/src/components/left/newChat/NewChatStep2.async.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './NewChatStep2'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const NewChatStep2Async: FC = (props) => { diff --git a/src/components/left/newChat/NewChatStep2.tsx b/src/components/left/newChat/NewChatStep2.tsx index f376e281b..dc23c5411 100644 --- a/src/components/left/newChat/NewChatStep2.tsx +++ b/src/components/left/newChat/NewChatStep2.tsx @@ -1,22 +1,24 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useState, useCallback, useEffect, memo, + memo, + useCallback, useEffect, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import { ChatCreationProgress } from '../../../types'; import { selectTabState } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import InputText from '../../ui/InputText'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import Spinner from '../../ui/Spinner'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + +import PrivateChatInfo from '../../common/PrivateChatInfo'; import AvatarEditable from '../../ui/AvatarEditable'; import Button from '../../ui/Button'; +import FloatingActionButton from '../../ui/FloatingActionButton'; +import InputText from '../../ui/InputText'; import ListItem from '../../ui/ListItem'; -import PrivateChatInfo from '../../common/PrivateChatInfo'; +import Spinner from '../../ui/Spinner'; export type OwnProps = { isChannel?: boolean; diff --git a/src/components/left/search/AudioResults.tsx b/src/components/left/search/AudioResults.tsx index 5179bc42f..7eaf593f1 100644 --- a/src/components/left/search/AudioResults.tsx +++ b/src/components/left/search/AudioResults.tsx @@ -1,24 +1,24 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import { AudioOrigin, LoadMoreDirection } from '../../../types'; import type { StateProps } from './helpers/createMapStateToProps'; +import { AudioOrigin, LoadMoreDirection } from '../../../types'; import { SLIDE_TRANSITION_DURATION } from '../../../config'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; -import { createMapStateToProps } from './helpers/createMapStateToProps'; -import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat'; -import { getSenderName } from './helpers/getSenderName'; -import { throttle } from '../../../util/schedulers'; import buildClassName from '../../../util/buildClassName'; +import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { throttle } from '../../../util/schedulers'; +import { createMapStateToProps } from './helpers/createMapStateToProps'; +import { getSenderName } from './helpers/getSenderName'; -import useAsyncRendering from '../../right/hooks/useAsyncRendering'; import useLang from '../../../hooks/useLang'; +import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import InfiniteScroll from '../../ui/InfiniteScroll'; import Audio from '../../common/Audio'; import NothingFound from '../../common/NothingFound'; +import InfiniteScroll from '../../ui/InfiniteScroll'; import Loading from '../../ui/Loading'; export type OwnProps = { diff --git a/src/components/left/search/ChatMessage.tsx b/src/components/left/search/ChatMessage.tsx index 97658c23f..d4b67957a 100644 --- a/src/components/left/search/ChatMessage.tsx +++ b/src/components/left/search/ChatMessage.tsx @@ -3,34 +3,35 @@ import React, { memo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { - ApiChat, ApiUser, ApiMessage, ApiMessageOutgoingStatus, + ApiChat, ApiMessage, ApiMessageOutgoingStatus, + ApiUser, } from '../../../api/types'; import type { LangFn } from '../../../hooks/useLang'; import { - getPrivateChatUserId, + getMessageIsSpoiler, getMessageMediaHash, getMessageMediaThumbDataUri, - getMessageVideo, getMessageRoundVideo, getMessageSticker, - getMessageIsSpoiler, + getMessageVideo, + getPrivateChatUserId, } from '../../../global/helpers'; import { selectChat, selectUser } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import { formatPastTimeShort } from '../../../util/dateFormat'; import { renderMessageSummary } from '../../common/helpers/renderMessageText'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useMedia from '../../../hooks/useMedia'; -import useLang from '../../../hooks/useLang'; import useSelectWithEnter from '../../../hooks/useSelectWithEnter'; -import useAppLayout from '../../../hooks/useAppLayout'; import Avatar from '../../common/Avatar'; -import ListItem from '../../ui/ListItem'; -import Link from '../../ui/Link'; import FullNameTitle from '../../common/FullNameTitle'; +import Link from '../../ui/Link'; +import ListItem from '../../ui/ListItem'; import './ChatMessage.scss'; diff --git a/src/components/left/search/ChatMessageResults.tsx b/src/components/left/search/ChatMessageResults.tsx index f24a2123d..a86ea4d66 100644 --- a/src/components/left/search/ChatMessageResults.tsx +++ b/src/components/left/search/ChatMessageResults.tsx @@ -1,7 +1,7 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChat, ApiMessage } from '../../../api/types'; import { LoadMoreDirection } from '../../../types'; @@ -10,11 +10,11 @@ import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import { throttle } from '../../../util/schedulers'; import { renderMessageSummary } from '../../common/helpers/renderMessageText'; -import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; +import useLang from '../../../hooks/useLang'; -import InfiniteScroll from '../../ui/InfiniteScroll'; import NothingFound from '../../common/NothingFound'; +import InfiniteScroll from '../../ui/InfiniteScroll'; import ChatMessage from './ChatMessage'; import DateSuggest from './DateSuggest'; import LeftSearchResultTopic from './LeftSearchResultTopic'; diff --git a/src/components/left/search/ChatResults.tsx b/src/components/left/search/ChatResults.tsx index 54aca6121..ee080e39e 100644 --- a/src/components/left/search/ChatResults.tsx +++ b/src/components/left/search/ChatResults.tsx @@ -1,34 +1,34 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChat, ApiMessage } from '../../../api/types'; import { LoadMoreDirection } from '../../../types'; +import { + filterUsersByName, + sortChatIds, +} from '../../../global/helpers'; import { selectTabState } from '../../../global/selectors'; import { unique } from '../../../util/iteratees'; -import { - sortChatIds, - filterUsersByName, -} from '../../../global/helpers'; import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import { throttle } from '../../../util/schedulers'; import { renderMessageSummary } from '../../common/helpers/renderMessageText'; -import useLang from '../../../hooks/useLang'; -import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; import useAppLayout from '../../../hooks/useAppLayout'; +import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; +import useLang from '../../../hooks/useLang'; -import InfiniteScroll from '../../ui/InfiniteScroll'; -import LeftSearchResultChat from './LeftSearchResultChat'; -import RecentContacts from './RecentContacts'; -import ChatMessage from './ChatMessage'; -import DateSuggest from './DateSuggest'; -import Link from '../../ui/Link'; import NothingFound from '../../common/NothingFound'; import PickerSelectedItem from '../../common/PickerSelectedItem'; +import InfiniteScroll from '../../ui/InfiniteScroll'; +import Link from '../../ui/Link'; +import ChatMessage from './ChatMessage'; +import DateSuggest from './DateSuggest'; +import LeftSearchResultChat from './LeftSearchResultChat'; +import RecentContacts from './RecentContacts'; export type OwnProps = { searchQuery?: string; diff --git a/src/components/left/search/DateSuggest.tsx b/src/components/left/search/DateSuggest.tsx index 2be4092ec..94028e9a2 100644 --- a/src/components/left/search/DateSuggest.tsx +++ b/src/components/left/search/DateSuggest.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; + import { formatDateToString } from '../../../util/dateFormat'; import './DateSuggest.scss'; diff --git a/src/components/left/search/FileResults.tsx b/src/components/left/search/FileResults.tsx index 06c1cb267..cfcecd472 100644 --- a/src/components/left/search/FileResults.tsx +++ b/src/components/left/search/FileResults.tsx @@ -1,29 +1,29 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiMessage } from '../../../api/types'; import type { StateProps } from './helpers/createMapStateToProps'; import { LoadMoreDirection } from '../../../types'; import { SLIDE_TRANSITION_DURATION } from '../../../config'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; -import { createMapStateToProps } from './helpers/createMapStateToProps'; -import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat'; -import { getSenderName } from './helpers/getSenderName'; -import { throttle } from '../../../util/schedulers'; import { getMessageDocument } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; +import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { throttle } from '../../../util/schedulers'; +import { createMapStateToProps } from './helpers/createMapStateToProps'; +import { getSenderName } from './helpers/getSenderName'; -import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import useLang from '../../../hooks/useLang'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useAsyncRendering from '../../right/hooks/useAsyncRendering'; import Document from '../../common/Document'; -import InfiniteScroll from '../../ui/InfiniteScroll'; import NothingFound from '../../common/NothingFound'; +import InfiniteScroll from '../../ui/InfiniteScroll'; import Loading from '../../ui/Loading'; export type OwnProps = { diff --git a/src/components/left/search/LeftSearch.async.tsx b/src/components/left/search/LeftSearch.async.tsx index 8d1d496f4..24cf74dcd 100644 --- a/src/components/left/search/LeftSearch.async.tsx +++ b/src/components/left/search/LeftSearch.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; + import type { OwnProps } from './LeftSearch'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const LeftSearchAsync: FC = (props) => { diff --git a/src/components/left/search/LeftSearch.tsx b/src/components/left/search/LeftSearch.tsx index 7c5879f94..b47aa7bb6 100644 --- a/src/components/left/search/LeftSearch.tsx +++ b/src/components/left/search/LeftSearch.tsx @@ -1,6 +1,7 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useCallback, useState, useMemo, useRef, + memo, useCallback, useMemo, useRef, + useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; @@ -8,18 +9,19 @@ import { GlobalSearchContent } from '../../../types'; import { selectTabState } from '../../../global/selectors'; import { parseDateString } from '../../../util/dateFormat'; + +import useHistoryBack from '../../../hooks/useHistoryBack'; import useKeyboardListNavigation from '../../../hooks/useKeyboardListNavigation'; import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; import TabList from '../../ui/TabList'; import Transition from '../../ui/Transition'; -import ChatResults from './ChatResults'; -import ChatMessageResults from './ChatMessageResults'; -import MediaResults from './MediaResults'; -import LinkResults from './LinkResults'; -import FileResults from './FileResults'; import AudioResults from './AudioResults'; +import ChatMessageResults from './ChatMessageResults'; +import ChatResults from './ChatResults'; +import FileResults from './FileResults'; +import LinkResults from './LinkResults'; +import MediaResults from './MediaResults'; import './LeftSearch.scss'; diff --git a/src/components/left/search/LeftSearchResultChat.tsx b/src/components/left/search/LeftSearchResultChat.tsx index 069de3993..5d14b50d3 100644 --- a/src/components/left/search/LeftSearchResultChat.tsx +++ b/src/components/left/search/LeftSearchResultChat.tsx @@ -5,16 +5,18 @@ import { withGlobal } from '../../../global'; import type { ApiChat, ApiUser } from '../../../api/types'; import { StoryViewerOrigin } from '../../../types'; +import { getPrivateChatUserId, isUserId, selectIsChatMuted } from '../../../global/helpers'; +import { + selectChat, selectIsChatPinned, selectNotifyExceptions, + selectNotifySettings, selectUser, +} from '../../../global/selectors'; + import useChatContextActions from '../../../hooks/useChatContextActions'; import useFlag from '../../../hooks/useFlag'; -import { isUserId, getPrivateChatUserId, selectIsChatMuted } from '../../../global/helpers'; -import { - selectChat, selectUser, selectIsChatPinned, selectNotifySettings, selectNotifyExceptions, -} from '../../../global/selectors'; import useSelectWithEnter from '../../../hooks/useSelectWithEnter'; -import PrivateChatInfo from '../../common/PrivateChatInfo'; import GroupChatInfo from '../../common/GroupChatInfo'; +import PrivateChatInfo from '../../common/PrivateChatInfo'; import ListItem from '../../ui/ListItem'; import ChatFolderModal from '../ChatFolderModal.async'; import MuteChatModal from '../MuteChatModal.async'; diff --git a/src/components/left/search/LeftSearchResultTopic.tsx b/src/components/left/search/LeftSearchResultTopic.tsx index 837c72ee4..0302b4574 100644 --- a/src/components/left/search/LeftSearchResultTopic.tsx +++ b/src/components/left/search/LeftSearchResultTopic.tsx @@ -4,13 +4,14 @@ import { withGlobal } from '../../../global'; import type { ApiTopic } from '../../../api/types'; -import { REM } from '../../common/helpers/mediaDimensions'; import { selectChat } from '../../../global/selectors'; +import { REM } from '../../common/helpers/mediaDimensions'; import renderText from '../../common/helpers/renderText'; + import useSelectWithEnter from '../../../hooks/useSelectWithEnter'; -import ListItem from '../../ui/ListItem'; import TopicIcon from '../../common/TopicIcon'; +import ListItem from '../../ui/ListItem'; type OwnProps = { chatId: string; diff --git a/src/components/left/search/LinkResults.tsx b/src/components/left/search/LinkResults.tsx index 33f4fedd2..7093b5387 100644 --- a/src/components/left/search/LinkResults.tsx +++ b/src/components/left/search/LinkResults.tsx @@ -1,27 +1,27 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import { LoadMoreDirection } from '../../../types'; import type { StateProps } from './helpers/createMapStateToProps'; +import { LoadMoreDirection } from '../../../types'; import { SLIDE_TRANSITION_DURATION } from '../../../config'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; -import { createMapStateToProps } from './helpers/createMapStateToProps'; -import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat'; -import { getSenderName } from './helpers/getSenderName'; -import { throttle } from '../../../util/schedulers'; import buildClassName from '../../../util/buildClassName'; +import { formatMonthAndYear, toYearMonth } from '../../../util/dateFormat'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { throttle } from '../../../util/schedulers'; +import { createMapStateToProps } from './helpers/createMapStateToProps'; +import { getSenderName } from './helpers/getSenderName'; -import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import useLang from '../../../hooks/useLang'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import InfiniteScroll from '../../ui/InfiniteScroll'; -import WebLink from '../../common/WebLink'; import NothingFound from '../../common/NothingFound'; +import WebLink from '../../common/WebLink'; +import InfiniteScroll from '../../ui/InfiniteScroll'; import Loading from '../../ui/Loading'; export type OwnProps = { diff --git a/src/components/left/search/MediaResults.tsx b/src/components/left/search/MediaResults.tsx index 89eef7941..f808465d1 100644 --- a/src/components/left/search/MediaResults.tsx +++ b/src/components/left/search/MediaResults.tsx @@ -1,27 +1,27 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { StateProps } from './helpers/createMapStateToProps'; import { LoadMoreDirection, MediaViewerOrigin } from '../../../types'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import { SLIDE_TRANSITION_DURATION } from '../../../config'; -import { createMapStateToProps } from './helpers/createMapStateToProps'; import buildClassName from '../../../util/buildClassName'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import { throttle } from '../../../util/schedulers'; +import { createMapStateToProps } from './helpers/createMapStateToProps'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; import useLang from '../../../hooks/useLang'; import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import InfiniteScroll from '../../ui/InfiniteScroll'; import Media from '../../common/Media'; -import ChatMessage from './ChatMessage'; import NothingFound from '../../common/NothingFound'; +import InfiniteScroll from '../../ui/InfiniteScroll'; import Loading from '../../ui/Loading'; +import ChatMessage from './ChatMessage'; export type OwnProps = { searchQuery?: string; diff --git a/src/components/left/search/RecentContacts.tsx b/src/components/left/search/RecentContacts.tsx index 395b9e764..7a7783aa7 100644 --- a/src/components/left/search/RecentContacts.tsx +++ b/src/components/left/search/RecentContacts.tsx @@ -1,20 +1,22 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useEffect, useCallback, useRef, memo, + memo, + useCallback, useEffect, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { ApiUser } from '../../../api/types'; import { getUserFirstOrLastName } from '../../../global/helpers'; -import renderText from '../../common/helpers/renderText'; -import { throttle } from '../../../util/schedulers'; import buildClassName from '../../../util/buildClassName'; +import { throttle } from '../../../util/schedulers'; +import renderText from '../../common/helpers/renderText'; + import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; import useLang from '../../../hooks/useLang'; -import Button from '../../ui/Button'; import Avatar from '../../common/Avatar'; +import Button from '../../ui/Button'; import LeftSearchResultChat from './LeftSearchResultChat'; import './RecentContacts.scss'; diff --git a/src/components/left/search/helpers/createMapStateToProps.ts b/src/components/left/search/helpers/createMapStateToProps.ts index 35910f75d..166367f68 100644 --- a/src/components/left/search/helpers/createMapStateToProps.ts +++ b/src/components/left/search/helpers/createMapStateToProps.ts @@ -1,7 +1,7 @@ -import type { GlobalState, TabState } from '../../../../global/types'; import type { ApiChat, ApiGlobalMessageSearchType, ApiMessage, ApiUser, } from '../../../../api/types'; +import type { GlobalState, TabState } from '../../../../global/types'; import type { ISettings } from '../../../../types'; import { selectChat, selectTabState, selectTheme } from '../../../../global/selectors'; diff --git a/src/components/left/search/helpers/getSenderName.ts b/src/components/left/search/helpers/getSenderName.ts index 5461dea6a..72d8e177a 100644 --- a/src/components/left/search/helpers/getSenderName.ts +++ b/src/components/left/search/helpers/getSenderName.ts @@ -1,11 +1,12 @@ import type { ApiChat, ApiMessage, ApiUser } from '../../../../api/types'; +import type { LangFn } from '../../../../hooks/useLang'; + import { getChatTitle, getSenderTitle, - isUserId, isChatGroup, + isUserId, } from '../../../../global/helpers'; -import type { LangFn } from '../../../../hooks/useLang'; export function getSenderName( lang: LangFn, message: ApiMessage, chatsById: Record, usersById: Record, diff --git a/src/components/left/settings/BlockUserModal.tsx b/src/components/left/settings/BlockUserModal.tsx index 1e7d4202d..ee218ba1e 100644 --- a/src/components/left/settings/BlockUserModal.tsx +++ b/src/components/left/settings/BlockUserModal.tsx @@ -1,14 +1,16 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useMemo, useState, memo, useCallback, useEffect, + memo, useCallback, useEffect, + useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { ApiUser } from '../../../api/types'; -import { selectTabState } from '../../../global/selectors'; import { filterUsersByName, getUserFullName } from '../../../global/helpers'; +import { selectTabState } from '../../../global/selectors'; import { unique } from '../../../util/iteratees'; + import useLang from '../../../hooks/useLang'; import ChatOrUserPicker from '../../common/ChatOrUserPicker'; diff --git a/src/components/left/settings/Settings.async.tsx b/src/components/left/settings/Settings.async.tsx index 8dc45ca07..63c051214 100644 --- a/src/components/left/settings/Settings.async.tsx +++ b/src/components/left/settings/Settings.async.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './Settings'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const SettingsAsync: FC = (props) => { diff --git a/src/components/left/settings/Settings.tsx b/src/components/left/settings/Settings.tsx index 321f76335..96bd70252 100644 --- a/src/components/left/settings/Settings.tsx +++ b/src/components/left/settings/Settings.tsx @@ -1,41 +1,41 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useState } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import { SettingsScreens } from '../../../types'; import type { FolderEditDispatch, FoldersState } from '../../../hooks/reducers/useFoldersReducer'; +import { SettingsScreens } from '../../../types'; -import { LAYERS_ANIMATION_NAME } from '../../../util/windowEnvironment'; import { selectTabState } from '../../../global/selectors'; +import { LAYERS_ANIMATION_NAME } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; import useTwoFaReducer from '../../../hooks/reducers/useTwoFaReducer'; +import useLastCallback from '../../../hooks/useLastCallback'; import Transition from '../../ui/Transition'; -import SettingsHeader from './SettingsHeader'; -import SettingsMain from './SettingsMain'; -import SettingsEditProfile from './SettingsEditProfile'; -import SettingsDataStorage from './SettingsDataStorage'; import SettingsFolders from './folders/SettingsFolders'; +import SettingsPasscode from './passcode/SettingsPasscode'; +import SettingsActiveSessions from './SettingsActiveSessions'; +import SettingsActiveWebsites from './SettingsActiveWebsites'; +import SettingsCustomEmoji from './SettingsCustomEmoji'; +import SettingsDataStorage from './SettingsDataStorage'; +import SettingsDoNotTranslate from './SettingsDoNotTranslate'; +import SettingsEditProfile from './SettingsEditProfile'; +import SettingsExperimental from './SettingsExperimental'; import SettingsGeneral from './SettingsGeneral'; import SettingsGeneralBackground from './SettingsGeneralBackground'; import SettingsGeneralBackgroundColor from './SettingsGeneralBackgroundColor'; -import SettingsNotifications from './SettingsNotifications'; -import SettingsPrivacy from './SettingsPrivacy'; +import SettingsHeader from './SettingsHeader'; import SettingsLanguage from './SettingsLanguage'; -import SettingsPrivacyVisibility from './SettingsPrivacyVisibility'; -import SettingsActiveSessions from './SettingsActiveSessions'; -import SettingsActiveWebsites from './SettingsActiveWebsites'; +import SettingsMain from './SettingsMain'; +import SettingsNotifications from './SettingsNotifications'; +import SettingsPerformance from './SettingsPerformance'; +import SettingsPrivacy from './SettingsPrivacy'; import SettingsPrivacyBlockedUsers from './SettingsPrivacyBlockedUsers'; -import SettingsTwoFa from './twoFa/SettingsTwoFa'; +import SettingsPrivacyVisibility from './SettingsPrivacyVisibility'; import SettingsPrivacyVisibilityExceptionList from './SettingsPrivacyVisibilityExceptionList'; import SettingsQuickReaction from './SettingsQuickReaction'; -import SettingsPasscode from './passcode/SettingsPasscode'; import SettingsStickers from './SettingsStickers'; -import SettingsCustomEmoji from './SettingsCustomEmoji'; -import SettingsDoNotTranslate from './SettingsDoNotTranslate'; -import SettingsExperimental from './SettingsExperimental'; -import SettingsPerformance from './SettingsPerformance'; +import SettingsTwoFa from './twoFa/SettingsTwoFa'; import './Settings.scss'; diff --git a/src/components/left/settings/SettingsActiveSession.tsx b/src/components/left/settings/SettingsActiveSession.tsx index 7b4597ba5..602e4a1b3 100644 --- a/src/components/left/settings/SettingsActiveSession.tsx +++ b/src/components/left/settings/SettingsActiveSession.tsx @@ -4,16 +4,17 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiSession } from '../../../api/types'; -import { formatDateTimeToString } from '../../../util/dateFormat'; -import useLang from '../../../hooks/useLang'; -import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; -import getSessionIcon from './helpers/getSessionIcon'; import buildClassName from '../../../util/buildClassName'; +import { formatDateTimeToString } from '../../../util/dateFormat'; +import getSessionIcon from './helpers/getSessionIcon'; +import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; +import useLang from '../../../hooks/useLang'; + +import Button from '../../ui/Button'; import ListItem from '../../ui/ListItem'; import Modal from '../../ui/Modal'; import Switcher from '../../ui/Switcher'; -import Button from '../../ui/Button'; import styles from './SettingsActiveSession.module.scss'; diff --git a/src/components/left/settings/SettingsActiveSessions.tsx b/src/components/left/settings/SettingsActiveSessions.tsx index 3f3691cd7..ac4522d2c 100644 --- a/src/components/left/settings/SettingsActiveSessions.tsx +++ b/src/components/left/settings/SettingsActiveSessions.tsx @@ -8,13 +8,14 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiSession } from '../../../api/types'; import { formatPastTimeShort } from '../../../util/dateFormat'; -import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; import getSessionIcon from './helpers/getSessionIcon'; -import ListItem from '../../ui/ListItem'; +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + import ConfirmDialog from '../../ui/ConfirmDialog'; +import ListItem from '../../ui/ListItem'; import RadioGroup from '../../ui/RadioGroup'; import SettingsActiveSession from './SettingsActiveSession'; diff --git a/src/components/left/settings/SettingsActiveWebsite.tsx b/src/components/left/settings/SettingsActiveWebsite.tsx index c60ea4e4f..3db9b5405 100644 --- a/src/components/left/settings/SettingsActiveWebsite.tsx +++ b/src/components/left/settings/SettingsActiveWebsite.tsx @@ -1,18 +1,18 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiUser, ApiWebSession } from '../../../api/types'; import buildClassName from '../../../util/buildClassName'; -import useLang from '../../../hooks/useLang'; import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; +import useLang from '../../../hooks/useLang'; -import Modal from '../../ui/Modal'; -import Button from '../../ui/Button'; import Avatar from '../../common/Avatar'; import FullNameTitle from '../../common/FullNameTitle'; +import Button from '../../ui/Button'; +import Modal from '../../ui/Modal'; import styles from './SettingsActiveWebsite.module.scss'; diff --git a/src/components/left/settings/SettingsActiveWebsites.tsx b/src/components/left/settings/SettingsActiveWebsites.tsx index 42f93f983..079104cf0 100644 --- a/src/components/left/settings/SettingsActiveWebsites.tsx +++ b/src/components/left/settings/SettingsActiveWebsites.tsx @@ -1,23 +1,23 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useState, } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiWebSession } from '../../../api/types'; -import { formatPastTimeShort } from '../../../util/dateFormat'; import buildClassName from '../../../util/buildClassName'; +import { formatPastTimeShort } from '../../../util/dateFormat'; import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; -import ListItem from '../../ui/ListItem'; -import ConfirmDialog from '../../ui/ConfirmDialog'; -import SettingsActiveWebsite from './SettingsActiveWebsite'; import Avatar from '../../common/Avatar'; import FullNameTitle from '../../common/FullNameTitle'; +import ConfirmDialog from '../../ui/ConfirmDialog'; +import ListItem from '../../ui/ListItem'; +import SettingsActiveWebsite from './SettingsActiveWebsite'; import styles from './SettingsActiveWebsites.module.scss'; diff --git a/src/components/left/settings/SettingsCustomEmoji.tsx b/src/components/left/settings/SettingsCustomEmoji.tsx index f8d233103..286841e80 100644 --- a/src/components/left/settings/SettingsCustomEmoji.tsx +++ b/src/components/left/settings/SettingsCustomEmoji.tsx @@ -1,16 +1,16 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker, ApiStickerSet } from '../../../api/types'; import type { ISettings } from '../../../types'; -import renderText from '../../common/helpers/renderText'; -import { pick } from '../../../util/iteratees'; - import { selectCanPlayAnimatedEmojis } from '../../../global/selectors'; +import { pick } from '../../../util/iteratees'; +import renderText from '../../common/helpers/renderText'; + import useHistoryBack from '../../../hooks/useHistoryBack'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; import useLang from '../../../hooks/useLang'; diff --git a/src/components/left/settings/SettingsDataStorage.tsx b/src/components/left/settings/SettingsDataStorage.tsx index cef47b418..eeaf546a9 100644 --- a/src/components/left/settings/SettingsDataStorage.tsx +++ b/src/components/left/settings/SettingsDataStorage.tsx @@ -6,8 +6,9 @@ import type { ISettings } from '../../../types'; import { AUTODOWNLOAD_FILESIZE_MB_LIMITS } from '../../../config'; import { pick } from '../../../util/iteratees'; -import useLang from '../../../hooks/useLang'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import Checkbox from '../../ui/Checkbox'; import RangeSlider from '../../ui/RangeSlider'; diff --git a/src/components/left/settings/SettingsDoNotTranslate.tsx b/src/components/left/settings/SettingsDoNotTranslate.tsx index 0332ef802..c5160bcb5 100644 --- a/src/components/left/settings/SettingsDoNotTranslate.tsx +++ b/src/components/left/settings/SettingsDoNotTranslate.tsx @@ -1,18 +1,18 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ISettings } from '../../../types'; import type { IRadioOption } from '../../ui/CheckboxGroup'; import { SUPPORTED_TRANSLATION_LANGUAGES } from '../../../config'; -import { partition, unique } from '../../../util/iteratees'; import buildClassName from '../../../util/buildClassName'; +import { partition, unique } from '../../../util/iteratees'; -import useHistoryBack from '../../../hooks/useHistoryBack'; import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; +import useHistoryBack from '../../../hooks/useHistoryBack'; import useLang from '../../../hooks/useLang'; import Checkbox from '../../ui/Checkbox'; diff --git a/src/components/left/settings/SettingsEditProfile.tsx b/src/components/left/settings/SettingsEditProfile.tsx index e7ccf523e..9ee03f523 100644 --- a/src/components/left/settings/SettingsEditProfile.tsx +++ b/src/components/left/settings/SettingsEditProfile.tsx @@ -1,33 +1,35 @@ import type { ChangeEvent } from 'react'; +import type { FC } from '../../../lib/teact/teact'; import React, { - useState, useCallback, memo, useEffect, useMemo, + memo, useCallback, useEffect, useMemo, + useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiUsername } from '../../../api/types'; import { ApiMediaFormat } from '../../../api/types'; import { ProfileEditProgress } from '../../../types'; import { PURCHASE_USERNAME, TME_LINK_PREFIX, USERNAME_PURCHASE_ERROR } from '../../../config'; -import { throttle } from '../../../util/schedulers'; -import { selectTabState, selectUser, selectUserFullInfo } from '../../../global/selectors'; import { getChatAvatarHash } from '../../../global/helpers'; +import { selectTabState, selectUser, selectUserFullInfo } from '../../../global/selectors'; import { selectCurrentLimit } from '../../../global/selectors/limits'; +import { throttle } from '../../../util/schedulers'; import renderText from '../../common/helpers/renderText'; -import useMedia from '../../../hooks/useMedia'; -import useLang from '../../../hooks/useLang'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; +import useMedia from '../../../hooks/useMedia'; import usePrevious from '../../../hooks/usePrevious'; -import AvatarEditable from '../../ui/AvatarEditable'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import Spinner from '../../ui/Spinner'; -import InputText from '../../ui/InputText'; -import UsernameInput from '../../common/UsernameInput'; -import TextArea from '../../ui/TextArea'; import ManageUsernames from '../../common/ManageUsernames'; import SafeLink from '../../common/SafeLink'; +import UsernameInput from '../../common/UsernameInput'; +import AvatarEditable from '../../ui/AvatarEditable'; +import FloatingActionButton from '../../ui/FloatingActionButton'; +import InputText from '../../ui/InputText'; +import Spinner from '../../ui/Spinner'; +import TextArea from '../../ui/TextArea'; type OwnProps = { isActive: boolean; diff --git a/src/components/left/settings/SettingsExperimental.tsx b/src/components/left/settings/SettingsExperimental.tsx index 9dee8ded9..9be49ec5c 100644 --- a/src/components/left/settings/SettingsExperimental.tsx +++ b/src/components/left/settings/SettingsExperimental.tsx @@ -1,20 +1,19 @@ -import React, { memo } from '../../../lib/teact/teact'; - import type { FC } from '../../../lib/teact/teact'; +import React, { memo } from '../../../lib/teact/teact'; +import { getActions, withGlobal } from '../../../global'; import { DEBUG_LOG_FILENAME } from '../../../config'; -import { getActions, withGlobal } from '../../../global'; -import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; import { getDebugLogs } from '../../../util/debugConsole'; import download from '../../../util/download'; +import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; import useHistoryBack from '../../../hooks/useHistoryBack'; import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import AnimatedIcon from '../../common/AnimatedIcon'; -import ListItem from '../../ui/ListItem'; import Checkbox from '../../ui/Checkbox'; +import ListItem from '../../ui/ListItem'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/SettingsGeneral.tsx b/src/components/left/settings/SettingsGeneral.tsx index 4962a64fa..4f6319f34 100644 --- a/src/components/left/settings/SettingsGeneral.tsx +++ b/src/components/left/settings/SettingsGeneral.tsx @@ -1,26 +1,28 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useCallback, memo, + memo, + useCallback, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { ISettings, TimeFormat } from '../../../types'; +import type { IRadioOption } from '../../ui/RadioGroup'; import { SettingsScreens } from '../../../types'; +import { pick } from '../../../util/iteratees'; +import { setTimeFormat } from '../../../util/langProvider'; +import { getSystemTheme } from '../../../util/systemTheme'; import { IS_ANDROID, IS_IOS, IS_MAC_OS, } from '../../../util/windowEnvironment'; -import { getSystemTheme } from '../../../util/systemTheme'; -import { pick } from '../../../util/iteratees'; -import { setTimeFormat } from '../../../util/langProvider'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; + import useAppLayout from '../../../hooks/useAppLayout'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import ListItem from '../../ui/ListItem'; -import RangeSlider from '../../ui/RangeSlider'; -import type { IRadioOption } from '../../ui/RadioGroup'; import RadioGroup from '../../ui/RadioGroup'; +import RangeSlider from '../../ui/RangeSlider'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/SettingsGeneralBackground.tsx b/src/components/left/settings/SettingsGeneralBackground.tsx index 88eb3455a..cecc8c2a2 100644 --- a/src/components/left/settings/SettingsGeneralBackground.tsx +++ b/src/components/left/settings/SettingsGeneralBackground.tsx @@ -1,24 +1,25 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useEffect, useCallback, useRef, + memo, useCallback, useEffect, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; +import type { ApiWallpaper } from '../../../api/types'; import type { ThemeKey } from '../../../types'; import { SettingsScreens, UPLOADING_WALLPAPER_SLUG } from '../../../types'; -import type { ApiWallpaper } from '../../../api/types'; import { DARK_THEME_PATTERN_COLOR, DEFAULT_PATTERN_COLOR } from '../../../config'; -import { throttle } from '../../../util/schedulers'; -import { validateFiles } from '../../../util/files'; -import { openSystemFilesDialog } from '../../../util/systemFilesDialog'; -import { getAverageColor, getPatternColor, rgb2hex } from '../../../util/colors'; import { selectTheme } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; +import { getAverageColor, getPatternColor, rgb2hex } from '../../../util/colors'; +import { validateFiles } from '../../../util/files'; +import { throttle } from '../../../util/schedulers'; +import { openSystemFilesDialog } from '../../../util/systemFilesDialog'; + +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; -import ListItem from '../../ui/ListItem'; import Checkbox from '../../ui/Checkbox'; +import ListItem from '../../ui/ListItem'; import Loading from '../../ui/Loading'; import WallpaperTile from './WallpaperTile'; diff --git a/src/components/left/settings/SettingsGeneralBackgroundColor.tsx b/src/components/left/settings/SettingsGeneralBackgroundColor.tsx index 8c2a061c7..cb1a8d696 100644 --- a/src/components/left/settings/SettingsGeneralBackgroundColor.tsx +++ b/src/components/left/settings/SettingsGeneralBackgroundColor.tsx @@ -6,16 +6,17 @@ import React, { import { getActions, withGlobal } from '../../../global'; import type { ThemeKey } from '../../../types'; +import type { RealTouchEvent } from '../../../util/captureEvents'; -import { pick } from '../../../util/iteratees'; +import { selectTheme } from '../../../global/selectors'; +import buildClassName from '../../../util/buildClassName'; +import { captureEvents } from '../../../util/captureEvents'; import { getPatternColor, hex2rgb, hsb2rgb, rgb2hex, rgb2hsb, } from '../../../util/colors'; -import type { RealTouchEvent } from '../../../util/captureEvents'; -import { captureEvents } from '../../../util/captureEvents'; -import { selectTheme } from '../../../global/selectors'; +import { pick } from '../../../util/iteratees'; + import useFlag from '../../../hooks/useFlag'; -import buildClassName from '../../../util/buildClassName'; import useHistoryBack from '../../../hooks/useHistoryBack'; import InputText from '../../ui/InputText'; diff --git a/src/components/left/settings/SettingsHeader.tsx b/src/components/left/settings/SettingsHeader.tsx index 2536c5a00..82e62e20f 100644 --- a/src/components/left/settings/SettingsHeader.tsx +++ b/src/components/left/settings/SettingsHeader.tsx @@ -6,14 +6,14 @@ import { getActions } from '../../../global'; import { SettingsScreens } from '../../../types'; +import useAppLayout from '../../../hooks/useAppLayout'; import useLang from '../../../hooks/useLang'; import useMultiClick from '../../../hooks/useMultiClick'; -import useAppLayout from '../../../hooks/useAppLayout'; -import DropdownMenu from '../../ui/DropdownMenu'; -import MenuItem from '../../ui/MenuItem'; import Button from '../../ui/Button'; import ConfirmDialog from '../../ui/ConfirmDialog'; +import DropdownMenu from '../../ui/DropdownMenu'; +import MenuItem from '../../ui/MenuItem'; type OwnProps = { currentScreen: SettingsScreens; diff --git a/src/components/left/settings/SettingsLanguage.tsx b/src/components/left/settings/SettingsLanguage.tsx index 1a2801e58..f41c45f87 100644 --- a/src/components/left/settings/SettingsLanguage.tsx +++ b/src/components/left/settings/SettingsLanguage.tsx @@ -1,26 +1,26 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import { SettingsScreens } from '../../../types'; -import type { ISettings, LangCode } from '../../../types'; import type { ApiLanguage } from '../../../api/types'; +import type { ISettings, LangCode } from '../../../types'; +import { SettingsScreens } from '../../../types'; +import { selectIsCurrentUserPremium } from '../../../global/selectors'; import { setLanguage } from '../../../util/langProvider'; import { IS_TRANSLATION_SUPPORTED } from '../../../util/windowEnvironment'; -import { selectIsCurrentUserPremium } from '../../../global/selectors'; import useFlag from '../../../hooks/useFlag'; import useHistoryBack from '../../../hooks/useHistoryBack'; import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; -import RadioGroup from '../../ui/RadioGroup'; -import Loading from '../../ui/Loading'; import Checkbox from '../../ui/Checkbox'; import ListItem from '../../ui/ListItem'; +import Loading from '../../ui/Loading'; +import RadioGroup from '../../ui/RadioGroup'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/SettingsMain.tsx b/src/components/left/settings/SettingsMain.tsx index d6a519a64..efad7fae6 100644 --- a/src/components/left/settings/SettingsMain.tsx +++ b/src/components/left/settings/SettingsMain.tsx @@ -1,17 +1,18 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import { SettingsScreens } from '../../../types'; import { selectIsPremiumPurchaseBlocked } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import ListItem from '../../ui/ListItem'; -import ProfileInfo from '../../common/ProfileInfo'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + import ChatExtra from '../../common/ChatExtra'; import PremiumIcon from '../../common/PremiumIcon'; +import ProfileInfo from '../../common/ProfileInfo'; +import ListItem from '../../ui/ListItem'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/SettingsNotifications.tsx b/src/components/left/settings/SettingsNotifications.tsx index f872948b9..e1e3a2614 100644 --- a/src/components/left/settings/SettingsNotifications.tsx +++ b/src/components/left/settings/SettingsNotifications.tsx @@ -1,17 +1,18 @@ import type { ChangeEvent } from 'react'; -import useRunDebounced from '../../../hooks/useRunDebounced'; import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; import { - playNotifySound, checkIfNotificationsSupported, checkIfOfflinePushFailed, + playNotifySound, } from '../../../util/notifications'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; +import useRunDebounced from '../../../hooks/useRunDebounced'; + import Checkbox from '../../ui/Checkbox'; import RangeSlider from '../../ui/RangeSlider'; diff --git a/src/components/left/settings/SettingsPasswordForm.tsx b/src/components/left/settings/SettingsPasswordForm.tsx index f49af800c..34af2e3cb 100644 --- a/src/components/left/settings/SettingsPasswordForm.tsx +++ b/src/components/left/settings/SettingsPasswordForm.tsx @@ -1,11 +1,11 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useState } from '../../../lib/teact/teact'; -import useLang from '../../../hooks/useLang'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; -import PasswordMonkey from '../../common/PasswordMonkey'; import PasswordForm from '../../common/PasswordForm'; +import PasswordMonkey from '../../common/PasswordMonkey'; type OwnProps = { error?: string; diff --git a/src/components/left/settings/SettingsPerformance.tsx b/src/components/left/settings/SettingsPerformance.tsx index e8c9e3c74..609fbb59c 100644 --- a/src/components/left/settings/SettingsPerformance.tsx +++ b/src/components/left/settings/SettingsPerformance.tsx @@ -5,7 +5,6 @@ import { getActions, withGlobal } from '../../../global'; import type { AnimationLevel, PerformanceType, PerformanceTypeKey } from '../../../types'; -import { IS_BACKDROP_BLUR_SUPPORTED } from '../../../util/windowEnvironment'; import { ANIMATION_LEVEL_CUSTOM, ANIMATION_LEVEL_MAX, ANIMATION_LEVEL_MED, ANIMATION_LEVEL_MIN, } from '../../../config'; @@ -16,11 +15,13 @@ import { } from '../../../global/initialState'; import { selectPerformanceSettings } from '../../../global/selectors'; import { areDeepEqual } from '../../../util/areDeepEqual'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; +import { IS_BACKDROP_BLUR_SUPPORTED } from '../../../util/windowEnvironment'; + +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; -import RangeSlider from '../../ui/RangeSlider'; import Checkbox from '../../ui/Checkbox'; +import RangeSlider from '../../ui/RangeSlider'; type PerformanceSection = [string, PerformanceOption[]]; type PerformanceOption = { diff --git a/src/components/left/settings/SettingsPrivacy.tsx b/src/components/left/settings/SettingsPrivacy.tsx index 1774424a5..568005878 100644 --- a/src/components/left/settings/SettingsPrivacy.tsx +++ b/src/components/left/settings/SettingsPrivacy.tsx @@ -7,11 +7,11 @@ import { SettingsScreens } from '../../../types'; import { selectCanSetPasscode, selectIsCurrentUserPremium } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; -import ListItem from '../../ui/ListItem'; import Checkbox from '../../ui/Checkbox'; +import ListItem from '../../ui/ListItem'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/SettingsPrivacyBlockedUsers.tsx b/src/components/left/settings/SettingsPrivacyBlockedUsers.tsx index 76110de74..9cba44115 100644 --- a/src/components/left/settings/SettingsPrivacyBlockedUsers.tsx +++ b/src/components/left/settings/SettingsPrivacyBlockedUsers.tsx @@ -5,19 +5,20 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiChat, ApiCountryCode, ApiUser } from '../../../api/types'; import { CHAT_HEIGHT_PX } from '../../../config'; -import { formatPhoneNumberWithCode } from '../../../util/phoneNumber'; import { getMainUsername, isUserId } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import useFlag from '../../../hooks/useFlag'; +import { formatPhoneNumberWithCode } from '../../../util/phoneNumber'; + +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; -import ListItem from '../../ui/ListItem'; -import FloatingActionButton from '../../ui/FloatingActionButton'; import Avatar from '../../common/Avatar'; +import FullNameTitle from '../../common/FullNameTitle'; +import FloatingActionButton from '../../ui/FloatingActionButton'; +import ListItem from '../../ui/ListItem'; import Loading from '../../ui/Loading'; import BlockUserModal from './BlockUserModal'; -import FullNameTitle from '../../common/FullNameTitle'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/SettingsPrivacyPublicProfilePhoto.tsx b/src/components/left/settings/SettingsPrivacyPublicProfilePhoto.tsx index ccf282afc..641fbb7b0 100644 --- a/src/components/left/settings/SettingsPrivacyPublicProfilePhoto.tsx +++ b/src/components/left/settings/SettingsPrivacyPublicProfilePhoto.tsx @@ -1,18 +1,18 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useRef, } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiPhoto } from '../../../api/types'; import useFlag from '../../../hooks/useFlag'; import useLang from '../../../hooks/useLang'; -import ListItem from '../../ui/ListItem'; -import SelectAvatar from '../../ui/SelectAvatar'; import Avatar from '../../common/Avatar'; import ConfirmDialog from '../../ui/ConfirmDialog'; +import ListItem from '../../ui/ListItem'; +import SelectAvatar from '../../ui/SelectAvatar'; import styles from './SettingsPrivacyPublicPhoto.module.scss'; diff --git a/src/components/left/settings/SettingsPrivacyVisibility.tsx b/src/components/left/settings/SettingsPrivacyVisibility.tsx index bd4be2266..0e9167cc5 100644 --- a/src/components/left/settings/SettingsPrivacyVisibility.tsx +++ b/src/components/left/settings/SettingsPrivacyVisibility.tsx @@ -6,10 +6,11 @@ import type { ApiChat, ApiPhoto, ApiUser } from '../../../api/types'; import type { ApiPrivacySettings } from '../../../types'; import { SettingsScreens } from '../../../types'; -import { getPrivacyKey } from './helpers/privacy'; import { selectUserFullInfo } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; +import { getPrivacyKey } from './helpers/privacy'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import ListItem from '../../ui/ListItem'; import RadioGroup from '../../ui/RadioGroup'; diff --git a/src/components/left/settings/SettingsPrivacyVisibilityExceptionList.tsx b/src/components/left/settings/SettingsPrivacyVisibilityExceptionList.tsx index 0adb33674..bfb648ed9 100644 --- a/src/components/left/settings/SettingsPrivacyVisibilityExceptionList.tsx +++ b/src/components/left/settings/SettingsPrivacyVisibilityExceptionList.tsx @@ -9,13 +9,14 @@ import type { ApiPrivacySettings } from '../../../types'; import { SettingsScreens } from '../../../types'; import { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID } from '../../../config'; -import { unique } from '../../../util/iteratees'; import { filterChatsByName, isUserId } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager'; +import { unique } from '../../../util/iteratees'; import { getPrivacyKey } from './helpers/privacy'; +import { useFolderManagerForOrderedIds } from '../../../hooks/useFolderManager'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + import Picker from '../../common/Picker'; import FloatingActionButton from '../../ui/FloatingActionButton'; diff --git a/src/components/left/settings/SettingsQuickReaction.tsx b/src/components/left/settings/SettingsQuickReaction.tsx index bd45047dc..ae134a522 100644 --- a/src/components/left/settings/SettingsQuickReaction.tsx +++ b/src/components/left/settings/SettingsQuickReaction.tsx @@ -1,7 +1,7 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAvailableReaction } from '../../../api/types'; import useHistoryBack from '../../../hooks/useHistoryBack'; diff --git a/src/components/left/settings/SettingsStickers.tsx b/src/components/left/settings/SettingsStickers.tsx index 9fcdc80f8..d83d2c929 100644 --- a/src/components/left/settings/SettingsStickers.tsx +++ b/src/components/left/settings/SettingsStickers.tsx @@ -1,31 +1,31 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import { SettingsScreens } from '../../../types'; -import type { ISettings } from '../../../types'; import type { ApiAvailableReaction, ApiReaction, ApiSticker, ApiStickerSet, } from '../../../api/types'; - -import renderText from '../../common/helpers/renderText'; -import { pick } from '../../../util/iteratees'; -import { REM } from '../../common/helpers/mediaDimensions'; +import type { ISettings } from '../../../types'; +import { SettingsScreens } from '../../../types'; import { selectCanPlayAnimatedEmojis } from '../../../global/selectors'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import { pick } from '../../../util/iteratees'; +import { REM } from '../../common/helpers/mediaDimensions'; +import renderText from '../../common/helpers/renderText'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; import useLang from '../../../hooks/useLang'; import ReactionStaticEmoji from '../../common/ReactionStaticEmoji'; +import StickerSetCard from '../../common/StickerSetCard'; import Checkbox from '../../ui/Checkbox'; import ListItem from '../../ui/ListItem'; -import StickerSetCard from '../../common/StickerSetCard'; const DEFAULT_REACTION_SIZE = 1.5 * REM; diff --git a/src/components/left/settings/WallpaperTile.tsx b/src/components/left/settings/WallpaperTile.tsx index a90e8d31c..8385caae7 100644 --- a/src/components/left/settings/WallpaperTile.tsx +++ b/src/components/left/settings/WallpaperTile.tsx @@ -1,20 +1,23 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useCallback, useEffect, useState, useRef, + memo, useCallback, useEffect, useRef, + useState, } from '../../../lib/teact/teact'; + import type { ApiWallpaper } from '../../../api/types'; import type { ThemeKey } from '../../../types'; import { UPLOADING_WALLPAPER_SLUG } from '../../../types'; import { CUSTOM_BG_CACHE_NAME } from '../../../config'; +import buildClassName from '../../../util/buildClassName'; import * as cacheApi from '../../../util/cacheApi'; import { fetchBlob } from '../../../util/files'; -import buildClassName from '../../../util/buildClassName'; + +import useCanvasBlur from '../../../hooks/useCanvasBlur'; import useMedia from '../../../hooks/useMedia'; import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; -import useShowTransition from '../../../hooks/useShowTransition'; import usePrevious from '../../../hooks/usePrevious'; -import useCanvasBlur from '../../../hooks/useCanvasBlur'; +import useShowTransition from '../../../hooks/useShowTransition'; import ProgressSpinner from '../../ui/ProgressSpinner'; diff --git a/src/components/left/settings/folders/SettingsFolders.tsx b/src/components/left/settings/folders/SettingsFolders.tsx index d0a68080b..ee031607e 100644 --- a/src/components/left/settings/folders/SettingsFolders.tsx +++ b/src/components/left/settings/folders/SettingsFolders.tsx @@ -1,16 +1,16 @@ +import type { FC } from '../../../../lib/teact/teact'; import React, { memo, useCallback } from '../../../../lib/teact/teact'; import { getActions } from '../../../../global'; -import type { FC } from '../../../../lib/teact/teact'; import type { ApiChatFolder } from '../../../../api/types'; -import { SettingsScreens } from '../../../../types'; import type { FolderEditDispatch, FoldersState } from '../../../../hooks/reducers/useFoldersReducer'; +import { SettingsScreens } from '../../../../types'; import { selectChatFilters } from '../../../../hooks/reducers/useFoldersReducer'; -import SettingsFoldersMain from './SettingsFoldersMain'; -import SettingsFoldersEdit, { ERROR_NO_CHATS, ERROR_NO_TITLE } from './SettingsFoldersEdit'; import SettingsFoldersChatFilters from './SettingsFoldersChatFilters'; +import SettingsFoldersEdit, { ERROR_NO_CHATS, ERROR_NO_TITLE } from './SettingsFoldersEdit'; +import SettingsFoldersMain from './SettingsFoldersMain'; import SettingsShareChatlist from './SettingsShareChatlist'; import './SettingsFolders.scss'; diff --git a/src/components/left/settings/folders/SettingsFoldersChatFilters.tsx b/src/components/left/settings/folders/SettingsFoldersChatFilters.tsx index 3cf6df8c2..10342b5c0 100644 --- a/src/components/left/settings/folders/SettingsFoldersChatFilters.tsx +++ b/src/components/left/settings/folders/SettingsFoldersChatFilters.tsx @@ -1,24 +1,25 @@ import type { FC } from '../../../../lib/teact/teact'; -import React, { memo, useMemo, useCallback } from '../../../../lib/teact/teact'; +import React, { memo, useCallback, useMemo } from '../../../../lib/teact/teact'; import { getGlobal } from '../../../../global'; -import { unique } from '../../../../util/iteratees'; +import type { + FolderEditDispatch, + FoldersState, +} from '../../../../hooks/reducers/useFoldersReducer'; import { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID } from '../../../../config'; import { filterChatsByName } from '../../../../global/helpers'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; -import { useFolderManagerForOrderedIds } from '../../../../hooks/useFolderManager'; -import type { - FoldersState, - FolderEditDispatch, -} from '../../../../hooks/reducers/useFoldersReducer'; +import { unique } from '../../../../util/iteratees'; + import { selectChatFilters, } from '../../../../hooks/reducers/useFoldersReducer'; +import { useFolderManagerForOrderedIds } from '../../../../hooks/useFolderManager'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; -import SettingsFoldersChatsPicker from './SettingsFoldersChatsPicker'; import Loading from '../../../ui/Loading'; +import SettingsFoldersChatsPicker from './SettingsFoldersChatsPicker'; type OwnProps = { mode: 'included' | 'excluded'; diff --git a/src/components/left/settings/folders/SettingsFoldersChatsPicker.tsx b/src/components/left/settings/folders/SettingsFoldersChatsPicker.tsx index d78d2e1eb..e004992f9 100644 --- a/src/components/left/settings/folders/SettingsFoldersChatsPicker.tsx +++ b/src/components/left/settings/folders/SettingsFoldersChatsPicker.tsx @@ -1,30 +1,32 @@ import type { FC } from '../../../../lib/teact/teact'; import React, { - useCallback, useRef, useEffect, memo, useState, + memo, useCallback, useEffect, useRef, useState, } from '../../../../lib/teact/teact'; -import { requestMutation } from '../../../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../../../global'; -import { isUserId } from '../../../../global/helpers'; import type { FolderChatType } from '../../../../hooks/reducers/useFoldersReducer'; -import { - INCLUDED_CHAT_TYPES, - EXCLUDED_CHAT_TYPES, -} from '../../../../hooks/reducers/useFoldersReducer'; + +import { requestMutation } from '../../../../lib/fasterdom/fasterdom'; +import { isUserId } from '../../../../global/helpers'; +import { selectCurrentLimit } from '../../../../global/selectors/limits'; import buildClassName from '../../../../util/buildClassName'; + +import { + EXCLUDED_CHAT_TYPES, + INCLUDED_CHAT_TYPES, +} from '../../../../hooks/reducers/useFoldersReducer'; import useInfiniteScroll from '../../../../hooks/useInfiniteScroll'; import useLang from '../../../../hooks/useLang'; -import { selectCurrentLimit } from '../../../../global/selectors/limits'; -import Checkbox from '../../../ui/Checkbox'; -import InputText from '../../../ui/InputText'; -import ListItem from '../../../ui/ListItem'; -import PrivateChatInfo from '../../../common/PrivateChatInfo'; import GroupChatInfo from '../../../common/GroupChatInfo'; import PickerSelectedItem from '../../../common/PickerSelectedItem'; -import InfiniteScroll from '../../../ui/InfiniteScroll'; -import Loading from '../../../ui/Loading'; +import PrivateChatInfo from '../../../common/PrivateChatInfo'; +import Checkbox from '../../../ui/Checkbox'; import FloatingActionButton from '../../../ui/FloatingActionButton'; +import InfiniteScroll from '../../../ui/InfiniteScroll'; +import InputText from '../../../ui/InputText'; +import ListItem from '../../../ui/ListItem'; +import Loading from '../../../ui/Loading'; import '../../../common/Picker.scss'; import './SettingsFoldersChatsPicker.scss'; diff --git a/src/components/left/settings/folders/SettingsFoldersEdit.tsx b/src/components/left/settings/folders/SettingsFoldersEdit.tsx index 8db110787..ff0a7ef43 100644 --- a/src/components/left/settings/folders/SettingsFoldersEdit.tsx +++ b/src/components/left/settings/folders/SettingsFoldersEdit.tsx @@ -5,34 +5,35 @@ import React, { import { getActions, getGlobal, withGlobal } from '../../../../global'; import type { ApiChatlistExportedInvite } from '../../../../api/types'; - -import { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config'; -import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import { MEMO_EMPTY_ARRAY } from '../../../../util/memo'; -import { findIntersectionWithSet } from '../../../../util/iteratees'; -import { isUserId } from '../../../../global/helpers'; import type { FolderEditDispatch, FoldersState, } from '../../../../hooks/reducers/useFoldersReducer'; + +import { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config'; +import { isUserId } from '../../../../global/helpers'; +import { selectCanShareFolder } from '../../../../global/selectors'; +import { selectCurrentLimit } from '../../../../global/selectors/limits'; +import { findIntersectionWithSet } from '../../../../util/iteratees'; +import { MEMO_EMPTY_ARRAY } from '../../../../util/memo'; +import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; + import { EXCLUDED_CHAT_TYPES, INCLUDED_CHAT_TYPES, selectChatFilters, } from '../../../../hooks/reducers/useFoldersReducer'; -import { selectCanShareFolder } from '../../../../global/selectors'; -import { selectCurrentLimit } from '../../../../global/selectors/limits'; -import useLang from '../../../../hooks/useLang'; import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; -import ListItem from '../../../ui/ListItem'; -import InputText from '../../../ui/InputText'; -import PrivateChatInfo from '../../../common/PrivateChatInfo'; -import GroupChatInfo from '../../../common/GroupChatInfo'; -import FloatingActionButton from '../../../ui/FloatingActionButton'; -import Spinner from '../../../ui/Spinner'; -import ShowMoreButton from '../../../ui/ShowMoreButton'; import AnimatedIcon from '../../../common/AnimatedIcon'; +import GroupChatInfo from '../../../common/GroupChatInfo'; +import PrivateChatInfo from '../../../common/PrivateChatInfo'; +import FloatingActionButton from '../../../ui/FloatingActionButton'; +import InputText from '../../../ui/InputText'; +import ListItem from '../../../ui/ListItem'; +import ShowMoreButton from '../../../ui/ShowMoreButton'; +import Spinner from '../../../ui/Spinner'; type OwnProps = { state: FoldersState; diff --git a/src/components/left/settings/folders/SettingsFoldersMain.tsx b/src/components/left/settings/folders/SettingsFoldersMain.tsx index f1210ee59..58108fec5 100644 --- a/src/components/left/settings/folders/SettingsFoldersMain.tsx +++ b/src/components/left/settings/folders/SettingsFoldersMain.tsx @@ -1,30 +1,31 @@ import type { FC } from '../../../../lib/teact/teact'; import React, { - memo, useMemo, useCallback, useEffect, useState, + memo, useCallback, useEffect, useMemo, useState, } from '../../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../../global'; import type { ApiChatFolder } from '../../../../api/types'; import { ALL_FOLDER_ID, STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config'; -import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; +import { getFolderDescriptionText } from '../../../../global/helpers'; +import { selectIsCurrentUserPremium } from '../../../../global/selectors'; +import { selectCurrentLimit } from '../../../../global/selectors/limits'; +import { isBetween } from '../../../../util/math'; import { MEMO_EMPTY_ARRAY } from '../../../../util/memo'; import { throttle } from '../../../../util/schedulers'; -import { isBetween } from '../../../../util/math'; -import { getFolderDescriptionText } from '../../../../global/helpers'; -import { selectCurrentLimit } from '../../../../global/selectors/limits'; -import { selectIsCurrentUserPremium } from '../../../../global/selectors'; +import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; import renderText from '../../../common/helpers/renderText'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; + import { useFolderManagerForChatsCount } from '../../../../hooks/useFolderManager'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; import usePrevious from '../../../../hooks/usePrevious'; -import ListItem from '../../../ui/ListItem'; -import Button from '../../../ui/Button'; -import Loading from '../../../ui/Loading'; import AnimatedIcon from '../../../common/AnimatedIcon'; +import Button from '../../../ui/Button'; import Draggable from '../../../ui/Draggable'; +import ListItem from '../../../ui/ListItem'; +import Loading from '../../../ui/Loading'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/folders/SettingsShareChatlist.tsx b/src/components/left/settings/folders/SettingsShareChatlist.tsx index 540f7ac26..7703add5b 100644 --- a/src/components/left/settings/folders/SettingsShareChatlist.tsx +++ b/src/components/left/settings/folders/SettingsShareChatlist.tsx @@ -1,30 +1,30 @@ +import type { FC } from '../../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../../global'; -import type { FC } from '../../../../lib/teact/teact'; - import { STICKER_SIZE_FOLDER_SETTINGS } from '../../../../config'; -import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import renderText from '../../../common/helpers/renderText'; -import { partition } from '../../../../util/iteratees'; +import { isChatChannel, isUserBot } from '../../../../global/helpers'; import { selectCanInviteToChat, selectChat, selectChatFolder, selectTabState, selectUser, } from '../../../../global/selectors'; -import { isChatChannel, isUserBot } from '../../../../global/helpers'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; +import { partition } from '../../../../util/iteratees'; +import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; +import renderText from '../../../common/helpers/renderText'; + import useEffectWithPrevDeps from '../../../../hooks/useEffectWithPrevDeps'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; import useLastCallback from '../../../../hooks/useLastCallback'; import AnimatedIcon from '../../../common/AnimatedIcon'; import InviteLink from '../../../common/InviteLink'; import Picker from '../../../common/Picker'; -import Spinner from '../../../ui/Spinner'; import FloatingActionButton from '../../../ui/FloatingActionButton'; +import Spinner from '../../../ui/Spinner'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/passcode/SettingsPasscode.tsx b/src/components/left/settings/passcode/SettingsPasscode.tsx index 0b5938c57..9f2ae83f0 100644 --- a/src/components/left/settings/passcode/SettingsPasscode.tsx +++ b/src/components/left/settings/passcode/SettingsPasscode.tsx @@ -5,13 +5,14 @@ import { getActions, withGlobal } from '../../../../global'; import type { GlobalState } from '../../../../global/types'; import { SettingsScreens } from '../../../../types'; -import useLang from '../../../../hooks/useLang'; import { decryptSession } from '../../../../util/passcode'; -import SettingsPasscodeStart from './SettingsPasscodeStart'; +import useLang from '../../../../hooks/useLang'; + import SettingsPasscodeForm from '../SettingsPasswordForm'; -import SettingsPasscodeEnabled from './SettingsPasscodeEnabled'; import SettingsPasscodeCongratulations from './SettingsPasscodeCongratulations'; +import SettingsPasscodeEnabled from './SettingsPasscodeEnabled'; +import SettingsPasscodeStart from './SettingsPasscodeStart'; export type OwnProps = { passcode: string; diff --git a/src/components/left/settings/passcode/SettingsPasscodeCongratulations.tsx b/src/components/left/settings/passcode/SettingsPasscodeCongratulations.tsx index 275274356..3745f4efd 100644 --- a/src/components/left/settings/passcode/SettingsPasscodeCongratulations.tsx +++ b/src/components/left/settings/passcode/SettingsPasscodeCongratulations.tsx @@ -3,11 +3,12 @@ import React, { memo, useCallback } from '../../../../lib/teact/teact'; import { STICKER_SIZE_PASSCODE } from '../../../../config'; import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; -import Button from '../../../ui/Button'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + import AnimatedIcon from '../../../common/AnimatedIcon'; +import Button from '../../../ui/Button'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/passcode/SettingsPasscodeEnabled.tsx b/src/components/left/settings/passcode/SettingsPasscodeEnabled.tsx index bbe8145ff..a66faed1b 100644 --- a/src/components/left/settings/passcode/SettingsPasscodeEnabled.tsx +++ b/src/components/left/settings/passcode/SettingsPasscodeEnabled.tsx @@ -3,12 +3,13 @@ import React, { memo } from '../../../../lib/teact/teact'; import { SettingsScreens } from '../../../../types'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; - import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import ListItem from '../../../ui/ListItem'; + +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + import AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview'; +import ListItem from '../../../ui/ListItem'; import lockPreviewUrl from '../../../../assets/lock.png'; diff --git a/src/components/left/settings/passcode/SettingsPasscodeStart.tsx b/src/components/left/settings/passcode/SettingsPasscodeStart.tsx index 137ae2c32..c66d8fc8d 100644 --- a/src/components/left/settings/passcode/SettingsPasscodeStart.tsx +++ b/src/components/left/settings/passcode/SettingsPasscodeStart.tsx @@ -3,11 +3,12 @@ import React, { memo } from '../../../../lib/teact/teact'; import { STICKER_SIZE_PASSCODE } from '../../../../config'; import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; -import Button from '../../../ui/Button'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + import AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview'; +import Button from '../../../ui/Button'; import lockPreviewUrl from '../../../../assets/lock.png'; diff --git a/src/components/left/settings/twoFa/SettingsTwoFa.tsx b/src/components/left/settings/twoFa/SettingsTwoFa.tsx index ec21ea987..2f4733bb8 100644 --- a/src/components/left/settings/twoFa/SettingsTwoFa.tsx +++ b/src/components/left/settings/twoFa/SettingsTwoFa.tsx @@ -3,17 +3,17 @@ import React, { memo, useCallback, useEffect } from '../../../../lib/teact/teact import { getActions, withGlobal } from '../../../../global'; import type { GlobalState } from '../../../../global/types'; +import type { TwoFaDispatch, TwoFaState } from '../../../../hooks/reducers/useTwoFaReducer'; import { SettingsScreens } from '../../../../types'; -import type { TwoFaDispatch, TwoFaState } from '../../../../hooks/reducers/useTwoFaReducer'; import useLang from '../../../../hooks/useLang'; -import SettingsTwoFaEnabled from './SettingsTwoFaEnabled'; import SettingsTwoFaPassword from '../SettingsPasswordForm'; -import SettingsTwoFaStart from './SettingsTwoFaStart'; -import SettingsTwoFaSkippableForm from './SettingsTwoFaSkippableForm'; import SettingsTwoFaCongratulations from './SettingsTwoFaCongratulations'; import SettingsTwoFaEmailCode from './SettingsTwoFaEmailCode'; +import SettingsTwoFaEnabled from './SettingsTwoFaEnabled'; +import SettingsTwoFaSkippableForm from './SettingsTwoFaSkippableForm'; +import SettingsTwoFaStart from './SettingsTwoFaStart'; export type OwnProps = { state: TwoFaState; diff --git a/src/components/left/settings/twoFa/SettingsTwoFaCongratulations.tsx b/src/components/left/settings/twoFa/SettingsTwoFaCongratulations.tsx index e9dbc2b24..0472f1367 100644 --- a/src/components/left/settings/twoFa/SettingsTwoFaCongratulations.tsx +++ b/src/components/left/settings/twoFa/SettingsTwoFaCongratulations.tsx @@ -5,11 +5,12 @@ import { SettingsScreens } from '../../../../types'; import { STICKER_SIZE_TWO_FA } from '../../../../config'; import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; -import Button from '../../../ui/Button'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + import AnimatedIcon from '../../../common/AnimatedIcon'; +import Button from '../../../ui/Button'; type OwnProps = { isActive?: boolean; diff --git a/src/components/left/settings/twoFa/SettingsTwoFaEmailCode.tsx b/src/components/left/settings/twoFa/SettingsTwoFaEmailCode.tsx index ff539c000..8adeaf1af 100644 --- a/src/components/left/settings/twoFa/SettingsTwoFaEmailCode.tsx +++ b/src/components/left/settings/twoFa/SettingsTwoFaEmailCode.tsx @@ -6,15 +6,16 @@ import { withGlobal } from '../../../../global'; import type { ApiSticker } from '../../../../api/types'; -import { IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; import { selectAnimatedEmoji } from '../../../../global/selectors'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; -import useAppLayout from '../../../../hooks/useAppLayout'; +import { IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; +import useAppLayout from '../../../../hooks/useAppLayout'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + +import AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker'; import InputText from '../../../ui/InputText'; import Loading from '../../../ui/Loading'; -import AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker'; type OwnProps = { isLoading?: boolean; diff --git a/src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx b/src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx index 3ab670f31..67cc1f26e 100644 --- a/src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx +++ b/src/components/left/settings/twoFa/SettingsTwoFaEnabled.tsx @@ -3,13 +3,14 @@ import React, { memo } from '../../../../lib/teact/teact'; import { SettingsScreens } from '../../../../types'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; - import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; -import ListItem from '../../../ui/ListItem'; import renderText from '../../../common/helpers/renderText'; + +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + import AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview'; +import ListItem from '../../../ui/ListItem'; import lockPreviewUrl from '../../../../assets/lock.png'; diff --git a/src/components/left/settings/twoFa/SettingsTwoFaSkippableForm.tsx b/src/components/left/settings/twoFa/SettingsTwoFaSkippableForm.tsx index fa18c086b..8e38001c0 100644 --- a/src/components/left/settings/twoFa/SettingsTwoFaSkippableForm.tsx +++ b/src/components/left/settings/twoFa/SettingsTwoFaSkippableForm.tsx @@ -6,18 +6,19 @@ import { withGlobal } from '../../../../global'; import type { ApiSticker } from '../../../../api/types'; -import { IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; import { selectAnimatedEmoji } from '../../../../global/selectors'; +import { IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; import renderText from '../../../common/helpers/renderText'; -import useFlag from '../../../../hooks/useFlag'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; -import useAppLayout from '../../../../hooks/useAppLayout'; -import Button from '../../../ui/Button'; -import Modal from '../../../ui/Modal'; -import InputText from '../../../ui/InputText'; +import useAppLayout from '../../../../hooks/useAppLayout'; +import useFlag from '../../../../hooks/useFlag'; +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; + import AnimatedIconFromSticker from '../../../common/AnimatedIconFromSticker'; +import Button from '../../../ui/Button'; +import InputText from '../../../ui/InputText'; +import Modal from '../../../ui/Modal'; type OwnProps = { icon: 'hint' | 'email'; diff --git a/src/components/left/settings/twoFa/SettingsTwoFaStart.tsx b/src/components/left/settings/twoFa/SettingsTwoFaStart.tsx index b50ee6096..dfa68c4ff 100644 --- a/src/components/left/settings/twoFa/SettingsTwoFaStart.tsx +++ b/src/components/left/settings/twoFa/SettingsTwoFaStart.tsx @@ -1,14 +1,15 @@ import type { FC } from '../../../../lib/teact/teact'; import React, { memo } from '../../../../lib/teact/teact'; -import useLang from '../../../../hooks/useLang'; -import useHistoryBack from '../../../../hooks/useHistoryBack'; +import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; + +import useHistoryBack from '../../../../hooks/useHistoryBack'; +import useLang from '../../../../hooks/useLang'; -import Button from '../../../ui/Button'; import AnimatedIconWithPreview from '../../../common/AnimatedIconWithPreview'; +import Button from '../../../ui/Button'; import lockPreviewUrl from '../../../../assets/lock.png'; -import { LOCAL_TGS_URLS } from '../../../common/helpers/animatedAssets'; type OwnProps = { onStart: NoneToVoidFunction; diff --git a/src/components/main/AppInactive.tsx b/src/components/main/AppInactive.tsx index c055417db..5f7eb2d7c 100644 --- a/src/components/main/AppInactive.tsx +++ b/src/components/main/AppInactive.tsx @@ -5,9 +5,10 @@ import useHistoryBack from '../../hooks/useHistoryBack'; import Button from '../ui/Button'; -import appInactivePath from '../../assets/app-inactive.png'; import './AppInactive.scss'; +import appInactivePath from '../../assets/app-inactive.png'; + const AppInactive: FC = () => { const handleReload = useCallback(() => { window.location.reload(); diff --git a/src/components/main/AttachBotRecipientPicker.async.tsx b/src/components/main/AttachBotRecipientPicker.async.tsx index a20cb6764..4c9c2b618 100644 --- a/src/components/main/AttachBotRecipientPicker.async.tsx +++ b/src/components/main/AttachBotRecipientPicker.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; + import type { OwnProps } from './AttachBotRecipientPicker'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const AttachBotRecipientPickerAsync: FC = (props) => { diff --git a/src/components/main/AttachBotRecipientPicker.tsx b/src/components/main/AttachBotRecipientPicker.tsx index 14e032373..11b544f18 100644 --- a/src/components/main/AttachBotRecipientPicker.tsx +++ b/src/components/main/AttachBotRecipientPicker.tsx @@ -1,11 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { TabState } from '../../global/types'; -import useLang from '../../hooks/useLang'; import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import RecipientPicker from '../common/RecipientPicker'; diff --git a/src/components/main/BotTrustModal.async.tsx b/src/components/main/BotTrustModal.async.tsx index c309ab337..373c0e375 100644 --- a/src/components/main/BotTrustModal.async.tsx +++ b/src/components/main/BotTrustModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './BotTrustModal'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const BotTrustModalAsync: FC = (props) => { diff --git a/src/components/main/BotTrustModal.tsx b/src/components/main/BotTrustModal.tsx index 05a17fb65..338b2b003 100644 --- a/src/components/main/BotTrustModal.tsx +++ b/src/components/main/BotTrustModal.tsx @@ -1,9 +1,9 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useState, } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiUser } from '../../api/types'; import { getUserFullName } from '../../global/helpers'; diff --git a/src/components/main/ConfettiContainer.tsx b/src/components/main/ConfettiContainer.tsx index 197c1fc13..b6f782a39 100644 --- a/src/components/main/ConfettiContainer.tsx +++ b/src/components/main/ConfettiContainer.tsx @@ -1,18 +1,18 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useRef } from '../../lib/teact/teact'; -import { requestMeasure } from '../../lib/fasterdom/fasterdom'; import { withGlobal } from '../../global'; import type { TabState } from '../../global/types'; -import type { FC } from '../../lib/teact/teact'; -import { pick } from '../../util/iteratees'; -import buildStyle from '../../util/buildStyle'; +import { requestMeasure } from '../../lib/fasterdom/fasterdom'; import { selectTabState } from '../../global/selectors'; +import buildStyle from '../../util/buildStyle'; +import { pick } from '../../util/iteratees'; -import useWindowSize from '../../hooks/useWindowSize'; -import useSyncEffect from '../../hooks/useSyncEffect'; -import useForceUpdate from '../../hooks/useForceUpdate'; import useAppLayout from '../../hooks/useAppLayout'; +import useForceUpdate from '../../hooks/useForceUpdate'; +import useSyncEffect from '../../hooks/useSyncEffect'; +import useWindowSize from '../../hooks/useWindowSize'; import styles from './ConfettiContainer.module.scss'; diff --git a/src/components/main/DeleteFolderDialog.async.tsx b/src/components/main/DeleteFolderDialog.async.tsx index 7df199f6b..8ac190036 100644 --- a/src/components/main/DeleteFolderDialog.async.tsx +++ b/src/components/main/DeleteFolderDialog.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './DeleteFolderDialog'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const DeleteFolderDialogAsync: FC = (props) => { diff --git a/src/components/main/DeleteFolderDialog.tsx b/src/components/main/DeleteFolderDialog.tsx index 107608294..ced2cee5a 100644 --- a/src/components/main/DeleteFolderDialog.tsx +++ b/src/components/main/DeleteFolderDialog.tsx @@ -1,11 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiChatFolder } from '../../api/types'; -import usePrevious from '../../hooks/usePrevious'; import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; import ConfirmDialog from '../ui/ConfirmDialog'; diff --git a/src/components/main/Dialogs.async.tsx b/src/components/main/Dialogs.async.tsx index 643496f7e..25af77179 100644 --- a/src/components/main/Dialogs.async.tsx +++ b/src/components/main/Dialogs.async.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/main/Dialogs.tsx b/src/components/main/Dialogs.tsx index 9c4fae8c4..2c0c8590e 100644 --- a/src/components/main/Dialogs.tsx +++ b/src/components/main/Dialogs.tsx @@ -11,12 +11,13 @@ import { selectCurrentMessageList, selectTabState } from '../../global/selectors import getReadableErrorText from '../../util/getReadableErrorText'; import { pick } from '../../util/iteratees'; import renderText from '../common/helpers/renderText'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import Modal from '../ui/Modal'; -import Button from '../ui/Button'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; + import Avatar from '../common/Avatar'; +import Button from '../ui/Button'; +import Modal from '../ui/Modal'; type StateProps = { currentMessageList?: MessageList; diff --git a/src/components/main/DownloadManager.tsx b/src/components/main/DownloadManager.tsx index fb4f28439..69bc52db1 100644 --- a/src/components/main/DownloadManager.tsx +++ b/src/components/main/DownloadManager.tsx @@ -2,18 +2,18 @@ import type { FC } from '../../lib/teact/teact'; import { memo, useEffect } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; -import type { GlobalState, TabState } from '../../global/types'; import type { ApiMessage } from '../../api/types'; +import type { GlobalState, TabState } from '../../global/types'; import { ApiMediaFormat } from '../../api/types'; -import { selectTabState } from '../../global/selectors'; -import { IS_OPFS_SUPPORTED, IS_SERVICE_WORKER_SUPPORTED, MAX_BUFFER_SIZE } from '../../util/windowEnvironment'; -import * as mediaLoader from '../../util/mediaLoader'; -import download from '../../util/download'; import { getMessageContentFilename, getMessageMediaFormat, getMessageMediaHash, } from '../../global/helpers'; +import { selectTabState } from '../../global/selectors'; +import download from '../../util/download'; import { compact } from '../../util/iteratees'; +import * as mediaLoader from '../../util/mediaLoader'; +import { IS_OPFS_SUPPORTED, IS_SERVICE_WORKER_SUPPORTED, MAX_BUFFER_SIZE } from '../../util/windowEnvironment'; import useLastCallback from '../../hooks/useLastCallback'; import useRunDebounced from '../../hooks/useRunDebounced'; diff --git a/src/components/main/DraftRecipientPicker.async.tsx b/src/components/main/DraftRecipientPicker.async.tsx index c157c7653..112efe448 100644 --- a/src/components/main/DraftRecipientPicker.async.tsx +++ b/src/components/main/DraftRecipientPicker.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; + import type { OwnProps } from './DraftRecipientPicker'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const DraftRecipientPickerAsync: FC = (props) => { diff --git a/src/components/main/DraftRecipientPicker.tsx b/src/components/main/DraftRecipientPicker.tsx index c167c4e10..6579a2c8d 100644 --- a/src/components/main/DraftRecipientPicker.tsx +++ b/src/components/main/DraftRecipientPicker.tsx @@ -6,8 +6,8 @@ import { getActions } from '../../global'; import type { TabState } from '../../global/types'; -import useLang from '../../hooks/useLang'; import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import RecipientPicker from '../common/RecipientPicker'; diff --git a/src/components/main/ForwardRecipientPicker.async.tsx b/src/components/main/ForwardRecipientPicker.async.tsx index b188c5d09..2640573ac 100644 --- a/src/components/main/ForwardRecipientPicker.async.tsx +++ b/src/components/main/ForwardRecipientPicker.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; + import type { OwnProps } from './ForwardRecipientPicker'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const ForwardRecipientPickerAsync: FC = (props) => { diff --git a/src/components/main/ForwardRecipientPicker.tsx b/src/components/main/ForwardRecipientPicker.tsx index 50109226f..0e7598631 100644 --- a/src/components/main/ForwardRecipientPicker.tsx +++ b/src/components/main/ForwardRecipientPicker.tsx @@ -4,13 +4,14 @@ import React, { } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; -import { selectChat, selectTabState, selectUser } from '../../global/selectors'; import { getChatTitle, getUserFirstOrLastName, isUserId } from '../../global/helpers'; -import useLang from '../../hooks/useLang'; +import { selectChat, selectTabState, selectUser } from '../../global/selectors'; + import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; import RecipientPicker from '../common/RecipientPicker'; -import usePrevious from '../../hooks/usePrevious'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/main/GameModal.tsx b/src/components/main/GameModal.tsx index a4c8dbd87..640fd7bb7 100644 --- a/src/components/main/GameModal.tsx +++ b/src/components/main/GameModal.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect } from '../../lib/teact/teact'; import { getActions } from '../../lib/teact/teactn'; +import { withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { TabState } from '../../global/types'; import { MAIN_THREAD_ID } from '../../api/types'; -import { withGlobal } from '../../global'; -import { selectChat } from '../../global/selectors'; import { getCanPostInChat } from '../../global/helpers'; +import { selectChat } from '../../global/selectors'; +import useInterval from '../../hooks/useInterval'; import useLang from '../../hooks/useLang'; import useSendMessageAction from '../../hooks/useSendMessageAction'; -import useInterval from '../../hooks/useInterval'; import Modal from '../ui/Modal'; diff --git a/src/components/main/HistoryCalendar.async.tsx b/src/components/main/HistoryCalendar.async.tsx index 65fb88ed5..aee978689 100644 --- a/src/components/main/HistoryCalendar.async.tsx +++ b/src/components/main/HistoryCalendar.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './HistoryCalendar'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const HistoryCalendarAsync: FC = (props) => { diff --git a/src/components/main/HistoryCalendar.tsx b/src/components/main/HistoryCalendar.tsx index b7c735175..6435b32bd 100644 --- a/src/components/main/HistoryCalendar.tsx +++ b/src/components/main/HistoryCalendar.tsx @@ -3,6 +3,7 @@ import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import { selectTabState } from '../../global/selectors'; + import useLang from '../../hooks/useLang'; import CalendarModal from '../common/CalendarModal'; diff --git a/src/components/main/LockScreen.async.tsx b/src/components/main/LockScreen.async.tsx index bc59d261a..7c687ed61 100644 --- a/src/components/main/LockScreen.async.tsx +++ b/src/components/main/LockScreen.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './LockScreen'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const LockScreenAsync: FC = (props) => { diff --git a/src/components/main/LockScreen.tsx b/src/components/main/LockScreen.tsx index 918bce67d..63effc65f 100644 --- a/src/components/main/LockScreen.tsx +++ b/src/components/main/LockScreen.tsx @@ -6,20 +6,22 @@ import { getActions, withGlobal } from '../../global'; import type { GlobalState } from '../../global/types'; -import { LOCAL_TGS_URLS } from '../common/helpers/animatedAssets'; -import useLang from '../../hooks/useLang'; import { decryptSession } from '../../util/passcode'; +import { LOCAL_TGS_URLS } from '../common/helpers/animatedAssets'; + +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import useShowTransition from '../../hooks/useShowTransition'; import useTimeout from '../../hooks/useTimeout'; -import useFlag from '../../hooks/useFlag'; import AnimatedIconWithPreview from '../common/AnimatedIconWithPreview'; import PasswordForm from '../common/PasswordForm'; -import ConfirmDialog from '../ui/ConfirmDialog'; import Button from '../ui/Button'; +import ConfirmDialog from '../ui/ConfirmDialog'; import Link from '../ui/Link'; import styles from './LockScreen.module.scss'; + import lockPreviewUrl from '../../assets/lock.png'; export type OwnProps = { diff --git a/src/components/main/Main.async.tsx b/src/components/main/Main.async.tsx index f998c0ae3..a1f3aa75b 100644 --- a/src/components/main/Main.async.tsx +++ b/src/components/main/Main.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './Main'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const MainAsync: FC = (props) => { diff --git a/src/components/main/Main.tsx b/src/components/main/Main.tsx index a87ac770d..eb0020f8f 100644 --- a/src/components/main/Main.tsx +++ b/src/components/main/Main.tsx @@ -1,12 +1,13 @@ -import React, { - useEffect, memo, useState, useRef, useLayoutEffect, -} from '../../lib/teact/teact'; -import { addExtraClass } from '../../lib/teact/teact-dom'; -import { requestNextMutation } from '../../lib/fasterdom/fasterdom'; -import { getActions, getGlobal, withGlobal } from '../../global'; +import '../../global/actions/all'; import type { FC } from '../../lib/teact/teact'; -import type { LangCode } from '../../types'; +import React, { + memo, useEffect, useLayoutEffect, + useRef, useState, +} from '../../lib/teact/teact'; +import { addExtraClass } from '../../lib/teact/teact-dom'; +import { getActions, getGlobal, withGlobal } from '../../global'; + import type { ApiAttachBot, ApiChat, @@ -16,87 +17,88 @@ import type { ApiUser, } from '../../api/types'; import type { ApiLimitTypeWithModal, TabState } from '../../global/types'; +import type { LangCode } from '../../types'; import { ElectronEvent } from '../../types/electron'; -import '../../global/actions/all'; import { BASE_EMOJI_KEYWORD_LANG, DEBUG, INACTIVE_MARKER, IS_ELECTRON, } from '../../config'; -import { IS_ANDROID } from '../../util/windowEnvironment'; +import { requestNextMutation } from '../../lib/fasterdom/fasterdom'; +import { getUserFullName } from '../../global/helpers'; import { + selectCanAnimateInterface, + selectChatFolder, selectChatMessage, - selectTabState, selectCurrentMessageList, selectIsCurrentUserPremium, selectIsForwardModalOpen, selectIsMediaViewerOpen, + selectIsReactionPickerOpen, selectIsRightColumnShown, selectIsServiceChatReady, - selectUser, - selectIsReactionPickerOpen, - selectPerformanceSettingsValue, - selectCanAnimateInterface, - selectChatFolder, selectIsStoryViewerOpen, + selectPerformanceSettingsValue, + selectTabState, + selectUser, } from '../../global/selectors'; -import { getUserFullName } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; import { waitForTransitionEnd } from '../../util/cssAnimationEndListeners'; import { processDeepLink } from '../../util/deeplink'; -import { parseInitialLocationHash, parseLocationHash } from '../../util/routing'; import { Bundles, loadBundle } from '../../util/moduleLoader'; +import { parseInitialLocationHash, parseLocationHash } from '../../util/routing'; import updateIcon from '../../util/updateIcon'; +import { IS_ANDROID } from '../../util/windowEnvironment'; -import useLastCallback from '../../hooks/useLastCallback'; +import useAppLayout from '../../hooks/useAppLayout'; import useBackgroundMode from '../../hooks/useBackgroundMode'; import useBeforeUnload from '../../hooks/useBeforeUnload'; -import useSyncEffect from '../../hooks/useSyncEffect'; -import usePreventPinchZoomGesture from '../../hooks/usePreventPinchZoomGesture'; import useForceUpdate from '../../hooks/useForceUpdate'; -import useShowTransition from '../../hooks/useShowTransition'; +import { useFullscreenStatus } from '../../hooks/useFullscreen'; import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; import useInterval from '../../hooks/useInterval'; -import { useFullscreenStatus } from '../../hooks/useFullscreen'; -import useAppLayout from '../../hooks/useAppLayout'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePreventPinchZoomGesture from '../../hooks/usePreventPinchZoomGesture'; +import useShowTransition from '../../hooks/useShowTransition'; +import useSyncEffect from '../../hooks/useSyncEffect'; import useTimeout from '../../hooks/useTimeout'; +import ActiveCallHeader from '../calls/ActiveCallHeader.async'; +import GroupCall from '../calls/group/GroupCall.async'; +import PhoneCall from '../calls/phone/PhoneCall.async'; +import RatePhoneCallModal from '../calls/phone/RatePhoneCallModal.async'; +import CustomEmojiSetsModal from '../common/CustomEmojiSetsModal.async'; import StickerSetModal from '../common/StickerSetModal.async'; import UnreadCount from '../common/UnreadCounter'; import LeftColumn from '../left/LeftColumn'; -import MiddleColumn from '../middle/MiddleColumn'; -import RightColumn from '../right/RightColumn'; import MediaViewer from '../mediaViewer/MediaViewer.async'; import AudioPlayer from '../middle/AudioPlayer'; -import DownloadManager from './DownloadManager'; -import GameModal from './GameModal'; -import Notifications from './Notifications.async'; -import Dialogs from './Dialogs.async'; -import ForwardRecipientPicker from './ForwardRecipientPicker.async'; -import SafeLinkModal from './SafeLinkModal.async'; -import HistoryCalendar from './HistoryCalendar.async'; -import GroupCall from '../calls/group/GroupCall.async'; -import ActiveCallHeader from '../calls/ActiveCallHeader.async'; -import PhoneCall from '../calls/phone/PhoneCall.async'; +import ReactionPicker from '../middle/message/ReactionPicker.async'; import MessageListHistoryHandler from '../middle/MessageListHistoryHandler'; -import NewContactModal from './NewContactModal.async'; -import RatePhoneCallModal from '../calls/phone/RatePhoneCallModal.async'; -import WebAppModal from '../modals/webApp/WebAppModal.async'; -import BotTrustModal from './BotTrustModal.async'; +import MiddleColumn from '../middle/MiddleColumn'; import AttachBotInstallModal from '../modals/attachBotInstall/AttachBotInstallModal.async'; -import ConfettiContainer from './ConfettiContainer'; +import ChatlistModal from '../modals/chatlist/ChatlistModal.async'; +import MapModal from '../modals/map/MapModal.async'; import UrlAuthModal from '../modals/urlAuth/UrlAuthModal.async'; -import PremiumMainModal from './premium/PremiumMainModal.async'; +import WebAppModal from '../modals/webApp/WebAppModal.async'; import PaymentModal from '../payment/PaymentModal.async'; import ReceiptModal from '../payment/ReceiptModal.async'; -import PremiumLimitReachedModal from './premium/common/PremiumLimitReachedModal.async'; -import DeleteFolderDialog from './DeleteFolderDialog.async'; -import CustomEmojiSetsModal from '../common/CustomEmojiSetsModal.async'; -import DraftRecipientPicker from './DraftRecipientPicker.async'; -import AttachBotRecipientPicker from './AttachBotRecipientPicker.async'; -import ReactionPicker from '../middle/message/ReactionPicker.async'; -import ChatlistModal from '../modals/chatlist/ChatlistModal.async'; +import RightColumn from '../right/RightColumn'; import StoryViewer from '../story/StoryViewer.async'; -import MapModal from '../modals/map/MapModal.async'; +import AttachBotRecipientPicker from './AttachBotRecipientPicker.async'; +import BotTrustModal from './BotTrustModal.async'; +import ConfettiContainer from './ConfettiContainer'; +import DeleteFolderDialog from './DeleteFolderDialog.async'; +import Dialogs from './Dialogs.async'; +import DownloadManager from './DownloadManager'; +import DraftRecipientPicker from './DraftRecipientPicker.async'; +import ForwardRecipientPicker from './ForwardRecipientPicker.async'; +import GameModal from './GameModal'; +import HistoryCalendar from './HistoryCalendar.async'; +import NewContactModal from './NewContactModal.async'; +import Notifications from './Notifications.async'; +import PremiumLimitReachedModal from './premium/common/PremiumLimitReachedModal.async'; +import PremiumMainModal from './premium/PremiumMainModal.async'; +import SafeLinkModal from './SafeLinkModal.async'; import './Main.scss'; diff --git a/src/components/main/NewContactModal.async.tsx b/src/components/main/NewContactModal.async.tsx index 01cd22ca3..b5aae19ec 100644 --- a/src/components/main/NewContactModal.async.tsx +++ b/src/components/main/NewContactModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './NewContactModal'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const NewContactModalAsync: FC = (props) => { diff --git a/src/components/main/NewContactModal.tsx b/src/components/main/NewContactModal.tsx index 1d66d70dc..a6f707aa5 100644 --- a/src/components/main/NewContactModal.tsx +++ b/src/components/main/NewContactModal.tsx @@ -6,20 +6,21 @@ import { getActions, withGlobal } from '../../global'; import type { ApiCountryCode, ApiUser, ApiUserStatus } from '../../api/types'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { getUserStatus } from '../../global/helpers'; import { selectUser, selectUserStatus } from '../../global/selectors'; -import renderText from '../common/helpers/renderText'; import { formatPhoneNumberWithCode } from '../../util/phoneNumber'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import renderText from '../common/helpers/renderText'; + +import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; -import Modal from '../ui/Modal'; import Avatar from '../common/Avatar'; -import InputText from '../ui/InputText'; -import Checkbox from '../ui/Checkbox'; import Button from '../ui/Button'; +import Checkbox from '../ui/Checkbox'; +import InputText from '../ui/InputText'; +import Modal from '../ui/Modal'; import './NewContactModal.scss'; diff --git a/src/components/main/Notifications.async.tsx b/src/components/main/Notifications.async.tsx index f3af3abbc..d2a41cb96 100644 --- a/src/components/main/Notifications.async.tsx +++ b/src/components/main/Notifications.async.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/main/SafeLinkModal.async.tsx b/src/components/main/SafeLinkModal.async.tsx index 4d0fbda99..5c353f3b6 100644 --- a/src/components/main/SafeLinkModal.async.tsx +++ b/src/components/main/SafeLinkModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; import type { OwnProps } from './SafeLinkModal'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const SafeLinkModalAsync: FC = (props) => { diff --git a/src/components/main/SafeLinkModal.tsx b/src/components/main/SafeLinkModal.tsx index 52f6eed07..6746f2d4b 100644 --- a/src/components/main/SafeLinkModal.tsx +++ b/src/components/main/SafeLinkModal.tsx @@ -4,8 +4,9 @@ import { getActions } from '../../global'; import { ensureProtocol } from '../../util/ensureProtocol'; import renderText from '../common/helpers/renderText'; -import useLang from '../../hooks/useLang'; + import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import useLang from '../../hooks/useLang'; import ConfirmDialog from '../ui/ConfirmDialog'; diff --git a/src/components/main/premium/GiftOption.tsx b/src/components/main/premium/GiftOption.tsx index 337449714..d07912dc4 100644 --- a/src/components/main/premium/GiftOption.tsx +++ b/src/components/main/premium/GiftOption.tsx @@ -1,11 +1,12 @@ import type { ChangeEvent } from 'react'; +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiPremiumGiftOption } from '../../../api/types'; -import { formatCurrency } from '../../../util/formatCurrency'; import buildClassName from '../../../util/buildClassName'; +import { formatCurrency } from '../../../util/formatCurrency'; + import useLang from '../../../hooks/useLang'; import styles from './GiftOption.module.scss'; diff --git a/src/components/main/premium/GiftPremiumModal.async.tsx b/src/components/main/premium/GiftPremiumModal.async.tsx index 651b32bbe..22ff5d68e 100644 --- a/src/components/main/premium/GiftPremiumModal.async.tsx +++ b/src/components/main/premium/GiftPremiumModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './GiftPremiumModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const GiftPremiumModalAsync: FC = (props) => { diff --git a/src/components/main/premium/GiftPremiumModal.tsx b/src/components/main/premium/GiftPremiumModal.tsx index cabde31f8..c02fd1e2b 100644 --- a/src/components/main/premium/GiftPremiumModal.tsx +++ b/src/components/main/premium/GiftPremiumModal.tsx @@ -1,27 +1,27 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiPremiumGiftOption, ApiUser } from '../../../api/types'; -import { formatCurrency } from '../../../util/formatCurrency'; -import renderText from '../../common/helpers/renderText'; import { getUserFirstOrLastName } from '../../../global/helpers'; import { selectTabState, selectUser, selectUserFullInfo, } from '../../../global/selectors'; +import { formatCurrency } from '../../../util/formatCurrency'; +import renderText from '../../common/helpers/renderText'; import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; import useLang from '../../../hooks/useLang'; -import Modal from '../../ui/Modal'; +import Avatar from '../../common/Avatar'; import Button from '../../ui/Button'; import Link from '../../ui/Link'; -import Avatar from '../../common/Avatar'; +import Modal from '../../ui/Modal'; import GiftOption from './GiftOption'; import styles from './GiftPremiumModal.module.scss'; diff --git a/src/components/main/premium/PremiumFeatureItem.tsx b/src/components/main/premium/PremiumFeatureItem.tsx index 84db291d6..e484ff2e4 100644 --- a/src/components/main/premium/PremiumFeatureItem.tsx +++ b/src/components/main/premium/PremiumFeatureItem.tsx @@ -1,9 +1,9 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; -import renderText from '../../common/helpers/renderText'; -import { hexToRgb, lerpRgb } from '../../../util/switchTheme'; import buildClassName from '../../../util/buildClassName'; +import { hexToRgb, lerpRgb } from '../../../util/switchTheme'; +import renderText from '../../common/helpers/renderText'; import ListItem from '../../ui/ListItem'; diff --git a/src/components/main/premium/PremiumFeatureModal.tsx b/src/components/main/premium/PremiumFeatureModal.tsx index 5c5e490b2..dcdf8d9d2 100644 --- a/src/components/main/premium/PremiumFeatureModal.tsx +++ b/src/components/main/premium/PremiumFeatureModal.tsx @@ -6,20 +6,21 @@ import React, { import type { ApiPremiumPromo } from '../../../api/types'; import type { ApiLimitType, GlobalState } from '../../../global/types'; -import buildClassName from '../../../util/buildClassName'; -import useLang from '../../../hooks/useLang'; import animateHorizontalScroll from '../../../util/animateHorizontalScroll'; -import useFlag from '../../../hooks/useFlag'; -import renderText from '../../common/helpers/renderText'; -import usePrevious from '../../../hooks/usePrevious'; +import buildClassName from '../../../util/buildClassName'; import { formatCurrency } from '../../../util/formatCurrency'; +import renderText from '../../common/helpers/renderText'; +import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; +import usePrevious from '../../../hooks/usePrevious'; + +import SliderDots from '../../common/SliderDots'; import Button from '../../ui/Button'; import PremiumLimitPreview from './common/PremiumLimitPreview'; -import PremiumFeaturePreviewVideo from './previews/PremiumFeaturePreviewVideo'; -import SliderDots from '../../common/SliderDots'; import PremiumFeaturePreviewStickers from './previews/PremiumFeaturePreviewStickers'; import PremiumFeaturePreviewStories from './previews/PremiumFeaturePreviewStories'; +import PremiumFeaturePreviewVideo from './previews/PremiumFeaturePreviewVideo'; import styles from './PremiumFeatureModal.module.scss'; diff --git a/src/components/main/premium/PremiumMainModal.async.tsx b/src/components/main/premium/PremiumMainModal.async.tsx index 38d8bce82..ffd66d572 100644 --- a/src/components/main/premium/PremiumMainModal.async.tsx +++ b/src/components/main/premium/PremiumMainModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './PremiumMainModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const PremiumMainModalAsync: FC = (props) => { diff --git a/src/components/main/premium/PremiumMainModal.tsx b/src/components/main/premium/PremiumMainModal.tsx index 7ded6861b..f5457320f 100644 --- a/src/components/main/premium/PremiumMainModal.tsx +++ b/src/components/main/premium/PremiumMainModal.tsx @@ -1,58 +1,59 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiPremiumPromo, ApiSticker, ApiStickerSet, ApiUser, } from '../../../api/types'; import type { GlobalState } from '../../../global/types'; +import { TME_LINK_PREFIX } from '../../../config'; +import { getUserFullName } from '../../../global/helpers'; +import { + selectIsCurrentUserPremium, selectStickerSet, + selectTabState, selectUser, +} from '../../../global/selectors'; +import { selectPremiumLimit } from '../../../global/selectors/limits'; +import buildClassName from '../../../util/buildClassName'; +import { formatCurrency } from '../../../util/formatCurrency'; +import { REM } from '../../common/helpers/mediaDimensions'; +import renderText from '../../common/helpers/renderText'; +import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities'; + +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useSyncEffect from '../../../hooks/useSyncEffect'; + +import CustomEmoji from '../../common/CustomEmoji'; +import Button from '../../ui/Button'; +import Modal from '../../ui/Modal'; +import Transition from '../../ui/Transition'; +import PremiumFeatureItem from './PremiumFeatureItem'; import PremiumFeatureModal, { PREMIUM_FEATURE_DESCRIPTIONS, PREMIUM_FEATURE_SECTIONS, PREMIUM_FEATURE_TITLES, } from './PremiumFeatureModal'; -import { TME_LINK_PREFIX } from '../../../config'; -import { formatCurrency } from '../../../util/formatCurrency'; -import buildClassName from '../../../util/buildClassName'; -import { - selectTabState, selectIsCurrentUserPremium, selectUser, selectStickerSet, -} from '../../../global/selectors'; -import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities'; -import { selectPremiumLimit } from '../../../global/selectors/limits'; -import renderText from '../../common/helpers/renderText'; -import { getUserFullName } from '../../../global/helpers'; -import { REM } from '../../common/helpers/mediaDimensions'; - -import useLang from '../../../hooks/useLang'; -import useSyncEffect from '../../../hooks/useSyncEffect'; -import useLastCallback from '../../../hooks/useLastCallback'; - -import Modal from '../../ui/Modal'; -import Button from '../../ui/Button'; -import PremiumFeatureItem from './PremiumFeatureItem'; -import Transition from '../../ui/Transition'; -import CustomEmoji from '../../common/CustomEmoji'; - -import PremiumLogo from '../../../assets/premium/PremiumLogo.svg'; -import PremiumLimits from '../../../assets/premium/PremiumLimits.svg'; -import PremiumFile from '../../../assets/premium/PremiumFile.svg'; -import PremiumSpeed from '../../../assets/premium/PremiumSpeed.svg'; -import PremiumVoice from '../../../assets/premium/PremiumVoice.svg'; -import PremiumAds from '../../../assets/premium/PremiumAds.svg'; -import PremiumReactions from '../../../assets/premium/PremiumReactions.svg'; -import PremiumStickers from '../../../assets/premium/PremiumStickers.svg'; -import PremiumChats from '../../../assets/premium/PremiumChats.svg'; -import PremiumBadge from '../../../assets/premium/PremiumBadge.svg'; -import PremiumVideo from '../../../assets/premium/PremiumVideo.svg'; -import PremiumEmoji from '../../../assets/premium/PremiumEmoji.svg'; -import PremiumStatus from '../../../assets/premium/PremiumStatus.svg'; -import PremiumTranslate from '../../../assets/premium/PremiumTranslate.svg'; import styles from './PremiumMainModal.module.scss'; +import PremiumAds from '../../../assets/premium/PremiumAds.svg'; +import PremiumBadge from '../../../assets/premium/PremiumBadge.svg'; +import PremiumChats from '../../../assets/premium/PremiumChats.svg'; +import PremiumEmoji from '../../../assets/premium/PremiumEmoji.svg'; +import PremiumFile from '../../../assets/premium/PremiumFile.svg'; +import PremiumLimits from '../../../assets/premium/PremiumLimits.svg'; +import PremiumLogo from '../../../assets/premium/PremiumLogo.svg'; +import PremiumReactions from '../../../assets/premium/PremiumReactions.svg'; +import PremiumSpeed from '../../../assets/premium/PremiumSpeed.svg'; +import PremiumStatus from '../../../assets/premium/PremiumStatus.svg'; +import PremiumStickers from '../../../assets/premium/PremiumStickers.svg'; +import PremiumTranslate from '../../../assets/premium/PremiumTranslate.svg'; +import PremiumVideo from '../../../assets/premium/PremiumVideo.svg'; +import PremiumVoice from '../../../assets/premium/PremiumVoice.svg'; + const LIMIT_ACCOUNTS = 4; const STATUS_EMOJI_SIZE = 8 * REM; diff --git a/src/components/main/premium/common/PremiumLimitReachedModal.async.tsx b/src/components/main/premium/common/PremiumLimitReachedModal.async.tsx index 3d2b591fe..6feac4a51 100644 --- a/src/components/main/premium/common/PremiumLimitReachedModal.async.tsx +++ b/src/components/main/premium/common/PremiumLimitReachedModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../../lib/teact/teact'; import React from '../../../../lib/teact/teact'; -import { Bundles } from '../../../../util/moduleLoader'; import type { OwnProps } from './PremiumLimitReachedModal'; +import { Bundles } from '../../../../util/moduleLoader'; + import useModuleLoader from '../../../../hooks/useModuleLoader'; const PremiumLimitReachedModalAsync: FC = (props) => { diff --git a/src/components/main/premium/common/PremiumLimitReachedModal.tsx b/src/components/main/premium/common/PremiumLimitReachedModal.tsx index 3649c539a..267c2af74 100644 --- a/src/components/main/premium/common/PremiumLimitReachedModal.tsx +++ b/src/components/main/premium/common/PremiumLimitReachedModal.tsx @@ -1,21 +1,22 @@ import type { FC } from '../../../../lib/teact/teact'; import React, { memo, useCallback, useEffect } from '../../../../lib/teact/teact'; +import { getActions, withGlobal } from '../../../../global'; import type { ApiLimitTypeWithModal } from '../../../../global/types'; import type { LangFn } from '../../../../hooks/useLang'; import type { IconName } from '../../../../types/icons'; -import renderText from '../../../common/helpers/renderText'; +import { MAX_UPLOAD_FILEPART_SIZE } from '../../../../config'; +import { selectIsCurrentUserPremium, selectIsPremiumPurchaseBlocked } from '../../../../global/selectors'; import buildClassName from '../../../../util/buildClassName'; import { formatFileSize } from '../../../../util/textFormat'; -import { getActions, withGlobal } from '../../../../global'; -import { selectIsCurrentUserPremium, selectIsPremiumPurchaseBlocked } from '../../../../global/selectors'; -import useLang from '../../../../hooks/useLang'; -import { MAX_UPLOAD_FILEPART_SIZE } from '../../../../config'; -import useFlag from '../../../../hooks/useFlag'; +import renderText from '../../../common/helpers/renderText'; + +import useFlag from '../../../../hooks/useFlag'; +import useLang from '../../../../hooks/useLang'; -import Modal from '../../../ui/Modal'; import Button from '../../../ui/Button'; +import Modal from '../../../ui/Modal'; import PremiumLimitsCompare from './PremiumLimitsCompare'; import styles from './PremiumLimitReachedModal.module.scss'; diff --git a/src/components/main/premium/common/PremiumLimitsCompare.tsx b/src/components/main/premium/common/PremiumLimitsCompare.tsx index 3eac34dda..d7595468a 100644 --- a/src/components/main/premium/common/PremiumLimitsCompare.tsx +++ b/src/components/main/premium/common/PremiumLimitsCompare.tsx @@ -1,9 +1,10 @@ +import type { FC } from '../../../../lib/teact/teact'; import React, { memo } from '../../../../lib/teact/teact'; -import type { FC } from '../../../../lib/teact/teact'; import type { IconName } from '../../../../types/icons'; import buildClassName from '../../../../util/buildClassName'; + import useLang from '../../../../hooks/useLang'; import styles from './PremiumLimitsCompare.module.scss'; diff --git a/src/components/main/premium/previews/PremiumFeaturePreviewStickers.tsx b/src/components/main/premium/previews/PremiumFeaturePreviewStickers.tsx index b7304fac5..04fafaf31 100644 --- a/src/components/main/premium/previews/PremiumFeaturePreviewStickers.tsx +++ b/src/components/main/premium/previews/PremiumFeaturePreviewStickers.tsx @@ -4,12 +4,13 @@ import React, { } from '../../../../lib/teact/teact'; import { withGlobal } from '../../../../global'; -import type { GlobalState } from '../../../../global/types'; import type { ApiSticker } from '../../../../api/types'; +import type { GlobalState } from '../../../../global/types'; import cycleRestrict from '../../../../util/cycleRestrict'; -import useMedia from '../../../../hooks/useMedia'; + import useFlag from '../../../../hooks/useFlag'; +import useMedia from '../../../../hooks/useMedia'; import AnimatedSticker from '../../../common/AnimatedSticker'; diff --git a/src/components/main/premium/previews/PremiumFeaturePreviewStories.tsx b/src/components/main/premium/previews/PremiumFeaturePreviewStories.tsx index 9fc5f1e89..7c3e9b428 100644 --- a/src/components/main/premium/previews/PremiumFeaturePreviewStories.tsx +++ b/src/components/main/premium/previews/PremiumFeaturePreviewStories.tsx @@ -4,15 +4,15 @@ import { withGlobal } from '../../../../global'; import type { ApiUser } from '../../../../api/types'; import { selectUser } from '../../../../global/selectors'; -import { REM } from '../../../common/helpers/mediaDimensions'; -import { DPR } from '../../../../util/windowEnvironment'; -import { drawGradientCircle } from '../../../common/AvatarStoryCircle'; import buildClassName from '../../../../util/buildClassName'; +import { DPR } from '../../../../util/windowEnvironment'; +import { REM } from '../../../common/helpers/mediaDimensions'; import useLang from '../../../../hooks/useLang'; import useScrolledState from '../../../../hooks/useScrolledState'; import Avatar from '../../../common/Avatar'; +import { drawGradientCircle } from '../../../common/AvatarStoryCircle'; import PremiumFeatureItem from '../PremiumFeatureItem'; import styles from './PremiumFeaturePreviewStories.module.scss'; diff --git a/src/components/main/premium/previews/PremiumFeaturePreviewVideo.tsx b/src/components/main/premium/previews/PremiumFeaturePreviewVideo.tsx index d149e7f53..1b2f9ee7a 100644 --- a/src/components/main/premium/previews/PremiumFeaturePreviewVideo.tsx +++ b/src/components/main/premium/previews/PremiumFeaturePreviewVideo.tsx @@ -3,16 +3,18 @@ import React, { memo } from '../../../../lib/teact/teact'; import type { ApiThumbnail } from '../../../../api/types'; -import useMedia from '../../../../hooks/useMedia'; import buildClassName from '../../../../util/buildClassName'; + import useCanvasBlur from '../../../../hooks/useCanvasBlur'; +import useMedia from '../../../../hooks/useMedia'; import useMediaTransition from '../../../../hooks/useMediaTransition'; -import DeviceFrame from '../../../../assets/premium/DeviceFrame.svg'; import OptimizedVideo from '../../../ui/OptimizedVideo'; import styles from './PremiumFeaturePreviewVideo.module.scss'; +import DeviceFrame from '../../../../assets/premium/DeviceFrame.svg'; + type OwnProps = { videoId: string; isReverseAnimation: boolean; diff --git a/src/components/mediaViewer/MediaViewer.async.tsx b/src/components/mediaViewer/MediaViewer.async.tsx index 4f7f47e57..42ac3d98e 100644 --- a/src/components/mediaViewer/MediaViewer.async.tsx +++ b/src/components/mediaViewer/MediaViewer.async.tsx @@ -2,6 +2,7 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; interface OwnProps { diff --git a/src/components/mediaViewer/MediaViewer.tsx b/src/components/mediaViewer/MediaViewer.tsx index 828003852..1de0fbff1 100644 --- a/src/components/mediaViewer/MediaViewer.tsx +++ b/src/components/mediaViewer/MediaViewer.tsx @@ -2,47 +2,48 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, } from '../../lib/teact/teact'; +import { getActions, withGlobal } from '../../global'; import type { ApiChat, ApiMessage, ApiPhoto, ApiUser, } from '../../api/types'; import { MediaViewerOrigin } from '../../types'; -import { getActions, withGlobal } from '../../global'; +import { ANIMATION_END_DELAY } from '../../config'; import { getChatMediaMessageIds, isChatAdmin, isUserId } from '../../global/helpers'; import { selectChat, selectChatMessage, selectChatMessages, selectChatScheduledMessages, - selectCurrentMediaSearch, selectTabState, - selectIsChatWithSelf, + selectCurrentMediaSearch, selectIsChatWithSelf, selectListedIds, - selectScheduledMessage, - selectUser, selectOutlyingListByMessageId, - selectUserFullInfo, selectPerformanceSettingsValue, + selectScheduledMessage, + selectTabState, + selectUser, + selectUserFullInfo, } from '../../global/selectors'; import { stopCurrentAudio } from '../../util/audioPlayer'; import captureEscKeyListener from '../../util/captureEscKeyListener'; -import { ANIMATION_END_DELAY } from '../../config'; -import { MEDIA_VIEWER_MEDIA_QUERY } from '../common/helpers/mediaDimensions'; import { disableDirectTextInput, enableDirectTextInput } from '../../util/directInputManager'; -import { animateClosing, animateOpening } from './helpers/ghostAnimation'; +import { MEDIA_VIEWER_MEDIA_QUERY } from '../common/helpers/mediaDimensions'; import { renderMessageText } from '../common/helpers/renderMessageText'; +import { animateClosing, animateOpening } from './helpers/ghostAnimation'; +import useAppLayout from '../../hooks/useAppLayout'; +import useElectronDrag from '../../hooks/useElectronDrag'; import useFlag from '../../hooks/useFlag'; import useForceUpdate from '../../hooks/useForceUpdate'; import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; -import { dispatchPriorityPlaybackEvent } from '../../hooks/usePriorityPlaybackCheck'; -import { exitPictureInPictureIfNeeded, usePictureInPictureSignal } from '../../hooks/usePictureInPicture'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import { exitPictureInPictureIfNeeded, usePictureInPictureSignal } from '../../hooks/usePictureInPicture'; import usePrevious from '../../hooks/usePrevious'; -import { useMediaProps } from './hooks/useMediaProps'; -import useElectronDrag from '../../hooks/useElectronDrag'; -import useAppLayout from '../../hooks/useAppLayout'; +import { dispatchPriorityPlaybackEvent } from '../../hooks/usePriorityPlaybackCheck'; import { useStateRef } from '../../hooks/useStateRef'; +import { useMediaProps } from './hooks/useMediaProps'; import ReportModal from '../common/ReportModal'; import Button from '../ui/Button'; @@ -53,7 +54,6 @@ import MediaViewerSlides from './MediaViewerSlides'; import SenderInfo from './SenderInfo'; import './MediaViewer.scss'; -import useLastCallback from '../../hooks/useLastCallback'; type StateProps = { chatId?: string; diff --git a/src/components/mediaViewer/MediaViewerActions.tsx b/src/components/mediaViewer/MediaViewerActions.tsx index 520f80b61..8e144ac77 100644 --- a/src/components/mediaViewer/MediaViewerActions.tsx +++ b/src/components/mediaViewer/MediaViewerActions.tsx @@ -1,35 +1,35 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { - ApiMessage, ApiPhoto, ApiChat, ApiUser, + ApiChat, ApiMessage, ApiPhoto, ApiUser, } from '../../api/types'; import type { MessageListType } from '../../global/types'; import type { MenuItemProps } from '../ui/MenuItem'; +import { getMessageMediaFormat, getMessageMediaHash, isUserId } from '../../global/helpers'; import { - selectIsDownloading, - selectIsMessageProtected, selectAllowedMessageActions, selectCurrentMessageList, selectIsChatProtected, + selectIsDownloading, + selectIsMessageProtected, } from '../../global/selectors'; -import { getMessageMediaFormat, getMessageMediaHash, isUserId } from '../../global/helpers'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; -import useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress'; -import useFlag from '../../hooks/useFlag'; import useAppLayout from '../../hooks/useAppLayout'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useMediaWithLoadProgress from '../../hooks/useMediaWithLoadProgress'; import useZoomChange from './hooks/useZoomChangeSignal'; +import DeleteMessageModal from '../common/DeleteMessageModal'; +import DeleteProfilePhotoModal from '../common/DeleteProfilePhotoModal'; import Button from '../ui/Button'; import DropdownMenu from '../ui/DropdownMenu'; import MenuItem from '../ui/MenuItem'; import ProgressSpinner from '../ui/ProgressSpinner'; -import DeleteMessageModal from '../common/DeleteMessageModal'; -import DeleteProfilePhotoModal from '../common/DeleteProfilePhotoModal'; import './MediaViewerActions.scss'; diff --git a/src/components/mediaViewer/MediaViewerContent.tsx b/src/components/mediaViewer/MediaViewerContent.tsx index f6b1c74ba..783d05214 100644 --- a/src/components/mediaViewer/MediaViewerContent.tsx +++ b/src/components/mediaViewer/MediaViewerContent.tsx @@ -7,20 +7,20 @@ import type { } from '../../api/types'; import { MediaViewerOrigin } from '../../types'; -import { IS_TOUCH_ENV, ARE_WEBCODECS_SUPPORTED } from '../../util/windowEnvironment'; import { - selectChat, selectChatMessage, selectTabState, selectIsMessageProtected, selectScheduledMessage, selectUser, + selectChat, selectChatMessage, selectIsMessageProtected, selectScheduledMessage, selectTabState, selectUser, } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; +import stopEvent from '../../util/stopEvent'; +import { ARE_WEBCODECS_SUPPORTED, IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { calculateMediaViewerDimensions } from '../common/helpers/mediaDimensions'; import { renderMessageText } from '../common/helpers/renderMessageText'; -import stopEvent from '../../util/stopEvent'; -import buildClassName from '../../util/buildClassName'; -import { useMediaProps } from './hooks/useMediaProps'; -import useLastCallback from '../../hooks/useLastCallback'; import useAppLayout from '../../hooks/useAppLayout'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import useControlsSignal from './hooks/useControlsSignal'; +import { useMediaProps } from './hooks/useMediaProps'; import Spinner from '../ui/Spinner'; import MediaViewerFooter from './MediaViewerFooter'; diff --git a/src/components/mediaViewer/MediaViewerFooter.tsx b/src/components/mediaViewer/MediaViewerFooter.tsx index 0891f9696..33ed55511 100644 --- a/src/components/mediaViewer/MediaViewerFooter.tsx +++ b/src/components/mediaViewer/MediaViewerFooter.tsx @@ -3,13 +3,14 @@ import React, { useEffect, useState } from '../../lib/teact/teact'; import type { TextPart } from '../../types'; +import buildClassName from '../../util/buildClassName'; +import { throttle } from '../../util/schedulers'; import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { REM } from '../common/helpers/mediaDimensions'; -import { throttle } from '../../util/schedulers'; -import buildClassName from '../../util/buildClassName'; + import useAppLayout from '../../hooks/useAppLayout'; -import useControlsSignal from './hooks/useControlsSignal'; import useDerivedState from '../../hooks/useDerivedState'; +import useControlsSignal from './hooks/useControlsSignal'; import './MediaViewerFooter.scss'; diff --git a/src/components/mediaViewer/MediaViewerSlides.tsx b/src/components/mediaViewer/MediaViewerSlides.tsx index a31a83579..6c0b90ee3 100644 --- a/src/components/mediaViewer/MediaViewerSlides.tsx +++ b/src/components/mediaViewer/MediaViewerSlides.tsx @@ -9,22 +9,22 @@ import type { RealTouchEvent } from '../../util/captureEvents'; import { animateNumber, timingFunctions } from '../../util/animation'; import buildClassName from '../../util/buildClassName'; import { captureEvents, IOS_SCREEN_EDGE_THRESHOLD } from '../../util/captureEvents'; -import { IS_IOS, IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { clamp, isBetween, round } from '../../util/math'; import { debounce } from '../../util/schedulers'; +import { IS_IOS, IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import useLastCallback from '../../hooks/useLastCallback'; import useDebouncedCallback from '../../hooks/useDebouncedCallback'; -import useLang from '../../hooks/useLang'; -import useTimeout from '../../hooks/useTimeout'; -import useWindowSize from '../../hooks/useWindowSize'; -import useHistoryBack from '../../hooks/useHistoryBack'; -import useSignal from '../../hooks/useSignal'; import useDerivedState from '../../hooks/useDerivedState'; import { useFullscreenStatus } from '../../hooks/useFullscreen'; -import useZoomChange from './hooks/useZoomChangeSignal'; +import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useSignal from '../../hooks/useSignal'; import { useSignalRef } from '../../hooks/useSignalRef'; +import useTimeout from '../../hooks/useTimeout'; +import useWindowSize from '../../hooks/useWindowSize'; import useControlsSignal from './hooks/useControlsSignal'; +import useZoomChange from './hooks/useZoomChangeSignal'; import MediaViewerContent from './MediaViewerContent'; diff --git a/src/components/mediaViewer/SeekLine.tsx b/src/components/mediaViewer/SeekLine.tsx index 14b561aae..7a9a15f4c 100644 --- a/src/components/mediaViewer/SeekLine.tsx +++ b/src/components/mediaViewer/SeekLine.tsx @@ -1,25 +1,25 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useRef, useState, useEffect, memo, useMemo, useLayoutEffect, + memo, useEffect, useLayoutEffect, + useMemo, useRef, useState, } from '../../lib/teact/teact'; -import type { BufferedRange } from '../../hooks/useBuffering'; import type { ApiDimensions } from '../../api/types'; +import type { BufferedRange } from '../../hooks/useBuffering'; -import useLastCallback from '../../hooks/useLastCallback'; -import useSignal from '../../hooks/useSignal'; -import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; -import { useThrottledSignal } from '../../hooks/useAsyncResolvers'; -import useVideoWaitingSignal from './hooks/useVideoWaitingSignal'; - -import { captureEvents } from '../../util/captureEvents'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { createVideoPreviews, getPreviewDimensions, renderVideoPreview } from '../../lib/video-preview/VideoPreview'; +import { animateNumber } from '../../util/animation'; import buildClassName from '../../util/buildClassName'; +import { captureEvents } from '../../util/captureEvents'; import { formatMediaDuration } from '../../util/dateFormat'; import { clamp, round } from '../../util/math'; -import { animateNumber } from '../../util/animation'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import { createVideoPreviews, renderVideoPreview, getPreviewDimensions } from '../../lib/video-preview/VideoPreview'; +import { useThrottledSignal } from '../../hooks/useAsyncResolvers'; +import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; +import useLastCallback from '../../hooks/useLastCallback'; +import useSignal from '../../hooks/useSignal'; +import useVideoWaitingSignal from './hooks/useVideoWaitingSignal'; import ShowTransition from '../ui/ShowTransition'; diff --git a/src/components/mediaViewer/SenderInfo.tsx b/src/components/mediaViewer/SenderInfo.tsx index d82124f81..577c7cebf 100644 --- a/src/components/mediaViewer/SenderInfo.tsx +++ b/src/components/mediaViewer/SenderInfo.tsx @@ -5,18 +5,18 @@ import { getActions, withGlobal } from '../../global'; import type { ApiChat, ApiMessage, ApiUser } from '../../api/types'; import { getSenderTitle, isUserId } from '../../global/helpers'; -import { formatMediaDateTime } from '../../util/dateFormat'; -import renderText from '../common/helpers/renderText'; import { selectChat, selectChatMessage, selectSender, selectUser, } from '../../global/selectors'; +import { formatMediaDateTime } from '../../util/dateFormat'; +import renderText from '../common/helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; import useAppLayout from '../../hooks/useAppLayout'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import Avatar from '../common/Avatar'; diff --git a/src/components/mediaViewer/SlideTransition.tsx b/src/components/mediaViewer/SlideTransition.tsx index 6c3c8e89f..a8781c8e5 100644 --- a/src/components/mediaViewer/SlideTransition.tsx +++ b/src/components/mediaViewer/SlideTransition.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; +import type { ChildrenFn, TransitionProps } from '../ui/Transition'; + import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; -import type { ChildrenFn, TransitionProps } from '../ui/Transition'; import Transition from '../ui/Transition'; const SlideTransition: FC = ({ children, ...props }) => { diff --git a/src/components/mediaViewer/VideoPlayer.tsx b/src/components/mediaViewer/VideoPlayer.tsx index c512aa6c5..89850fa95 100644 --- a/src/components/mediaViewer/VideoPlayer.tsx +++ b/src/components/mediaViewer/VideoPlayer.tsx @@ -6,22 +6,22 @@ import { getActions } from '../../global'; import type { ApiDimensions } from '../../api/types'; -import { IS_IOS, IS_TOUCH_ENV, IS_YA_BROWSER } from '../../util/windowEnvironment'; +import { clamp } from '../../util/math'; import safePlay from '../../util/safePlay'; import stopEvent from '../../util/stopEvent'; -import { clamp } from '../../util/math'; +import { IS_IOS, IS_TOUCH_ENV, IS_YA_BROWSER } from '../../util/windowEnvironment'; -import useLastCallback from '../../hooks/useLastCallback'; +import useUnsupportedMedia from '../../hooks/media/useUnsupportedMedia'; +import useAppLayout from '../../hooks/useAppLayout'; import useBuffering from '../../hooks/useBuffering'; +import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; import useFullscreen from '../../hooks/useFullscreen'; +import useLastCallback from '../../hooks/useLastCallback'; import usePictureInPicture from '../../hooks/usePictureInPicture'; import useShowTransition from '../../hooks/useShowTransition'; import useVideoCleanup from '../../hooks/useVideoCleanup'; -import useAppLayout from '../../hooks/useAppLayout'; -import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; import useControlsSignal from './hooks/useControlsSignal'; import useVideoWaitingSignal from './hooks/useVideoWaitingSignal'; -import useUnsupportedMedia from '../../hooks/media/useUnsupportedMedia'; import Button from '../ui/Button'; import ProgressSpinner from '../ui/ProgressSpinner'; diff --git a/src/components/mediaViewer/VideoPlayerControls.tsx b/src/components/mediaViewer/VideoPlayerControls.tsx index 679cefa0b..4a7d0a0ef 100644 --- a/src/components/mediaViewer/VideoPlayerControls.tsx +++ b/src/components/mediaViewer/VideoPlayerControls.tsx @@ -1,30 +1,31 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useEffect, useMemo, useLayoutEffect, + memo, useEffect, useLayoutEffect, + useMemo, } from '../../lib/teact/teact'; -import type { BufferedRange } from '../../hooks/useBuffering'; import type { ApiDimensions } from '../../api/types'; - -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import useAppLayout from '../../hooks/useAppLayout'; -import useDerivedState from '../../hooks/useDerivedState'; -import useSignal from '../../hooks/useSignal'; -import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; -import useControlsSignal from './hooks/useControlsSignal'; +import type { BufferedRange } from '../../hooks/useBuffering'; import buildClassName from '../../util/buildClassName'; -import { IS_IOS, IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { formatMediaDuration } from '../../util/dateFormat'; import { formatFileSize } from '../../util/textFormat'; +import { IS_IOS, IS_TOUCH_ENV } from '../../util/windowEnvironment'; + +import useAppLayout from '../../hooks/useAppLayout'; +import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; +import useDerivedState from '../../hooks/useDerivedState'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useSignal from '../../hooks/useSignal'; +import useControlsSignal from './hooks/useControlsSignal'; -import SeekLine from './SeekLine'; import Button from '../ui/Button'; -import RangeSlider from '../ui/RangeSlider'; import Menu from '../ui/Menu'; import MenuItem from '../ui/MenuItem'; +import RangeSlider from '../ui/RangeSlider'; +import SeekLine from './SeekLine'; import './VideoPlayerControls.scss'; diff --git a/src/components/mediaViewer/helpers/ghostAnimation.ts b/src/components/mediaViewer/helpers/ghostAnimation.ts index 051695608..05f41a442 100644 --- a/src/components/mediaViewer/helpers/ghostAnimation.ts +++ b/src/components/mediaViewer/helpers/ghostAnimation.ts @@ -1,20 +1,19 @@ -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; - import type { ApiDimensions, ApiMessage } from '../../../api/types'; import { MediaViewerOrigin } from '../../../types'; import { ANIMATION_END_DELAY, MESSAGE_CONTENT_SELECTOR } from '../../../config'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import { getMessageHtmlId } from '../../../global/helpers'; +import { isElementInViewport } from '../../../util/isElementInViewport'; +import stopEvent from '../../../util/stopEvent'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import windowSize from '../../../util/windowSize'; import { calculateDimensions, getMediaViewerAvailableDimensions, MEDIA_VIEWER_MEDIA_QUERY, REM, } from '../../common/helpers/mediaDimensions'; -import windowSize from '../../../util/windowSize'; -import stopEvent from '../../../util/stopEvent'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import { getMessageHtmlId } from '../../../global/helpers'; -import { isElementInViewport } from '../../../util/isElementInViewport'; const ANIMATION_DURATION = 200; diff --git a/src/components/mediaViewer/hooks/useControlsSignal.ts b/src/components/mediaViewer/hooks/useControlsSignal.ts index fbeb52f96..eed6659e8 100644 --- a/src/components/mediaViewer/hooks/useControlsSignal.ts +++ b/src/components/mediaViewer/hooks/useControlsSignal.ts @@ -1,4 +1,5 @@ import { createSignal } from '../../../util/signals'; + import useDerivedSignal from '../../../hooks/useDerivedSignal'; const [getControlsVisible, setControlsVisible] = createSignal(false); diff --git a/src/components/mediaViewer/hooks/useMediaProps.ts b/src/components/mediaViewer/hooks/useMediaProps.ts index 725b75f92..ec4d06c2b 100644 --- a/src/components/mediaViewer/hooks/useMediaProps.ts +++ b/src/components/mediaViewer/hooks/useMediaProps.ts @@ -1,32 +1,35 @@ +import { useMemo } from '../../../lib/teact/teact'; + import type { - ApiMessage, ApiChat, ApiUser, + ApiChat, ApiMessage, ApiUser, } from '../../../api/types'; import { ApiMediaFormat } from '../../../api/types'; +import { MediaViewerOrigin } from '../../../types'; + import { - getVideoAvatarMediaHash, getChatAvatarHash, + getMessageActionPhoto, + getMessageDocument, + getMessageFileName, + getMessageFileSize, + getMessageMediaFormat, getMessageMediaHash, + getMessageMediaThumbDataUri, getMessagePhoto, getMessageVideo, getMessageWebPagePhoto, getMessageWebPageVideo, + getPhotoFullDimensions, + getVideoAvatarMediaHash, + getVideoDimensions, isMessageDocumentPhoto, isMessageDocumentVideo, - getMessageMediaFormat, - getMessageMediaThumbDataUri, - getMessageFileName, - getMessageDocument, - getPhotoFullDimensions, - getVideoDimensions, - getMessageFileSize, - getMessageActionPhoto, } from '../../../global/helpers'; -import { useMemo } from '../../../lib/teact/teact'; +import { AVATAR_FULL_DIMENSIONS, VIDEO_AVATAR_FULL_DIMENSIONS } from '../../common/helpers/mediaDimensions'; + +import useBlurSync from '../../../hooks/useBlurSync'; import useMedia from '../../../hooks/useMedia'; import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; -import useBlurSync from '../../../hooks/useBlurSync'; -import { MediaViewerOrigin } from '../../../types'; -import { VIDEO_AVATAR_FULL_DIMENSIONS, AVATAR_FULL_DIMENSIONS } from '../../common/helpers/mediaDimensions'; type UseMediaProps = { mediaId?: number; diff --git a/src/components/mediaViewer/hooks/useVideoWaitingSignal.ts b/src/components/mediaViewer/hooks/useVideoWaitingSignal.ts index c2246aaaa..64e86f018 100644 --- a/src/components/mediaViewer/hooks/useVideoWaitingSignal.ts +++ b/src/components/mediaViewer/hooks/useVideoWaitingSignal.ts @@ -1,6 +1,7 @@ -import { createSignal } from '../../../util/signals'; import { useEffect } from '../../../lib/teact/teact'; +import { createSignal } from '../../../util/signals'; + export const [getIsVideoWaiting, setIsVideoWaiting] = createSignal(false); export default function useVideoWaitingSignal() { diff --git a/src/components/mediaViewer/hooks/useZoomChangeSignal.ts b/src/components/mediaViewer/hooks/useZoomChangeSignal.ts index 897e9bf83..6e1c75591 100644 --- a/src/components/mediaViewer/hooks/useZoomChangeSignal.ts +++ b/src/components/mediaViewer/hooks/useZoomChangeSignal.ts @@ -1,6 +1,7 @@ -import { createSignal } from '../../../util/signals'; import { useEffect } from '../../../lib/teact/teact'; +import { createSignal } from '../../../util/signals'; + const [getZoomChange, setZoomChange] = createSignal(1); export default function useZoomChange() { diff --git a/src/components/middle/ActionMessage.tsx b/src/components/middle/ActionMessage.tsx index eb8f35fa1..99a28e918 100644 --- a/src/components/middle/ActionMessage.tsx +++ b/src/components/middle/ActionMessage.tsx @@ -7,10 +7,12 @@ import { getActions, getGlobal, withGlobal } from '../../global'; import type { ApiChat, ApiMessage, ApiSticker, ApiTopic, ApiUser, } from '../../api/types'; +import type { MessageListType } from '../../global/types'; +import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import type { FocusDirection } from '../../types'; import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage'; -import type { MessageListType } from '../../global/types'; +import { getMessageHtmlId, isChatChannel } from '../../global/helpers'; import { selectCanPlayAnimatedEmojis, selectChat, @@ -20,22 +22,21 @@ import { selectTopicFromMessage, selectUser, } from '../../global/selectors'; -import { getMessageHtmlId, isChatChannel } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; import { renderActionMessageText } from '../common/helpers/renderActionMessageText'; import { preventMessageInputBlur } from './helpers/preventMessageInputBlur'; -import useEnsureMessage from '../../hooks/useEnsureMessage'; -import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; -import type { ObserveFn } from '../../hooks/useIntersectionObserver'; -import { useIsIntersecting, useOnIntersect } from '../../hooks/useIntersectionObserver'; -import useFocusMessage from './message/hooks/useFocusMessage'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import useShowTransition from '../../hooks/useShowTransition'; -import ContextMenuContainer from './message/ContextMenuContainer.async'; +import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; +import useEnsureMessage from '../../hooks/useEnsureMessage'; +import useFlag from '../../hooks/useFlag'; +import { useIsIntersecting, useOnIntersect } from '../../hooks/useIntersectionObserver'; +import useLang from '../../hooks/useLang'; +import useShowTransition from '../../hooks/useShowTransition'; +import useFocusMessage from './message/hooks/useFocusMessage'; + import AnimatedIconFromSticker from '../common/AnimatedIconFromSticker'; import ActionMessageSuggestedAvatar from './ActionMessageSuggestedAvatar'; +import ContextMenuContainer from './message/ContextMenuContainer.async'; type OwnProps = { message: ApiMessage; diff --git a/src/components/middle/ActionMessageSuggestedAvatar.tsx b/src/components/middle/ActionMessageSuggestedAvatar.tsx index 0578dca48..6c45b93bf 100644 --- a/src/components/middle/ActionMessageSuggestedAvatar.tsx +++ b/src/components/middle/ActionMessageSuggestedAvatar.tsx @@ -1,23 +1,23 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useState } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiMessage } from '../../api/types'; import type { TextPart } from '../../types'; -import { MediaViewerOrigin, SettingsScreens } from '../../types'; import { ApiMediaFormat, MAIN_THREAD_ID } from '../../api/types'; +import { MediaViewerOrigin, SettingsScreens } from '../../types'; import { getMessageMediaHash } from '../../global/helpers'; import * as mediaLoader from '../../util/mediaLoader'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; import useMedia from '../../hooks/useMedia'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; import Avatar from '../common/Avatar'; -import CropModal from '../ui/CropModal'; import ConfirmDialog from '../ui/ConfirmDialog'; +import CropModal from '../ui/CropModal'; type OwnProps = { message: ApiMessage; diff --git a/src/components/middle/AudioPlayer.tsx b/src/components/middle/AudioPlayer.tsx index 173c66f77..92bd2657c 100644 --- a/src/components/middle/AudioPlayer.tsx +++ b/src/components/middle/AudioPlayer.tsx @@ -1,39 +1,38 @@ +import type { FC } from '../../lib/teact/teact'; import React, { useMemo, useRef } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; -import type { AudioOrigin } from '../../types'; import type { ApiAudio, ApiChat, ApiMessage, ApiUser, } from '../../api/types'; +import type { AudioOrigin } from '../../types'; -import { IS_IOS, IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION } from '../../config'; - -import * as mediaLoader from '../../util/mediaLoader'; import { getMediaDuration, getMessageContent, getMessageMediaHash, getSenderTitle, isMessageLocal, } from '../../global/helpers'; -import { selectChat, selectTabState, selectSender } from '../../global/selectors'; -import buildClassName from '../../util/buildClassName'; +import { selectChat, selectSender, selectTabState } from '../../global/selectors'; import { makeTrackId } from '../../util/audioPlayer'; +import buildClassName from '../../util/buildClassName'; +import * as mediaLoader from '../../util/mediaLoader'; import { clearMediaSession } from '../../util/mediaSession'; +import { IS_IOS, IS_TOUCH_ENV } from '../../util/windowEnvironment'; import renderText from '../common/helpers/renderText'; -import useLang from '../../hooks/useLang'; import useAppLayout from '../../hooks/useAppLayout'; import useAudioPlayer from '../../hooks/useAudioPlayer'; -import useMessageMediaMetadata from '../../hooks/useMessageMediaMetadata'; import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useMessageMediaMetadata from '../../hooks/useMessageMediaMetadata'; -import RippleEffect from '../ui/RippleEffect'; import Button from '../ui/Button'; -import RangeSlider from '../ui/RangeSlider'; import DropdownMenu from '../ui/DropdownMenu'; import MenuItem from '../ui/MenuItem'; +import RangeSlider from '../ui/RangeSlider'; +import RippleEffect from '../ui/RippleEffect'; import './AudioPlayer.scss'; -import useLastCallback from '../../hooks/useLastCallback'; type OwnProps = { message: ApiMessage; diff --git a/src/components/middle/ChatLanguageModal.async.tsx b/src/components/middle/ChatLanguageModal.async.tsx index a116bbc0b..aca227846 100644 --- a/src/components/middle/ChatLanguageModal.async.tsx +++ b/src/components/middle/ChatLanguageModal.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './ChatLanguageModal'; import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const ChatLanguageModalAsync: FC = (props) => { diff --git a/src/components/middle/ChatLanguageModal.tsx b/src/components/middle/ChatLanguageModal.tsx index 8fab50f2f..7e9323060 100644 --- a/src/components/middle/ChatLanguageModal.tsx +++ b/src/components/middle/ChatLanguageModal.tsx @@ -1,26 +1,25 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; - +import { SUPPORTED_TRANSLATION_LANGUAGES } from '../../config'; import { selectLanguageCode, selectRequestedChatTranslationLanguage, selectRequestedMessageTranslationLanguage, selectTabState, } from '../../global/selectors'; -import { SUPPORTED_TRANSLATION_LANGUAGES } from '../../config'; import buildClassName from '../../util/buildClassName'; import renderText from '../common/helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import Modal from '../ui/Modal'; -import ListItem from '../ui/ListItem'; import InputText from '../ui/InputText'; +import ListItem from '../ui/ListItem'; +import Modal from '../ui/Modal'; import styles from './ChatLanguageModal.module.scss'; diff --git a/src/components/middle/ChatReportPanel.tsx b/src/components/middle/ChatReportPanel.tsx index 4edfd970b..f41632b26 100644 --- a/src/components/middle/ChatReportPanel.tsx +++ b/src/components/middle/ChatReportPanel.tsx @@ -1,22 +1,22 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo, useState } from '../../lib/teact/teact'; -import { withGlobal, getActions } from '../../global'; +import { getActions, withGlobal } from '../../global'; import type { ApiChat, ApiChatSettings, ApiUser } from '../../api/types'; -import { selectChat, selectUser } from '../../global/selectors'; import { getChatTitle, getUserFirstOrLastName, getUserFullName, isChatBasicGroup, isUserId, } from '../../global/helpers'; +import { selectChat, selectUser } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import Button from '../ui/Button'; -import ConfirmDialog from '../ui/ConfirmDialog'; import Checkbox from '../ui/Checkbox'; +import ConfirmDialog from '../ui/ConfirmDialog'; import './ChatReportPanel.scss'; diff --git a/src/components/middle/ContactGreeting.tsx b/src/components/middle/ContactGreeting.tsx index c8f88484e..32759f8fb 100644 --- a/src/components/middle/ContactGreeting.tsx +++ b/src/components/middle/ContactGreeting.tsx @@ -5,11 +5,11 @@ import { getActions, withGlobal } from '../../global'; import type { ApiSticker, ApiUpdateConnectionStateType } from '../../api/types'; import type { MessageList } from '../../global/types'; -import { selectChat, selectCurrentMessageList } from '../../global/selectors'; import { getUserIdDividend } from '../../global/helpers'; +import { selectChat, selectCurrentMessageList } from '../../global/selectors'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import StickerView from '../common/StickerView'; diff --git a/src/components/middle/DeleteSelectedMessageModal.tsx b/src/components/middle/DeleteSelectedMessageModal.tsx index ba545f8c4..e6a412f45 100644 --- a/src/components/middle/DeleteSelectedMessageModal.tsx +++ b/src/components/middle/DeleteSelectedMessageModal.tsx @@ -3,23 +3,23 @@ import React, { memo, useEffect } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import { - selectCanDeleteSelectedMessages, selectCurrentChat, selectTabState, selectUser, -} from '../../global/selectors'; -import { - isUserId, - getUserFirstOrLastName, getPrivateChatUserId, + getUserFirstOrLastName, isChatBasicGroup, isChatSuperGroup, + isUserId, } from '../../global/helpers'; +import { + selectCanDeleteSelectedMessages, selectCurrentChat, selectTabState, selectUser, +} from '../../global/selectors'; import renderText from '../common/helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import usePrevious from '../../hooks/usePrevious'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; +import Modal from '../ui/Modal'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/middle/EmojiInteractionAnimation.async.tsx b/src/components/middle/EmojiInteractionAnimation.async.tsx index 9aa5d3eed..48c82016f 100644 --- a/src/components/middle/EmojiInteractionAnimation.async.tsx +++ b/src/components/middle/EmojiInteractionAnimation.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './EmojiInteractionAnimation'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/middle/EmojiInteractionAnimation.tsx b/src/components/middle/EmojiInteractionAnimation.tsx index 7466591db..864c37a4b 100644 --- a/src/components/middle/EmojiInteractionAnimation.tsx +++ b/src/components/middle/EmojiInteractionAnimation.tsx @@ -6,17 +6,16 @@ import { getActions, withGlobal } from '../../global'; import type { ActiveEmojiInteraction } from '../../global/types'; -import { IS_ANDROID } from '../../util/windowEnvironment'; - import { selectAnimatedEmojiEffect, } from '../../global/selectors'; -import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; - -import useLastCallback from '../../hooks/useLastCallback'; -import useFlag from '../../hooks/useFlag'; -import useMedia from '../../hooks/useMedia'; import buildClassName from '../../util/buildClassName'; +import { IS_ANDROID } from '../../util/windowEnvironment'; + +import useFlag from '../../hooks/useFlag'; +import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; +import useLastCallback from '../../hooks/useLastCallback'; +import useMedia from '../../hooks/useMedia'; import AnimatedSticker from '../common/AnimatedSticker'; diff --git a/src/components/middle/FloatingActionButtons.tsx b/src/components/middle/FloatingActionButtons.tsx index c38662ff7..ed0170636 100644 --- a/src/components/middle/FloatingActionButtons.tsx +++ b/src/components/middle/FloatingActionButtons.tsx @@ -1,13 +1,13 @@ import type { FC } from '../../lib/teact/teact'; -import React, { memo, useRef, useEffect } from '../../lib/teact/teact'; +import React, { memo, useEffect, useRef } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { MessageListType } from '../../global/types'; import { MAIN_THREAD_ID } from '../../api/types'; import { selectChat, selectCurrentMessageList } from '../../global/selectors'; -import buildClassName from '../../util/buildClassName'; import animateScroll from '../../util/animateScroll'; +import buildClassName from '../../util/buildClassName'; import useLastCallback from '../../hooks/useLastCallback'; diff --git a/src/components/middle/HeaderActions.tsx b/src/components/middle/HeaderActions.tsx index 240a03523..09e0389b6 100644 --- a/src/components/middle/HeaderActions.tsx +++ b/src/components/middle/HeaderActions.tsx @@ -1,16 +1,15 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo, useRef, useState, } from '../../lib/teact/teact'; -import { requestMeasure, requestNextMutation } from '../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { MessageListType } from '../../global/types'; -import { MAIN_THREAD_ID } from '../../api/types'; import type { IAnchorPosition } from '../../types'; +import { MAIN_THREAD_ID } from '../../api/types'; import { ManagementScreens } from '../../types'; -import { ARE_CALLS_SUPPORTED, IS_APP } from '../../util/windowEnvironment'; +import { requestMeasure, requestNextMutation } from '../../lib/fasterdom/fasterdom'; import { isChatBasicGroup, isChatChannel, isChatSuperGroup, isUserId, } from '../../global/helpers'; @@ -30,16 +29,17 @@ import { selectTranslationLanguage, selectUserFullInfo, } from '../../global/selectors'; +import { ARE_CALLS_SUPPORTED, IS_APP } from '../../util/windowEnvironment'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; import { useHotkeys } from '../../hooks/useHotkeys'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import Button from '../ui/Button'; -import HeaderMenuContainer from './HeaderMenuContainer.async'; import DropdownMenu from '../ui/DropdownMenu'; import MenuItem from '../ui/MenuItem'; import MenuSeparator from '../ui/MenuSeparator'; +import HeaderMenuContainer from './HeaderMenuContainer.async'; interface OwnProps { chatId: string; diff --git a/src/components/middle/HeaderMenuContainer.async.tsx b/src/components/middle/HeaderMenuContainer.async.tsx index 42a54d508..51ce51a0f 100644 --- a/src/components/middle/HeaderMenuContainer.async.tsx +++ b/src/components/middle/HeaderMenuContainer.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './HeaderMenuContainer'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/middle/HeaderMenuContainer.tsx b/src/components/middle/HeaderMenuContainer.tsx index f73b1ba40..d30d22e79 100644 --- a/src/components/middle/HeaderMenuContainer.tsx +++ b/src/components/middle/HeaderMenuContainer.tsx @@ -6,24 +6,10 @@ import { getActions, withGlobal } from '../../global'; import type { ApiBotCommand, ApiChat } from '../../api/types'; import type { IAnchorPosition } from '../../types'; -import { MAIN_THREAD_ID } from '../../api/types'; import type { IconName } from '../../types/icons'; +import { MAIN_THREAD_ID } from '../../api/types'; import { REPLIES_USER_ID } from '../../config'; -import { disableScrolling, enableScrolling } from '../../util/scrollLock'; -import { - selectChat, - selectBot, - selectChatFullInfo, - selectCurrentMessageList, - selectIsPremiumPurchaseBlocked, - selectNotifyExceptions, - selectNotifySettings, - selectTabState, - selectUser, - selectUserFullInfo, - selectCanManage, selectIsRightColumnShown, selectCanTranslateChat, -} from '../../global/selectors'; import { getCanAddContact, getCanDeleteChat, @@ -35,21 +21,35 @@ import { isUserRightBanned, selectIsChatMuted, } from '../../global/helpers'; +import { + selectBot, + selectCanManage, selectCanTranslateChat, + selectChat, + selectChatFullInfo, + selectCurrentMessageList, + selectIsPremiumPurchaseBlocked, + selectIsRightColumnShown, selectNotifyExceptions, + selectNotifySettings, + selectTabState, + selectUser, + selectUserFullInfo, +} from '../../global/selectors'; +import { disableScrolling, enableScrolling } from '../../util/scrollLock'; -import useLastCallback from '../../hooks/useLastCallback'; -import useShowTransition from '../../hooks/useShowTransition'; -import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; import useAppLayout from '../../hooks/useAppLayout'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation'; +import useShowTransition from '../../hooks/useShowTransition'; -import Portal from '../ui/Portal'; +import DeleteChatModal from '../common/DeleteChatModal'; +import ReportModal from '../common/ReportModal'; +import MuteChatModal from '../left/MuteChatModal.async'; import Menu from '../ui/Menu'; import MenuItem from '../ui/MenuItem'; import MenuSeparator from '../ui/MenuSeparator'; -import DeleteChatModal from '../common/DeleteChatModal'; -import MuteChatModal from '../left/MuteChatModal.async'; -import ReportModal from '../common/ReportModal'; +import Portal from '../ui/Portal'; import './HeaderMenuContainer.scss'; diff --git a/src/components/middle/HeaderPinnedMessage.tsx b/src/components/middle/HeaderPinnedMessage.tsx index f43338ec5..c758ba7c2 100644 --- a/src/components/middle/HeaderPinnedMessage.tsx +++ b/src/components/middle/HeaderPinnedMessage.tsx @@ -4,32 +4,32 @@ import { getActions } from '../../global'; import type { ApiMessage } from '../../api/types'; -import { getPictogramDimensions, REM } from '../common/helpers/mediaDimensions'; import { getMessageIsSpoiler, getMessageMediaHash, getMessageSingleInlineButton, } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { getPictogramDimensions, REM } from '../common/helpers/mediaDimensions'; import renderText from '../common/helpers/renderText'; +import { useFastClick } from '../../hooks/useFastClick'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; import useMedia from '../../hooks/useMedia'; import useThumbnail from '../../hooks/useThumbnail'; -import useFlag from '../../hooks/useFlag'; -import useLang from '../../hooks/useLang'; -import { useFastClick } from '../../hooks/useFastClick'; import useAsyncRendering from '../right/hooks/useAsyncRendering'; -import RippleEffect from '../ui/RippleEffect'; -import ConfirmDialog from '../ui/ConfirmDialog'; -import Button from '../ui/Button'; -import PinnedMessageNavigation from './PinnedMessageNavigation'; -import MessageSummary from '../common/MessageSummary'; -import MediaSpoiler from '../common/MediaSpoiler'; import AnimatedCounter from '../common/AnimatedCounter'; -import Transition from '../ui/Transition'; +import MediaSpoiler from '../common/MediaSpoiler'; +import MessageSummary from '../common/MessageSummary'; +import Button from '../ui/Button'; +import ConfirmDialog from '../ui/ConfirmDialog'; +import RippleEffect from '../ui/RippleEffect'; import Spinner from '../ui/Spinner'; +import Transition from '../ui/Transition'; +import PinnedMessageNavigation from './PinnedMessageNavigation'; import styles from './HeaderPinnedMessage.module.scss'; diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index 85a8fe967..f0d783cae 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -1,3 +1,4 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, @@ -5,18 +6,15 @@ import React, { useRef, } from '../../lib/teact/teact'; import { addExtraClass, removeExtraClass } from '../../lib/teact/teact-dom'; -import { requestForcedReflow, forceMeasure, requestMeasure } from '../../lib/fasterdom/fasterdom'; - -import type { FC } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; + import type { ApiMessage, ApiRestrictionReason, ApiTopic, } from '../../api/types'; - -import { MAIN_THREAD_ID } from '../../api/types'; import type { MessageListType } from '../../global/types'; import type { Signal } from '../../util/signals'; import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage'; +import { MAIN_THREAD_ID } from '../../api/types'; import { LoadMoreDirection } from '../../types'; import { @@ -24,59 +22,60 @@ import { MESSAGE_LIST_SLICE, SERVICE_NOTIFICATIONS_USER_ID, } from '../../config'; +import { forceMeasure, requestForcedReflow, requestMeasure } from '../../lib/fasterdom/fasterdom'; +import { + getMessageHtmlId, + isChatChannel, + isChatGroup, + isChatWithRepliesBot, + isLocalMessageId, + isUserId, +} from '../../global/helpers'; import { - selectChatMessages, - selectIsViewportNewest, - selectFirstUnreadId, - selectFocusedMessageId, - selectChat, - selectIsInSelectMode, - selectIsChatWithSelf, selectBot, - selectScrollOffset, - selectThreadTopMessageId, + selectChat, + selectChatFullInfo, + selectChatMessages, selectChatScheduledMessages, selectCurrentMessageIds, + selectFirstUnreadId, + selectFocusedMessageId, + selectIsChatWithSelf, selectIsCurrentUserPremium, + selectIsInSelectMode, + selectIsViewportNewest, selectLastScrollOffset, - selectThreadInfo, - selectTabState, - selectChatFullInfo, selectPerformanceSettingsValue, + selectScrollOffset, + selectTabState, + selectThreadInfo, + selectThreadTopMessageId, } from '../../global/selectors'; -import { - isChatChannel, - isUserId, - isChatWithRepliesBot, - isChatGroup, - isLocalMessageId, - getMessageHtmlId, -} from '../../global/helpers'; -import { orderBy } from '../../util/iteratees'; -import { debounce, onTickEnd } from '../../util/schedulers'; +import animateScroll, { isAnimatingScroll, restartCurrentScrollAnimation } from '../../util/animateScroll'; import buildClassName from '../../util/buildClassName'; +import { orderBy } from '../../util/iteratees'; +import resetScroll from '../../util/resetScroll'; +import { debounce, onTickEnd } from '../../util/schedulers'; import { groupMessages } from './helpers/groupMessages'; import { preventMessageInputBlur } from './helpers/preventMessageInputBlur'; -import resetScroll from '../../util/resetScroll'; -import animateScroll, { isAnimatingScroll, restartCurrentScrollAnimation } from '../../util/animateScroll'; -import useLastCallback from '../../hooks/useLastCallback'; -import { useStateRef } from '../../hooks/useStateRef'; -import useSyncEffect from '../../hooks/useSyncEffect'; -import useStickyDates from './hooks/useStickyDates'; +import { isBackgroundModeActive } from '../../hooks/useBackgroundMode'; +import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; import useInterval from '../../hooks/useInterval'; -import useNativeCopySelectedMessages from '../../hooks/useNativeCopySelectedMessages'; +import useLastCallback from '../../hooks/useLastCallback'; import useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps'; -import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; +import useNativeCopySelectedMessages from '../../hooks/useNativeCopySelectedMessages'; +import { useStateRef } from '../../hooks/useStateRef'; +import useSyncEffect from '../../hooks/useSyncEffect'; import useContainerHeight from './hooks/useContainerHeight'; -import { isBackgroundModeActive } from '../../hooks/useBackgroundMode'; +import useStickyDates from './hooks/useStickyDates'; import Loading from '../ui/Loading'; -import MessageListContent from './MessageListContent'; import ContactGreeting from './ContactGreeting'; -import NoMessages from './NoMessages'; import MessageListBotInfo from './MessageListBotInfo'; +import MessageListContent from './MessageListContent'; +import NoMessages from './NoMessages'; import './MessageList.scss'; diff --git a/src/components/middle/MessageListBotInfo.tsx b/src/components/middle/MessageListBotInfo.tsx index c44575e99..97f775000 100644 --- a/src/components/middle/MessageListBotInfo.tsx +++ b/src/components/middle/MessageListBotInfo.tsx @@ -1,22 +1,23 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiBotInfo } from '../../api/types'; -import { DPR } from '../../util/windowEnvironment'; -import renderText from '../common/helpers/renderText'; import { getBotCoverMediaHash, getDocumentMediaHash, getPhotoFullDimensions, getVideoDimensions, } from '../../global/helpers'; -import buildStyle from '../../util/buildStyle'; -import buildClassName from '../../util/buildClassName'; import { selectBot, selectUserFullInfo } from '../../global/selectors'; -import useMedia from '../../hooks/useMedia'; +import buildClassName from '../../util/buildClassName'; +import buildStyle from '../../util/buildStyle'; +import { DPR } from '../../util/windowEnvironment'; +import renderText from '../common/helpers/renderText'; + import useLang from '../../hooks/useLang'; +import useMedia from '../../hooks/useMedia'; import OptimizedVideo from '../ui/OptimizedVideo'; import Skeleton from '../ui/placeholder/Skeleton'; diff --git a/src/components/middle/MessageListContent.tsx b/src/components/middle/MessageListContent.tsx index 606ce4bd4..6992d68c8 100644 --- a/src/components/middle/MessageListContent.tsx +++ b/src/components/middle/MessageListContent.tsx @@ -4,29 +4,30 @@ import React, { memo } from '../../lib/teact/teact'; import { getActions } from '../../global'; import type { MessageListType } from '../../global/types'; -import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage'; import type { Signal } from '../../util/signals'; +import type { MessageDateGroup } from './helpers/groupMessages'; +import type { PinnedIntersectionChangedCallback } from './hooks/usePinnedMessage'; +import { MAIN_THREAD_ID } from '../../api/types'; import { SCHEDULED_WHEN_ONLINE } from '../../config'; -import { MAIN_THREAD_ID } from '../../api/types'; -import buildClassName from '../../util/buildClassName'; -import { compact } from '../../util/iteratees'; -import { formatHumanDate } from '../../util/dateFormat'; import { getMessageHtmlId, getMessageOriginalId, isActionMessage, isOwnMessage, isServiceNotificationMessage, } from '../../global/helpers'; -import useLang from '../../hooks/useLang'; -import type { MessageDateGroup } from './helpers/groupMessages'; +import buildClassName from '../../util/buildClassName'; +import { formatHumanDate } from '../../util/dateFormat'; +import { compact } from '../../util/iteratees'; import { isAlbum } from './helpers/groupMessages'; import { preventMessageInputBlur } from './helpers/preventMessageInputBlur'; -import useScrollHooks from './hooks/useScrollHooks'; -import useMessageObservers from './hooks/useMessageObservers'; -import usePrevious from '../../hooks/usePrevious'; -import useDerivedSignal from '../../hooks/useDerivedSignal'; +import useDerivedSignal from '../../hooks/useDerivedSignal'; +import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; +import useMessageObservers from './hooks/useMessageObservers'; +import useScrollHooks from './hooks/useScrollHooks'; + +import ActionMessage from './ActionMessage'; import Message from './message/Message'; import SponsoredMessage from './message/SponsoredMessage'; -import ActionMessage from './ActionMessage'; import MessageListBotInfo from './MessageListBotInfo'; interface OwnProps { diff --git a/src/components/middle/MessageListHistoryHandler.tsx b/src/components/middle/MessageListHistoryHandler.tsx index 2f8703458..0a70af7de 100644 --- a/src/components/middle/MessageListHistoryHandler.tsx +++ b/src/components/middle/MessageListHistoryHandler.tsx @@ -1,11 +1,12 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { MessageList as GlobalMessageList } from '../../global/types'; -import { createLocationHash } from '../../util/routing'; import { selectTabState } from '../../global/selectors'; +import { createLocationHash } from '../../util/routing'; + import useHistoryBack from '../../hooks/useHistoryBack'; type StateProps = { diff --git a/src/components/middle/MessageSelectToolbar.async.tsx b/src/components/middle/MessageSelectToolbar.async.tsx index 87ff4d812..77d1d43d4 100644 --- a/src/components/middle/MessageSelectToolbar.async.tsx +++ b/src/components/middle/MessageSelectToolbar.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import { Bundles } from '../../util/moduleLoader'; + import type { OwnProps } from './MessageSelectToolbar'; +import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; const MessageSelectToolbarAsync: FC = (props) => { diff --git a/src/components/middle/MessageSelectToolbar.tsx b/src/components/middle/MessageSelectToolbar.tsx index f8c5e0520..40dab96fd 100644 --- a/src/components/middle/MessageSelectToolbar.tsx +++ b/src/components/middle/MessageSelectToolbar.tsx @@ -10,22 +10,22 @@ import { selectCanDownloadSelectedMessages, selectCanForwardMessages, selectCanReportSelectedMessages, - selectCurrentMessageList, selectTabState, - selectHasProtectedMessage, + selectCurrentMessageList, selectHasProtectedMessage, selectSelectedMessagesCount, + selectTabState, } from '../../global/selectors'; -import captureKeyboardListeners from '../../util/captureKeyboardListeners'; import buildClassName from '../../util/buildClassName'; +import captureKeyboardListeners from '../../util/captureKeyboardListeners'; -import useLastCallback from '../../hooks/useLastCallback'; import useFlag from '../../hooks/useFlag'; -import usePrevious from '../../hooks/usePrevious'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePrevious from '../../hooks/usePrevious'; import useCopySelectedMessages from './hooks/useCopySelectedMessages'; +import ReportModal from '../common/ReportModal'; import Button from '../ui/Button'; import DeleteSelectedMessageModal from './DeleteSelectedMessageModal'; -import ReportModal from '../common/ReportModal'; import './MessageSelectToolbar.scss'; diff --git a/src/components/middle/MiddleColumn.tsx b/src/components/middle/MiddleColumn.tsx index cb56deae8..87972575d 100644 --- a/src/components/middle/MiddleColumn.tsx +++ b/src/components/middle/MiddleColumn.tsx @@ -1,38 +1,46 @@ import React, { - useEffect, useState, memo, useMemo, + memo, useEffect, useMemo, + useState, } from '../../lib/teact/teact'; -import { requestMeasure, requestMutation } from '../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../global'; import type { ApiChat, ApiChatBannedRights } from '../../api/types'; -import { MAIN_THREAD_ID } from '../../api/types'; import type { - MessageListType, ActiveEmojiInteraction, + MessageListType, } from '../../global/types'; import type { ThemeKey } from '../../types'; +import { MAIN_THREAD_ID } from '../../api/types'; import { - MOBILE_SCREEN_MAX_WIDTH, - MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, - SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, ANIMATION_END_DELAY, - SUPPORTED_IMAGE_CONTENT_TYPES, - GENERAL_TOPIC_ID, - TMP_CHAT_ID, - MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES, - EDITABLE_INPUT_ID, EDITABLE_INPUT_CSS_SELECTOR, + EDITABLE_INPUT_ID, + GENERAL_TOPIC_ID, IS_ELECTRON, + MAX_SCREEN_WIDTH_FOR_EXPAND_PINNED_MESSAGES, + MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, + MOBILE_SCREEN_MAX_WIDTH, + SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, + SUPPORTED_IMAGE_CONTENT_TYPES, + TMP_CHAT_ID, } from '../../config'; +import { requestMeasure, requestMutation } from '../../lib/fasterdom/fasterdom'; import { - IS_ANDROID, IS_IOS, IS_TRANSLATION_SUPPORTED, MASK_IMAGE_DISABLED, -} from '../../util/windowEnvironment'; -import { DropAreaState } from './composer/DropArea'; + getCanPostInChat, + getForumComposerPlaceholder, + getHasAdminRight, + getMessageSendingRestrictionReason, + isChatChannel, + isChatGroup, + isChatSuperGroup, + isUserId, + isUserRightBanned, +} from '../../global/helpers'; import { + selectBot, selectCanAnimateInterface, selectChat, - selectBot, selectChatFullInfo, selectChatMessage, selectCurrentMessageList, @@ -48,52 +56,44 @@ import { selectThreadInfo, selectThreadTopMessageId, } from '../../global/selectors'; -import { - getCanPostInChat, - getMessageSendingRestrictionReason, - getForumComposerPlaceholder, - isChatChannel, - isChatGroup, - isChatSuperGroup, - isUserId, - isUserRightBanned, - getHasAdminRight, -} from '../../global/helpers'; -import calculateMiddleFooterTransforms from './helpers/calculateMiddleFooterTransforms'; -import captureEscKeyListener from '../../util/captureEscKeyListener'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; +import captureEscKeyListener from '../../util/captureEscKeyListener'; +import { + IS_ANDROID, IS_IOS, IS_TRANSLATION_SUPPORTED, MASK_IMAGE_DISABLED, +} from '../../util/windowEnvironment'; +import calculateMiddleFooterTransforms from './helpers/calculateMiddleFooterTransforms'; -import useLastCallback from '../../hooks/useLastCallback'; -import useCustomBackground from '../../hooks/useCustomBackground'; -import useWindowSize from '../../hooks/useWindowSize'; -import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation'; -import useLang from '../../hooks/useLang'; -import useHistoryBack from '../../hooks/useHistoryBack'; -import usePrevious from '../../hooks/usePrevious'; -import useForceUpdate from '../../hooks/useForceUpdate'; -import useSyncEffect from '../../hooks/useSyncEffect'; import useAppLayout from '../../hooks/useAppLayout'; -import usePinnedMessage from './hooks/usePinnedMessage'; +import useCustomBackground from '../../hooks/useCustomBackground'; +import useForceUpdate from '../../hooks/useForceUpdate'; +import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation'; +import usePrevious from '../../hooks/usePrevious'; import { useResize } from '../../hooks/useResize'; +import useSyncEffect from '../../hooks/useSyncEffect'; +import useWindowSize from '../../hooks/useWindowSize'; +import usePinnedMessage from './hooks/usePinnedMessage'; -import Transition from '../ui/Transition'; -import MiddleHeader from './MiddleHeader'; -import MessageList from './MessageList'; -import FloatingActionButtons from './FloatingActionButtons'; -import Button from '../ui/Button'; -import MobileSearch from './MobileSearch.async'; -import MessageSelectToolbar from './MessageSelectToolbar.async'; -import UnpinAllMessagesModal from '../common/UnpinAllMessagesModal.async'; -import SeenByModal from '../common/SeenByModal.async'; -import EmojiInteractionAnimation from './EmojiInteractionAnimation.async'; -import ReactorListModal from './ReactorListModal.async'; -import GiftPremiumModal from '../main/premium/GiftPremiumModal.async'; -import ChatLanguageModal from './ChatLanguageModal.async'; import Composer from '../common/Composer'; +import SeenByModal from '../common/SeenByModal.async'; +import UnpinAllMessagesModal from '../common/UnpinAllMessagesModal.async'; +import GiftPremiumModal from '../main/premium/GiftPremiumModal.async'; +import Button from '../ui/Button'; +import Transition from '../ui/Transition'; +import ChatLanguageModal from './ChatLanguageModal.async'; +import { DropAreaState } from './composer/DropArea'; +import EmojiInteractionAnimation from './EmojiInteractionAnimation.async'; +import FloatingActionButtons from './FloatingActionButtons'; +import MessageList from './MessageList'; +import MessageSelectToolbar from './MessageSelectToolbar.async'; +import MiddleHeader from './MiddleHeader'; +import MobileSearch from './MobileSearch.async'; +import ReactorListModal from './ReactorListModal.async'; import './MiddleColumn.scss'; - import styles from './MiddleColumn.module.scss'; interface OwnProps { diff --git a/src/components/middle/MiddleHeader.tsx b/src/components/middle/MiddleHeader.tsx index ae93be809..2c8966f8c 100644 --- a/src/components/middle/MiddleHeader.tsx +++ b/src/components/middle/MiddleHeader.tsx @@ -1,17 +1,16 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useLayoutEffect, useRef, } from '../../lib/teact/teact'; -import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; -import type { GlobalState, MessageListType } from '../../global/types'; -import type { Signal } from '../../util/signals'; import type { ApiChat, ApiMessage, ApiTypingStatus, ApiUser, } from '../../api/types'; -import { StoryViewerOrigin } from '../../types'; +import type { GlobalState, MessageListType } from '../../global/types'; +import type { Signal } from '../../util/signals'; import { MAIN_THREAD_ID } from '../../api/types'; +import { StoryViewerOrigin } from '../../types'; import { EDITABLE_INPUT_CSS_SELECTOR, @@ -22,6 +21,7 @@ import { SAFE_SCREEN_WIDTH_FOR_CHAT_INFO, SAFE_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN, } from '../../config'; +import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { getChatTitle, getMessageKey, @@ -35,7 +35,6 @@ import { selectChat, selectChatMessage, selectChatMessages, - selectTabState, selectForwardedSender, selectIsChatBotNotStarted, selectIsChatWithBot, @@ -45,36 +44,37 @@ import { selectIsUserBlocked, selectPinnedIds, selectScheduledIds, + selectTabState, selectThreadInfo, selectThreadParam, selectThreadTopMessageId, } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; import cycleRestrict from '../../util/cycleRestrict'; -import useLastCallback from '../../hooks/useLastCallback'; -import { useFastClick } from '../../hooks/useFastClick'; -import useEnsureMessage from '../../hooks/useEnsureMessage'; -import useWindowSize from '../../hooks/useWindowSize'; -import useShowTransition from '../../hooks/useShowTransition'; -import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; -import buildClassName from '../../util/buildClassName'; -import useLang from '../../hooks/useLang'; -import useConnectionStatus from '../../hooks/useConnectionStatus'; -import usePrevious from '../../hooks/usePrevious'; -import useElectronDrag from '../../hooks/useElectronDrag'; import useAppLayout from '../../hooks/useAppLayout'; +import useConnectionStatus from '../../hooks/useConnectionStatus'; +import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; import useDerivedState from '../../hooks/useDerivedState'; +import useElectronDrag from '../../hooks/useElectronDrag'; +import useEnsureMessage from '../../hooks/useEnsureMessage'; +import { useFastClick } from '../../hooks/useFastClick'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import usePrevious from '../../hooks/usePrevious'; +import useShowTransition from '../../hooks/useShowTransition'; +import useWindowSize from '../../hooks/useWindowSize'; -import PrivateChatInfo from '../common/PrivateChatInfo'; +import GroupCallTopPane from '../calls/group/GroupCallTopPane'; import GroupChatInfo from '../common/GroupChatInfo'; +import PrivateChatInfo from '../common/PrivateChatInfo'; import UnreadCounter from '../common/UnreadCounter'; -import Transition from '../ui/Transition'; import Button from '../ui/Button'; +import Transition from '../ui/Transition'; +import AudioPlayer from './AudioPlayer'; +import ChatReportPanel from './ChatReportPanel'; import HeaderActions from './HeaderActions'; import HeaderPinnedMessage from './HeaderPinnedMessage'; -import AudioPlayer from './AudioPlayer'; -import GroupCallTopPane from '../calls/group/GroupCallTopPane'; -import ChatReportPanel from './ChatReportPanel'; import './MiddleHeader.scss'; diff --git a/src/components/middle/MobileSearch.async.tsx b/src/components/middle/MobileSearch.async.tsx index 1efd535df..844077253 100644 --- a/src/components/middle/MobileSearch.async.tsx +++ b/src/components/middle/MobileSearch.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './MobileSearch'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/middle/MobileSearch.tsx b/src/components/middle/MobileSearch.tsx index bbad6ae2d..10e7f1bfb 100644 --- a/src/components/middle/MobileSearch.tsx +++ b/src/components/middle/MobileSearch.tsx @@ -1,21 +1,22 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useEffect, useRef, useState, useLayoutEffect, + memo, useEffect, useLayoutEffect, + useRef, useState, } from '../../lib/teact/teact'; -import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../global'; import type { ApiChat } from '../../api/types'; -import { IS_IOS } from '../../util/windowEnvironment'; -import { debounce } from '../../util/schedulers'; +import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { - selectCurrentTextSearch, selectCurrentChat, - selectTabState, selectCurrentMessageList, + selectCurrentTextSearch, + selectTabState, } from '../../global/selectors'; import { getDayStartAt } from '../../util/dateFormat'; +import { debounce } from '../../util/schedulers'; +import { IS_IOS } from '../../util/windowEnvironment'; import useLastCallback from '../../hooks/useLastCallback'; diff --git a/src/components/middle/NoMessages.tsx b/src/components/middle/NoMessages.tsx index 41dbca76b..f28cec9d1 100644 --- a/src/components/middle/NoMessages.tsx +++ b/src/components/middle/NoMessages.tsx @@ -1,12 +1,13 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; -import type { MessageListType } from '../../global/types'; import type { ApiTopic } from '../../api/types'; +import type { MessageListType } from '../../global/types'; import type { LangFn } from '../../hooks/useLang'; import { REM } from '../common/helpers/mediaDimensions'; import renderText from '../common/helpers/renderText'; + import useLang from '../../hooks/useLang'; import TopicIcon from '../common/TopicIcon'; diff --git a/src/components/middle/PinnedMessageNavigation.tsx b/src/components/middle/PinnedMessageNavigation.tsx index fe066b471..ee8c2bf48 100644 --- a/src/components/middle/PinnedMessageNavigation.tsx +++ b/src/components/middle/PinnedMessageNavigation.tsx @@ -1,9 +1,9 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useRef, + memo, useLayoutEffect, useMemo, - memo, + useRef, } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; diff --git a/src/components/middle/ReactorListModal.async.tsx b/src/components/middle/ReactorListModal.async.tsx index f2b993a18..31be51b53 100644 --- a/src/components/middle/ReactorListModal.async.tsx +++ b/src/components/middle/ReactorListModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './ReactorListModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/middle/ReactorListModal.tsx b/src/components/middle/ReactorListModal.tsx index f5b1efad5..7bdfd24d8 100644 --- a/src/components/middle/ReactorListModal.tsx +++ b/src/components/middle/ReactorListModal.tsx @@ -1,38 +1,39 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useMemo, useEffect, useState, useRef, + memo, useEffect, useMemo, useRef, + useState, } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; import type { ApiAvailableReaction, ApiMessage, ApiReaction } from '../../api/types'; import { LoadMoreDirection } from '../../types'; +import { getReactionUniqueKey, isSameReaction } from '../../global/helpers'; import { selectChatMessage, selectTabState, } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; -import { formatIntegerCompact } from '../../util/textFormat'; -import { unique } from '../../util/iteratees'; -import { isSameReaction, getReactionUniqueKey } from '../../global/helpers'; import { formatDateAtTime } from '../../util/dateFormat'; +import { unique } from '../../util/iteratees'; +import { formatIntegerCompact } from '../../util/textFormat'; -import useLang from '../../hooks/useLang'; -import useInfiniteScroll from '../../hooks/useInfiniteScroll'; import useFlag from '../../hooks/useFlag'; +import useInfiniteScroll from '../../hooks/useInfiniteScroll'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import InfiniteScroll from '../ui/InfiniteScroll'; -import Modal from '../ui/Modal'; -import Button from '../ui/Button'; import Avatar from '../common/Avatar'; -import ListItem from '../ui/ListItem'; -import ReactionStaticEmoji from '../common/ReactionStaticEmoji'; -import Loading from '../ui/Loading'; import FullNameTitle from '../common/FullNameTitle'; import PrivateChatInfo from '../common/PrivateChatInfo'; +import ReactionStaticEmoji from '../common/ReactionStaticEmoji'; +import Button from '../ui/Button'; +import InfiniteScroll from '../ui/InfiniteScroll'; +import ListItem from '../ui/ListItem'; +import Loading from '../ui/Loading'; +import Modal from '../ui/Modal'; import './ReactorListModal.scss'; -import useLastCallback from '../../hooks/useLastCallback'; const MIN_REACTIONS_COUNT_FOR_FILTERS = 10; diff --git a/src/components/middle/ScrollDownButton.tsx b/src/components/middle/ScrollDownButton.tsx index ed7384085..73ed48759 100644 --- a/src/components/middle/ScrollDownButton.tsx +++ b/src/components/middle/ScrollDownButton.tsx @@ -3,13 +3,14 @@ import React, { memo, useRef } from '../../lib/teact/teact'; import type { IconName } from '../../types/icons'; -import { formatIntegerCompact } from '../../util/textFormat'; -import useLang from '../../hooks/useLang'; -import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; import buildClassName from '../../util/buildClassName'; +import { formatIntegerCompact } from '../../util/textFormat'; + +import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; +import useLang from '../../hooks/useLang'; -import Menu from '../ui/Menu'; import Button from '../ui/Button'; +import Menu from '../ui/Menu'; import MenuItem from '../ui/MenuItem'; import styles from './ScrollDownButton.module.scss'; diff --git a/src/components/middle/composer/AttachBotIcon.tsx b/src/components/middle/composer/AttachBotIcon.tsx index 7cba832d8..782db6a13 100644 --- a/src/components/middle/composer/AttachBotIcon.tsx +++ b/src/components/middle/composer/AttachBotIcon.tsx @@ -1,12 +1,13 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; -import type { ISettings } from '../../../types'; import type { ApiDocument } from '../../../api/types'; +import type { ISettings } from '../../../types'; import { ApiMediaFormat } from '../../../api/types'; import { getDocumentMediaHash } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; + import useAppLayout from '../../../hooks/useAppLayout'; import useMedia from '../../../hooks/useMedia'; diff --git a/src/components/middle/composer/AttachBotItem.tsx b/src/components/middle/composer/AttachBotItem.tsx index 453626a60..22778a36f 100644 --- a/src/components/middle/composer/AttachBotItem.tsx +++ b/src/components/middle/composer/AttachBotItem.tsx @@ -4,16 +4,16 @@ import React, { } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { IAnchorPosition, ISettings } from '../../../types'; import type { ApiAttachBot } from '../../../api/types'; +import type { IAnchorPosition, ISettings } from '../../../types'; -import useLastCallback from '../../../hooks/useLastCallback'; import useFlag from '../../../hooks/useFlag'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; -import Portal from '../../ui/Portal'; import Menu from '../../ui/Menu'; import MenuItem from '../../ui/MenuItem'; +import Portal from '../../ui/Portal'; import AttachBotIcon from './AttachBotIcon'; type OwnProps = { diff --git a/src/components/middle/composer/AttachMenu.tsx b/src/components/middle/composer/AttachMenu.tsx index 43d2d0fdd..138127dff 100644 --- a/src/components/middle/composer/AttachMenu.tsx +++ b/src/components/middle/composer/AttachMenu.tsx @@ -1,10 +1,11 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useMemo, useEffect, + memo, useEffect, + useMemo, } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; -import type { GlobalState } from '../../../global/types'; import type { ApiAttachMenuPeerType } from '../../../api/types'; +import type { GlobalState } from '../../../global/types'; import type { ISettings } from '../../../types'; import { @@ -12,19 +13,19 @@ import { SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES, } from '../../../config'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import { openSystemFilesDialog } from '../../../util/systemFilesDialog'; -import { validateFiles } from '../../../util/files'; import { getDebugLogs } from '../../../util/debugConsole'; +import { validateFiles } from '../../../util/files'; +import { openSystemFilesDialog } from '../../../util/systemFilesDialog'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useMouseInside from '../../../hooks/useMouseInside'; -import useLang from '../../../hooks/useLang'; -import useFlag from '../../../hooks/useFlag'; -import ResponsiveHoverButton from '../../ui/ResponsiveHoverButton'; import Menu from '../../ui/Menu'; import MenuItem from '../../ui/MenuItem'; +import ResponsiveHoverButton from '../../ui/ResponsiveHoverButton'; import AttachBotItem from './AttachBotItem'; import './AttachMenu.scss'; diff --git a/src/components/middle/composer/AttachmentModal.async.tsx b/src/components/middle/composer/AttachmentModal.async.tsx index 98f019d27..bd8689b63 100644 --- a/src/components/middle/composer/AttachmentModal.async.tsx +++ b/src/components/middle/composer/AttachmentModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './AttachmentModal'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/AttachmentModal.tsx b/src/components/middle/composer/AttachmentModal.tsx index 272be8857..1646f1b05 100644 --- a/src/components/middle/composer/AttachmentModal.tsx +++ b/src/components/middle/composer/AttachmentModal.tsx @@ -1,10 +1,9 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAttachment, ApiChatMember, ApiSticker, } from '../../../api/types'; @@ -19,40 +18,41 @@ import { SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES, } from '../../../config'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { isUserId } from '../../../global/helpers'; -import captureEscKeyListener from '../../../util/captureEscKeyListener'; -import getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems'; -import { getHtmlTextLength } from './helpers/getHtmlTextLength'; import { selectChatFullInfo, selectIsChatWithSelf } from '../../../global/selectors'; import { selectCurrentLimit } from '../../../global/selectors/limits'; -import { openSystemFilesDialog } from '../../../util/systemFilesDialog'; import buildClassName from '../../../util/buildClassName'; +import captureEscKeyListener from '../../../util/captureEscKeyListener'; import { validateFiles } from '../../../util/files'; import { removeAllSelections } from '../../../util/selection'; +import { openSystemFilesDialog } from '../../../util/systemFilesDialog'; +import getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems'; +import { getHtmlTextLength } from './helpers/getHtmlTextLength'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; +import useDerivedState from '../../../hooks/useDerivedState'; +import useFlag from '../../../hooks/useFlag'; +import useGetSelectionRange from '../../../hooks/useGetSelectionRange'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import usePrevious from '../../../hooks/usePrevious'; -import useMentionTooltip from './hooks/useMentionTooltip'; -import useEmojiTooltip from './hooks/useEmojiTooltip'; -import useLang from '../../../hooks/useLang'; -import useFlag from '../../../hooks/useFlag'; -import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; -import useCustomEmojiTooltip from './hooks/useCustomEmojiTooltip'; -import useAppLayout from '../../../hooks/useAppLayout'; import useScrolledState from '../../../hooks/useScrolledState'; -import useGetSelectionRange from '../../../hooks/useGetSelectionRange'; -import useDerivedState from '../../../hooks/useDerivedState'; +import useCustomEmojiTooltip from './hooks/useCustomEmojiTooltip'; +import useEmojiTooltip from './hooks/useEmojiTooltip'; +import useMentionTooltip from './hooks/useMentionTooltip'; import Button from '../../ui/Button'; -import Modal from '../../ui/Modal'; -import MessageInput from './MessageInput'; -import MentionTooltip from './MentionTooltip'; -import EmojiTooltip from './EmojiTooltip.async'; -import CustomSendMenu from './CustomSendMenu.async'; -import CustomEmojiTooltip from './CustomEmojiTooltip.async'; -import AttachmentModalItem from './AttachmentModalItem'; import DropdownMenu from '../../ui/DropdownMenu'; import MenuItem from '../../ui/MenuItem'; +import Modal from '../../ui/Modal'; +import AttachmentModalItem from './AttachmentModalItem'; +import CustomEmojiTooltip from './CustomEmojiTooltip.async'; +import CustomSendMenu from './CustomSendMenu.async'; +import EmojiTooltip from './EmojiTooltip.async'; +import MentionTooltip from './MentionTooltip'; +import MessageInput from './MessageInput'; import SymbolMenuButton from './SymbolMenuButton'; import styles from './AttachmentModal.module.scss'; diff --git a/src/components/middle/composer/AttachmentModalItem.tsx b/src/components/middle/composer/AttachmentModalItem.tsx index cbd0e6a98..5d94af364 100644 --- a/src/components/middle/composer/AttachmentModalItem.tsx +++ b/src/components/middle/composer/AttachmentModalItem.tsx @@ -1,12 +1,12 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAttachment } from '../../../api/types'; import { GIF_MIME_TYPE, SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES } from '../../../config'; -import { getFileExtension } from '../../common/helpers/documentInfo'; import buildClassName from '../../../util/buildClassName'; import { formatMediaDuration } from '../../../util/dateFormat'; +import { getFileExtension } from '../../common/helpers/documentInfo'; import { REM } from '../../common/helpers/mediaDimensions'; import useLastCallback from '../../../hooks/useLastCallback'; diff --git a/src/components/middle/composer/BotCommand.tsx b/src/components/middle/composer/BotCommand.tsx index 92465d805..067f7fa63 100644 --- a/src/components/middle/composer/BotCommand.tsx +++ b/src/components/middle/composer/BotCommand.tsx @@ -3,11 +3,11 @@ import React, { memo } from '../../../lib/teact/teact'; import type { ApiBotCommand, ApiUser } from '../../../api/types'; -import renderText from '../../common/helpers/renderText'; import buildClassName from '../../../util/buildClassName'; +import renderText from '../../common/helpers/renderText'; -import ListItem from '../../ui/ListItem'; import Avatar from '../../common/Avatar'; +import ListItem from '../../ui/ListItem'; import './BotCommand.scss'; diff --git a/src/components/middle/composer/BotCommandMenu.async.tsx b/src/components/middle/composer/BotCommandMenu.async.tsx index 1f70dc671..08a1e2206 100644 --- a/src/components/middle/composer/BotCommandMenu.async.tsx +++ b/src/components/middle/composer/BotCommandMenu.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './BotCommandMenu'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/BotCommandMenu.tsx b/src/components/middle/composer/BotCommandMenu.tsx index 8117beaa2..60f1016da 100644 --- a/src/components/middle/composer/BotCommandMenu.tsx +++ b/src/components/middle/composer/BotCommandMenu.tsx @@ -1,14 +1,14 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiBotCommand } from '../../../api/types'; import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import useAppLayout from '../../../hooks/useAppLayout'; import useLastCallback from '../../../hooks/useLastCallback'; import useMouseInside from '../../../hooks/useMouseInside'; -import useAppLayout from '../../../hooks/useAppLayout'; import Menu from '../../ui/Menu'; import BotCommand from './BotCommand'; diff --git a/src/components/middle/composer/BotCommandTooltip.async.tsx b/src/components/middle/composer/BotCommandTooltip.async.tsx index 720f969e1..9e92afc42 100644 --- a/src/components/middle/composer/BotCommandTooltip.async.tsx +++ b/src/components/middle/composer/BotCommandTooltip.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './BotCommandTooltip'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/BotCommandTooltip.tsx b/src/components/middle/composer/BotCommandTooltip.tsx index 9f9cbb9bf..5e3b6b850 100644 --- a/src/components/middle/composer/BotCommandTooltip.tsx +++ b/src/components/middle/composer/BotCommandTooltip.tsx @@ -1,16 +1,16 @@ import type { FC } from '../../../lib/teact/teact'; -import React, { useEffect, useRef, memo } from '../../../lib/teact/teact'; +import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { Signal } from '../../../util/signals'; import type { ApiBotCommand } from '../../../api/types'; +import type { Signal } from '../../../util/signals'; import buildClassName from '../../../util/buildClassName'; import setTooltipItemVisible from '../../../util/setTooltipItemVisible'; import useLastCallback from '../../../hooks/useLastCallback'; -import useShowTransition from '../../../hooks/useShowTransition'; import usePrevious from '../../../hooks/usePrevious'; +import useShowTransition from '../../../hooks/useShowTransition'; import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; import BotCommand from './BotCommand'; diff --git a/src/components/middle/composer/BotKeyboardMenu.tsx b/src/components/middle/composer/BotKeyboardMenu.tsx index ffc886a3d..aad7d75e2 100644 --- a/src/components/middle/composer/BotKeyboardMenu.tsx +++ b/src/components/middle/composer/BotKeyboardMenu.tsx @@ -4,12 +4,13 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiMessage } from '../../../api/types'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import { selectChatMessage, selectCurrentMessageList } from '../../../global/selectors'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; + import useMouseInside from '../../../hooks/useMouseInside'; -import Menu from '../../ui/Menu'; import Button from '../../ui/Button'; +import Menu from '../../ui/Menu'; import './BotKeyboardMenu.scss'; diff --git a/src/components/middle/composer/ComposerEmbeddedMessage.tsx b/src/components/middle/composer/ComposerEmbeddedMessage.tsx index 506cca317..a97a02ccc 100644 --- a/src/components/middle/composer/ComposerEmbeddedMessage.tsx +++ b/src/components/middle/composer/ComposerEmbeddedMessage.tsx @@ -1,42 +1,42 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChat, ApiMessage, ApiUser } from '../../../api/types'; +import { isUserId, stripCustomEmoji } from '../../../global/helpers'; import { + selectCanAnimateInterface, selectChat, selectChatMessage, - selectSender, - selectForwardedSender, - selectUser, selectCurrentMessageList, - selectReplyingToId, selectEditingId, - selectEditingScheduledId, selectEditingMessage, + selectEditingScheduledId, + selectForwardedSender, selectIsChatWithSelf, selectIsCurrentUserPremium, + selectReplyingToId, + selectSender, selectTabState, - selectCanAnimateInterface, + selectUser, } from '../../../global/selectors'; -import captureEscKeyListener from '../../../util/captureEscKeyListener'; import buildClassName from '../../../util/buildClassName'; -import { isUserId, stripCustomEmoji } from '../../../global/helpers'; +import captureEscKeyListener from '../../../util/captureEscKeyListener'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import useShowTransition from '../../../hooks/useShowTransition'; -import useLang from '../../../hooks/useLang'; import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import useMenuPosition from '../../../hooks/useMenuPosition'; +import useShowTransition from '../../../hooks/useShowTransition'; +import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import Button from '../../ui/Button'; import EmbeddedMessage from '../../common/EmbeddedMessage'; -import MenuItem from '../../ui/MenuItem'; +import Button from '../../ui/Button'; import Menu from '../../ui/Menu'; +import MenuItem from '../../ui/MenuItem'; import MenuSeparator from '../../ui/MenuSeparator'; import './ComposerEmbeddedMessage.scss'; diff --git a/src/components/middle/composer/CustomEmojiButton.tsx b/src/components/middle/composer/CustomEmojiButton.tsx index 8330e4372..38e736570 100644 --- a/src/components/middle/composer/CustomEmojiButton.tsx +++ b/src/components/middle/composer/CustomEmojiButton.tsx @@ -1,6 +1,6 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; diff --git a/src/components/middle/composer/CustomEmojiTooltip.async.tsx b/src/components/middle/composer/CustomEmojiTooltip.async.tsx index c9ffc01ac..7d7d6d3ec 100644 --- a/src/components/middle/composer/CustomEmojiTooltip.async.tsx +++ b/src/components/middle/composer/CustomEmojiTooltip.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './CustomEmojiTooltip'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/CustomEmojiTooltip.tsx b/src/components/middle/composer/CustomEmojiTooltip.tsx index 35c2a2043..dde633c94 100644 --- a/src/components/middle/composer/CustomEmojiTooltip.tsx +++ b/src/components/middle/composer/CustomEmojiTooltip.tsx @@ -1,7 +1,7 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker } from '../../../api/types'; import type { GlobalActions } from '../../../global'; @@ -10,14 +10,14 @@ import { selectIsChatWithSelf, selectIsCurrentUserPremium } from '../../../globa import buildClassName from '../../../util/buildClassName'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; -import useLastCallback from '../../../hooks/useLastCallback'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import useShowTransition from '../../../hooks/useShowTransition'; -import usePrevious from '../../../hooks/usePrevious'; import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import usePrevious from '../../../hooks/usePrevious'; +import useShowTransition from '../../../hooks/useShowTransition'; -import Loading from '../../ui/Loading'; import StickerButton from '../../common/StickerButton'; +import Loading from '../../ui/Loading'; import styles from './CustomEmojiTooltip.module.scss'; diff --git a/src/components/middle/composer/CustomSendMenu.async.tsx b/src/components/middle/composer/CustomSendMenu.async.tsx index 94c6938a6..42b990b76 100644 --- a/src/components/middle/composer/CustomSendMenu.async.tsx +++ b/src/components/middle/composer/CustomSendMenu.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './CustomSendMenu'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/CustomSendMenu.tsx b/src/components/middle/composer/CustomSendMenu.tsx index 44735fca8..e1e62251f 100644 --- a/src/components/middle/composer/CustomSendMenu.tsx +++ b/src/components/middle/composer/CustomSendMenu.tsx @@ -1,12 +1,11 @@ -import React, { memo, useState } from '../../../lib/teact/teact'; - import type { FC } from '../../../lib/teact/teact'; +import React, { memo, useState } from '../../../lib/teact/teact'; import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; -import useMouseInside from '../../../hooks/useMouseInside'; import useLang from '../../../hooks/useLang'; +import useMouseInside from '../../../hooks/useMouseInside'; import Menu from '../../ui/Menu'; import MenuItem from '../../ui/MenuItem'; diff --git a/src/components/middle/composer/DropArea.async.tsx b/src/components/middle/composer/DropArea.async.tsx index a8976b095..bb6d2659d 100644 --- a/src/components/middle/composer/DropArea.async.tsx +++ b/src/components/middle/composer/DropArea.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './DropArea'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/DropArea.tsx b/src/components/middle/composer/DropArea.tsx index 95656e3cb..8a292e315 100644 --- a/src/components/middle/composer/DropArea.tsx +++ b/src/components/middle/composer/DropArea.tsx @@ -1,14 +1,13 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; -import useShowTransition from '../../../hooks/useShowTransition'; import buildClassName from '../../../util/buildClassName'; -import getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems'; - import captureEscKeyListener from '../../../util/captureEscKeyListener'; +import getFilesFromDataTransferItems from './helpers/getFilesFromDataTransferItems'; import useLastCallback from '../../../hooks/useLastCallback'; import usePrevious from '../../../hooks/usePrevious'; +import useShowTransition from '../../../hooks/useShowTransition'; import Portal from '../../ui/Portal'; import DropTarget from './DropTarget'; diff --git a/src/components/middle/composer/DropTarget.tsx b/src/components/middle/composer/DropTarget.tsx index 229fc0bb9..bcd867baf 100644 --- a/src/components/middle/composer/DropTarget.tsx +++ b/src/components/middle/composer/DropTarget.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; -import useFlag from '../../../hooks/useFlag'; import buildClassName from '../../../util/buildClassName'; +import useFlag from '../../../hooks/useFlag'; + import './DropTarget.scss'; export type OwnProps = { diff --git a/src/components/middle/composer/EmojiButton.tsx b/src/components/middle/composer/EmojiButton.tsx index f03a10a9c..705fe3804 100644 --- a/src/components/middle/composer/EmojiButton.tsx +++ b/src/components/middle/composer/EmojiButton.tsx @@ -1,11 +1,10 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; - import { IS_ELECTRON, PRODUCTION_URL } from '../../../config'; -import { IS_EMOJI_SUPPORTED } from '../../../util/windowEnvironment'; -import { handleEmojiLoad, LOADED_EMOJIS } from '../../../util/emoji'; import buildClassName from '../../../util/buildClassName'; +import { handleEmojiLoad, LOADED_EMOJIS } from '../../../util/emoji'; +import { IS_EMOJI_SUPPORTED } from '../../../util/windowEnvironment'; import useLastCallback from '../../../hooks/useLastCallback'; diff --git a/src/components/middle/composer/EmojiCategory.tsx b/src/components/middle/composer/EmojiCategory.tsx index cf21edb37..7e7402235 100644 --- a/src/components/middle/composer/EmojiCategory.tsx +++ b/src/components/middle/composer/EmojiCategory.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useRef } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; -import { REM } from '../../common/helpers/mediaDimensions'; import { EMOJI_SIZE_PICKER, RECENT_SYMBOL_SET_ID } from '../../../config'; import buildClassName from '../../../util/buildClassName'; import windowSize from '../../../util/windowSize'; +import { REM } from '../../common/helpers/mediaDimensions'; -import { useOnIntersect } from '../../../hooks/useIntersectionObserver'; -import useMediaTransition from '../../../hooks/useMediaTransition'; -import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; +import { useOnIntersect } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useMediaTransition from '../../../hooks/useMediaTransition'; import EmojiButton from './EmojiButton'; diff --git a/src/components/middle/composer/EmojiPicker.tsx b/src/components/middle/composer/EmojiPicker.tsx index 58d76d373..d86076157 100644 --- a/src/components/middle/composer/EmojiPicker.tsx +++ b/src/components/middle/composer/EmojiPicker.tsx @@ -1,33 +1,34 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { - useState, useEffect, memo, useRef, useMemo, + memo, useEffect, useMemo, + useRef, useState, } from '../../../lib/teact/teact'; import { withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { GlobalState } from '../../../global/types'; import type { + EmojiData, EmojiModule, EmojiRawData, - EmojiData, } from '../../../util/emoji'; import { MENU_TRANSITION_DURATION, RECENT_SYMBOL_SET_ID } from '../../../config'; -import { REM } from '../../common/helpers/mediaDimensions'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; -import { uncompressEmoji } from '../../../util/emoji'; -import animateScroll from '../../../util/animateScroll'; -import { pick } from '../../../util/iteratees'; -import buildClassName from '../../../util/buildClassName'; import animateHorizontalScroll from '../../../util/animateHorizontalScroll'; +import animateScroll from '../../../util/animateScroll'; +import buildClassName from '../../../util/buildClassName'; +import { uncompressEmoji } from '../../../util/emoji'; +import { pick } from '../../../util/iteratees'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import { REM } from '../../common/helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; -import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; +import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import useScrolledState from '../../../hooks/useScrolledState'; +import useAsyncRendering from '../../right/hooks/useAsyncRendering'; import Button from '../../ui/Button'; import Loading from '../../ui/Loading'; diff --git a/src/components/middle/composer/EmojiTooltip.async.tsx b/src/components/middle/composer/EmojiTooltip.async.tsx index 42efee355..4b8fac8c1 100644 --- a/src/components/middle/composer/EmojiTooltip.async.tsx +++ b/src/components/middle/composer/EmojiTooltip.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './EmojiTooltip'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/EmojiTooltip.tsx b/src/components/middle/composer/EmojiTooltip.tsx index 3aa79683f..3ec92acf4 100644 --- a/src/components/middle/composer/EmojiTooltip.tsx +++ b/src/components/middle/composer/EmojiTooltip.tsx @@ -1,24 +1,24 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useRef } from '../../../lib/teact/teact'; import type { ApiSticker } from '../../../api/types'; -import type { FC } from '../../../lib/teact/teact'; +import animateHorizontalScroll from '../../../util/animateHorizontalScroll'; import buildClassName from '../../../util/buildClassName'; import findInViewport from '../../../util/findInViewport'; import isFullyVisible from '../../../util/isFullyVisible'; -import animateHorizontalScroll from '../../../util/animateHorizontalScroll'; -import useLastCallback from '../../../hooks/useLastCallback'; import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; -import useShowTransition from '../../../hooks/useShowTransition'; -import usePrevDuringAnimation from '../../../hooks/usePrevDuringAnimation'; -import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import usePrevDuringAnimation from '../../../hooks/usePrevDuringAnimation'; +import useShowTransition from '../../../hooks/useShowTransition'; +import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; import Loading from '../../ui/Loading'; -import EmojiButton from './EmojiButton'; import CustomEmojiButton from './CustomEmojiButton'; +import EmojiButton from './EmojiButton'; import './EmojiTooltip.scss'; diff --git a/src/components/middle/composer/GifPicker.tsx b/src/components/middle/composer/GifPicker.tsx index b50d9e9c4..8a785eaff 100644 --- a/src/components/middle/composer/GifPicker.tsx +++ b/src/components/middle/composer/GifPicker.tsx @@ -1,22 +1,22 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useEffect, memo, useRef, + memo, useEffect, useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; import type { ApiVideo } from '../../../api/types'; import { SLIDE_TRANSITION_DURATION } from '../../../config'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import buildClassName from '../../../util/buildClassName'; import { selectCurrentMessageList, selectIsChatWithSelf } from '../../../global/selectors'; +import buildClassName from '../../../util/buildClassName'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; import useAsyncRendering from '../../right/hooks/useAsyncRendering'; -import Loading from '../../ui/Loading'; import GifButton from '../../common/GifButton'; +import Loading from '../../ui/Loading'; import './GifPicker.scss'; diff --git a/src/components/middle/composer/InlineBotTooltip.async.tsx b/src/components/middle/composer/InlineBotTooltip.async.tsx index e50bad180..bb815640d 100644 --- a/src/components/middle/composer/InlineBotTooltip.async.tsx +++ b/src/components/middle/composer/InlineBotTooltip.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './InlineBotTooltip'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/InlineBotTooltip.tsx b/src/components/middle/composer/InlineBotTooltip.tsx index dfffcd887..d12fd6e70 100644 --- a/src/components/middle/composer/InlineBotTooltip.tsx +++ b/src/components/middle/composer/InlineBotTooltip.tsx @@ -1,31 +1,31 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiBotInlineMediaResult, ApiBotInlineResult, ApiBotInlineSwitchPm, ApiBotInlineSwitchWebview, } from '../../../api/types'; import { LoadMoreDirection } from '../../../types'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import setTooltipItemVisible from '../../../util/setTooltipItemVisible'; import buildClassName from '../../../util/buildClassName'; -import { extractCurrentThemeParams } from '../../../util/themeStyle'; import { throttle } from '../../../util/schedulers'; +import setTooltipItemVisible from '../../../util/setTooltipItemVisible'; +import { extractCurrentThemeParams } from '../../../util/themeStyle'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useShowTransition from '../../../hooks/useShowTransition'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import usePrevious from '../../../hooks/usePrevious'; import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import usePrevious from '../../../hooks/usePrevious'; +import useShowTransition from '../../../hooks/useShowTransition'; import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; -import MediaResult from './inlineResults/MediaResult'; +import InfiniteScroll from '../../ui/InfiniteScroll'; +import ListItem from '../../ui/ListItem'; import ArticleResult from './inlineResults/ArticleResult'; import GifResult from './inlineResults/GifResult'; +import MediaResult from './inlineResults/MediaResult'; import StickerResult from './inlineResults/StickerResult'; -import ListItem from '../../ui/ListItem'; -import InfiniteScroll from '../../ui/InfiniteScroll'; import './InlineBotTooltip.scss'; diff --git a/src/components/middle/composer/MentionTooltip.async.tsx b/src/components/middle/composer/MentionTooltip.async.tsx index 23fb0288a..bbf7a6d3d 100644 --- a/src/components/middle/composer/MentionTooltip.async.tsx +++ b/src/components/middle/composer/MentionTooltip.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './MentionTooltip'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/MentionTooltip.tsx b/src/components/middle/composer/MentionTooltip.tsx index c13231895..e46b68c1a 100644 --- a/src/components/middle/composer/MentionTooltip.tsx +++ b/src/components/middle/composer/MentionTooltip.tsx @@ -1,5 +1,5 @@ import type { FC } from '../../../lib/teact/teact'; -import React, { useEffect, useRef, memo } from '../../../lib/teact/teact'; +import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getGlobal } from '../../../global'; import type { ApiUser } from '../../../api/types'; @@ -12,8 +12,8 @@ import usePrevious from '../../../hooks/usePrevious'; import useShowTransition from '../../../hooks/useShowTransition'; import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; -import ListItem from '../../ui/ListItem'; import PrivateChatInfo from '../../common/PrivateChatInfo'; +import ListItem from '../../ui/ListItem'; import './MentionTooltip.scss'; diff --git a/src/components/middle/composer/MessageInput.tsx b/src/components/middle/composer/MessageInput.tsx index fd1e1886c..637a41f1b 100644 --- a/src/components/middle/composer/MessageInput.tsx +++ b/src/components/middle/composer/MessageInput.tsx @@ -1,38 +1,39 @@ -import type { RefObject, ChangeEvent } from 'react'; +import type { ChangeEvent, RefObject } from 'react'; import type { FC } from '../../../lib/teact/teact'; import React, { - useEffect, useRef, memo, useState, useLayoutEffect, + memo, useEffect, useLayoutEffect, + useRef, useState, } from '../../../lib/teact/teact'; -import { requestMutation, requestForcedReflow } from '../../../lib/fasterdom/fasterdom'; import { getActions, withGlobal } from '../../../global'; import type { IAnchorPosition, ISettings } from '../../../types'; import type { Signal } from '../../../util/signals'; import { EDITABLE_INPUT_ID } from '../../../config'; -import { - IS_ANDROID, IS_EMOJI_SUPPORTED, IS_IOS, IS_TOUCH_ENV, -} from '../../../util/windowEnvironment'; +import { requestForcedReflow, requestMutation } from '../../../lib/fasterdom/fasterdom'; import { selectCanPlayAnimatedEmojis, selectIsInSelectMode, selectReplyingToId } from '../../../global/selectors'; -import { debounce } from '../../../util/schedulers'; -import focusEditableElement from '../../../util/focusEditableElement'; import buildClassName from '../../../util/buildClassName'; import captureKeyboardListeners from '../../../util/captureKeyboardListeners'; import { getIsDirectTextInputDisabled } from '../../../util/directInputManager'; +import focusEditableElement from '../../../util/focusEditableElement'; import parseEmojiOnlyString from '../../../util/parseEmojiOnlyString'; -import { isSelectionInsideInput } from './helpers/selection'; +import { debounce } from '../../../util/schedulers'; +import { + IS_ANDROID, IS_EMOJI_SUPPORTED, IS_IOS, IS_TOUCH_ENV, +} from '../../../util/windowEnvironment'; import renderText from '../../common/helpers/renderText'; +import { isSelectionInsideInput } from './helpers/selection'; -import useLastCallback from '../../../hooks/useLastCallback'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useDerivedState from '../../../hooks/useDerivedState'; import useFlag from '../../../hooks/useFlag'; import { isHeavyAnimating } from '../../../hooks/useHeavyAnimationCheck'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import useInputCustomEmojis from './hooks/useInputCustomEmojis'; -import useAppLayout from '../../../hooks/useAppLayout'; -import useDerivedState from '../../../hooks/useDerivedState'; -import TextFormatter from './TextFormatter'; import TextTimer from '../../ui/TextTimer'; +import TextFormatter from './TextFormatter'; const CONTEXT_MENU_CLOSE_DELAY_MS = 100; // Focus slows down animation, also it breaks transition layout in Chrome diff --git a/src/components/middle/composer/PollModal.async.tsx b/src/components/middle/composer/PollModal.async.tsx index 5f578a7f7..ceac9c64a 100644 --- a/src/components/middle/composer/PollModal.async.tsx +++ b/src/components/middle/composer/PollModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './PollModal'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/PollModal.tsx b/src/components/middle/composer/PollModal.tsx index 75b59c5c3..68c005552 100644 --- a/src/components/middle/composer/PollModal.tsx +++ b/src/components/middle/composer/PollModal.tsx @@ -3,20 +3,20 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef, useState, } from '../../../lib/teact/teact'; -import { requestNextMutation } from '../../../lib/fasterdom/fasterdom'; import type { ApiNewPoll } from '../../../api/types'; +import { requestNextMutation } from '../../../lib/fasterdom/fasterdom'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; import parseMessageInput from '../../../util/parseMessageInput'; -import useLastCallback from '../../../hooks/useLastCallback'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import Button from '../../ui/Button'; -import Modal from '../../ui/Modal'; -import InputText from '../../ui/InputText'; import Checkbox from '../../ui/Checkbox'; +import InputText from '../../ui/InputText'; +import Modal from '../../ui/Modal'; import RadioGroup from '../../ui/RadioGroup'; import TextArea from '../../ui/TextArea'; diff --git a/src/components/middle/composer/SendAsMenu.async.tsx b/src/components/middle/composer/SendAsMenu.async.tsx index 0d434c1c6..cb60d5a15 100644 --- a/src/components/middle/composer/SendAsMenu.async.tsx +++ b/src/components/middle/composer/SendAsMenu.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './SendAsMenu'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/SendAsMenu.tsx b/src/components/middle/composer/SendAsMenu.tsx index 2c82cc6f6..90fc22698 100644 --- a/src/components/middle/composer/SendAsMenu.tsx +++ b/src/components/middle/composer/SendAsMenu.tsx @@ -1,22 +1,22 @@ -import React, { useEffect, useRef, memo } from '../../../lib/teact/teact'; +import type { FC } from '../../../lib/teact/teact'; +import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSendAsPeerId } from '../../../api/types'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import buildClassName from '../../../util/buildClassName'; import setTooltipItemVisible from '../../../util/setTooltipItemVisible'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; -import useMouseInside from '../../../hooks/useMouseInside'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMouseInside from '../../../hooks/useMouseInside'; +import { useKeyboardNavigation } from './hooks/useKeyboardNavigation'; -import ListItem from '../../ui/ListItem'; import Avatar from '../../common/Avatar'; -import Menu from '../../ui/Menu'; import FullNameTitle from '../../common/FullNameTitle'; +import ListItem from '../../ui/ListItem'; +import Menu from '../../ui/Menu'; import './SendAsMenu.scss'; diff --git a/src/components/middle/composer/StickerPicker.tsx b/src/components/middle/composer/StickerPicker.tsx index 99d51abd1..3868ab9e9 100644 --- a/src/components/middle/composer/StickerPicker.tsx +++ b/src/components/middle/composer/StickerPicker.tsx @@ -1,11 +1,12 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { - useEffect, memo, useRef, useMemo, + memo, useEffect, useMemo, + useRef, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { ApiStickerSet, ApiSticker, ApiChat } from '../../../api/types'; +import type { ApiChat, ApiSticker, ApiStickerSet } from '../../../api/types'; import type { StickerSetOrReactionsSetOrRecent } from '../../../types'; -import type { FC } from '../../../lib/teact/teact'; import { CHAT_STICKER_SET_ID, @@ -16,32 +17,32 @@ import { STICKER_PICKER_MAX_SHARED_COVERS, STICKER_SIZE_PICKER_HEADER, } from '../../../config'; -import { REM } from '../../common/helpers/mediaDimensions'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import { isUserId } from '../../../global/helpers'; -import buildClassName from '../../../util/buildClassName'; -import animateHorizontalScroll from '../../../util/animateHorizontalScroll'; -import { pickTruthy, uniqueByField } from '../../../util/iteratees'; import { selectChat, selectChatFullInfo, selectIsChatWithSelf, selectIsCurrentUserPremium, selectShouldLoopStickers, } from '../../../global/selectors'; +import animateHorizontalScroll from '../../../util/animateHorizontalScroll'; +import buildClassName from '../../../util/buildClassName'; +import { pickTruthy, uniqueByField } from '../../../util/iteratees'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import { REM } from '../../common/helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useAsyncRendering from '../../right/hooks/useAsyncRendering'; import useHorizontalScroll from '../../../hooks/useHorizontalScroll'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useScrolledState from '../../../hooks/useScrolledState'; import useSendMessageAction from '../../../hooks/useSendMessageAction'; import { useStickerPickerObservers } from '../../common/hooks/useStickerPickerObservers'; -import useScrolledState from '../../../hooks/useScrolledState'; +import useAsyncRendering from '../../right/hooks/useAsyncRendering'; import Avatar from '../../common/Avatar'; -import Loading from '../../ui/Loading'; -import Button from '../../ui/Button'; +import PremiumIcon from '../../common/PremiumIcon'; import StickerButton from '../../common/StickerButton'; import StickerSet from '../../common/StickerSet'; +import Button from '../../ui/Button'; +import Loading from '../../ui/Loading'; import StickerSetCover from './StickerSetCover'; -import PremiumIcon from '../../common/PremiumIcon'; import styles from './StickerPicker.module.scss'; diff --git a/src/components/middle/composer/StickerSetCover.tsx b/src/components/middle/composer/StickerSetCover.tsx index d6f70ce90..67cb87707 100644 --- a/src/components/middle/composer/StickerSetCover.tsx +++ b/src/components/middle/composer/StickerSetCover.tsx @@ -1,24 +1,24 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiStickerSet } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import { STICKER_SIZE_PICKER_HEADER } from '../../../config'; -import { selectIsAlwaysHighPriorityEmoji } from '../../../global/selectors'; -import { IS_WEBM_SUPPORTED } from '../../../util/windowEnvironment'; -import { getFirstLetters } from '../../../util/textFormat'; -import buildClassName from '../../../util/buildClassName'; import { getStickerPreviewHash } from '../../../global/helpers'; +import { selectIsAlwaysHighPriorityEmoji } from '../../../global/selectors'; +import buildClassName from '../../../util/buildClassName'; +import { getFirstLetters } from '../../../util/textFormat'; +import { IS_WEBM_SUPPORTED } from '../../../util/windowEnvironment'; +import useColorFilter from '../../../hooks/stickers/useColorFilter'; +import useDynamicColorListener from '../../../hooks/stickers/useDynamicColorListener'; +import useCoordsInSharedCanvas from '../../../hooks/useCoordsInSharedCanvas'; import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; import useMedia from '../../../hooks/useMedia'; import useMediaTransition from '../../../hooks/useMediaTransition'; -import useCoordsInSharedCanvas from '../../../hooks/useCoordsInSharedCanvas'; import useCustomEmoji from '../../common/hooks/useCustomEmoji'; -import useDynamicColorListener from '../../../hooks/stickers/useDynamicColorListener'; -import useColorFilter from '../../../hooks/stickers/useColorFilter'; import AnimatedSticker from '../../common/AnimatedSticker'; import OptimizedVideo from '../../ui/OptimizedVideo'; diff --git a/src/components/middle/composer/StickerTooltip.async.tsx b/src/components/middle/composer/StickerTooltip.async.tsx index b6444c39a..c67835a74 100644 --- a/src/components/middle/composer/StickerTooltip.async.tsx +++ b/src/components/middle/composer/StickerTooltip.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './StickerTooltip'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/StickerTooltip.tsx b/src/components/middle/composer/StickerTooltip.tsx index 5b34e6b1b..4abb34d51 100644 --- a/src/components/middle/composer/StickerTooltip.tsx +++ b/src/components/middle/composer/StickerTooltip.tsx @@ -5,16 +5,17 @@ import { withGlobal } from '../../../global'; import type { ApiSticker } from '../../../api/types'; import { STICKER_SIZE_PICKER } from '../../../config'; +import { selectIsChatWithSelf, selectIsCurrentUserPremium } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; + import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import useShowTransition from '../../../hooks/useShowTransition'; import usePrevious from '../../../hooks/usePrevious'; import useSendMessageAction from '../../../hooks/useSendMessageAction'; -import { selectIsChatWithSelf, selectIsCurrentUserPremium } from '../../../global/selectors'; +import useShowTransition from '../../../hooks/useShowTransition'; -import Loading from '../../ui/Loading'; import StickerButton from '../../common/StickerButton'; +import Loading from '../../ui/Loading'; import './StickerTooltip.scss'; diff --git a/src/components/middle/composer/SymbolMenu.async.tsx b/src/components/middle/composer/SymbolMenu.async.tsx index c383f8a8c..6058857e3 100644 --- a/src/components/middle/composer/SymbolMenu.async.tsx +++ b/src/components/middle/composer/SymbolMenu.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './SymbolMenu'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/SymbolMenu.tsx b/src/components/middle/composer/SymbolMenu.tsx index 69f8783ae..f27d60457 100644 --- a/src/components/middle/composer/SymbolMenu.tsx +++ b/src/components/middle/composer/SymbolMenu.tsx @@ -1,32 +1,32 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useLayoutEffect, useRef, useState, } from '../../../lib/teact/teact'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiSticker, ApiVideo } from '../../../api/types'; import type { GlobalActions } from '../../../global'; -import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import { selectIsContextMenuTranslucent, selectTabState } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; -import { selectTabState, selectIsContextMenuTranslucent } from '../../../global/selectors'; +import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useShowTransition from '../../../hooks/useShowTransition'; -import useMouseInside from '../../../hooks/useMouseInside'; -import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMouseInside from '../../../hooks/useMouseInside'; +import useShowTransition from '../../../hooks/useShowTransition'; +import CustomEmojiPicker from '../../common/CustomEmojiPicker'; import Button from '../../ui/Button'; import Menu from '../../ui/Menu'; +import Portal from '../../ui/Portal'; import Transition from '../../ui/Transition'; import EmojiPicker from './EmojiPicker'; -import CustomEmojiPicker from '../../common/CustomEmojiPicker'; -import StickerPicker from './StickerPicker'; import GifPicker from './GifPicker'; +import StickerPicker from './StickerPicker'; import SymbolMenuFooter, { SYMBOL_MENU_TAB_TITLES, SymbolMenuTabs } from './SymbolMenuFooter'; -import Portal from '../../ui/Portal'; import './SymbolMenu.scss'; diff --git a/src/components/middle/composer/SymbolMenuButton.tsx b/src/components/middle/composer/SymbolMenuButton.tsx index f5b6c1f29..ea316a0a4 100644 --- a/src/components/middle/composer/SymbolMenuButton.tsx +++ b/src/components/middle/composer/SymbolMenuButton.tsx @@ -1,20 +1,20 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useRef, useState } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; +import type { ApiSticker, ApiVideo } from '../../../api/types'; import type { IAnchorPosition } from '../../../types'; -import type { ApiVideo, ApiSticker } from '../../../api/types'; import { EDITABLE_INPUT_CSS_SELECTOR, EDITABLE_INPUT_MODAL_CSS_SELECTOR } from '../../../config'; import buildClassName from '../../../util/buildClassName'; -import useLastCallback from '../../../hooks/useLastCallback'; import useFlag from '../../../hooks/useFlag'; +import useLastCallback from '../../../hooks/useLastCallback'; import useMenuPosition from '../../../hooks/useMenuPosition'; import Button from '../../ui/Button'; -import Spinner from '../../ui/Spinner'; import ResponsiveHoverButton from '../../ui/ResponsiveHoverButton'; +import Spinner from '../../ui/Spinner'; import SymbolMenu from './SymbolMenu.async'; const MOBILE_KEYBOARD_HIDE_DELAY_MS = 100; diff --git a/src/components/middle/composer/SymbolMenuFooter.tsx b/src/components/middle/composer/SymbolMenuFooter.tsx index 0da07bf82..23c598894 100644 --- a/src/components/middle/composer/SymbolMenuFooter.tsx +++ b/src/components/middle/composer/SymbolMenuFooter.tsx @@ -3,8 +3,8 @@ import React, { memo } from '../../../lib/teact/teact'; import buildClassName from '../../../util/buildClassName'; -import useLastCallback from '../../../hooks/useLastCallback'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import Button from '../../ui/Button'; diff --git a/src/components/middle/composer/TextFormatter.async.tsx b/src/components/middle/composer/TextFormatter.async.tsx index 8949e0a9d..a079fc95c 100644 --- a/src/components/middle/composer/TextFormatter.async.tsx +++ b/src/components/middle/composer/TextFormatter.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './TextFormatter'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/composer/TextFormatter.tsx b/src/components/middle/composer/TextFormatter.tsx index 6acc175ad..02eb40bd1 100644 --- a/src/components/middle/composer/TextFormatter.tsx +++ b/src/components/middle/composer/TextFormatter.tsx @@ -8,17 +8,17 @@ import { ApiMessageEntityTypes } from '../../../api/types'; import { EDITABLE_INPUT_ID } from '../../../config'; import buildClassName from '../../../util/buildClassName'; -import { ensureProtocol } from '../../../util/ensureProtocol'; import captureEscKeyListener from '../../../util/captureEscKeyListener'; +import { ensureProtocol } from '../../../util/ensureProtocol'; import getKeyFromEvent from '../../../util/getKeyFromEvent'; -import { INPUT_CUSTOM_EMOJI_SELECTOR } from './helpers/customEmoji'; import stopEvent from '../../../util/stopEvent'; +import { INPUT_CUSTOM_EMOJI_SELECTOR } from './helpers/customEmoji'; +import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useShowTransition from '../../../hooks/useShowTransition'; import useVirtualBackdrop from '../../../hooks/useVirtualBackdrop'; -import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; import Button from '../../ui/Button'; diff --git a/src/components/middle/composer/WebPagePreview.tsx b/src/components/middle/composer/WebPagePreview.tsx index 073b12888..ab2116d6f 100644 --- a/src/components/middle/composer/WebPagePreview.tsx +++ b/src/components/middle/composer/WebPagePreview.tsx @@ -1,29 +1,29 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiFormattedText, ApiMessage, ApiMessageEntityTextUrl, ApiWebPage, } from '../../../api/types'; -import { ApiMessageEntityTypes } from '../../../api/types'; import type { ISettings } from '../../../types'; import type { Signal } from '../../../util/signals'; +import { ApiMessageEntityTypes } from '../../../api/types'; import { RE_LINK_TEMPLATE } from '../../../config'; -import { selectTabState, selectNoWebPage, selectTheme } from '../../../global/selectors'; +import { selectNoWebPage, selectTabState, selectTheme } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import parseMessageInput from '../../../util/parseMessageInput'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useSyncEffect from '../../../hooks/useSyncEffect'; -import useShowTransition from '../../../hooks/useShowTransition'; -import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; -import useDerivedState from '../../../hooks/useDerivedState'; -import useDerivedSignal from '../../../hooks/useDerivedSignal'; import { useDebouncedResolver } from '../../../hooks/useAsyncResolvers'; +import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; +import useDerivedSignal from '../../../hooks/useDerivedSignal'; +import useDerivedState from '../../../hooks/useDerivedState'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useShowTransition from '../../../hooks/useShowTransition'; +import useSyncEffect from '../../../hooks/useSyncEffect'; -import WebPage from '../message/WebPage'; import Button from '../../ui/Button'; +import WebPage from '../message/WebPage'; import './WebPagePreview.scss'; diff --git a/src/components/middle/composer/helpers/buildAttachment.ts b/src/components/middle/composer/helpers/buildAttachment.ts index 8b9053cf1..47713c2ba 100644 --- a/src/components/middle/composer/helpers/buildAttachment.ts +++ b/src/components/middle/composer/helpers/buildAttachment.ts @@ -1,4 +1,5 @@ import type { ApiAttachment } from '../../../../api/types'; + import { GIF_MIME_TYPE, SUPPORTED_AUDIO_CONTENT_TYPES, @@ -7,9 +8,9 @@ import { } from '../../../../config'; import { parseAudioMetadata } from '../../../../util/audio'; import { + createPosterForVideo, preloadImage, preloadVideo, - createPosterForVideo, } from '../../../../util/files'; import { scaleImage } from '../../../../util/imageResize'; diff --git a/src/components/middle/composer/helpers/customEmoji.ts b/src/components/middle/composer/helpers/customEmoji.ts index ecbb65096..598dd490b 100644 --- a/src/components/middle/composer/helpers/customEmoji.ts +++ b/src/components/middle/composer/helpers/customEmoji.ts @@ -1,11 +1,12 @@ +import { getGlobal } from '../../../../global'; + import type { ApiMessageEntityCustomEmoji, ApiSticker } from '../../../../api/types'; import { ApiMessageEntityTypes } from '../../../../api/types'; -import { getGlobal } from '../../../../global'; import { EMOJI_SIZES } from '../../../../config'; -import { REM } from '../../../common/helpers/mediaDimensions'; -import { getInputCustomEmojiParams } from '../../../../util/customEmojiManager'; import buildClassName from '../../../../util/buildClassName'; +import { getInputCustomEmojiParams } from '../../../../util/customEmojiManager'; +import { REM } from '../../../common/helpers/mediaDimensions'; export const INPUT_CUSTOM_EMOJI_SELECTOR = 'img[data-document-id]'; diff --git a/src/components/middle/composer/hooks/useAttachmentModal.ts b/src/components/middle/composer/hooks/useAttachmentModal.ts index 0e491c7f7..eb07ab496 100644 --- a/src/components/middle/composer/hooks/useAttachmentModal.ts +++ b/src/components/middle/composer/hooks/useAttachmentModal.ts @@ -3,13 +3,13 @@ import { getActions } from '../../../../global'; import type { ApiAttachment } from '../../../../api/types'; -import buildAttachment from '../helpers/buildAttachment'; -import { MEMO_EMPTY_ARRAY } from '../../../../util/memo'; import { SUPPORTED_AUDIO_CONTENT_TYPES, SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES, } from '../../../../config'; +import { MEMO_EMPTY_ARRAY } from '../../../../util/memo'; +import buildAttachment from '../helpers/buildAttachment'; import useLastCallback from '../../../../hooks/useLastCallback'; diff --git a/src/components/middle/composer/hooks/useBotCommandTooltip.ts b/src/components/middle/composer/hooks/useBotCommandTooltip.ts index 70b2c99fb..c045661f9 100644 --- a/src/components/middle/composer/hooks/useBotCommandTooltip.ts +++ b/src/components/middle/composer/hooks/useBotCommandTooltip.ts @@ -4,9 +4,10 @@ import type { ApiBotCommand } from '../../../../api/types'; import type { Signal } from '../../../../util/signals'; import { prepareForRegExp } from '../helpers/prepareForRegExp'; -import useFlag from '../../../../hooks/useFlag'; -import useDerivedSignal from '../../../../hooks/useDerivedSignal'; + import { useThrottledResolver } from '../../../../hooks/useAsyncResolvers'; +import useDerivedSignal from '../../../../hooks/useDerivedSignal'; +import useFlag from '../../../../hooks/useFlag'; const RE_COMMAND = /^\/([\w@]{1,32})?$/i; diff --git a/src/components/middle/composer/hooks/useClipboardPaste.ts b/src/components/middle/composer/hooks/useClipboardPaste.ts index 919a46e22..c1c8d3ea1 100644 --- a/src/components/middle/composer/hooks/useClipboardPaste.ts +++ b/src/components/middle/composer/hooks/useClipboardPaste.ts @@ -1,17 +1,17 @@ +import type { StateHookSetter } from '../../../../lib/teact/teact'; import { useEffect } from '../../../../lib/teact/teact'; -import type { StateHookSetter } from '../../../../lib/teact/teact'; import type { ApiAttachment, ApiFormattedText, ApiMessage } from '../../../../api/types'; import { ApiMessageEntityTypes } from '../../../../api/types'; -import buildAttachment from '../helpers/buildAttachment'; import { DEBUG, EDITABLE_INPUT_ID, EDITABLE_INPUT_MODAL_ID, EDITABLE_STORY_INPUT_ID, } from '../../../../config'; -import getFilesFromDataTransferItems from '../helpers/getFilesFromDataTransferItems'; -import parseMessageInput, { ENTITY_CLASS_BY_NODE_NAME } from '../../../../util/parseMessageInput'; import cleanDocsHtml from '../../../../lib/cleanDocsHtml'; import { containsCustomEmoji, stripCustomEmoji } from '../../../../global/helpers/symbols'; +import parseMessageInput, { ENTITY_CLASS_BY_NODE_NAME } from '../../../../util/parseMessageInput'; +import buildAttachment from '../helpers/buildAttachment'; +import getFilesFromDataTransferItems from '../helpers/getFilesFromDataTransferItems'; const MAX_MESSAGE_LENGTH = 4096; diff --git a/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts b/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts index 5881dace2..9ade9ea7b 100644 --- a/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts +++ b/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts @@ -1,23 +1,23 @@ import type { RefObject } from 'react'; import { useEffect } from '../../../../lib/teact/teact'; -import twemojiRegex from '../../../../lib/twemojiRegex'; -import { requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; +import { getActions } from '../../../../global'; import type { ApiSticker } from '../../../../api/types'; import type { Signal } from '../../../../util/signals'; -import { getActions } from '../../../../global'; import { EMOJI_IMG_REGEX } from '../../../../config'; -import { IS_EMOJI_SUPPORTED } from '../../../../util/windowEnvironment'; -import { getHtmlBeforeSelection } from '../../../../util/selection'; +import { requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; +import twemojiRegex from '../../../../lib/twemojiRegex'; import focusEditableElement from '../../../../util/focusEditableElement'; +import { getHtmlBeforeSelection } from '../../../../util/selection'; +import { IS_EMOJI_SUPPORTED } from '../../../../util/windowEnvironment'; import { buildCustomEmojiHtml } from '../helpers/customEmoji'; -import useLastCallback from '../../../../hooks/useLastCallback'; +import { useThrottledResolver } from '../../../../hooks/useAsyncResolvers'; +import useDerivedSignal from '../../../../hooks/useDerivedSignal'; import useDerivedState from '../../../../hooks/useDerivedState'; import useFlag from '../../../../hooks/useFlag'; -import useDerivedSignal from '../../../../hooks/useDerivedSignal'; -import { useThrottledResolver } from '../../../../hooks/useAsyncResolvers'; +import useLastCallback from '../../../../hooks/useLastCallback'; const THROTTLE = 300; const RE_ENDS_ON_EMOJI = new RegExp(`(${twemojiRegex.source})$`, 'g'); diff --git a/src/components/middle/composer/hooks/useDraft.ts b/src/components/middle/composer/hooks/useDraft.ts index 2071bbbd3..4dc48a468 100644 --- a/src/components/middle/composer/hooks/useDraft.ts +++ b/src/components/middle/composer/hooks/useDraft.ts @@ -1,24 +1,26 @@ import { useEffect, useRef } from '../../../../lib/teact/teact'; -import { requestMeasure, requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; import { getActions } from '../../../../global'; -import type { ApiDraft } from '../../../../global/types'; import type { ApiMessage } from '../../../../api/types'; +import type { ApiDraft } from '../../../../global/types'; import type { Signal } from '../../../../util/signals'; - import { ApiMessageEntityTypes } from '../../../../api/types'; + import { DRAFT_DEBOUNCE, EDITABLE_INPUT_CSS_SELECTOR } from '../../../../config'; -import { IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; +import { + requestMeasure, requestNextMutation, +} from '../../../../lib/fasterdom/fasterdom'; import focusEditableElement from '../../../../util/focusEditableElement'; import parseMessageInput from '../../../../util/parseMessageInput'; +import { IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; import { getTextWithEntitiesAsHtml } from '../../../common/helpers/renderTextWithEntities'; -import useLastCallback from '../../../../hooks/useLastCallback'; import useBackgroundMode from '../../../../hooks/useBackgroundMode'; import useBeforeUnload from '../../../../hooks/useBeforeUnload'; -import { useStateRef } from '../../../../hooks/useStateRef'; -import useRunDebounced from '../../../../hooks/useRunDebounced'; +import useLastCallback from '../../../../hooks/useLastCallback'; import useLayoutEffectWithPrevDeps from '../../../../hooks/useLayoutEffectWithPrevDeps'; +import useRunDebounced from '../../../../hooks/useRunDebounced'; +import { useStateRef } from '../../../../hooks/useStateRef'; let isFrozen = false; diff --git a/src/components/middle/composer/hooks/useEditing.ts b/src/components/middle/composer/hooks/useEditing.ts index 0eb159c37..a0855d6f7 100644 --- a/src/components/middle/composer/hooks/useEditing.ts +++ b/src/components/middle/composer/hooks/useEditing.ts @@ -1,6 +1,5 @@ import { useEffect, useState } from '../../../../lib/teact/teact'; import { getActions } from '../../../../global'; -import { requestMeasure, requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; import type { ApiFormattedText, ApiMessage } from '../../../../api/types'; import type { MessageListType } from '../../../../global/types'; @@ -8,17 +7,18 @@ import type { Signal } from '../../../../util/signals'; import { ApiMessageEntityTypes } from '../../../../api/types'; import { EDITABLE_INPUT_CSS_SELECTOR } from '../../../../config'; -import useEffectWithPrevDeps from '../../../../hooks/useEffectWithPrevDeps'; -import parseMessageInput from '../../../../util/parseMessageInput'; -import focusEditableElement from '../../../../util/focusEditableElement'; +import { requestMeasure, requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; import { hasMessageMedia } from '../../../../global/helpers'; +import focusEditableElement from '../../../../util/focusEditableElement'; +import parseMessageInput from '../../../../util/parseMessageInput'; import { getTextWithEntitiesAsHtml } from '../../../common/helpers/renderTextWithEntities'; -import useLastCallback from '../../../../hooks/useLastCallback'; +import { useDebouncedResolver } from '../../../../hooks/useAsyncResolvers'; import useBackgroundMode from '../../../../hooks/useBackgroundMode'; import useBeforeUnload from '../../../../hooks/useBeforeUnload'; -import { useDebouncedResolver } from '../../../../hooks/useAsyncResolvers'; import useDerivedSignal from '../../../../hooks/useDerivedSignal'; +import useEffectWithPrevDeps from '../../../../hooks/useEffectWithPrevDeps'; +import useLastCallback from '../../../../hooks/useLastCallback'; const URL_ENTITIES = new Set([ApiMessageEntityTypes.TextUrl, ApiMessageEntityTypes.Url]); const DEBOUNCE_MS = 300; diff --git a/src/components/middle/composer/hooks/useEmojiTooltip.ts b/src/components/middle/composer/hooks/useEmojiTooltip.ts index f2917ef6e..fa9d1890a 100644 --- a/src/components/middle/composer/hooks/useEmojiTooltip.ts +++ b/src/components/middle/composer/hooks/useEmojiTooltip.ts @@ -1,28 +1,28 @@ import { useEffect, useState } from '../../../../lib/teact/teact'; -import { requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; import { getGlobal } from '../../../../global'; import type { ApiSticker } from '../../../../api/types'; import type { EmojiData, EmojiModule, EmojiRawData } from '../../../../util/emoji'; -import { uncompressEmoji } from '../../../../util/emoji'; import type { Signal } from '../../../../util/signals'; import { EDITABLE_INPUT_CSS_SELECTOR, EDITABLE_INPUT_ID } from '../../../../config'; +import { requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; +import { selectCustomEmojiForEmojis } from '../../../../global/selectors'; +import { uncompressEmoji } from '../../../../util/emoji'; +import focusEditableElement from '../../../../util/focusEditableElement'; import { buildCollectionByKey, mapValues, pickTruthy, unique, uniqueByField, } from '../../../../util/iteratees'; import { MEMO_EMPTY_ARRAY } from '../../../../util/memo'; -import { prepareForRegExp } from '../helpers/prepareForRegExp'; -import focusEditableElement from '../../../../util/focusEditableElement'; import memoized from '../../../../util/memoized'; import renderText from '../../../common/helpers/renderText'; -import { selectCustomEmojiForEmojis } from '../../../../global/selectors'; import { buildCustomEmojiHtml } from '../helpers/customEmoji'; +import { prepareForRegExp } from '../helpers/prepareForRegExp'; -import useLastCallback from '../../../../hooks/useLastCallback'; -import useFlag from '../../../../hooks/useFlag'; -import useDerivedSignal from '../../../../hooks/useDerivedSignal'; import { useThrottledResolver } from '../../../../hooks/useAsyncResolvers'; +import useDerivedSignal from '../../../../hooks/useDerivedSignal'; +import useFlag from '../../../../hooks/useFlag'; +import useLastCallback from '../../../../hooks/useLastCallback'; interface Library { keywords: string[]; diff --git a/src/components/middle/composer/hooks/useInlineBotTooltip.ts b/src/components/middle/composer/hooks/useInlineBotTooltip.ts index c4a748537..a42ae9922 100644 --- a/src/components/middle/composer/hooks/useInlineBotTooltip.ts +++ b/src/components/middle/composer/hooks/useInlineBotTooltip.ts @@ -1,16 +1,16 @@ import { useEffect } from '../../../../lib/teact/teact'; +import { getActions } from '../../../../global'; import type { InlineBotSettings } from '../../../../types'; import type { Signal } from '../../../../util/signals'; -import { getActions } from '../../../../global'; import memoized from '../../../../util/memoized'; -import useLastCallback from '../../../../hooks/useLastCallback'; -import useFlag from '../../../../hooks/useFlag'; -import useDerivedState from '../../../../hooks/useDerivedState'; -import useSyncEffect from '../../../../hooks/useSyncEffect'; import { useThrottledResolver } from '../../../../hooks/useAsyncResolvers'; +import useDerivedState from '../../../../hooks/useDerivedState'; +import useFlag from '../../../../hooks/useFlag'; +import useLastCallback from '../../../../hooks/useLastCallback'; +import useSyncEffect from '../../../../hooks/useSyncEffect'; const THROTTLE = 300; const INLINE_BOT_QUERY_REGEXP = /^@([a-z0-9_]{1,32})[\u00A0\u0020]+(.*)/i; diff --git a/src/components/middle/composer/hooks/useInputCustomEmojis.ts b/src/components/middle/composer/hooks/useInputCustomEmojis.ts index b507b0ca4..9c881f20c 100644 --- a/src/components/middle/composer/hooks/useInputCustomEmojis.ts +++ b/src/components/middle/composer/hooks/useInputCustomEmojis.ts @@ -1,30 +1,30 @@ import { useEffect, useLayoutEffect, useRef, } from '../../../../lib/teact/teact'; -import { requestMeasure } from '../../../../lib/fasterdom/fasterdom'; -import { ensureRLottie } from '../../../../lib/rlottie/RLottie.async'; +import { getGlobal } from '../../../../global'; import type { ApiSticker } from '../../../../api/types'; import type { Signal } from '../../../../util/signals'; -import { getGlobal } from '../../../../global'; +import { requestMeasure } from '../../../../lib/fasterdom/fasterdom'; +import { ensureRLottie } from '../../../../lib/rlottie/RLottie.async'; import { selectIsAlwaysHighPriorityEmoji } from '../../../../global/selectors'; +import AbsoluteVideo from '../../../../util/AbsoluteVideo'; import { addCustomEmojiInputRenderCallback, getCustomEmojiMediaDataForInput, } from '../../../../util/customEmojiManager'; import { round } from '../../../../util/math'; -import AbsoluteVideo from '../../../../util/AbsoluteVideo'; -import { REM } from '../../../common/helpers/mediaDimensions'; import { hexToRgb } from '../../../../util/switchTheme'; -import useColorFilter from '../../../../hooks/stickers/useColorFilter'; +import { REM } from '../../../common/helpers/mediaDimensions'; +import useColorFilter from '../../../../hooks/stickers/useColorFilter'; +import useDynamicColorListener from '../../../../hooks/stickers/useDynamicColorListener'; +import useBackgroundMode from '../../../../hooks/useBackgroundMode'; +import useEffectWithPrevDeps from '../../../../hooks/useEffectWithPrevDeps'; import useLastCallback from '../../../../hooks/useLastCallback'; import useResizeObserver from '../../../../hooks/useResizeObserver'; -import useBackgroundMode from '../../../../hooks/useBackgroundMode'; import useThrottledCallback from '../../../../hooks/useThrottledCallback'; -import useDynamicColorListener from '../../../../hooks/stickers/useDynamicColorListener'; -import useEffectWithPrevDeps from '../../../../hooks/useEffectWithPrevDeps'; const SIZE = 1.25 * REM; const THROTTLE_MS = 300; diff --git a/src/components/middle/composer/hooks/useMentionTooltip.ts b/src/components/middle/composer/hooks/useMentionTooltip.ts index 671bdc988..c8e1541fa 100644 --- a/src/components/middle/composer/hooks/useMentionTooltip.ts +++ b/src/components/middle/composer/hooks/useMentionTooltip.ts @@ -1,22 +1,22 @@ import type { RefObject } from 'react'; import { useEffect, useState } from '../../../../lib/teact/teact'; import { getGlobal } from '../../../../global'; -import { requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; import type { ApiChatMember, ApiUser } from '../../../../api/types'; import type { Signal } from '../../../../util/signals'; - import { ApiMessageEntityTypes } from '../../../../api/types'; + +import { requestNextMutation } from '../../../../lib/fasterdom/fasterdom'; import { filterUsersByName, getMainUsername, getUserFirstOrLastName } from '../../../../global/helpers'; -import { prepareForRegExp } from '../helpers/prepareForRegExp'; import focusEditableElement from '../../../../util/focusEditableElement'; import { pickTruthy, unique } from '../../../../util/iteratees'; import { getCaretPosition, getHtmlBeforeSelection, setCaretPosition } from '../../../../util/selection'; +import { prepareForRegExp } from '../helpers/prepareForRegExp'; -import useLastCallback from '../../../../hooks/useLastCallback'; -import useFlag from '../../../../hooks/useFlag'; -import useDerivedSignal from '../../../../hooks/useDerivedSignal'; import { useThrottledResolver } from '../../../../hooks/useAsyncResolvers'; +import useDerivedSignal from '../../../../hooks/useDerivedSignal'; +import useFlag from '../../../../hooks/useFlag'; +import useLastCallback from '../../../../hooks/useLastCallback'; const THROTTLE = 300; diff --git a/src/components/middle/composer/hooks/useStickerTooltip.ts b/src/components/middle/composer/hooks/useStickerTooltip.ts index 0742e0c31..2b6c7355a 100644 --- a/src/components/middle/composer/hooks/useStickerTooltip.ts +++ b/src/components/middle/composer/hooks/useStickerTooltip.ts @@ -1,18 +1,18 @@ import { useEffect } from '../../../../lib/teact/teact'; +import { getActions } from '../../../../global'; import type { ApiSticker } from '../../../../api/types'; import type { Signal } from '../../../../util/signals'; -import { getActions } from '../../../../global'; import { EMOJI_IMG_REGEX } from '../../../../config'; -import { IS_EMOJI_SUPPORTED } from '../../../../util/windowEnvironment'; -import parseEmojiOnlyString from '../../../../util/parseEmojiOnlyString'; import twemojiRegex from '../../../../lib/twemojiRegex'; +import parseEmojiOnlyString from '../../../../util/parseEmojiOnlyString'; +import { IS_EMOJI_SUPPORTED } from '../../../../util/windowEnvironment'; import { prepareForRegExp } from '../helpers/prepareForRegExp'; +import useDerivedSignal from '../../../../hooks/useDerivedSignal'; import useDerivedState from '../../../../hooks/useDerivedState'; import useFlag from '../../../../hooks/useFlag'; -import useDerivedSignal from '../../../../hooks/useDerivedSignal'; const MAX_LENGTH = 8; const STARTS_ENDS_ON_EMOJI_IMG_REGEX = new RegExp(`^${EMOJI_IMG_REGEX.source}$`, 'g'); diff --git a/src/components/middle/composer/hooks/useVoiceRecording.ts b/src/components/middle/composer/hooks/useVoiceRecording.ts index 9903c1913..80abba62b 100644 --- a/src/components/middle/composer/hooks/useVoiceRecording.ts +++ b/src/components/middle/composer/hooks/useVoiceRecording.ts @@ -1,9 +1,9 @@ import { useEffect, useRef, useState } from '../../../../lib/teact/teact'; -import { requestMutation } from '../../../../lib/fasterdom/fasterdom'; -import { IS_SAFARI, IS_VOICE_RECORDING_SUPPORTED } from '../../../../util/windowEnvironment'; -import * as voiceRecording from '../../../../util/voiceRecording'; +import { requestMutation } from '../../../../lib/fasterdom/fasterdom'; import captureEscKeyListener from '../../../../util/captureEscKeyListener'; +import * as voiceRecording from '../../../../util/voiceRecording'; +import { IS_SAFARI, IS_VOICE_RECORDING_SUPPORTED } from '../../../../util/windowEnvironment'; import useLastCallback from '../../../../hooks/useLastCallback'; diff --git a/src/components/middle/composer/inlineResults/BaseResult.tsx b/src/components/middle/composer/inlineResults/BaseResult.tsx index b60268af1..13659384b 100644 --- a/src/components/middle/composer/inlineResults/BaseResult.tsx +++ b/src/components/middle/composer/inlineResults/BaseResult.tsx @@ -5,9 +5,10 @@ import type { ApiWebDocument } from '../../../../api/types'; import { getFirstLetters } from '../../../../util/textFormat'; import renderText from '../../../common/helpers/renderText'; -import useMedia from '../../../../hooks/useMedia'; import { preventMessageInputBlurWithBubbling } from '../../helpers/preventMessageInputBlur'; +import useMedia from '../../../../hooks/useMedia'; + import ListItem from '../../../ui/ListItem'; import './BaseResult.scss'; diff --git a/src/components/middle/composer/inlineResults/GifResult.tsx b/src/components/middle/composer/inlineResults/GifResult.tsx index eb78487dc..ce630941f 100644 --- a/src/components/middle/composer/inlineResults/GifResult.tsx +++ b/src/components/middle/composer/inlineResults/GifResult.tsx @@ -2,7 +2,6 @@ import type { FC } from '../../../../lib/teact/teact'; import React, { memo } from '../../../../lib/teact/teact'; import type { ApiBotInlineMediaResult, ApiBotInlineResult, ApiVideo } from '../../../../api/types'; - import type { ObserveFn } from '../../../../hooks/useIntersectionObserver'; import useLastCallback from '../../../../hooks/useLastCallback'; diff --git a/src/components/middle/composer/inlineResults/StickerResult.tsx b/src/components/middle/composer/inlineResults/StickerResult.tsx index 1fb55fe5f..bc6b3480c 100644 --- a/src/components/middle/composer/inlineResults/StickerResult.tsx +++ b/src/components/middle/composer/inlineResults/StickerResult.tsx @@ -2,9 +2,9 @@ import type { FC } from '../../../../lib/teact/teact'; import React, { memo } from '../../../../lib/teact/teact'; import type { ApiBotInlineMediaResult, ApiBotInlineResult } from '../../../../api/types'; +import type { ObserveFn } from '../../../../hooks/useIntersectionObserver'; import { STICKER_SIZE_INLINE_BOT_RESULT } from '../../../../config'; -import type { ObserveFn } from '../../../../hooks/useIntersectionObserver'; import StickerButton from '../../../common/StickerButton'; diff --git a/src/components/middle/helpers/groupMessages.ts b/src/components/middle/helpers/groupMessages.ts index 9afa9f208..f611318e3 100644 --- a/src/components/middle/helpers/groupMessages.ts +++ b/src/components/middle/helpers/groupMessages.ts @@ -1,8 +1,8 @@ import type { ApiMessage } from '../../../api/types'; import type { IAlbum } from '../../../types'; -import { getDayStartAt } from '../../../util/dateFormat'; import { isActionMessage } from '../../../global/helpers'; +import { getDayStartAt } from '../../../util/dateFormat'; type SenderGroup = (ApiMessage | IAlbum)[]; diff --git a/src/components/middle/hooks/useAuthorWidth.ts b/src/components/middle/hooks/useAuthorWidth.ts index fa995287f..e5ffd018d 100644 --- a/src/components/middle/hooks/useAuthorWidth.ts +++ b/src/components/middle/hooks/useAuthorWidth.ts @@ -1,5 +1,6 @@ import type { RefObject } from 'react'; import { useLayoutEffect } from '../../../lib/teact/teact'; + import { requestForcedReflow } from '../../../lib/fasterdom/fasterdom'; export default function useAuthorWidth( diff --git a/src/components/middle/hooks/useContainerHeight.ts b/src/components/middle/hooks/useContainerHeight.ts index f57a9d50a..cc18a6df5 100644 --- a/src/components/middle/hooks/useContainerHeight.ts +++ b/src/components/middle/hooks/useContainerHeight.ts @@ -2,8 +2,8 @@ import type { RefObject } from 'react'; import { useEffect, useRef } from '../../../lib/teact/teact'; import useLastCallback from '../../../hooks/useLastCallback'; -import useSignal from '../../../hooks/useSignal'; import useResizeObserver from '../../../hooks/useResizeObserver'; +import useSignal from '../../../hooks/useSignal'; export default function useContainerHeight(containerRef: RefObject, isComposerVisible: boolean) { const [getContainerHeight, setContainerHeight] = useSignal(); diff --git a/src/components/middle/hooks/useMessageObservers.ts b/src/components/middle/hooks/useMessageObservers.ts index 35851e722..f4c9e2385 100644 --- a/src/components/middle/hooks/useMessageObservers.ts +++ b/src/components/middle/hooks/useMessageObservers.ts @@ -5,9 +5,10 @@ import type { MessageListType } from '../../../global/types'; import type { PinnedIntersectionChangedCallback } from './usePinnedMessage'; import { IS_ANDROID } from '../../../util/windowEnvironment'; -import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import useBackgroundMode, { isBackgroundModeActive } from '../../../hooks/useBackgroundMode'; + import useAppLayout from '../../../hooks/useAppLayout'; +import useBackgroundMode, { isBackgroundModeActive } from '../../../hooks/useBackgroundMode'; +import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; const INTERSECTION_THROTTLE_FOR_READING = 150; const INTERSECTION_THROTTLE_FOR_MEDIA = IS_ANDROID ? 1000 : 350; diff --git a/src/components/middle/hooks/usePinnedMessage.ts b/src/components/middle/hooks/usePinnedMessage.ts index 226bd28eb..292810016 100644 --- a/src/components/middle/hooks/usePinnedMessage.ts +++ b/src/components/middle/hooks/usePinnedMessage.ts @@ -1,14 +1,14 @@ -import { getGlobal } from '../../../global'; import { useEffect, useRef } from '../../../lib/teact/teact'; +import { getGlobal } from '../../../global'; import { selectFocusedMessageId, selectListedIds, selectOutlyingListByMessageId, } from '../../../global/selectors'; +import cycleRestrict from '../../../util/cycleRestrict'; import { unique } from '../../../util/iteratees'; import { clamp } from '../../../util/math'; -import cycleRestrict from '../../../util/cycleRestrict'; import useLastCallback from '../../../hooks/useLastCallback'; import useSignal from '../../../hooks/useSignal'; diff --git a/src/components/middle/hooks/useScrollHooks.ts b/src/components/middle/hooks/useScrollHooks.ts index ccc01ec3c..3c75bb65f 100644 --- a/src/components/middle/hooks/useScrollHooks.ts +++ b/src/components/middle/hooks/useScrollHooks.ts @@ -1,21 +1,21 @@ import type { RefObject } from 'react'; import { useEffect, useMemo, useRef } from '../../../lib/teact/teact'; -import { requestMeasure } from '../../../lib/fasterdom/fasterdom'; import { getActions } from '../../../global'; -import { LoadMoreDirection } from '../../../types'; import type { MessageListType } from '../../../global/types'; import type { Signal } from '../../../util/signals'; +import { LoadMoreDirection } from '../../../types'; -import { MESSAGE_LIST_SENSITIVE_AREA } from '../../../util/windowEnvironment'; -import { debounce } from '../../../util/schedulers'; +import { requestMeasure } from '../../../lib/fasterdom/fasterdom'; import { isLocalMessageId } from '../../../global/helpers'; +import { debounce } from '../../../util/schedulers'; +import { MESSAGE_LIST_SENSITIVE_AREA } from '../../../util/windowEnvironment'; -import useLastCallback from '../../../hooks/useLastCallback'; -import { useIntersectionObserver, useOnIntersect } from '../../../hooks/useIntersectionObserver'; -import useSyncEffect from '../../../hooks/useSyncEffect'; -import { useSignalEffect } from '../../../hooks/useSignalEffect'; import { useDebouncedSignal } from '../../../hooks/useAsyncResolvers'; +import { useIntersectionObserver, useOnIntersect } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import { useSignalEffect } from '../../../hooks/useSignalEffect'; +import useSyncEffect from '../../../hooks/useSyncEffect'; const FAB_THRESHOLD = 50; const NOTCH_THRESHOLD = 1; // Notch has zero height so we at least need a 1px margin to intersect diff --git a/src/components/middle/hooks/useStickyDates.ts b/src/components/middle/hooks/useStickyDates.ts index d968725a1..854938aeb 100644 --- a/src/components/middle/hooks/useStickyDates.ts +++ b/src/components/middle/hooks/useStickyDates.ts @@ -1,8 +1,8 @@ import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import useFlag from '../../../hooks/useFlag'; import useLastCallback from '../../../hooks/useLastCallback'; import useRunDebounced from '../../../hooks/useRunDebounced'; -import useFlag from '../../../hooks/useFlag'; const DEBOUNCE = 1000; const STICKY_TOP = 10; diff --git a/src/components/middle/message/Album.tsx b/src/components/middle/message/Album.tsx index 52d2dee6b..37d424efe 100644 --- a/src/components/middle/message/Album.tsx +++ b/src/components/middle/message/Album.tsx @@ -1,22 +1,22 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; +import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { GlobalState } from '../../../global/types'; import type { ApiMessage } from '../../../api/types'; +import type { GlobalState } from '../../../global/types'; +import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import type { IAlbum, ISettings } from '../../../types'; import type { IAlbumLayout } from './helpers/calculateAlbumLayout'; -import { AlbumRectPart } from './helpers/calculateAlbumLayout'; import { getMessageContent, getMessageHtmlId, getMessageOriginalId } from '../../../global/helpers'; -import { getActions, getGlobal, withGlobal } from '../../../global'; -import withSelectControl from './hocs/withSelectControl'; -import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import { selectActiveDownloads, selectCanAutoLoadMedia, selectCanAutoPlayMedia, selectTheme, } from '../../../global/selectors'; +import { AlbumRectPart } from './helpers/calculateAlbumLayout'; +import withSelectControl from './hocs/withSelectControl'; import useLastCallback from '../../../hooks/useLastCallback'; diff --git a/src/components/middle/message/AnimatedCustomEmoji.tsx b/src/components/middle/message/AnimatedCustomEmoji.tsx index 4e33f5537..0c5adca49 100644 --- a/src/components/middle/message/AnimatedCustomEmoji.tsx +++ b/src/components/middle/message/AnimatedCustomEmoji.tsx @@ -6,14 +6,15 @@ import type { ApiSticker } from '../../../api/types'; import type { ActiveEmojiInteraction } from '../../../global/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; -import { LIKE_STICKER_ID } from '../../common/helpers/mediaDimensions'; import { selectAnimatedEmojiEffect, selectAnimatedEmojiSound, selectCanPlayAnimatedEmojis, } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; +import { LIKE_STICKER_ID } from '../../common/helpers/mediaDimensions'; import { getCustomEmojiSize } from '../composer/helpers/customEmoji'; + import useAnimatedEmoji from '../../common/hooks/useAnimatedEmoji'; import CustomEmoji from '../../common/CustomEmoji'; diff --git a/src/components/middle/message/AnimatedEmoji.tsx b/src/components/middle/message/AnimatedEmoji.tsx index 249fca3db..767837a0a 100644 --- a/src/components/middle/message/AnimatedEmoji.tsx +++ b/src/components/middle/message/AnimatedEmoji.tsx @@ -6,13 +6,14 @@ import type { ApiSticker } from '../../../api/types'; import type { ActiveEmojiInteraction } from '../../../global/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; -import { LIKE_STICKER_ID } from '../../common/helpers/mediaDimensions'; import { selectAnimatedEmoji, selectAnimatedEmojiEffect, selectAnimatedEmojiSound, } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; +import { LIKE_STICKER_ID } from '../../common/helpers/mediaDimensions'; + import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; import useAnimatedEmoji from '../../common/hooks/useAnimatedEmoji'; diff --git a/src/components/middle/message/BaseStory.tsx b/src/components/middle/message/BaseStory.tsx index 2a324dd3c..53f758860 100644 --- a/src/components/middle/message/BaseStory.tsx +++ b/src/components/middle/message/BaseStory.tsx @@ -3,17 +3,17 @@ import { getActions } from '../../../global'; import type { ApiMessageStoryData, ApiTypeStory } from '../../../api/types'; -import { IS_CANVAS_FILTER_SUPPORTED } from '../../../util/windowEnvironment'; import { getStoryMediaHash } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; import { formatMediaDuration } from '../../../util/dateFormat'; +import { IS_CANVAS_FILTER_SUPPORTED } from '../../../util/windowEnvironment'; -import useMedia from '../../../hooks/useMedia'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useLang from '../../../hooks/useLang'; -import useCanvasBlur from '../../../hooks/useCanvasBlur'; import useAppLayout from '../../../hooks/useAppLayout'; +import useCanvasBlur from '../../../hooks/useCanvasBlur'; import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMedia from '../../../hooks/useMedia'; import useShowTransition from '../../../hooks/useShowTransition'; import styles from './BaseStory.module.scss'; diff --git a/src/components/middle/message/CommentButton.tsx b/src/components/middle/message/CommentButton.tsx index f52d1d305..b95984d41 100644 --- a/src/components/middle/message/CommentButton.tsx +++ b/src/components/middle/message/CommentButton.tsx @@ -7,14 +7,14 @@ import type { } from '../../../api/types'; import { isUserId } from '../../../global/helpers'; -import { formatIntegerCompact } from '../../../util/textFormat'; import buildClassName from '../../../util/buildClassName'; +import { formatIntegerCompact } from '../../../util/textFormat'; -import useLastCallback from '../../../hooks/useLastCallback'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; -import Avatar from '../../common/Avatar'; import AnimatedCounter from '../../common/AnimatedCounter'; +import Avatar from '../../common/Avatar'; import './CommentButton.scss'; diff --git a/src/components/middle/message/Contact.tsx b/src/components/middle/message/Contact.tsx index 3a491172f..6bff7fd96 100644 --- a/src/components/middle/message/Contact.tsx +++ b/src/components/middle/message/Contact.tsx @@ -2,11 +2,11 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { ApiUser, ApiContact, ApiCountryCode } from '../../../api/types'; +import type { ApiContact, ApiCountryCode, ApiUser } from '../../../api/types'; import { selectUser } from '../../../global/selectors'; -import { formatPhoneNumberWithCode } from '../../../util/phoneNumber'; import buildClassName from '../../../util/buildClassName'; +import { formatPhoneNumberWithCode } from '../../../util/phoneNumber'; import useLastCallback from '../../../hooks/useLastCallback'; diff --git a/src/components/middle/message/ContextMenuContainer.async.tsx b/src/components/middle/message/ContextMenuContainer.async.tsx index b6c3ae885..856712b2a 100644 --- a/src/components/middle/message/ContextMenuContainer.async.tsx +++ b/src/components/middle/message/ContextMenuContainer.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './ContextMenuContainer'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/message/ContextMenuContainer.tsx b/src/components/middle/message/ContextMenuContainer.tsx index a2baf6da1..25ef8029d 100644 --- a/src/components/middle/message/ContextMenuContainer.tsx +++ b/src/components/middle/message/ContextMenuContainer.tsx @@ -4,17 +4,30 @@ import React, { } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { MessageListType, TabState } from '../../../global/types'; import type { - ApiAvailableReaction, ApiStickerSetInfo, ApiMessage, ApiStickerSet, ApiChatReactions, ApiReaction, ApiThreadInfo, + ApiAvailableReaction, ApiChatReactions, ApiMessage, ApiReaction, ApiStickerSet, ApiStickerSetInfo, ApiThreadInfo, } from '../../../api/types'; +import type { MessageListType, TabState } from '../../../global/types'; import type { IAlbum, IAnchorPosition } from '../../../types'; +import { PREVIEW_AVATAR_COUNT, SERVICE_NOTIFICATIONS_USER_ID } from '../../../config'; +import { + areReactionsEmpty, + getChatMessageLink, + getMessageVideo, + isActionMessage, + isChatChannel, + isChatGroup, + isMessageLocal, + isOwnMessage, + isUserId, +} from '../../../global/helpers'; import { selectActiveDownloads, selectAllowedMessageActions, selectCanPlayAnimatedEmojis, selectCanScheduleUntilOnline, + selectCanTranslateMessage, selectChat, selectChatFullInfo, selectCurrentMessageList, @@ -22,39 +35,26 @@ import { selectIsMessageProtected, selectIsPremiumPurchaseBlocked, selectIsReactionPickerOpen, - selectCanTranslateMessage, selectMessageCustomEmojiSets, selectMessageTranslations, + selectRequestedChatTranslationLanguage, selectRequestedMessageTranslationLanguage, selectStickerSet, - selectRequestedChatTranslationLanguage, } from '../../../global/selectors'; -import { - isActionMessage, - isChatChannel, - isChatGroup, - isOwnMessage, - areReactionsEmpty, - isUserId, - isMessageLocal, - getMessageVideo, - getChatMessageLink, -} from '../../../global/helpers'; -import { PREVIEW_AVATAR_COUNT, SERVICE_NOTIFICATIONS_USER_ID } from '../../../config'; import buildClassName from '../../../util/buildClassName'; import { copyTextToClipboard } from '../../../util/clipboard'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useShowTransition from '../../../hooks/useShowTransition'; import useFlag from '../../../hooks/useFlag'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import useSchedule from '../../../hooks/useSchedule'; +import useShowTransition from '../../../hooks/useShowTransition'; import DeleteMessageModal from '../../common/DeleteMessageModal'; -import ReportModal from '../../common/ReportModal'; import PinMessageModal from '../../common/PinMessageModal'; -import MessageContextMenu from './MessageContextMenu'; +import ReportModal from '../../common/ReportModal'; import ConfirmDialog from '../../ui/ConfirmDialog'; +import MessageContextMenu from './MessageContextMenu'; export type OwnProps = { isOpen: boolean; diff --git a/src/components/middle/message/CustomEmojiEffect.tsx b/src/components/middle/message/CustomEmojiEffect.tsx index 761adcc41..5d6566e2d 100644 --- a/src/components/middle/message/CustomEmojiEffect.tsx +++ b/src/components/middle/message/CustomEmojiEffect.tsx @@ -1,11 +1,12 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiEmojiStatus, ApiReactionCustomEmoji } from '../../../api/types'; -import { IS_OFFSET_PATH_SUPPORTED } from '../../../util/windowEnvironment'; import { getStickerPreviewHash } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; +import { IS_OFFSET_PATH_SUPPORTED } from '../../../util/windowEnvironment'; + import useMedia from '../../../hooks/useMedia'; import CustomEmoji from '../../common/CustomEmoji'; diff --git a/src/components/middle/message/Game.tsx b/src/components/middle/message/Game.tsx index 14bf8c389..371915202 100644 --- a/src/components/middle/message/Game.tsx +++ b/src/components/middle/message/Game.tsx @@ -1,9 +1,9 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; +import { getActions } from '../../../global'; import type { ApiMessage } from '../../../api/types'; -import { getActions } from '../../../global'; import { getGamePreviewPhotoHash, getGamePreviewVideoHash, getMessageText } from '../../../global/helpers'; import useMedia from '../../../hooks/useMedia'; diff --git a/src/components/middle/message/InlineButtons.tsx b/src/components/middle/message/InlineButtons.tsx index acd643109..ab3edb1b5 100644 --- a/src/components/middle/message/InlineButtons.tsx +++ b/src/components/middle/message/InlineButtons.tsx @@ -1,10 +1,11 @@ +import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiKeyboardButton, ApiMessage } from '../../../api/types'; import { RE_TME_LINK } from '../../../config'; import renderText from '../../common/helpers/renderText'; + import useLang from '../../../hooks/useLang'; import Button from '../../ui/Button'; diff --git a/src/components/middle/message/Invoice.tsx b/src/components/middle/message/Invoice.tsx index b21d7cc49..b08a7ace7 100644 --- a/src/components/middle/message/Invoice.tsx +++ b/src/components/middle/message/Invoice.tsx @@ -1,18 +1,18 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useRef } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiMessage } from '../../../api/types'; import type { ISettings } from '../../../types'; import { CUSTOM_APPENDIX_ATTRIBUTE, MESSAGE_CONTENT_SELECTOR } from '../../../config'; import { getMessageInvoice, getWebDocumentHash } from '../../../global/helpers'; +import buildStyle from '../../../util/buildStyle'; import { formatCurrency } from '../../../util/formatCurrency'; import renderText from '../../common/helpers/renderText'; import getCustomAppendixBg from './helpers/getCustomAppendixBg'; -import buildStyle from '../../../util/buildStyle'; -import useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps'; import useLang from '../../../hooks/useLang'; +import useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps'; import useMedia from '../../../hooks/useMedia'; import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef'; diff --git a/src/components/middle/message/InvoiceMediaPreview.tsx b/src/components/middle/message/InvoiceMediaPreview.tsx index 69519711d..830a2d606 100644 --- a/src/components/middle/message/InvoiceMediaPreview.tsx +++ b/src/components/middle/message/InvoiceMediaPreview.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiMessage } from '../../../api/types'; import { getMessageInvoice } from '../../../global/helpers'; -import { formatCurrency } from '../../../util/formatCurrency'; -import { formatMediaDuration } from '../../../util/dateFormat'; import buildClassName from '../../../util/buildClassName'; +import { formatMediaDuration } from '../../../util/dateFormat'; +import { formatCurrency } from '../../../util/formatCurrency'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useLang from '../../../hooks/useLang'; import useInterval from '../../../hooks/useInterval'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import MediaSpoiler from '../../common/MediaSpoiler'; diff --git a/src/components/middle/message/Location.tsx b/src/components/middle/message/Location.tsx index 8bafab076..554553b19 100644 --- a/src/components/middle/message/Location.tsx +++ b/src/components/middle/message/Location.tsx @@ -1,32 +1,32 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useLayoutEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChat, ApiMessage, ApiUser } from '../../../api/types'; import type { ISettings } from '../../../types'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { - getMessageLocation, buildStaticMapHash, + getMessageLocation, isGeoLiveExpired, } from '../../../global/helpers'; +import buildClassName from '../../../util/buildClassName'; import { formatCountdownShort, formatLastUpdated } from '../../../util/dateFormat'; import { getMetersPerPixel, getVenueColor, getVenueIconUrl, } from '../../../util/map'; import { getServerTime } from '../../../util/serverTime'; +import useForceUpdate from '../../../hooks/useForceUpdate'; +import useInterval from '../../../hooks/useInterval'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import useMedia from '../../../hooks/useMedia'; -import useLang from '../../../hooks/useLang'; -import useForceUpdate from '../../../hooks/useForceUpdate'; -import useTimeout from '../../../hooks/useTimeout'; -import buildClassName from '../../../util/buildClassName'; import usePrevious from '../../../hooks/usePrevious'; -import useInterval from '../../../hooks/useInterval'; +import useTimeout from '../../../hooks/useTimeout'; import Avatar from '../../common/Avatar'; import Skeleton from '../../ui/placeholder/Skeleton'; diff --git a/src/components/middle/message/Message.tsx b/src/components/middle/message/Message.tsx index 35d7665b9..4a31924cc 100644 --- a/src/components/middle/message/Message.tsx +++ b/src/components/middle/message/Message.tsx @@ -3,12 +3,7 @@ import React, { memo, useCallback, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { - ActiveEmojiInteraction, - ActiveReaction, - ChatTranslatedMessages, - MessageListType, -} from '../../../global/types'; + import type { ApiAvailableReaction, ApiChat, @@ -23,16 +18,42 @@ import type { ApiUser, ApiUsername, } from '../../../api/types'; -import { MAIN_THREAD_ID } from '../../../api/types'; -import type { FocusDirection, IAlbum, ISettings } from '../../../types'; -import { AudioOrigin } from '../../../types'; +import type { + ActiveEmojiInteraction, + ActiveReaction, + ChatTranslatedMessages, + MessageListType, +} from '../../../global/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; -import { useOnIntersect } from '../../../hooks/useIntersectionObserver'; -import type { PinnedIntersectionChangedCallback } from '../hooks/usePinnedMessage'; +import type { FocusDirection, IAlbum, ISettings } from '../../../types'; import type { Signal } from '../../../util/signals'; +import type { PinnedIntersectionChangedCallback } from '../hooks/usePinnedMessage'; +import { MAIN_THREAD_ID } from '../../../api/types'; +import { AudioOrigin } from '../../../types'; -import { IS_ANDROID, IS_TRANSLATION_SUPPORTED } from '../../../util/windowEnvironment'; import { EMOJI_STATUS_LOOP_LIMIT, GENERAL_TOPIC_ID, IS_ELECTRON } from '../../../config'; +import { + areReactionsEmpty, + getMessageContent, + getMessageCustomShape, + getMessageHtmlId, + getMessageLocation, + getMessageSingleCustomEmoji, + getMessageSingleRegularEmoji, + getSenderTitle, + getUserColorKey, + hasMessageText, + isAnonymousOwnMessage, + isChatChannel, + isChatGroup, + isChatWithRepliesBot, + isGeoLiveExpired, + isMessageLocal, + isMessageTranslatable, + isOwnMessage, + isReplyMessage, + isUserId, +} from '../../../global/helpers'; import { selectAllowedMessageActions, selectAnimatedEmoji, @@ -72,98 +93,78 @@ import { selectUser, selectUserStory, } from '../../../global/selectors'; -import { - areReactionsEmpty, - getMessageContent, - getMessageCustomShape, - getMessageHtmlId, - getMessageLocation, - getMessageSingleCustomEmoji, - getMessageSingleRegularEmoji, - getSenderTitle, - getUserColorKey, - hasMessageText, - isAnonymousOwnMessage, - isChatChannel, - isChatGroup, - isChatWithRepliesBot, - isGeoLiveExpired, - isMessageLocal, - isMessageTranslatable, - isOwnMessage, - isReplyMessage, - isUserId, -} from '../../../global/helpers'; +import { isAnimatingScroll } from '../../../util/animateScroll'; import buildClassName from '../../../util/buildClassName'; +import { isElementInViewport } from '../../../util/isElementInViewport'; +import { IS_ANDROID, IS_TRANSLATION_SUPPORTED } from '../../../util/windowEnvironment'; import { calculateDimensionsForMessageMedia, getStickerDimensions, REM, ROUND_VIDEO_DIMENSIONS_PX, } from '../../common/helpers/mediaDimensions'; -import { buildContentClassName } from './helpers/buildContentClassName'; -import { calculateMediaDimensions, getMinMediaWidth, MIN_MEDIA_WIDTH_WITH_TEXT } from './helpers/mediaDimensions'; -import { calculateAlbumLayout } from './helpers/calculateAlbumLayout'; import renderText from '../../common/helpers/renderText'; -import { isElementInViewport } from '../../../util/isElementInViewport'; import { getCustomEmojiSize } from '../composer/helpers/customEmoji'; -import { isAnimatingScroll } from '../../../util/animateScroll'; +import { buildContentClassName } from './helpers/buildContentClassName'; +import { calculateAlbumLayout } from './helpers/calculateAlbumLayout'; +import { calculateMediaDimensions, getMinMediaWidth, MIN_MEDIA_WIDTH_WITH_TEXT } from './helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useEnsureMessage from '../../../hooks/useEnsureMessage'; -import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; -import useLang from '../../../hooks/useLang'; -import useShowTransition from '../../../hooks/useShowTransition'; -import useFlag from '../../../hooks/useFlag'; -import useFocusMessage from './hooks/useFocusMessage'; -import useOuterHandlers from './hooks/useOuterHandlers'; -import useInnerHandlers from './hooks/useInnerHandlers'; import useAppLayout from '../../../hooks/useAppLayout'; -import useResizeObserver from '../../../hooks/useResizeObserver'; -import useThrottledCallback from '../../../hooks/useThrottledCallback'; -import useMessageTranslation from './hooks/useMessageTranslation'; -import usePrevious from '../../../hooks/usePrevious'; -import useTextLanguage from '../../../hooks/useTextLanguage'; -import useAuthorWidth from '../hooks/useAuthorWidth'; +import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; +import useEnsureMessage from '../../../hooks/useEnsureMessage'; import useEnsureStory from '../../../hooks/useEnsureStory'; +import useFlag from '../../../hooks/useFlag'; import { dispatchHeavyAnimationEvent } from '../../../hooks/useHeavyAnimationCheck'; +import { useOnIntersect } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import usePrevious from '../../../hooks/usePrevious'; +import useResizeObserver from '../../../hooks/useResizeObserver'; +import useShowTransition from '../../../hooks/useShowTransition'; +import useTextLanguage from '../../../hooks/useTextLanguage'; +import useThrottledCallback from '../../../hooks/useThrottledCallback'; +import useAuthorWidth from '../hooks/useAuthorWidth'; import useDetectChatLanguage from './hooks/useDetectChatLanguage'; +import useFocusMessage from './hooks/useFocusMessage'; +import useInnerHandlers from './hooks/useInnerHandlers'; +import useMessageTranslation from './hooks/useMessageTranslation'; +import useOuterHandlers from './hooks/useOuterHandlers'; -import Button from '../../ui/Button'; -import Avatar from '../../common/Avatar'; -import EmbeddedMessage from '../../common/EmbeddedMessage'; -import Document from '../../common/Document'; import Audio from '../../common/Audio'; -import MessageMeta from './MessageMeta'; -import ContextMenuContainer from './ContextMenuContainer.async'; -import Sticker from './Sticker'; -import AnimatedEmoji from './AnimatedEmoji'; +import Avatar from '../../common/Avatar'; +import CustomEmoji from '../../common/CustomEmoji'; +import Document from '../../common/Document'; +import DotAnimation from '../../common/DotAnimation'; +import EmbeddedMessage from '../../common/EmbeddedMessage'; +import EmbeddedStory from '../../common/EmbeddedStory'; +import FakeIcon from '../../common/FakeIcon'; +import MessageText from '../../common/MessageText'; +import PremiumIcon from '../../common/PremiumIcon'; +import ReactionStaticEmoji from '../../common/ReactionStaticEmoji'; +import TopicChip from '../../common/TopicChip'; +import Button from '../../ui/Button'; +import Album from './Album'; import AnimatedCustomEmoji from './AnimatedCustomEmoji'; -import Photo from './Photo'; -import Video from './Video'; +import AnimatedEmoji from './AnimatedEmoji'; +import CommentButton from './CommentButton'; import Contact from './Contact'; -import Poll from './Poll'; -import WebPage from './WebPage'; +import ContextMenuContainer from './ContextMenuContainer.async'; +import Game from './Game'; +import InlineButtons from './InlineButtons'; import Invoice from './Invoice'; import InvoiceMediaPreview from './InvoiceMediaPreview'; import Location from './Location'; -import Game from './Game'; -import Album from './Album'; -import RoundVideo from './RoundVideo'; -import InlineButtons from './InlineButtons'; -import CommentButton from './CommentButton'; -import Reactions from './Reactions'; -import ReactionStaticEmoji from '../../common/ReactionStaticEmoji'; +import MessageMeta from './MessageMeta'; import MessagePhoneCall from './MessagePhoneCall'; -import DotAnimation from '../../common/DotAnimation'; -import CustomEmoji from '../../common/CustomEmoji'; -import PremiumIcon from '../../common/PremiumIcon'; -import FakeIcon from '../../common/FakeIcon'; -import MessageText from '../../common/MessageText'; -import TopicChip from '../../common/TopicChip'; -import EmbeddedStory from '../../common/EmbeddedStory'; +import Photo from './Photo'; +import Poll from './Poll'; +import Reactions from './Reactions'; +import RoundVideo from './RoundVideo'; +import Sticker from './Sticker'; import Story from './Story'; import StoryMention from './StoryMention'; +import Video from './Video'; +import WebPage from './WebPage'; import './Message.scss'; diff --git a/src/components/middle/message/MessageContextMenu.tsx b/src/components/middle/message/MessageContextMenu.tsx index aff1209b7..6dcbccde0 100644 --- a/src/components/middle/message/MessageContextMenu.tsx +++ b/src/components/middle/message/MessageContextMenu.tsx @@ -1,9 +1,9 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAvailableReaction, ApiChat, @@ -17,25 +17,25 @@ import type { } from '../../../api/types'; import type { IAnchorPosition } from '../../../types'; -import { REM } from '../../common/helpers/mediaDimensions'; -import { getMessageCopyOptions } from './helpers/copyOptions'; -import { disableScrolling, enableScrolling } from '../../../util/scrollLock'; -import buildClassName from '../../../util/buildClassName'; -import renderText from '../../common/helpers/renderText'; import { getUserFullName, isUserId } from '../../../global/helpers'; +import buildClassName from '../../../util/buildClassName'; +import { disableScrolling, enableScrolling } from '../../../util/scrollLock'; +import { REM } from '../../common/helpers/mediaDimensions'; +import renderText from '../../common/helpers/renderText'; +import { getMessageCopyOptions } from './helpers/copyOptions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useFlag from '../../../hooks/useFlag'; -import useMenuPosition from '../../../hooks/useMenuPosition'; -import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; +import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMenuPosition from '../../../hooks/useMenuPosition'; +import AvatarList from '../../common/AvatarList'; import Menu from '../../ui/Menu'; import MenuItem from '../../ui/MenuItem'; import MenuSeparator from '../../ui/MenuSeparator'; import Skeleton from '../../ui/placeholder/Skeleton'; import ReactionSelector from './ReactionSelector'; -import AvatarList from '../../common/AvatarList'; import './MessageContextMenu.scss'; diff --git a/src/components/middle/message/MessageMeta.tsx b/src/components/middle/message/MessageMeta.tsx index 792e873c8..8707fa54a 100644 --- a/src/components/middle/message/MessageMeta.tsx +++ b/src/components/middle/message/MessageMeta.tsx @@ -6,16 +6,16 @@ import type { ApiAvailableReaction, ApiMessage, ApiMessageOutgoingStatus, ApiThreadInfo, } from '../../../api/types'; +import buildClassName from '../../../util/buildClassName'; import { formatDateTimeToString, formatTime } from '../../../util/dateFormat'; import { formatIntegerCompact } from '../../../util/textFormat'; - import renderText from '../../common/helpers/renderText'; -import useLang from '../../../hooks/useLang'; -import useFlag from '../../../hooks/useFlag'; -import buildClassName from '../../../util/buildClassName'; -import MessageOutgoingStatus from '../../common/MessageOutgoingStatus'; +import useFlag from '../../../hooks/useFlag'; +import useLang from '../../../hooks/useLang'; + import AnimatedCounter from '../../common/AnimatedCounter'; +import MessageOutgoingStatus from '../../common/MessageOutgoingStatus'; import './MessageMeta.scss'; diff --git a/src/components/middle/message/MessagePhoneCall.tsx b/src/components/middle/message/MessagePhoneCall.tsx index cd3fc20f9..5a5e60d12 100644 --- a/src/components/middle/message/MessagePhoneCall.tsx +++ b/src/components/middle/message/MessagePhoneCall.tsx @@ -4,11 +4,11 @@ import { getActions } from '../../../global'; import type { ApiMessage, PhoneCallAction } from '../../../api/types'; -import useLang from '../../../hooks/useLang'; import buildClassName from '../../../util/buildClassName'; -import { formatTimeDuration, formatTime } from '../../../util/dateFormat'; +import { formatTime, formatTimeDuration } from '../../../util/dateFormat'; import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; import Button from '../../ui/Button'; diff --git a/src/components/middle/message/Photo.tsx b/src/components/middle/message/Photo.tsx index 19877c3a6..1830acfad 100644 --- a/src/components/middle/message/Photo.tsx +++ b/src/components/middle/message/Photo.tsx @@ -1,39 +1,39 @@ -import React, { useRef, useState } from '../../../lib/teact/teact'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; - import type { FC } from '../../../lib/teact/teact'; +import React, { useRef, useState } from '../../../lib/teact/teact'; + import type { ApiMessage } from '../../../api/types'; +import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import type { ISettings } from '../../../types'; import type { IMediaDimensions } from './helpers/calculateAlbumLayout'; -import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import { CUSTOM_APPENDIX_ATTRIBUTE, MESSAGE_CONTENT_SELECTOR } from '../../../config'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; import { + getMediaTransferState, + getMessageMediaFormat, + getMessageMediaHash, + getMessageMediaThumbDataUri, getMessagePhoto, getMessageWebPagePhoto, - getMessageMediaHash, - getMediaTransferState, isOwnMessage, - getMessageMediaFormat, - getMessageMediaThumbDataUri, } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; import getCustomAppendixBg from './helpers/getCustomAppendixBg'; import { calculateMediaDimensions, MIN_MEDIA_HEIGHT } from './helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useFlag from '../../../hooks/useFlag'; import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps'; +import useMediaTransition from '../../../hooks/useMediaTransition'; import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; +import usePrevious from '../../../hooks/usePrevious'; import useShowTransition from '../../../hooks/useShowTransition'; import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef'; -import usePrevious from '../../../hooks/usePrevious'; -import useMediaTransition from '../../../hooks/useMediaTransition'; -import useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps'; -import useFlag from '../../../hooks/useFlag'; -import useAppLayout from '../../../hooks/useAppLayout'; -import ProgressSpinner from '../../ui/ProgressSpinner'; import MediaSpoiler from '../../common/MediaSpoiler'; +import ProgressSpinner from '../../ui/ProgressSpinner'; export type OwnProps = { id?: string; diff --git a/src/components/middle/message/Poll.tsx b/src/components/middle/message/Poll.tsx index 64a01210f..6b9590b3f 100644 --- a/src/components/middle/message/Poll.tsx +++ b/src/components/middle/message/Poll.tsx @@ -1,32 +1,32 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { + memo, useEffect, useLayoutEffect, - useState, - memo, useMemo, useRef, + useState, } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { LangFn } from '../../../hooks/useLang'; import type { - ApiMessage, ApiPoll, ApiPollAnswer, ApiChat, ApiUser, + ApiChat, ApiMessage, ApiPoll, ApiPollAnswer, ApiUser, } from '../../../api/types'; +import type { LangFn } from '../../../hooks/useLang'; +import { formatMediaDuration } from '../../../util/dateFormat'; +import { getServerTime } from '../../../util/serverTime'; import renderText from '../../common/helpers/renderText'; import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities'; -import { formatMediaDuration } from '../../../util/dateFormat'; -import useLang from '../../../hooks/useLang'; -import { getServerTime } from '../../../util/serverTime'; +import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; -import CheckboxGroup from '../../ui/CheckboxGroup'; -import RadioGroup from '../../ui/RadioGroup'; import Avatar from '../../common/Avatar'; import Button from '../../ui/Button'; +import CheckboxGroup from '../../ui/CheckboxGroup'; import Notification from '../../ui/Notification'; +import RadioGroup from '../../ui/RadioGroup'; import PollOption from './PollOption'; import './Poll.scss'; diff --git a/src/components/middle/message/PollOption.tsx b/src/components/middle/message/PollOption.tsx index 28d43ffe8..2d5954e5e 100644 --- a/src/components/middle/message/PollOption.tsx +++ b/src/components/middle/message/PollOption.tsx @@ -1,6 +1,7 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useState, useEffect, + useEffect, + useState, } from '../../../lib/teact/teact'; import type { ApiPollAnswer, ApiPollResult } from '../../../api/types'; diff --git a/src/components/middle/message/ReactionAnimatedEmoji.tsx b/src/components/middle/message/ReactionAnimatedEmoji.tsx index 6a6c4295a..1e13f65ef 100644 --- a/src/components/middle/message/ReactionAnimatedEmoji.tsx +++ b/src/components/middle/message/ReactionAnimatedEmoji.tsx @@ -1,30 +1,30 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo, useRef, } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { ActiveReaction } from '../../../global/types'; import type { ApiAvailableReaction, ApiReaction, ApiStickerSet } from '../../../api/types'; +import type { ActiveReaction } from '../../../global/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; -import buildClassName from '../../../util/buildClassName'; import { isSameReaction } from '../../../global/helpers'; +import buildClassName from '../../../util/buildClassName'; import { REM } from '../../common/helpers/mediaDimensions'; -import useMedia from '../../../hooks/useMedia'; -import useShowTransition from '../../../hooks/useShowTransition'; import useFlag from '../../../hooks/useFlag'; import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMedia from '../../../hooks/useMedia'; +import useShowTransition from '../../../hooks/useShowTransition'; import useCustomEmoji from '../../common/hooks/useCustomEmoji'; +import AnimatedSticker from '../../common/AnimatedSticker'; import CustomEmoji from '../../common/CustomEmoji'; import ReactionStaticEmoji from '../../common/ReactionStaticEmoji'; -import AnimatedSticker from '../../common/AnimatedSticker'; import CustomEmojiEffect from './CustomEmojiEffect'; import styles from './ReactionAnimatedEmoji.module.scss'; -import useLastCallback from '../../../hooks/useLastCallback'; type OwnProps = { reaction: ApiReaction; diff --git a/src/components/middle/message/ReactionButton.tsx b/src/components/middle/message/ReactionButton.tsx index 598e33950..d16ca0b69 100644 --- a/src/components/middle/message/ReactionButton.tsx +++ b/src/components/middle/message/ReactionButton.tsx @@ -1,23 +1,23 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import type { ApiAvailableReaction, ApiChat, ApiMessage, ApiReactionCount, ApiStickerSet, ApiUser, } from '../../../api/types'; import type { ActiveReaction } from '../../../global/types'; +import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; +import { isReactionChosen, isSameReaction } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; import { formatIntegerCompact } from '../../../util/textFormat'; -import { isSameReaction, isReactionChosen } from '../../../global/helpers'; import useLastCallback from '../../../hooks/useLastCallback'; -import Button from '../../ui/Button'; -import AvatarList from '../../common/AvatarList'; -import ReactionAnimatedEmoji from './ReactionAnimatedEmoji'; import AnimatedCounter from '../../common/AnimatedCounter'; +import AvatarList from '../../common/AvatarList'; +import Button from '../../ui/Button'; +import ReactionAnimatedEmoji from './ReactionAnimatedEmoji'; import './Reactions.scss'; diff --git a/src/components/middle/message/ReactionPicker.async.tsx b/src/components/middle/message/ReactionPicker.async.tsx index 7d2e95e1d..a0851f7a6 100644 --- a/src/components/middle/message/ReactionPicker.async.tsx +++ b/src/components/middle/message/ReactionPicker.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './ReactionPicker'; import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const ReactionPickerAsync: FC = (props) => { diff --git a/src/components/middle/message/ReactionPicker.tsx b/src/components/middle/message/ReactionPicker.tsx index 3c460ecad..43bfdd607 100644 --- a/src/components/middle/message/ReactionPicker.tsx +++ b/src/components/middle/message/ReactionPicker.tsx @@ -1,32 +1,32 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo, useRef } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { - ApiMessage, ApiReaction, ApiSticker, ApiReactionCustomEmoji, ApiStory, ApiStorySkipped, - ApiMessageEntity, + ApiMessage, ApiMessageEntity, + ApiReaction, ApiReactionCustomEmoji, ApiSticker, ApiStory, ApiStorySkipped, } from '../../../api/types'; import type { IAnchorPosition } from '../../../types'; -import { REM } from '../../common/helpers/mediaDimensions'; -import buildClassName from '../../../util/buildClassName'; import { isUserId } from '../../../global/helpers'; import { selectChat, selectChatFullInfo, selectChatMessage, selectIsContextMenuTranslucent, selectIsCurrentUserPremium, selectTabState, selectUserStory, } from '../../../global/selectors'; +import buildClassName from '../../../util/buildClassName'; import parseMessageInput from '../../../util/parseMessageInput'; +import { REM } from '../../common/helpers/mediaDimensions'; import { buildCustomEmojiHtml } from '../composer/helpers/customEmoji'; +import { getIsMobile } from '../../../hooks/useAppLayout'; +import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; -import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; import useMenuPosition from '../../../hooks/useMenuPosition'; -import { getIsMobile } from '../../../hooks/useAppLayout'; import CustomEmojiPicker from '../../common/CustomEmojiPicker'; -import ReactionPickerLimited from './ReactionPickerLimited'; import Menu from '../../ui/Menu'; +import ReactionPickerLimited from './ReactionPickerLimited'; import styles from './ReactionPicker.module.scss'; diff --git a/src/components/middle/message/ReactionPickerLimited.tsx b/src/components/middle/message/ReactionPickerLimited.tsx index ac114c4fb..a69b17ed1 100644 --- a/src/components/middle/message/ReactionPickerLimited.tsx +++ b/src/components/middle/message/ReactionPickerLimited.tsx @@ -1,16 +1,16 @@ -import React, { memo, useRef, useMemo } from '../../../lib/teact/teact'; +import type { FC } from '../../../lib/teact/teact'; +import React, { memo, useMemo, useRef } from '../../../lib/teact/teact'; import { withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { ApiReaction, ApiAvailableReaction, ApiChatReactions } from '../../../api/types'; +import type { ApiAvailableReaction, ApiChatReactions, ApiReaction } from '../../../api/types'; -import { REM } from '../../common/helpers/mediaDimensions'; -import buildClassName from '../../../util/buildClassName'; import { getReactionUniqueKey, sortReactions } from '../../../global/helpers'; import { selectChatFullInfo } from '../../../global/selectors'; +import buildClassName from '../../../util/buildClassName'; +import { REM } from '../../common/helpers/mediaDimensions'; -import useWindowSize from '../../../hooks/useWindowSize'; import useAppLayout from '../../../hooks/useAppLayout'; +import useWindowSize from '../../../hooks/useWindowSize'; import ReactionEmoji from '../../common/ReactionEmoji'; diff --git a/src/components/middle/message/ReactionSelector.tsx b/src/components/middle/message/ReactionSelector.tsx index 5ecf4bd13..9449aba59 100644 --- a/src/components/middle/message/ReactionSelector.tsx +++ b/src/components/middle/message/ReactionSelector.tsx @@ -1,21 +1,21 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo, useRef } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAvailableReaction, ApiChatReactions, ApiReaction, ApiReactionCount, } from '../../../api/types'; import type { IAnchorPosition } from '../../../types'; -import buildClassName, { createClassNameBuilder } from '../../../util/buildClassName'; import { - isSameReaction, canSendReaction, getReactionUniqueKey, sortReactions, + canSendReaction, getReactionUniqueKey, isSameReaction, sortReactions, } from '../../../global/helpers'; +import buildClassName, { createClassNameBuilder } from '../../../util/buildClassName'; -import useLastCallback from '../../../hooks/useLastCallback'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; -import ReactionSelectorReaction from './ReactionSelectorReaction'; import Button from '../../ui/Button'; +import ReactionSelectorReaction from './ReactionSelectorReaction'; import './ReactionSelector.scss'; diff --git a/src/components/middle/message/ReactionSelectorReaction.tsx b/src/components/middle/message/ReactionSelectorReaction.tsx index 590bdfc0a..96df84727 100644 --- a/src/components/middle/message/ReactionSelectorReaction.tsx +++ b/src/components/middle/message/ReactionSelectorReaction.tsx @@ -1,12 +1,13 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAvailableReaction, ApiReaction } from '../../../api/types'; -import { REM } from '../../common/helpers/mediaDimensions'; import { createClassNameBuilder } from '../../../util/buildClassName'; -import useMedia from '../../../hooks/useMedia'; +import { REM } from '../../common/helpers/mediaDimensions'; + import useFlag from '../../../hooks/useFlag'; +import useMedia from '../../../hooks/useMedia'; import AnimatedSticker from '../../common/AnimatedSticker'; diff --git a/src/components/middle/message/Reactions.tsx b/src/components/middle/message/Reactions.tsx index 894ac6ed1..952a652e7 100644 --- a/src/components/middle/message/Reactions.tsx +++ b/src/components/middle/message/Reactions.tsx @@ -1,12 +1,13 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useMemo } from '../../../lib/teact/teact'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAvailableReaction, ApiMessage, ApiStickerSet } from '../../../api/types'; import type { ActiveReaction } from '../../../global/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import { getReactionUniqueKey } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; + import useLang from '../../../hooks/useLang'; import ReactionButton from './ReactionButton'; diff --git a/src/components/middle/message/RoundVideo.tsx b/src/components/middle/message/RoundVideo.tsx index aff6a1ad1..466e16702 100644 --- a/src/components/middle/message/RoundVideo.tsx +++ b/src/components/middle/message/RoundVideo.tsx @@ -9,28 +9,28 @@ import { getActions } from '../../../global'; import type { ApiMessage } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; - import { ApiMediaFormat } from '../../../api/types'; -import { ROUND_VIDEO_DIMENSIONS_PX } from '../../common/helpers/mediaDimensions'; + import { getMessageMediaFormat, getMessageMediaHash, getMessageMediaThumbDataUri } from '../../../global/helpers'; -import { formatMediaDuration } from '../../../util/dateFormat'; -import buildClassName from '../../../util/buildClassName'; import { stopCurrentAudio } from '../../../util/audioPlayer'; +import buildClassName from '../../../util/buildClassName'; +import { formatMediaDuration } from '../../../util/dateFormat'; import safePlay from '../../../util/safePlay'; +import { ROUND_VIDEO_DIMENSIONS_PX } from '../../common/helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; -import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; -import useShowTransition from '../../../hooks/useShowTransition'; -import useMediaTransition from '../../../hooks/useMediaTransition'; -import usePrevious from '../../../hooks/usePrevious'; -import useFlag from '../../../hooks/useFlag'; -import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef'; -import useSignal from '../../../hooks/useSignal'; import { useThrottledSignal } from '../../../hooks/useAsyncResolvers'; +import useFlag from '../../../hooks/useFlag'; +import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMediaTransition from '../../../hooks/useMediaTransition'; +import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; +import usePrevious from '../../../hooks/usePrevious'; +import useShowTransition from '../../../hooks/useShowTransition'; +import useSignal from '../../../hooks/useSignal'; +import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef'; -import ProgressSpinner from '../../ui/ProgressSpinner'; import OptimizedVideo from '../../ui/OptimizedVideo'; +import ProgressSpinner from '../../ui/ProgressSpinner'; import './RoundVideo.scss'; diff --git a/src/components/middle/message/SponsoredMessage.tsx b/src/components/middle/message/SponsoredMessage.tsx index 2822d011c..6a8facbf4 100644 --- a/src/components/middle/message/SponsoredMessage.tsx +++ b/src/components/middle/message/SponsoredMessage.tsx @@ -7,21 +7,21 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiChat, ApiSponsoredMessage, ApiUser } from '../../../api/types'; -import { IS_ANDROID, IS_TOUCH_ENV } from '../../../util/windowEnvironment'; -import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities'; -import { selectChat, selectSponsoredMessage, selectUser } from '../../../global/selectors'; import { getChatTitle, getUserFullName } from '../../../global/helpers'; +import { selectChat, selectSponsoredMessage, selectUser } from '../../../global/selectors'; +import { IS_ANDROID, IS_TOUCH_ENV } from '../../../util/windowEnvironment'; import renderText from '../../common/helpers/renderText'; +import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities'; import { preventMessageInputBlur } from '../helpers/preventMessageInputBlur'; -import useLastCallback from '../../../hooks/useLastCallback'; -import useLang from '../../../hooks/useLang'; +import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; import useFlag from '../../../hooks/useFlag'; import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver'; -import useContextMenuHandlers from '../../../hooks/useContextMenuHandlers'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; -import Button from '../../ui/Button'; import AboutAdsModal from '../../common/AboutAdsModal.async'; +import Button from '../../ui/Button'; import SponsoredMessageContextMenuContainer from './SponsoredMessageContextMenuContainer.async'; import './SponsoredMessage.scss'; diff --git a/src/components/middle/message/SponsoredMessageContextMenuContainer.async.tsx b/src/components/middle/message/SponsoredMessageContextMenuContainer.async.tsx index 6891e3d08..d4c9f7f84 100644 --- a/src/components/middle/message/SponsoredMessageContextMenuContainer.async.tsx +++ b/src/components/middle/message/SponsoredMessageContextMenuContainer.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; + import type { OwnProps } from './SponsoredMessageContextMenuContainer'; + import { Bundles } from '../../../util/moduleLoader'; import useModuleLoader from '../../../hooks/useModuleLoader'; diff --git a/src/components/middle/message/SponsoredMessageContextMenuContainer.tsx b/src/components/middle/message/SponsoredMessageContextMenuContainer.tsx index 95eaf0dc9..bb525ebd4 100644 --- a/src/components/middle/message/SponsoredMessageContextMenuContainer.tsx +++ b/src/components/middle/message/SponsoredMessageContextMenuContainer.tsx @@ -8,9 +8,9 @@ import type { IAnchorPosition } from '../../../types'; import { selectIsCurrentUserPremium, selectIsPremiumPurchaseBlocked } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; +import useFlag from '../../../hooks/useFlag'; import useLastCallback from '../../../hooks/useLastCallback'; import useShowTransition from '../../../hooks/useShowTransition'; -import useFlag from '../../../hooks/useFlag'; import MessageContextMenu from './MessageContextMenu'; diff --git a/src/components/middle/message/Sticker.tsx b/src/components/middle/message/Sticker.tsx index f7208a427..fdf799f69 100644 --- a/src/components/middle/message/Sticker.tsx +++ b/src/components/middle/message/Sticker.tsx @@ -1,26 +1,26 @@ import type { FC } from '../../../lib/teact/teact'; import React, { useEffect, useRef } from '../../../lib/teact/teact'; +import { getActions } from '../../../global'; import type { ApiMessage } from '../../../api/types'; -import { ApiMediaFormat } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; +import { ApiMediaFormat } from '../../../api/types'; -import { getStickerDimensions } from '../../common/helpers/mediaDimensions'; import { getMessageMediaHash } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; import { IS_WEBM_SUPPORTED } from '../../../util/windowEnvironment'; -import { getActions } from '../../../global'; +import { getStickerDimensions } from '../../common/helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; -import useMedia from '../../../hooks/useMedia'; -import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; import useAppLayout from '../../../hooks/useAppLayout'; +import useFlag from '../../../hooks/useFlag'; +import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMedia from '../../../hooks/useMedia'; import usePrevious from '../../../hooks/usePrevious'; -import StickerView from '../../common/StickerView'; import AnimatedSticker from '../../common/AnimatedSticker'; +import StickerView from '../../common/StickerView'; import './Sticker.scss'; diff --git a/src/components/middle/message/StoryMention.tsx b/src/components/middle/message/StoryMention.tsx index e3dff4cc0..090dd2cfb 100644 --- a/src/components/middle/message/StoryMention.tsx +++ b/src/components/middle/message/StoryMention.tsx @@ -9,13 +9,13 @@ import { getStoryMediaHash, getUserFirstOrLastName } from '../../../global/helpe import { selectUser, selectUserStories, selectUserStory, } from '../../../global/selectors'; -import renderText from '../../common/helpers/renderText'; import buildClassName from '../../../util/buildClassName'; +import renderText from '../../common/helpers/renderText'; -import useLastCallback from '../../../hooks/useLastCallback'; import useEnsureStory from '../../../hooks/useEnsureStory'; -import useMedia from '../../../hooks/useMedia'; import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMedia from '../../../hooks/useMedia'; interface OwnProps { message: ApiMessage; diff --git a/src/components/middle/message/Video.tsx b/src/components/middle/message/Video.tsx index eb5ae8edc..61448a5f9 100644 --- a/src/components/middle/message/Video.tsx +++ b/src/components/middle/message/Video.tsx @@ -1,15 +1,11 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { useRef, useState } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiMessage } from '../../../api/types'; -import type { IMediaDimensions } from './helpers/calculateAlbumLayout'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; +import type { IMediaDimensions } from './helpers/calculateAlbumLayout'; -import { MIN_MEDIA_HEIGHT } from './helpers/mediaDimensions'; -import { formatMediaDuration } from '../../../util/dateFormat'; -import buildClassName from '../../../util/buildClassName'; -import { calculateVideoDimensions } from '../../common/helpers/mediaDimensions'; import { getMediaTransferState, getMessageMediaFormat, @@ -19,23 +15,27 @@ import { getMessageWebPageVideo, isOwnMessage, } from '../../../global/helpers'; +import buildClassName from '../../../util/buildClassName'; +import { formatMediaDuration } from '../../../util/dateFormat'; import * as mediaLoader from '../../../util/mediaLoader'; +import { calculateVideoDimensions } from '../../common/helpers/mediaDimensions'; +import { MIN_MEDIA_HEIGHT } from './helpers/mediaDimensions'; -import useLastCallback from '../../../hooks/useLastCallback'; -import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; -import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; -import useMedia from '../../../hooks/useMedia'; -import useShowTransition from '../../../hooks/useShowTransition'; -import usePrevious from '../../../hooks/usePrevious'; -import useMediaTransition from '../../../hooks/useMediaTransition'; -import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef'; -import useFlag from '../../../hooks/useFlag'; -import useAppLayout from '../../../hooks/useAppLayout'; import useUnsupportedMedia from '../../../hooks/media/useUnsupportedMedia'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useFlag from '../../../hooks/useFlag'; +import { useIsIntersecting } from '../../../hooks/useIntersectionObserver'; +import useLastCallback from '../../../hooks/useLastCallback'; +import useMedia from '../../../hooks/useMedia'; +import useMediaTransition from '../../../hooks/useMediaTransition'; +import useMediaWithLoadProgress from '../../../hooks/useMediaWithLoadProgress'; +import usePrevious from '../../../hooks/usePrevious'; +import useShowTransition from '../../../hooks/useShowTransition'; +import useBlurredMediaThumbRef from './hooks/useBlurredMediaThumbRef'; -import ProgressSpinner from '../../ui/ProgressSpinner'; -import OptimizedVideo from '../../ui/OptimizedVideo'; import MediaSpoiler from '../../common/MediaSpoiler'; +import OptimizedVideo from '../../ui/OptimizedVideo'; +import ProgressSpinner from '../../ui/ProgressSpinner'; export type OwnProps = { id?: string; diff --git a/src/components/middle/message/WebPage.tsx b/src/components/middle/message/WebPage.tsx index 68e83f1f7..d7d4d1474 100644 --- a/src/components/middle/message/WebPage.tsx +++ b/src/components/middle/message/WebPage.tsx @@ -1,28 +1,28 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiMessage, ApiTypeStory } from '../../../api/types'; import type { ObserveFn } from '../../../hooks/useIntersectionObserver'; import type { ISettings } from '../../../types'; import { getMessageWebPage } from '../../../global/helpers'; +import buildClassName from '../../../util/buildClassName'; +import trimText from '../../../util/trimText'; +import renderText from '../../common/helpers/renderText'; import { calculateMediaDimensions } from './helpers/mediaDimensions'; import { getWebpageButtonText } from './helpers/webpageType'; -import renderText from '../../common/helpers/renderText'; -import trimText from '../../../util/trimText'; -import buildClassName from '../../../util/buildClassName'; -import useLastCallback from '../../../hooks/useLastCallback'; import useAppLayout from '../../../hooks/useAppLayout'; -import useLang from '../../../hooks/useLang'; import useEnsureStory from '../../../hooks/useEnsureStory'; +import useLang from '../../../hooks/useLang'; +import useLastCallback from '../../../hooks/useLastCallback'; import SafeLink from '../../common/SafeLink'; -import Photo from './Photo'; -import Video from './Video'; import Button from '../../ui/Button'; import BaseStory from './BaseStory'; +import Photo from './Photo'; +import Video from './Video'; import './WebPage.scss'; diff --git a/src/components/middle/message/helpers/calculateAlbumLayout.ts b/src/components/middle/message/helpers/calculateAlbumLayout.ts index 82d404905..b94ac8270 100644 --- a/src/components/middle/message/helpers/calculateAlbumLayout.ts +++ b/src/components/middle/message/helpers/calculateAlbumLayout.ts @@ -3,12 +3,12 @@ // https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/ui/grouped_layout.cpp // https://github.com/overtake/TelegramSwift/blob/master/Telegram-Mac/GroupedLayout.swift#L83 +import type { ApiDimensions, ApiMessage } from '../../../../api/types'; import type { IAlbum } from '../../../../types'; -import type { ApiMessage, ApiDimensions } from '../../../../api/types'; +import { clamp } from '../../../../util/math'; import { getAvailableWidth, REM } from '../../../common/helpers/mediaDimensions'; import { calculateMediaDimensions } from './mediaDimensions'; -import { clamp } from '../../../../util/math'; export const AlbumRectPart = { None: 0, diff --git a/src/components/middle/message/helpers/copyOptions.ts b/src/components/middle/message/helpers/copyOptions.ts index 105e7c968..d1efb52bb 100644 --- a/src/components/middle/message/helpers/copyOptions.ts +++ b/src/components/middle/message/helpers/copyOptions.ts @@ -1,9 +1,7 @@ import type { ApiMessage } from '../../../../api/types'; +import type { IconName } from '../../../../types/icons'; import { ApiMediaFormat } from '../../../../api/types'; -import type { IconName } from '../../../../types/icons'; - -import * as mediaLoader from '../../../../util/mediaLoader'; import { getMessageContact, getMessageMediaHash, @@ -21,6 +19,7 @@ import { copyTextToClipboard, } from '../../../../util/clipboard'; import getMessageIdsForSelectedText from '../../../../util/getMessageIdsForSelectedText'; +import * as mediaLoader from '../../../../util/mediaLoader'; import { renderMessageText } from '../../../common/helpers/renderMessageText'; type ICopyOptions = { diff --git a/src/components/middle/message/helpers/mediaDimensions.ts b/src/components/middle/message/helpers/mediaDimensions.ts index fd8569034..039cc63e6 100644 --- a/src/components/middle/message/helpers/mediaDimensions.ts +++ b/src/components/middle/message/helpers/mediaDimensions.ts @@ -1,13 +1,14 @@ import type { ApiMessage } from '../../../../api/types'; -import { calculateInlineImageDimensions, calculateVideoDimensions, REM } from '../../../common/helpers/mediaDimensions'; + import { - getMessageText, getMessagePhoto, - getMessageWebPagePhoto, - isOwnMessage, + getMessageText, getMessageVideo, + getMessageWebPagePhoto, getMessageWebPageVideo, + isOwnMessage, } from '../../../../global/helpers'; +import { calculateInlineImageDimensions, calculateVideoDimensions, REM } from '../../../common/helpers/mediaDimensions'; const SMALL_IMAGE_THRESHOLD = 12; const MIN_MESSAGE_LENGTH_FOR_BLUR = 40; diff --git a/src/components/middle/message/hocs/withSelectControl.tsx b/src/components/middle/message/hocs/withSelectControl.tsx index bb06a78c9..18b3fd02b 100644 --- a/src/components/middle/message/hocs/withSelectControl.tsx +++ b/src/components/middle/message/hocs/withSelectControl.tsx @@ -1,16 +1,17 @@ import type { MouseEvent as ReactMouseEvent } from 'react'; import type { FC } from '../../../../lib/teact/teact'; -import React, { useMemo, memo } from '../../../../lib/teact/teact'; +import React, { memo, useMemo } from '../../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../../global'; import type { OwnProps as PhotoProps } from '../Photo'; import type { OwnProps as VideoProps } from '../Video'; -import buildClassName from '../../../../util/buildClassName'; import { selectIsInSelectMode, selectIsMessageSelected, } from '../../../../global/selectors'; +import buildClassName from '../../../../util/buildClassName'; + import useLastCallback from '../../../../hooks/useLastCallback'; type OwnProps = diff --git a/src/components/middle/message/hooks/useBlurredMediaThumbRef.ts b/src/components/middle/message/hooks/useBlurredMediaThumbRef.ts index 105fbd373..1e8ee4bcd 100644 --- a/src/components/middle/message/hooks/useBlurredMediaThumbRef.ts +++ b/src/components/middle/message/hooks/useBlurredMediaThumbRef.ts @@ -1,9 +1,10 @@ import type { ApiMessage } from '../../../../api/types'; -import { IS_CANVAS_FILTER_SUPPORTED } from '../../../../util/windowEnvironment'; import { getMessageMediaThumbDataUri } from '../../../../global/helpers'; -import useCanvasBlur from '../../../../hooks/useCanvasBlur'; +import { IS_CANVAS_FILTER_SUPPORTED } from '../../../../util/windowEnvironment'; + import useAppLayout from '../../../../hooks/useAppLayout'; +import useCanvasBlur from '../../../../hooks/useCanvasBlur'; export default function useBlurredMediaThumbRef( message: ApiMessage, diff --git a/src/components/middle/message/hooks/useDetectChatLanguage.ts b/src/components/middle/message/hooks/useDetectChatLanguage.ts index b9aabf6da..9a9bd9550 100644 --- a/src/components/middle/message/hooks/useDetectChatLanguage.ts +++ b/src/components/middle/message/hooks/useDetectChatLanguage.ts @@ -1,10 +1,11 @@ +import { useEffect } from '../../../../lib/teact/teact'; +import { getActions } from '../../../../global'; + import type { ApiMessage } from '../../../../api/types'; import type { Signal } from '../../../../util/signals'; -import { getActions } from '../../../../global'; import LimitedMap from '../../../../util/primitives/LimitedMap'; import { throttle } from '../../../../util/schedulers'; -import { useEffect } from '../../../../lib/teact/teact'; // https://github.com/DrKLO/Telegram/blob/dfd74f809e97d1ecad9672fc7388cb0223a95dfc/TMessagesProj/src/main/java/org/telegram/messenger/TranslateController.java#L35 const MIN_MESSAGES_CHECKED = 8; diff --git a/src/components/middle/message/hooks/useFocusMessage.ts b/src/components/middle/message/hooks/useFocusMessage.ts index 8ad11cc31..7ffce835a 100644 --- a/src/components/middle/message/hooks/useFocusMessage.ts +++ b/src/components/middle/message/hooks/useFocusMessage.ts @@ -1,8 +1,8 @@ import { useLayoutEffect, useRef } from '../../../../lib/teact/teact'; -import { requestForcedReflow, requestMeasure, requestMutation } from '../../../../lib/fasterdom/fasterdom'; import type { FocusDirection } from '../../../../types'; +import { requestForcedReflow, requestMeasure, requestMutation } from '../../../../lib/fasterdom/fasterdom'; import animateScroll from '../../../../util/animateScroll'; // This is used when the viewport was replaced. diff --git a/src/components/middle/message/hooks/useInnerHandlers.ts b/src/components/middle/message/hooks/useInnerHandlers.ts index e6b2ecb87..25459fd1c 100644 --- a/src/components/middle/message/hooks/useInnerHandlers.ts +++ b/src/components/middle/message/hooks/useInnerHandlers.ts @@ -1,13 +1,14 @@ import type React from '../../../../lib/teact/teact'; import { getActions } from '../../../../global'; +import type { + ApiChat, ApiMessage, ApiStory, + ApiTopic, ApiUser, +} from '../../../../api/types'; import type { LangFn } from '../../../../hooks/useLang'; import type { IAlbum } from '../../../../types'; -import type { - ApiChat, ApiTopic, ApiMessage, ApiUser, ApiStory, -} from '../../../../api/types'; -import { MediaViewerOrigin } from '../../../../types'; import { MAIN_THREAD_ID } from '../../../../api/types'; +import { MediaViewerOrigin } from '../../../../types'; import useLastCallback from '../../../../hooks/useLastCallback'; diff --git a/src/components/middle/message/hooks/useMessageTranslation.ts b/src/components/middle/message/hooks/useMessageTranslation.ts index b77b8be21..4a1a01f6a 100644 --- a/src/components/middle/message/hooks/useMessageTranslation.ts +++ b/src/components/middle/message/hooks/useMessageTranslation.ts @@ -1,6 +1,8 @@ import { useEffect } from '../../../../lib/teact/teact'; import { getActions } from '../../../../global'; + import type { ChatTranslatedMessages } from '../../../../global/types'; + import { throttle } from '../../../../util/schedulers'; const MESSAGE_LIMIT_PER_REQUEST = 20; diff --git a/src/components/middle/message/hooks/useOuterHandlers.ts b/src/components/middle/message/hooks/useOuterHandlers.ts index 4ee186971..0a4435479 100644 --- a/src/components/middle/message/hooks/useOuterHandlers.ts +++ b/src/components/middle/message/hooks/useOuterHandlers.ts @@ -1,18 +1,19 @@ import type { RefObject } from 'react'; import type React from '../../../../lib/teact/teact'; -import type { Signal } from '../../../../util/signals'; - import { useEffect, useRef } from '../../../../lib/teact/teact'; -import { requestMeasure } from '../../../../lib/fasterdom/fasterdom'; import { getActions } from '../../../../global'; +import type { Signal } from '../../../../util/signals'; + +import { requestMeasure } from '../../../../lib/fasterdom/fasterdom'; +import { captureEvents, SwipeDirection } from '../../../../util/captureEvents'; +import stopEvent from '../../../../util/stopEvent'; import { IS_ANDROID, IS_TOUCH_ENV } from '../../../../util/windowEnvironment'; import windowSize from '../../../../util/windowSize'; -import { captureEvents, SwipeDirection } from '../../../../util/captureEvents'; -import useFlag from '../../../../hooks/useFlag'; -import { preventMessageInputBlur } from '../../helpers/preventMessageInputBlur'; -import stopEvent from '../../../../util/stopEvent'; import { REM } from '../../../common/helpers/mediaDimensions'; +import { preventMessageInputBlur } from '../../helpers/preventMessageInputBlur'; + +import useFlag from '../../../../hooks/useFlag'; import useThrottledCallback from '../../../../hooks/useThrottledCallback'; const ANDROID_KEYBOARD_HIDE_DELAY_MS = 350; diff --git a/src/components/middle/message/hooks/useVideoAutoPause.ts b/src/components/middle/message/hooks/useVideoAutoPause.ts index 682b9ce59..4e1dcb77b 100644 --- a/src/components/middle/message/hooks/useVideoAutoPause.ts +++ b/src/components/middle/message/hooks/useVideoAutoPause.ts @@ -1,9 +1,10 @@ import { useEffect, useRef } from '../../../../lib/teact/teact'; + import { requestMeasure } from '../../../../lib/fasterdom/fasterdom'; -import useLastCallback from '../../../../hooks/useLastCallback'; import useBackgroundMode, { isBackgroundModeActive } from '../../../../hooks/useBackgroundMode'; import useHeavyAnimationCheck, { isHeavyAnimating } from '../../../../hooks/useHeavyAnimationCheck'; +import useLastCallback from '../../../../hooks/useLastCallback'; import usePriorityPlaybackCheck, { isPriorityPlaybackActive } from '../../../../hooks/usePriorityPlaybackCheck'; export default function useVideoAutoPause( diff --git a/src/components/modals/attachBotInstall/AttachBotInstallModal.async.tsx b/src/components/modals/attachBotInstall/AttachBotInstallModal.async.tsx index 05ed8bb99..96b878fc8 100644 --- a/src/components/modals/attachBotInstall/AttachBotInstallModal.async.tsx +++ b/src/components/modals/attachBotInstall/AttachBotInstallModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './AttachBotInstallModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const AttachBotInstallModalAsync: FC = (props) => { diff --git a/src/components/modals/attachBotInstall/AttachBotInstallModal.tsx b/src/components/modals/attachBotInstall/AttachBotInstallModal.tsx index 8074210ec..0859da494 100644 --- a/src/components/modals/attachBotInstall/AttachBotInstallModal.tsx +++ b/src/components/modals/attachBotInstall/AttachBotInstallModal.tsx @@ -1,9 +1,9 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useState, } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAttachBot } from '../../../api/types'; import renderText from '../../common/helpers/renderText'; @@ -11,8 +11,8 @@ import renderText from '../../common/helpers/renderText'; import useLang from '../../../hooks/useLang'; import usePrevious from '../../../hooks/usePrevious'; -import ConfirmDialog from '../../ui/ConfirmDialog'; import Checkbox from '../../ui/Checkbox'; +import ConfirmDialog from '../../ui/ConfirmDialog'; export type OwnProps = { bot?: ApiAttachBot; diff --git a/src/components/modals/chatlist/ChatlistAlready.tsx b/src/components/modals/chatlist/ChatlistAlready.tsx index 586fc0871..37804101b 100644 --- a/src/components/modals/chatlist/ChatlistAlready.tsx +++ b/src/components/modals/chatlist/ChatlistAlready.tsx @@ -1,17 +1,17 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useState } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChatFolder, ApiChatlistInviteAlready } from '../../../api/types'; -import renderText from '../../common/helpers/renderText'; import buildClassName from '../../../util/buildClassName'; +import renderText from '../../common/helpers/renderText'; import useLang from '../../../hooks/useLang'; -import Button from '../../ui/Button'; import Picker from '../../common/Picker'; import Badge from '../../ui/Badge'; +import Button from '../../ui/Button'; import styles from './ChatlistModal.module.scss'; diff --git a/src/components/modals/chatlist/ChatlistDelete.tsx b/src/components/modals/chatlist/ChatlistDelete.tsx index e184311fb..86f79b42a 100644 --- a/src/components/modals/chatlist/ChatlistDelete.tsx +++ b/src/components/modals/chatlist/ChatlistDelete.tsx @@ -1,18 +1,18 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useState } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChatFolder } from '../../../api/types'; -import renderText from '../../common/helpers/renderText'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import buildClassName from '../../../util/buildClassName'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import renderText from '../../common/helpers/renderText'; import useLang from '../../../hooks/useLang'; -import Button from '../../ui/Button'; -import Badge from '../../ui/Badge'; import Picker from '../../common/Picker'; +import Badge from '../../ui/Badge'; +import Button from '../../ui/Button'; import styles from './ChatlistModal.module.scss'; diff --git a/src/components/modals/chatlist/ChatlistModal.async.tsx b/src/components/modals/chatlist/ChatlistModal.async.tsx index 5daf1eb98..8691de88a 100644 --- a/src/components/modals/chatlist/ChatlistModal.async.tsx +++ b/src/components/modals/chatlist/ChatlistModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './ChatlistModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const ChatlistModalAsync: FC = (props) => { diff --git a/src/components/modals/chatlist/ChatlistModal.tsx b/src/components/modals/chatlist/ChatlistModal.tsx index de643f913..8f11fbcff 100644 --- a/src/components/modals/chatlist/ChatlistModal.tsx +++ b/src/components/modals/chatlist/ChatlistModal.tsx @@ -1,20 +1,20 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; -import type { TabState } from '../../../global/types'; import type { ApiChatFolder } from '../../../api/types'; +import type { TabState } from '../../../global/types'; import { selectChatFolder } from '../../../global/selectors'; -import usePrevious from '../../../hooks/usePrevious'; import useLang from '../../../hooks/useLang'; +import usePrevious from '../../../hooks/usePrevious'; -import ChatlistNew from './ChatlistNew'; -import ChatlistAlready from './ChatlistAlready'; -import ChatlistDelete from './ChatlistDelete'; import Modal from '../../ui/Modal'; import Tab from '../../ui/Tab'; +import ChatlistAlready from './ChatlistAlready'; +import ChatlistDelete from './ChatlistDelete'; +import ChatlistNew from './ChatlistNew'; import styles from './ChatlistModal.module.scss'; diff --git a/src/components/modals/chatlist/ChatlistNew.tsx b/src/components/modals/chatlist/ChatlistNew.tsx index 2c061688e..6991b8904 100644 --- a/src/components/modals/chatlist/ChatlistNew.tsx +++ b/src/components/modals/chatlist/ChatlistNew.tsx @@ -1,19 +1,19 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChatlistInviteNew } from '../../../api/types'; -import renderText from '../../common/helpers/renderText'; import buildClassName from '../../../util/buildClassName'; +import renderText from '../../common/helpers/renderText'; import useLang from '../../../hooks/useLang'; -import Button from '../../ui/Button'; import Picker from '../../common/Picker'; import Badge from '../../ui/Badge'; +import Button from '../../ui/Button'; import styles from './ChatlistModal.module.scss'; diff --git a/src/components/modals/map/MapModal.async.tsx b/src/components/modals/map/MapModal.async.tsx index 33b2f6977..719c076e7 100644 --- a/src/components/modals/map/MapModal.async.tsx +++ b/src/components/modals/map/MapModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './MapModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const MapModalAsync: FC = (props) => { diff --git a/src/components/modals/map/MapModal.tsx b/src/components/modals/map/MapModal.tsx index 59f8a9f92..0334a2a34 100644 --- a/src/components/modals/map/MapModal.tsx +++ b/src/components/modals/map/MapModal.tsx @@ -3,14 +3,14 @@ import { getActions } from '../../../global'; import type { ApiGeoPoint } from '../../../api/types'; -import { IS_IOS, IS_MAC_OS } from '../../../util/windowEnvironment'; import { prepareMapUrl } from '../../../util/map'; +import { IS_IOS, IS_MAC_OS } from '../../../util/windowEnvironment'; import useLang from '../../../hooks/useLang'; import useLastCallback from '../../../hooks/useLastCallback'; -import Modal from '../../ui/Modal'; import Button from '../../ui/Button'; +import Modal from '../../ui/Modal'; import styles from './MapModal.module.scss'; diff --git a/src/components/modals/urlAuth/UrlAuthModal.async.tsx b/src/components/modals/urlAuth/UrlAuthModal.async.tsx index b1fb6857b..d3568db25 100644 --- a/src/components/modals/urlAuth/UrlAuthModal.async.tsx +++ b/src/components/modals/urlAuth/UrlAuthModal.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; + import type { OwnProps } from './UrlAuthModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const UrlAuthModalAsync: FC = (props) => { diff --git a/src/components/modals/urlAuth/UrlAuthModal.tsx b/src/components/modals/urlAuth/UrlAuthModal.tsx index ea4e9244e..d8a9bab15 100644 --- a/src/components/modals/urlAuth/UrlAuthModal.tsx +++ b/src/components/modals/urlAuth/UrlAuthModal.tsx @@ -1,20 +1,20 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useState, } from '../../../lib/teact/teact'; import { getActions, getGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { TabState } from '../../../global/types'; +import { getUserFullName } from '../../../global/helpers'; import { ensureProtocol } from '../../../util/ensureProtocol'; import renderText from '../../common/helpers/renderText'; -import { getUserFullName } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; import useCurrentOrPrev from '../../../hooks/useCurrentOrPrev'; +import useLang from '../../../hooks/useLang'; -import ConfirmDialog from '../../ui/ConfirmDialog'; import Checkbox from '../../ui/Checkbox'; +import ConfirmDialog from '../../ui/ConfirmDialog'; import styles from './UrlAuthModal.module.scss'; diff --git a/src/components/modals/webApp/WebAppModal.async.tsx b/src/components/modals/webApp/WebAppModal.async.tsx index 82583bc1a..321b00c2d 100644 --- a/src/components/modals/webApp/WebAppModal.async.tsx +++ b/src/components/modals/webApp/WebAppModal.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './WebAppModal'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; const WebAppModalAsync: FC = (props) => { diff --git a/src/components/modals/webApp/WebAppModal.tsx b/src/components/modals/webApp/WebAppModal.tsx index ec10da7f3..504e5d044 100644 --- a/src/components/modals/webApp/WebAppModal.tsx +++ b/src/components/modals/webApp/WebAppModal.tsx @@ -1,39 +1,39 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiAttachBot, ApiChat, ApiUser } from '../../../api/types'; import type { TabState } from '../../../global/types'; import type { ThemeKey } from '../../../types'; import type { PopupOptions, WebAppInboundEvent } from '../../../types/webapp'; -import { callApi } from '../../../api/gramjs'; import { TME_LINK_PREFIX } from '../../../config'; +import { convertToApiChatType } from '../../../global/helpers'; import { selectCurrentChat, selectTabState, selectTheme, selectUser, } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; import { extractCurrentThemeParams, validateHexColor } from '../../../util/themeStyle'; -import { convertToApiChatType } from '../../../global/helpers'; +import { callApi } from '../../../api/gramjs'; +import useAppLayout from '../../../hooks/useAppLayout'; +import useFlag from '../../../hooks/useFlag'; import useInterval from '../../../hooks/useInterval'; import useLang from '../../../hooks/useLang'; -import useSyncEffect from '../../../hooks/useSyncEffect'; -import useWebAppFrame from './hooks/useWebAppFrame'; -import usePrevious from '../../../hooks/usePrevious'; -import useFlag from '../../../hooks/useFlag'; -import useAppLayout from '../../../hooks/useAppLayout'; import useLastCallback from '../../../hooks/useLastCallback'; +import usePrevious from '../../../hooks/usePrevious'; +import useSyncEffect from '../../../hooks/useSyncEffect'; import usePopupLimit from './hooks/usePopupLimit'; +import useWebAppFrame from './hooks/useWebAppFrame'; -import Modal from '../../ui/Modal'; import Button from '../../ui/Button'; +import ConfirmDialog from '../../ui/ConfirmDialog'; import DropdownMenu from '../../ui/DropdownMenu'; import MenuItem from '../../ui/MenuItem'; +import Modal from '../../ui/Modal'; import Spinner from '../../ui/Spinner'; -import ConfirmDialog from '../../ui/ConfirmDialog'; import styles from './WebAppModal.module.scss'; diff --git a/src/components/modals/webApp/hooks/usePopupLimit.ts b/src/components/modals/webApp/hooks/usePopupLimit.ts index ba22d5b8a..ab5cbb35a 100644 --- a/src/components/modals/webApp/hooks/usePopupLimit.ts +++ b/src/components/modals/webApp/hooks/usePopupLimit.ts @@ -1,4 +1,5 @@ import { useRef, useState } from '../../../../lib/teact/teact'; + import useLastCallback from '../../../../hooks/useLastCallback'; export default function usePopupLimit(sequentialLimit: number, resetAfter: number) { diff --git a/src/components/payment/CardInput.tsx b/src/components/payment/CardInput.tsx index 0e9d21b55..15b3d5748 100644 --- a/src/components/payment/CardInput.tsx +++ b/src/components/payment/CardInput.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React, { - memo, useCallback, useState, useRef, useEffect, + memo, useCallback, useEffect, + useRef, useState, } from '../../lib/teact/teact'; +import { CardType, detectCardType } from '../common/helpers/detectCardType'; import { formatCardNumber } from '../middle/helpers/inputFormatters'; -import { detectCardType, CardType } from '../common/helpers/detectCardType'; + import useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation'; import useLang from '../../hooks/useLang'; @@ -13,8 +15,8 @@ import InputText from '../ui/InputText'; import './CardInput.scss'; import mastercardIconPath from '../../assets/mastercard.svg'; -import visaIconPath from '../../assets/visa.svg'; import mirIconPath from '../../assets/mir.svg'; +import visaIconPath from '../../assets/visa.svg'; const CARD_NUMBER_MAX_LENGTH = 23; diff --git a/src/components/payment/Checkout.tsx b/src/components/payment/Checkout.tsx index e410c84fe..916eb2a4c 100644 --- a/src/components/payment/Checkout.tsx +++ b/src/components/payment/Checkout.tsx @@ -1,25 +1,27 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; +import type { + ApiChat, ApiInvoice, ApiPaymentCredentials, +} from '../../api/types'; import type { FormEditDispatch } from '../../hooks/reducers/usePaymentReducer'; import type { LangCode, Price } from '../../types'; -import type { ApiChat, ApiInvoice, ApiPaymentCredentials } from '../../api/types'; import type { IconName } from '../../types/icons'; - import { PaymentStep } from '../../types'; + import { getWebDocumentHash } from '../../global/helpers'; -import { formatCurrency } from '../../util/formatCurrency'; import buildClassName from '../../util/buildClassName'; +import { formatCurrency } from '../../util/formatCurrency'; import renderText from '../common/helpers/renderText'; import useLang from '../../hooks/useLang'; import useMedia from '../../hooks/useMedia'; -import Checkbox from '../ui/Checkbox'; -import Skeleton from '../ui/placeholder/Skeleton'; import SafeLink from '../common/SafeLink'; +import Checkbox from '../ui/Checkbox'; import ListItem from '../ui/ListItem'; +import Skeleton from '../ui/placeholder/Skeleton'; import styles from './Checkout.module.scss'; diff --git a/src/components/payment/ConfirmPayment.tsx b/src/components/payment/ConfirmPayment.tsx index 0477029e4..252eb1a4c 100644 --- a/src/components/payment/ConfirmPayment.tsx +++ b/src/components/payment/ConfirmPayment.tsx @@ -1,9 +1,9 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { FC } from '../../lib/teact/teact'; - import { TME_LINK_PREFIX } from '../../config'; + import useLang from '../../hooks/useLang'; import './ConfirmPayment.scss'; diff --git a/src/components/payment/ExpiryInput.tsx b/src/components/payment/ExpiryInput.tsx index 65f648f10..9c31a11ef 100644 --- a/src/components/payment/ExpiryInput.tsx +++ b/src/components/payment/ExpiryInput.tsx @@ -3,9 +3,10 @@ import React, { memo, useCallback } from '../../lib/teact/teact'; import { formatCardExpiry } from '../middle/helpers/inputFormatters'; -import InputText from '../ui/InputText'; import useLang from '../../hooks/useLang'; +import InputText from '../ui/InputText'; + const MAX_FIELD_LENGTH = 5; export type OwnProps = { diff --git a/src/components/payment/PasswordConfirm.tsx b/src/components/payment/PasswordConfirm.tsx index cbf0d4692..357b46971 100644 --- a/src/components/payment/PasswordConfirm.tsx +++ b/src/components/payment/PasswordConfirm.tsx @@ -1,15 +1,16 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useMemo, useState } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiPaymentCredentials } from '../../api/types'; import type { FormState } from '../../hooks/reducers/usePaymentReducer'; import { selectTabState } from '../../global/selectors'; + import useLang from '../../hooks/useLang'; -import PasswordMonkey from '../common/PasswordMonkey'; import PasswordForm from '../common/PasswordForm'; +import PasswordMonkey from '../common/PasswordMonkey'; interface OwnProps { isActive?: boolean; diff --git a/src/components/payment/PaymentInfo.tsx b/src/components/payment/PaymentInfo.tsx index d5f0812f5..904e2993e 100644 --- a/src/components/payment/PaymentInfo.tsx +++ b/src/components/payment/PaymentInfo.tsx @@ -1,18 +1,19 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useCallback, memo, useRef, useEffect, + memo, useCallback, useEffect, + useRef, } from '../../lib/teact/teact'; import type { ApiCountry } from '../../api/types'; +import type { FormEditDispatch, FormState } from '../../hooks/reducers/usePaymentReducer'; -import type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer'; import useLang from '../../hooks/useLang'; -import InputText from '../ui/InputText'; import Checkbox from '../ui/Checkbox'; +import InputText from '../ui/InputText'; import Select from '../ui/Select'; -import ExpiryInput from './ExpiryInput'; import CardInput from './CardInput'; +import ExpiryInput from './ExpiryInput'; import './PaymentInfo.scss'; diff --git a/src/components/payment/PaymentModal.async.tsx b/src/components/payment/PaymentModal.async.tsx index 41bb1cc35..c1dcf7c07 100644 --- a/src/components/payment/PaymentModal.async.tsx +++ b/src/components/payment/PaymentModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './PaymentModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/payment/PaymentModal.tsx b/src/components/payment/PaymentModal.tsx index b9c932027..d9d2a7207 100644 --- a/src/components/payment/PaymentModal.tsx +++ b/src/components/payment/PaymentModal.tsx @@ -4,33 +4,34 @@ import React, { } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { TabState } from '../../global/types'; import type { ApiChat, ApiCountry, ApiPaymentCredentials } from '../../api/types'; -import type { Price, ShippingOption } from '../../types'; +import type { TabState } from '../../global/types'; import type { FormState } from '../../hooks/reducers/usePaymentReducer'; - +import type { Price, ShippingOption } from '../../types'; import { PaymentStep } from '../../types'; + import { selectChat, selectTabState } from '../../global/selectors'; -import { formatCurrency } from '../../util/formatCurrency'; import buildClassName from '../../util/buildClassName'; -import { detectCardTypeText } from '../common/helpers/detectCardType'; import captureKeyboardListeners from '../../util/captureKeyboardListeners'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; +import { formatCurrency } from '../../util/formatCurrency'; +import { detectCardTypeText } from '../common/helpers/detectCardType'; + import usePaymentReducer from '../../hooks/reducers/usePaymentReducer'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import usePrevious from '../../hooks/usePrevious'; -import ShippingInfo from './ShippingInfo'; -import Shipping from './Shipping'; -import Checkout from './Checkout'; -import PaymentInfo from './PaymentInfo'; import Button from '../ui/Button'; import Modal from '../ui/Modal'; -import Transition from '../ui/Transition'; import Spinner from '../ui/Spinner'; +import Transition from '../ui/Transition'; +import Checkout from './Checkout'; import ConfirmPayment from './ConfirmPayment'; -import SavedPaymentCredentials from './SavedPaymentCredentials'; import PasswordConfirm from './PasswordConfirm'; +import PaymentInfo from './PaymentInfo'; +import SavedPaymentCredentials from './SavedPaymentCredentials'; +import Shipping from './Shipping'; +import ShippingInfo from './ShippingInfo'; import './PaymentModal.scss'; diff --git a/src/components/payment/ReceiptModal.async.tsx b/src/components/payment/ReceiptModal.async.tsx index 4a407cfb2..03991e7bf 100644 --- a/src/components/payment/ReceiptModal.async.tsx +++ b/src/components/payment/ReceiptModal.async.tsx @@ -1,6 +1,8 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './ReceiptModal'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; diff --git a/src/components/payment/ReceiptModal.tsx b/src/components/payment/ReceiptModal.tsx index 77a09e71b..a440d3ce3 100644 --- a/src/components/payment/ReceiptModal.tsx +++ b/src/components/payment/ReceiptModal.tsx @@ -1,18 +1,18 @@ -import React, { memo, useMemo, useEffect } from '../../lib/teact/teact'; +import type { FC } from '../../lib/teact/teact'; +import React, { memo, useEffect, useMemo } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; - -import type { Price } from '../../types'; import type { ApiShippingAddress, ApiWebDocument } from '../../api/types'; +import type { Price } from '../../types'; import { selectTabState } from '../../global/selectors'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import Checkout from './Checkout'; -import Modal from '../ui/Modal'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; + import Button from '../ui/Button'; +import Modal from '../ui/Modal'; +import Checkout from './Checkout'; import './PaymentModal.scss'; diff --git a/src/components/payment/SavedPaymentCredentials.tsx b/src/components/payment/SavedPaymentCredentials.tsx index a10707437..99ffa8c3a 100644 --- a/src/components/payment/SavedPaymentCredentials.tsx +++ b/src/components/payment/SavedPaymentCredentials.tsx @@ -1,10 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { ApiPaymentCredentials } from '../../api/types'; -import type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer'; +import type { FormEditDispatch, FormState } from '../../hooks/reducers/usePaymentReducer'; import { MEMO_EMPTY_ARRAY } from '../../util/memo'; + import useLang from '../../hooks/useLang'; import Button from '../ui/Button'; diff --git a/src/components/payment/Shipping.tsx b/src/components/payment/Shipping.tsx index 9e5fdf134..fb3c11f5c 100644 --- a/src/components/payment/Shipping.tsx +++ b/src/components/payment/Shipping.tsx @@ -1,12 +1,14 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useCallback, memo, useMemo, useEffect, + memo, useCallback, useEffect, + useMemo, } from '../../lib/teact/teact'; +import type { FormEditDispatch, FormState } from '../../hooks/reducers/usePaymentReducer'; import type { ShippingOption } from '../../types'; import { formatCurrency } from '../../util/formatCurrency'; -import type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer'; + import useLang from '../../hooks/useLang'; import RadioGroup from '../ui/RadioGroup'; diff --git a/src/components/payment/ShippingInfo.tsx b/src/components/payment/ShippingInfo.tsx index c404cdfb8..7c4b2aeea 100644 --- a/src/components/payment/ShippingInfo.tsx +++ b/src/components/payment/ShippingInfo.tsx @@ -1,17 +1,18 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useRef, useCallback, useEffect, memo, + memo, + useCallback, useEffect, useRef, } from '../../lib/teact/teact'; import type { ApiCountry } from '../../api/types'; -import type { FormState, FormEditDispatch } from '../../hooks/reducers/usePaymentReducer'; +import type { FormEditDispatch, FormState } from '../../hooks/reducers/usePaymentReducer'; import useFocusAfterAnimation from '../../hooks/useFocusAfterAnimation'; import useLang from '../../hooks/useLang'; +import Checkbox from '../ui/Checkbox'; import InputText from '../ui/InputText'; import Select from '../ui/Select'; -import Checkbox from '../ui/Checkbox'; import './ShippingInfo.scss'; diff --git a/src/components/right/AddChatMembers.tsx b/src/components/right/AddChatMembers.tsx index 78ac6f612..ee01a7c73 100644 --- a/src/components/right/AddChatMembers.tsx +++ b/src/components/right/AddChatMembers.tsx @@ -1,6 +1,6 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useCallback, useMemo, memo, useState, + memo, useCallback, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; @@ -9,14 +9,15 @@ import type { } from '../../api/types'; import { NewChatMembersProgress } from '../../types'; -import { unique } from '../../util/iteratees'; -import { selectChat, selectChatFullInfo, selectTabState } from '../../global/selectors'; import { filterUsersByName, isChatChannel, isUserBot, sortChatIds, } from '../../global/helpers'; +import { selectChat, selectChatFullInfo, selectTabState } from '../../global/selectors'; +import { unique } from '../../util/iteratees'; + +import useHistoryBack from '../../hooks/useHistoryBack'; import useLang from '../../hooks/useLang'; import usePrevious from '../../hooks/usePrevious'; -import useHistoryBack from '../../hooks/useHistoryBack'; import Picker from '../common/Picker'; import FloatingActionButton from '../ui/FloatingActionButton'; diff --git a/src/components/right/CreateTopic.async.tsx b/src/components/right/CreateTopic.async.tsx index 0dcf84e37..20825b7ce 100644 --- a/src/components/right/CreateTopic.async.tsx +++ b/src/components/right/CreateTopic.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './CreateTopic'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const CreateTopicAsync: FC = (props) => { diff --git a/src/components/right/CreateTopic.tsx b/src/components/right/CreateTopic.tsx index 23d8ed5ca..c6e69e62f 100644 --- a/src/components/right/CreateTopic.tsx +++ b/src/components/right/CreateTopic.tsx @@ -1,27 +1,27 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiChat, ApiSticker } from '../../api/types'; import type { TabState } from '../../global/types'; import { DEFAULT_TOPIC_ICON_STICKER_ID } from '../../config'; import { selectChat, selectIsCurrentUserPremium, selectTabState } from '../../global/selectors'; -import { getTopicColors } from '../../util/forumColors'; -import cycleRestrict from '../../util/cycleRestrict'; import buildClassName from '../../util/buildClassName'; +import cycleRestrict from '../../util/cycleRestrict'; +import { getTopicColors } from '../../util/forumColors'; import { REM } from '../common/helpers/mediaDimensions'; -import useLang from '../../hooks/useLang'; import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; -import TopicIcon from '../common/TopicIcon'; -import InputText from '../ui/InputText'; -import FloatingActionButton from '../ui/FloatingActionButton'; -import Spinner from '../ui/Spinner'; import CustomEmojiPicker from '../common/CustomEmojiPicker'; +import TopicIcon from '../common/TopicIcon'; +import FloatingActionButton from '../ui/FloatingActionButton'; +import InputText from '../ui/InputText'; +import Spinner from '../ui/Spinner'; import Transition from '../ui/Transition'; import styles from './ManageTopic.module.scss'; diff --git a/src/components/right/DeleteMemberModal.tsx b/src/components/right/DeleteMemberModal.tsx index aeb87ccd9..ca499fca0 100644 --- a/src/components/right/DeleteMemberModal.tsx +++ b/src/components/right/DeleteMemberModal.tsx @@ -1,12 +1,13 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ApiChat } from '../../api/types'; -import { selectCurrentChat, selectUser } from '../../global/selectors'; import { getUserFirstOrLastName } from '../../global/helpers'; +import { selectCurrentChat, selectUser } from '../../global/selectors'; import renderText from '../common/helpers/renderText'; + import useLang from '../../hooks/useLang'; import ConfirmDialog from '../ui/ConfirmDialog'; diff --git a/src/components/right/EditTopic.async.tsx b/src/components/right/EditTopic.async.tsx index 71adfca33..b773d8c66 100644 --- a/src/components/right/EditTopic.async.tsx +++ b/src/components/right/EditTopic.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './EditTopic'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const EditTopicAsync: FC = (props) => { diff --git a/src/components/right/EditTopic.tsx b/src/components/right/EditTopic.tsx index d21d9f7c6..ffc428e9b 100644 --- a/src/components/right/EditTopic.tsx +++ b/src/components/right/EditTopic.tsx @@ -1,26 +1,26 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiChat, ApiSticker, ApiTopic } from '../../api/types'; import type { TabState } from '../../global/types'; import { DEFAULT_TOPIC_ICON_STICKER_ID, GENERAL_TOPIC_ID } from '../../config'; -import { REM } from '../common/helpers/mediaDimensions'; import { selectChat, selectIsCurrentUserPremium, selectTabState } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; +import { REM } from '../common/helpers/mediaDimensions'; -import useLang from '../../hooks/useLang'; import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; -import TopicIcon from '../common/TopicIcon'; -import InputText from '../ui/InputText'; -import FloatingActionButton from '../ui/FloatingActionButton'; -import Spinner from '../ui/Spinner'; -import Loading from '../ui/Loading'; import CustomEmojiPicker from '../common/CustomEmojiPicker'; +import TopicIcon from '../common/TopicIcon'; +import FloatingActionButton from '../ui/FloatingActionButton'; +import InputText from '../ui/InputText'; +import Loading from '../ui/Loading'; +import Spinner from '../ui/Spinner'; import Transition from '../ui/Transition'; import styles from './ManageTopic.module.scss'; diff --git a/src/components/right/GifSearch.async.tsx b/src/components/right/GifSearch.async.tsx index 7196ca4b3..e48ba5c7e 100644 --- a/src/components/right/GifSearch.async.tsx +++ b/src/components/right/GifSearch.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const GifSearchAsync: FC = () => { diff --git a/src/components/right/GifSearch.tsx b/src/components/right/GifSearch.tsx index 9eeaed1c3..4909e8ae7 100644 --- a/src/components/right/GifSearch.tsx +++ b/src/components/right/GifSearch.tsx @@ -1,28 +1,29 @@ import type { FC } from '../../lib/teact/teact'; -import React, { memo, useRef, useCallback } from '../../lib/teact/teact'; +import React, { memo, useCallback, useRef } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ApiChat, ApiVideo } from '../../api/types'; import type { MessageList } from '../../global/types'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; +import { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers'; import { - selectCurrentGifSearch, - selectChat, - selectIsChatWithBot, - selectCurrentMessageList, selectCanScheduleUntilOnline, + selectChat, + selectCurrentGifSearch, + selectCurrentMessageList, + selectIsChatWithBot, selectIsChatWithSelf, selectThreadInfo, } from '../../global/selectors'; -import { getAllowedAttachmentOptions, getCanPostInChat } from '../../global/helpers'; import buildClassName from '../../util/buildClassName'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; + +import useHistoryBack from '../../hooks/useHistoryBack'; import { useIntersectionObserver } from '../../hooks/useIntersectionObserver'; import useLang from '../../hooks/useLang'; -import useHistoryBack from '../../hooks/useHistoryBack'; import useSchedule from '../../hooks/useSchedule'; -import InfiniteScroll from '../ui/InfiniteScroll'; import GifButton from '../common/GifButton'; +import InfiniteScroll from '../ui/InfiniteScroll'; import Loading from '../ui/Loading'; import './GifSearch.scss'; diff --git a/src/components/right/PollAnswerResults.tsx b/src/components/right/PollAnswerResults.tsx index 4c01abc59..6d4957a53 100644 --- a/src/components/right/PollAnswerResults.tsx +++ b/src/components/right/PollAnswerResults.tsx @@ -1,6 +1,7 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useCallback, useState, memo, useEffect, + memo, useCallback, useEffect, + useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; @@ -10,16 +11,18 @@ import type { ApiPollAnswer, ApiPollResult, } from '../../api/types'; -import { selectTabState } from '../../global/selectors'; -import { isUserId } from '../../global/helpers'; -import usePrevious from '../../hooks/usePrevious'; -import useLang from '../../hooks/useLang'; -import ShowMoreButton from '../ui/ShowMoreButton'; -import Loading from '../ui/Loading'; -import ListItem from '../ui/ListItem'; -import PrivateChatInfo from '../common/PrivateChatInfo'; +import { isUserId } from '../../global/helpers'; +import { selectTabState } from '../../global/selectors'; + +import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; + import GroupChatInfo from '../common/GroupChatInfo'; +import PrivateChatInfo from '../common/PrivateChatInfo'; +import ListItem from '../ui/ListItem'; +import Loading from '../ui/Loading'; +import ShowMoreButton from '../ui/ShowMoreButton'; import './PollAnswerResults.scss'; diff --git a/src/components/right/PollResults.async.tsx b/src/components/right/PollResults.async.tsx index 2cb2cc01c..788e4cabe 100644 --- a/src/components/right/PollResults.async.tsx +++ b/src/components/right/PollResults.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const PollResultsAsync: FC = () => { diff --git a/src/components/right/PollResults.tsx b/src/components/right/PollResults.tsx index 0d1b20eb8..22c7a53e7 100644 --- a/src/components/right/PollResults.tsx +++ b/src/components/right/PollResults.tsx @@ -1,19 +1,19 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; -import type { ApiMessage, ApiChat } from '../../api/types'; +import type { ApiChat, ApiMessage } from '../../api/types'; +import { getMessagePoll } from '../../global/helpers'; import { selectChat, selectChatMessage, selectTabState } from '../../global/selectors'; import { buildCollectionByKey } from '../../util/iteratees'; -import { getMessagePoll } from '../../global/helpers'; import renderText from '../common/helpers/renderText'; -import useLang from '../../hooks/useLang'; import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; -import PollAnswerResults from './PollAnswerResults'; import Loading from '../ui/Loading'; +import PollAnswerResults from './PollAnswerResults'; import './PollResults.scss'; diff --git a/src/components/right/Profile.tsx b/src/components/right/Profile.tsx index e728f0f8e..28216b5e9 100644 --- a/src/components/right/Profile.tsx +++ b/src/components/right/Profile.tsx @@ -1,22 +1,23 @@ +import type { FC } from '../../lib/teact/teact'; import React, { - useEffect, useMemo, useRef, useState, memo, useCallback, + memo, useCallback, + useEffect, useMemo, useRef, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { - ApiMessage, ApiChat, ApiChatMember, + ApiMessage, + ApiTypeStory, ApiUser, ApiUserStatus, - ApiTypeStory, } from '../../api/types'; -import { MAIN_THREAD_ID } from '../../api/types'; import type { ISettings, ProfileState, ProfileTabType, SharedMediaType, } from '../../types'; -import { NewChatMembersProgress, MediaViewerOrigin, AudioOrigin } from '../../types'; +import { MAIN_THREAD_ID } from '../../api/types'; +import { AudioOrigin, MediaViewerOrigin, NewChatMembersProgress } from '../../types'; import { MEMBERS_SLICE, @@ -24,7 +25,6 @@ import { SHARED_MEDIA_SLICE, SLIDE_TRANSITION_DURATION, } from '../../config'; -import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { getHasAdminRight, isChatAdmin, isChatChannel, isChatGroup, isUserBot, isUserId, isUserRightBanned, } from '../../global/helpers'; @@ -42,36 +42,37 @@ import { selectUserStories, } from '../../global/selectors'; import { captureEvents, SwipeDirection } from '../../util/captureEvents'; +import { IS_TOUCH_ENV } from '../../util/windowEnvironment'; import { getSenderName } from '../left/search/helpers/getSenderName'; -import useLastCallback from '../../hooks/useLastCallback'; -import useCacheBuster from '../../hooks/useCacheBuster'; -import useProfileViewportIds from './hooks/useProfileViewportIds'; -import useProfileState from './hooks/useProfileState'; -import useTransitionFixes from './hooks/useTransitionFixes'; -import useAsyncRendering from './hooks/useAsyncRendering'; -import useLang from '../../hooks/useLang'; -import { useIntersectionObserver } from '../../hooks/useIntersectionObserver'; -import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; import useUserStoriesPolling from '../../hooks/polling/useUserStoriesPolling'; +import useCacheBuster from '../../hooks/useCacheBuster'; +import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; +import { useIntersectionObserver } from '../../hooks/useIntersectionObserver'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useAsyncRendering from './hooks/useAsyncRendering'; +import useProfileState from './hooks/useProfileState'; +import useProfileViewportIds from './hooks/useProfileViewportIds'; +import useTransitionFixes from './hooks/useTransitionFixes'; -import Transition from '../ui/Transition'; -import InfiniteScroll from '../ui/InfiniteScroll'; -import TabList from '../ui/TabList'; -import Spinner from '../ui/Spinner'; -import ListItem, { type MenuItemContextAction } from '../ui/ListItem'; -import PrivateChatInfo from '../common/PrivateChatInfo'; -import ProfileInfo from '../common/ProfileInfo'; -import Document from '../common/Document'; import Audio from '../common/Audio'; import ChatExtra from '../common/ChatExtra'; -import Media from '../common/Media'; -import MediaStory from '../story/MediaStory'; -import WebLink from '../common/WebLink'; -import NothingFound from '../common/NothingFound'; -import FloatingActionButton from '../ui/FloatingActionButton'; -import DeleteMemberModal from './DeleteMemberModal'; +import Document from '../common/Document'; import GroupChatInfo from '../common/GroupChatInfo'; +import Media from '../common/Media'; +import NothingFound from '../common/NothingFound'; +import PrivateChatInfo from '../common/PrivateChatInfo'; +import ProfileInfo from '../common/ProfileInfo'; +import WebLink from '../common/WebLink'; +import MediaStory from '../story/MediaStory'; +import FloatingActionButton from '../ui/FloatingActionButton'; +import InfiniteScroll from '../ui/InfiniteScroll'; +import ListItem, { type MenuItemContextAction } from '../ui/ListItem'; +import Spinner from '../ui/Spinner'; +import TabList from '../ui/TabList'; +import Transition from '../ui/Transition'; +import DeleteMemberModal from './DeleteMemberModal'; import './Profile.scss'; diff --git a/src/components/right/RightColumn.tsx b/src/components/right/RightColumn.tsx index 4c66f2278..9699affea 100644 --- a/src/components/right/RightColumn.tsx +++ b/src/components/right/RightColumn.tsx @@ -3,36 +3,36 @@ import React, { memo, useEffect, useState } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; import type { ProfileTabType } from '../../types'; +import { MAIN_THREAD_ID } from '../../api/types'; import { ManagementScreens, NewChatMembersProgress, ProfileState, RightColumnContent, } from '../../types'; -import { MAIN_THREAD_ID } from '../../api/types'; import { ANIMATION_END_DELAY, MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN } from '../../config'; -import captureEscKeyListener from '../../util/captureEscKeyListener'; import { selectAreActiveChatsLoaded, selectChat, selectCurrentMessageList, selectRightColumnContentKey, selectTabState, } from '../../global/selectors'; +import captureEscKeyListener from '../../util/captureEscKeyListener'; +import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import useHistoryBack from '../../hooks/useHistoryBack'; import useLastCallback from '../../hooks/useLastCallback'; import useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps'; import useWindowSize from '../../hooks/useWindowSize'; -import useHistoryBack from '../../hooks/useHistoryBack'; -import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; -import RightHeader from './RightHeader'; -import Profile from './Profile'; import Transition from '../ui/Transition'; -import RightSearch from './RightSearch.async'; -import Management from './management/Management.async'; -import Statistics from './statistics/Statistics.async'; -import MessageStatistics from './statistics/MessageStatistics.async'; -import StickerSearch from './StickerSearch.async'; -import GifSearch from './GifSearch.async'; -import PollResults from './PollResults.async'; import AddChatMembers from './AddChatMembers'; import CreateTopic from './CreateTopic.async'; import EditTopic from './EditTopic.async'; +import GifSearch from './GifSearch.async'; +import Management from './management/Management.async'; +import PollResults from './PollResults.async'; +import Profile from './Profile'; +import RightHeader from './RightHeader'; +import RightSearch from './RightSearch.async'; +import MessageStatistics from './statistics/MessageStatistics.async'; +import Statistics from './statistics/Statistics.async'; +import StickerSearch from './StickerSearch.async'; import './RightColumn.scss'; diff --git a/src/components/right/RightHeader.tsx b/src/components/right/RightHeader.tsx index 5e6ff2af6..0b50e8ffb 100644 --- a/src/components/right/RightHeader.tsx +++ b/src/components/right/RightHeader.tsx @@ -7,8 +7,9 @@ import { MAIN_THREAD_ID } from '../../api/types'; import { ManagementScreens, ProfileState } from '../../types'; import { ANIMATION_END_DELAY } from '../../config'; -import { debounce } from '../../util/schedulers'; -import buildClassName from '../../util/buildClassName'; +import { + getCanAddContact, getCanManageTopic, isChatChannel, isUserBot, isUserId, +} from '../../global/helpers'; import { selectCanManage, selectChat, @@ -19,22 +20,21 @@ import { selectTabState, selectUser, } from '../../global/selectors'; -import { - getCanAddContact, getCanManageTopic, isChatChannel, isUserBot, isUserId, -} from '../../global/helpers'; +import buildClassName from '../../util/buildClassName'; import { getDayStartAt } from '../../util/dateFormat'; +import { debounce } from '../../util/schedulers'; -import useLastCallback from '../../hooks/useLastCallback'; -import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; -import useLang from '../../hooks/useLang'; -import useFlag from '../../hooks/useFlag'; -import useElectronDrag from '../../hooks/useElectronDrag'; import useAppLayout from '../../hooks/useAppLayout'; +import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import useElectronDrag from '../../hooks/useElectronDrag'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import SearchInput from '../ui/SearchInput'; import Button from '../ui/Button'; -import Transition from '../ui/Transition'; import ConfirmDialog from '../ui/ConfirmDialog'; +import SearchInput from '../ui/SearchInput'; +import Transition from '../ui/Transition'; import './RightHeader.scss'; diff --git a/src/components/right/RightSearch.async.tsx b/src/components/right/RightSearch.async.tsx index eacd204d2..9fa2f60ce 100644 --- a/src/components/right/RightSearch.async.tsx +++ b/src/components/right/RightSearch.async.tsx @@ -1,9 +1,12 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import type { OwnProps } from './RightSearch'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const RightSearchAsync: FC = (props) => { diff --git a/src/components/right/RightSearch.tsx b/src/components/right/RightSearch.tsx index 35345cbae..38270c094 100644 --- a/src/components/right/RightSearch.tsx +++ b/src/components/right/RightSearch.tsx @@ -1,30 +1,32 @@ +import type { FC } from '../../lib/teact/teact'; import React, { - useMemo, memo, useRef, useEffect, useCallback, + memo, useCallback, + useEffect, useMemo, useRef, } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; -import type { ApiMessage, ApiUser, ApiChat } from '../../api/types'; +import type { ApiChat, ApiMessage, ApiUser } from '../../api/types'; -import { MEMO_EMPTY_ARRAY } from '../../util/memo'; import { - selectUser, - selectChatMessages, selectChat, + selectChatMessages, selectCurrentTextSearch, + selectUser, } from '../../global/selectors'; import { disableDirectTextInput, enableDirectTextInput } from '../../util/directInputManager'; +import { MEMO_EMPTY_ARRAY } from '../../util/memo'; import { renderMessageSummary } from '../common/helpers/renderMessageText'; -import useLang from '../../hooks/useLang'; -import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; + import useHistoryBack from '../../hooks/useHistoryBack'; import useInfiniteScroll from '../../hooks/useInfiniteScroll'; +import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; +import useLang from '../../hooks/useLang'; -import InfiniteScroll from '../ui/InfiniteScroll'; -import ListItem from '../ui/ListItem'; -import LastMessageMeta from '../common/LastMessageMeta'; import Avatar from '../common/Avatar'; import FullNameTitle from '../common/FullNameTitle'; +import LastMessageMeta from '../common/LastMessageMeta'; +import InfiniteScroll from '../ui/InfiniteScroll'; +import ListItem from '../ui/ListItem'; import './RightSearch.scss'; diff --git a/src/components/right/StickerSearch.async.tsx b/src/components/right/StickerSearch.async.tsx index cfe36a21e..95ef3fc3e 100644 --- a/src/components/right/StickerSearch.async.tsx +++ b/src/components/right/StickerSearch.async.tsx @@ -1,8 +1,10 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; + import { Bundles } from '../../util/moduleLoader'; import useModuleLoader from '../../hooks/useModuleLoader'; + import Loading from '../ui/Loading'; const StickerSearchAsync: FC = () => { diff --git a/src/components/right/StickerSearch.tsx b/src/components/right/StickerSearch.tsx index 5890539c1..5513f8849 100644 --- a/src/components/right/StickerSearch.tsx +++ b/src/components/right/StickerSearch.tsx @@ -4,11 +4,12 @@ import React, { } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import { throttle } from '../../util/schedulers'; import { selectCurrentStickerSearch, selectTabState } from '../../global/selectors'; +import { throttle } from '../../util/schedulers'; + +import useHistoryBack from '../../hooks/useHistoryBack'; import { useIntersectionObserver } from '../../hooks/useIntersectionObserver'; import useLang from '../../hooks/useLang'; -import useHistoryBack from '../../hooks/useHistoryBack'; import Loading from '../ui/Loading'; import StickerSetResult from './StickerSetResult'; diff --git a/src/components/right/StickerSetResult.tsx b/src/components/right/StickerSetResult.tsx index 2f6872657..f524b49c9 100644 --- a/src/components/right/StickerSetResult.tsx +++ b/src/components/right/StickerSetResult.tsx @@ -1,6 +1,6 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useEffect, memo, useMemo, useCallback, useRef, + memo, useCallback, useEffect, useMemo, useRef, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; @@ -9,10 +9,11 @@ import type { ObserveFn } from '../../hooks/useIntersectionObserver'; import { STICKER_SIZE_SEARCH } from '../../config'; import { selectIsCurrentUserPremium, selectShouldLoopStickers, selectStickerSet } from '../../global/selectors'; + import useLang from '../../hooks/useLang'; -import Button from '../ui/Button'; import StickerButton from '../common/StickerButton'; +import Button from '../ui/Button'; import Spinner from '../ui/Spinner'; type OwnProps = { diff --git a/src/components/right/hooks/useAsyncRendering.ts b/src/components/right/hooks/useAsyncRendering.ts index c8c9e41bb..a639a1d90 100644 --- a/src/components/right/hooks/useAsyncRendering.ts +++ b/src/components/right/hooks/useAsyncRendering.ts @@ -1,7 +1,7 @@ import { useEffect, useRef } from '../../../lib/teact/teact'; -import useSyncEffect from '../../../hooks/useSyncEffect'; import useForceUpdate from '../../../hooks/useForceUpdate'; +import useSyncEffect from '../../../hooks/useSyncEffect'; export default function useAsyncRendering(dependencies: T, delay?: number) { const isDisabled = delay === undefined; diff --git a/src/components/right/hooks/useProfileState.ts b/src/components/right/hooks/useProfileState.ts index c75a9d1c9..d0a3c6940 100644 --- a/src/components/right/hooks/useProfileState.ts +++ b/src/components/right/hooks/useProfileState.ts @@ -5,8 +5,8 @@ import { ProfileState } from '../../../types'; import animateScroll from '../../../util/animateScroll'; import { throttle } from '../../../util/schedulers'; -import useLastCallback from '../../../hooks/useLastCallback'; import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; +import useLastCallback from '../../../hooks/useLastCallback'; const TRANSITION_DURATION = 300; const PROGRAMMATIC_SCROLL_TIMEOUT_MS = 350; diff --git a/src/components/right/hooks/useProfileViewportIds.ts b/src/components/right/hooks/useProfileViewportIds.ts index 0b1e8ec39..fc3215917 100644 --- a/src/components/right/hooks/useProfileViewportIds.ts +++ b/src/components/right/hooks/useProfileViewportIds.ts @@ -7,8 +7,9 @@ import type { ProfileTabType, SharedMediaType } from '../../../types'; import { MEMBERS_SLICE, MESSAGE_SEARCH_SLICE, SHARED_MEDIA_SLICE } from '../../../config'; import { getMessageContentIds, sortChatIds, sortUserIds } from '../../../global/helpers'; -import useSyncEffect from '../../../hooks/useSyncEffect'; + import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; +import useSyncEffect from '../../../hooks/useSyncEffect'; export default function useProfileViewportIds( loadMoreMembers: AnyToVoidFunction, diff --git a/src/components/right/hooks/useTransitionFixes.ts b/src/components/right/hooks/useTransitionFixes.ts index 5e0114413..41db55b6c 100644 --- a/src/components/right/hooks/useTransitionFixes.ts +++ b/src/components/right/hooks/useTransitionFixes.ts @@ -1,5 +1,6 @@ import { useEffect } from '../../../lib/teact/teact'; -import { requestMutation, requestMeasure } from '../../../lib/fasterdom/fasterdom'; + +import { requestMeasure, requestMutation } from '../../../lib/fasterdom/fasterdom'; import useLastCallback from '../../../hooks/useLastCallback'; diff --git a/src/components/right/management/JoinRequest.tsx b/src/components/right/management/JoinRequest.tsx index e50649407..a7b944c08 100644 --- a/src/components/right/management/JoinRequest.tsx +++ b/src/components/right/management/JoinRequest.tsx @@ -6,9 +6,10 @@ import type { ApiUser } from '../../../api/types'; import { getUserFullName } from '../../../global/helpers'; import { selectUser } from '../../../global/selectors'; +import { createClassNameBuilder } from '../../../util/buildClassName'; import { formatHumanDate, formatTime, isToday } from '../../../util/dateFormat'; import { getServerTime } from '../../../util/serverTime'; -import { createClassNameBuilder } from '../../../util/buildClassName'; + import useLang from '../../../hooks/useLang'; import Avatar from '../../common/Avatar'; diff --git a/src/components/right/management/ManageChannel.tsx b/src/components/right/management/ManageChannel.tsx index 947ade4e8..0d4b8c695 100644 --- a/src/components/right/management/ManageChannel.tsx +++ b/src/components/right/management/ManageChannel.tsx @@ -5,27 +5,28 @@ import React, { } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { ManagementProgress, ManagementScreens } from '../../../types'; import type { ApiAvailableReaction, ApiChat, ApiChatFullInfo, ApiExportedInvite, } from '../../../api/types'; import { ApiMediaFormat } from '../../../api/types'; +import { ManagementProgress, ManagementScreens } from '../../../types'; import { getChatAvatarHash, getHasAdminRight, isChatPublic } from '../../../global/helpers'; -import useMedia from '../../../hooks/useMedia'; -import useLang from '../../../hooks/useLang'; import { selectChat, selectChatFullInfo, selectTabState } from '../../../global/selectors'; -import useFlag from '../../../hooks/useFlag'; -import useHistoryBack from '../../../hooks/useHistoryBack'; import { formatInteger } from '../../../util/textFormat'; +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; +import useMedia from '../../../hooks/useMedia'; + import AvatarEditable from '../../ui/AvatarEditable'; +import Checkbox from '../../ui/Checkbox'; +import ConfirmDialog from '../../ui/ConfirmDialog'; +import FloatingActionButton from '../../ui/FloatingActionButton'; import InputText from '../../ui/InputText'; import ListItem from '../../ui/ListItem'; -import Checkbox from '../../ui/Checkbox'; import Spinner from '../../ui/Spinner'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import ConfirmDialog from '../../ui/ConfirmDialog'; import TextArea from '../../ui/TextArea'; import './Management.scss'; diff --git a/src/components/right/management/ManageChatAdministrators.tsx b/src/components/right/management/ManageChatAdministrators.tsx index 8b24924a4..2b9db01d5 100644 --- a/src/components/right/management/ManageChatAdministrators.tsx +++ b/src/components/right/management/ManageChatAdministrators.tsx @@ -2,17 +2,18 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getGlobal, withGlobal } from '../../../global'; -import { ManagementScreens } from '../../../types'; import type { ApiChat, ApiChatMember } from '../../../api/types'; +import { ManagementScreens } from '../../../types'; import { getUserFullName, isChatChannel } from '../../../global/helpers'; import { selectChat, selectChatFullInfo } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import ListItem from '../../ui/ListItem'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + import PrivateChatInfo from '../../common/PrivateChatInfo'; import FloatingActionButton from '../../ui/FloatingActionButton'; +import ListItem from '../../ui/ListItem'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageChatPrivacyType.tsx b/src/components/right/management/ManageChatPrivacyType.tsx index 52d1eb41d..3439a896c 100644 --- a/src/components/right/management/ManageChatPrivacyType.tsx +++ b/src/components/right/management/ManageChatPrivacyType.tsx @@ -9,26 +9,27 @@ import type { ApiChat } from '../../../api/types'; import { ManagementProgress } from '../../../types'; import { PURCHASE_USERNAME, TME_LINK_PREFIX, USERNAME_PURCHASE_ERROR } from '../../../config'; -import { - selectChat, selectTabState, selectManagement, selectChatFullInfo, -} from '../../../global/selectors'; import { isChatChannel, isChatPublic } from '../../../global/helpers'; +import { + selectChat, selectChatFullInfo, + selectManagement, selectTabState, +} from '../../../global/selectors'; import { selectCurrentLimit } from '../../../global/selectors/limits'; import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import usePrevious from '../../../hooks/usePrevious'; +import ManageUsernames from '../../common/ManageUsernames'; import SafeLink from '../../common/SafeLink'; -import ListItem from '../../ui/ListItem'; -import RadioGroup from '../../ui/RadioGroup'; -import Loading from '../../ui/Loading'; -import Spinner from '../../ui/Spinner'; -import FloatingActionButton from '../../ui/FloatingActionButton'; import UsernameInput from '../../common/UsernameInput'; import ConfirmDialog from '../../ui/ConfirmDialog'; -import ManageUsernames from '../../common/ManageUsernames'; +import FloatingActionButton from '../../ui/FloatingActionButton'; +import ListItem from '../../ui/ListItem'; +import Loading from '../../ui/Loading'; +import RadioGroup from '../../ui/RadioGroup'; +import Spinner from '../../ui/Spinner'; type PrivacyType = 'private' | 'public'; diff --git a/src/components/right/management/ManageChatRemovedUsers.tsx b/src/components/right/management/ManageChatRemovedUsers.tsx index 3d916d966..04c9b5f0b 100644 --- a/src/components/right/management/ManageChatRemovedUsers.tsx +++ b/src/components/right/management/ManageChatRemovedUsers.tsx @@ -4,16 +4,17 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiChat, ApiChatMember, ApiUser } from '../../../api/types'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; -import { selectChat, selectChatFullInfo } from '../../../global/selectors'; import { getHasAdminRight, getUserFullName, isChatChannel } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; +import { selectChat, selectChatFullInfo } from '../../../global/selectors'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; + import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import PrivateChatInfo from '../../common/PrivateChatInfo'; -import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; import FloatingActionButton from '../../ui/FloatingActionButton'; +import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; import RemoveGroupUserModal from './RemoveGroupUserModal'; type OwnProps = { diff --git a/src/components/right/management/ManageDiscussion.tsx b/src/components/right/management/ManageDiscussion.tsx index 5b134b58a..abfacddaf 100644 --- a/src/components/right/management/ManageDiscussion.tsx +++ b/src/components/right/management/ManageDiscussion.tsx @@ -8,21 +8,22 @@ import type { ApiChat } from '../../../api/types'; import { ManagementScreens } from '../../../types'; import { STICKER_SIZE_DISCUSSION_GROUPS } from '../../../config'; -import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; -import { selectChat, selectChatFullInfo } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; - -import ListItem from '../../ui/ListItem'; -import NothingFound from '../../common/NothingFound'; -import GroupChatInfo from '../../common/GroupChatInfo'; -import ConfirmDialog from '../../ui/ConfirmDialog'; -import useFlag from '../../../hooks/useFlag'; -import renderText from '../../common/helpers/renderText'; -import Avatar from '../../common/Avatar'; import { isChatChannel } from '../../../global/helpers'; +import { selectChat, selectChatFullInfo } from '../../../global/selectors'; +import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; +import renderText from '../../common/helpers/renderText'; + +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + import AnimatedIcon from '../../common/AnimatedIcon'; +import Avatar from '../../common/Avatar'; +import GroupChatInfo from '../../common/GroupChatInfo'; +import NothingFound from '../../common/NothingFound'; import Checkbox from '../../ui/Checkbox'; +import ConfirmDialog from '../../ui/ConfirmDialog'; +import ListItem from '../../ui/ListItem'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageGroup.tsx b/src/components/right/management/ManageGroup.tsx index 81226727a..4f31d352b 100644 --- a/src/components/right/management/ManageGroup.tsx +++ b/src/components/right/management/ManageGroup.tsx @@ -5,11 +5,11 @@ import React, { } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { ManagementProgress, ManagementScreens } from '../../../types'; import type { ApiAvailableReaction, ApiChat, ApiChatBannedRights, ApiChatFullInfo, ApiExportedInvite, } from '../../../api/types'; import { ApiMediaFormat } from '../../../api/types'; +import { ManagementProgress, ManagementScreens } from '../../../types'; import { getChatAvatarHash, @@ -17,24 +17,25 @@ import { isChatBasicGroup, isChatPublic, } from '../../../global/helpers'; -import { debounce } from '../../../util/schedulers'; import { selectChat, selectChatFullInfo, selectTabState } from '../../../global/selectors'; +import { debounce } from '../../../util/schedulers'; import { formatInteger } from '../../../util/textFormat'; import renderText from '../../common/helpers/renderText'; -import useMedia from '../../../hooks/useMedia'; -import useLang from '../../../hooks/useLang'; + import useFlag from '../../../hooks/useFlag'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; +import useMedia from '../../../hooks/useMedia'; import AvatarEditable from '../../ui/AvatarEditable'; +import Checkbox from '../../ui/Checkbox'; +import ConfirmDialog from '../../ui/ConfirmDialog'; +import FloatingActionButton from '../../ui/FloatingActionButton'; import InputText from '../../ui/InputText'; import ListItem from '../../ui/ListItem'; -import Checkbox from '../../ui/Checkbox'; import Spinner from '../../ui/Spinner'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import ConfirmDialog from '../../ui/ConfirmDialog'; -import TextArea from '../../ui/TextArea'; import Switcher from '../../ui/Switcher'; +import TextArea from '../../ui/TextArea'; import './Management.scss'; diff --git a/src/components/right/management/ManageGroupAdminRights.tsx b/src/components/right/management/ManageGroupAdminRights.tsx index 93eda03d5..e9986596e 100644 --- a/src/components/right/management/ManageGroupAdminRights.tsx +++ b/src/components/right/management/ManageGroupAdminRights.tsx @@ -9,19 +9,20 @@ import type { } from '../../../api/types'; import { ManagementScreens } from '../../../types'; -import { selectChat, selectChatFullInfo } from '../../../global/selectors'; import { getUserFullName, isChatBasicGroup, isChatChannel } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; +import { selectChat, selectChatFullInfo } from '../../../global/selectors'; + import useFlag from '../../../hooks/useFlag'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import PrivateChatInfo from '../../common/PrivateChatInfo'; -import ListItem from '../../ui/ListItem'; import Checkbox from '../../ui/Checkbox'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import Spinner from '../../ui/Spinner'; import ConfirmDialog from '../../ui/ConfirmDialog'; +import FloatingActionButton from '../../ui/FloatingActionButton'; import InputText from '../../ui/InputText'; +import ListItem from '../../ui/ListItem'; +import Spinner from '../../ui/Spinner'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageGroupMembers.tsx b/src/components/right/management/ManageGroupMembers.tsx index 9db24aae9..3ec50724c 100644 --- a/src/components/right/management/ManageGroupMembers.tsx +++ b/src/components/right/management/ManageGroupMembers.tsx @@ -7,24 +7,26 @@ import { getActions, getGlobal, withGlobal } from '../../../global'; import type { ApiChatMember, ApiUserStatus } from '../../../api/types'; import { ManagementScreens } from '../../../types'; -import { unique } from '../../../util/iteratees'; -import { selectChat, selectChatFullInfo, selectTabState } from '../../../global/selectors'; import { - sortUserIds, isChatChannel, filterUsersByName, sortChatIds, isUserBot, getHasAdminRight, isChatBasicGroup, + filterUsersByName, getHasAdminRight, isChatBasicGroup, + isChatChannel, isUserBot, sortChatIds, sortUserIds, } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; +import { selectChat, selectChatFullInfo, selectTabState } from '../../../global/selectors'; +import { unique } from '../../../util/iteratees'; + import useHistoryBack from '../../../hooks/useHistoryBack'; import useInfiniteScroll from '../../../hooks/useInfiniteScroll'; import useKeyboardListNavigation from '../../../hooks/useKeyboardListNavigation'; +import useLang from '../../../hooks/useLang'; -import PrivateChatInfo from '../../common/PrivateChatInfo'; import NothingFound from '../../common/NothingFound'; -import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; -import InputText from '../../ui/InputText'; +import PrivateChatInfo from '../../common/PrivateChatInfo'; import InfiniteScroll from '../../ui/InfiniteScroll'; +import InputText from '../../ui/InputText'; +import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; import Loading from '../../ui/Loading'; -import DeleteMemberModal from '../DeleteMemberModal'; import Switcher from '../../ui/Switcher'; +import DeleteMemberModal from '../DeleteMemberModal'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageGroupPermissions.tsx b/src/components/right/management/ManageGroupPermissions.tsx index 4533d1e34..f1ca90ad7 100644 --- a/src/components/right/management/ManageGroupPermissions.tsx +++ b/src/components/right/management/ManageGroupPermissions.tsx @@ -4,22 +4,23 @@ import React, { } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { ManagementScreens } from '../../../types'; import type { ApiChat, ApiChatBannedRights, ApiChatMember } from '../../../api/types'; +import { ManagementScreens } from '../../../types'; -import stopEvent from '../../../util/stopEvent'; -import buildClassName from '../../../util/buildClassName'; import { isChatPublic } from '../../../global/helpers'; import { selectChat, selectChatFullInfo } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; +import buildClassName from '../../../util/buildClassName'; +import stopEvent from '../../../util/stopEvent'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import useManagePermissions from '../hooks/useManagePermissions'; -import ListItem from '../../ui/ListItem'; +import PrivateChatInfo from '../../common/PrivateChatInfo'; import Checkbox from '../../ui/Checkbox'; import FloatingActionButton from '../../ui/FloatingActionButton'; +import ListItem from '../../ui/ListItem'; import Spinner from '../../ui/Spinner'; -import PrivateChatInfo from '../../common/PrivateChatInfo'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageGroupUserPermissions.tsx b/src/components/right/management/ManageGroupUserPermissions.tsx index 04527e910..b1dcb7c91 100644 --- a/src/components/right/management/ManageGroupUserPermissions.tsx +++ b/src/components/right/management/ManageGroupUserPermissions.tsx @@ -8,19 +8,20 @@ import type { ApiChat, ApiChatBannedRights, ApiChatMember } from '../../../api/t import { ManagementScreens } from '../../../types'; import { selectChat, selectChatFullInfo } from '../../../global/selectors'; -import stopEvent from '../../../util/stopEvent'; import buildClassName from '../../../util/buildClassName'; -import useManagePermissions from '../hooks/useManagePermissions'; -import useLang from '../../../hooks/useLang'; +import stopEvent from '../../../util/stopEvent'; + import useFlag from '../../../hooks/useFlag'; import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; +import useManagePermissions from '../hooks/useManagePermissions'; import PrivateChatInfo from '../../common/PrivateChatInfo'; -import ListItem from '../../ui/ListItem'; import Checkbox from '../../ui/Checkbox'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import Spinner from '../../ui/Spinner'; import ConfirmDialog from '../../ui/ConfirmDialog'; +import FloatingActionButton from '../../ui/FloatingActionButton'; +import ListItem from '../../ui/ListItem'; +import Spinner from '../../ui/Spinner'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageGroupUserPermissionsCreate.tsx b/src/components/right/management/ManageGroupUserPermissionsCreate.tsx index 77b0995ec..ea1a45c30 100644 --- a/src/components/right/management/ManageGroupUserPermissionsCreate.tsx +++ b/src/components/right/management/ManageGroupUserPermissionsCreate.tsx @@ -5,13 +5,14 @@ import { withGlobal } from '../../../global'; import type { ApiChatMember, ApiUser, ApiUserStatus } from '../../../api/types'; import { ManagementScreens } from '../../../types'; +import { isChatChannel, sortUserIds } from '../../../global/helpers'; import { selectChat, selectChatFullInfo } from '../../../global/selectors'; -import { sortUserIds, isChatChannel } from '../../../global/helpers'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import NothingFound from '../../common/NothingFound'; import PrivateChatInfo from '../../common/PrivateChatInfo'; import ListItem from '../../ui/ListItem'; -import NothingFound from '../../common/NothingFound'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageInvite.tsx b/src/components/right/management/ManageInvite.tsx index 9ae1bfd50..c142e5e09 100644 --- a/src/components/right/management/ManageInvite.tsx +++ b/src/components/right/management/ManageInvite.tsx @@ -7,19 +7,20 @@ import type { ApiExportedInvite } from '../../../api/types'; import { ManagementScreens } from '../../../types'; import { selectTabState } from '../../../global/selectors'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import useLang from '../../../hooks/useLang'; import { formatFullDate, formatTime } from '../../../util/dateFormat'; -import useFlag from '../../../hooks/useFlag'; import { getServerTime } from '../../../util/serverTime'; +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; +import useSyncEffect from '../../../hooks/useSyncEffect'; + +import CalendarModal from '../../common/CalendarModal'; +import Button from '../../ui/Button'; import Checkbox from '../../ui/Checkbox'; +import FloatingActionButton from '../../ui/FloatingActionButton'; import InputText from '../../ui/InputText'; import RadioGroup from '../../ui/RadioGroup'; -import Button from '../../ui/Button'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import useSyncEffect from '../../../hooks/useSyncEffect'; -import CalendarModal from '../../common/CalendarModal'; const DEFAULT_USAGE_LIMITS = [1, 10, 100]; const DEFAULT_EXPIRE_DATE = { diff --git a/src/components/right/management/ManageInviteInfo.tsx b/src/components/right/management/ManageInviteInfo.tsx index d1b2a160a..edd16922b 100644 --- a/src/components/right/management/ManageInviteInfo.tsx +++ b/src/components/right/management/ManageInviteInfo.tsx @@ -4,17 +4,18 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiChatInviteImporter, ApiExportedInvite, ApiUser } from '../../../api/types'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import useLang from '../../../hooks/useLang'; -import { copyTextToClipboard } from '../../../util/clipboard'; -import { getServerTime } from '../../../util/serverTime'; -import { formatFullDate, formatMediaDateTime, formatTime } from '../../../util/dateFormat'; import { isChatChannel } from '../../../global/helpers'; import { selectChat, selectTabState } from '../../../global/selectors'; +import { copyTextToClipboard } from '../../../util/clipboard'; +import { formatFullDate, formatMediaDateTime, formatTime } from '../../../util/dateFormat'; +import { getServerTime } from '../../../util/serverTime'; + +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import PrivateChatInfo from '../../common/PrivateChatInfo'; -import ListItem from '../../ui/ListItem'; import Button from '../../ui/Button'; +import ListItem from '../../ui/ListItem'; import Spinner from '../../ui/Spinner'; type OwnProps = { diff --git a/src/components/right/management/ManageInvites.tsx b/src/components/right/management/ManageInvites.tsx index bd3da413d..0eee755bb 100644 --- a/src/components/right/management/ManageInvites.tsx +++ b/src/components/right/management/ManageInvites.tsx @@ -1,31 +1,32 @@ +import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback, useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import type { FC } from '../../../lib/teact/teact'; import type { ApiChat, ApiExportedInvite } from '../../../api/types'; import { ManagementScreens } from '../../../types'; import { STICKER_SIZE_INVITES, TME_LINK_PREFIX } from '../../../config'; -import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; -import { formatCountdown, MILLISECONDS_IN_DAY } from '../../../util/dateFormat'; import { getMainUsername, isChatChannel } from '../../../global/helpers'; import { selectChat, selectTabState } from '../../../global/selectors'; import { copyTextToClipboard } from '../../../util/clipboard'; +import { formatCountdown, MILLISECONDS_IN_DAY } from '../../../util/dateFormat'; import { getServerTime } from '../../../util/serverTime'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import useLang from '../../../hooks/useLang'; -import useInterval from '../../../hooks/useInterval'; -import useForceUpdate from '../../../hooks/useForceUpdate'; -import useFlag from '../../../hooks/useFlag'; +import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; -import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; +import useFlag from '../../../hooks/useFlag'; +import useForceUpdate from '../../../hooks/useForceUpdate'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useInterval from '../../../hooks/useInterval'; +import useLang from '../../../hooks/useLang'; + +import AnimatedIcon from '../../common/AnimatedIcon'; +import InviteLink from '../../common/InviteLink'; import NothingFound from '../../common/NothingFound'; import Button from '../../ui/Button'; import ConfirmDialog from '../../ui/ConfirmDialog'; -import AnimatedIcon from '../../common/AnimatedIcon'; -import InviteLink from '../../common/InviteLink'; +import ListItem, { type MenuItemContextAction } from '../../ui/ListItem'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageJoinRequests.tsx b/src/components/right/management/ManageJoinRequests.tsx index d151e9ded..370633c92 100644 --- a/src/components/right/management/ManageJoinRequests.tsx +++ b/src/components/right/management/ManageJoinRequests.tsx @@ -5,18 +5,19 @@ import { getActions, withGlobal } from '../../../global'; import type { ApiChat } from '../../../api/types'; import { STICKER_SIZE_JOIN_REQUESTS } from '../../../config'; -import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; -import useHistoryBack from '../../../hooks/useHistoryBack'; -import { selectChat } from '../../../global/selectors'; import { isChatChannel, isUserId } from '../../../global/helpers'; -import useLang from '../../../hooks/useLang'; -import useFlag from '../../../hooks/useFlag'; +import { selectChat } from '../../../global/selectors'; +import { LOCAL_TGS_URLS } from '../../common/helpers/animatedAssets'; -import JoinRequest from './JoinRequest'; +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + +import AnimatedIcon from '../../common/AnimatedIcon'; import Button from '../../ui/Button'; import ConfirmDialog from '../../ui/ConfirmDialog'; import Spinner from '../../ui/Spinner'; -import AnimatedIcon from '../../common/AnimatedIcon'; +import JoinRequest from './JoinRequest'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageReactions.tsx b/src/components/right/management/ManageReactions.tsx index 5c0d0f42f..8a951375f 100644 --- a/src/components/right/management/ManageReactions.tsx +++ b/src/components/right/management/ManageReactions.tsx @@ -1,6 +1,7 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useCallback, useEffect, useState, useMemo, + memo, useCallback, useEffect, useMemo, + useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; @@ -10,14 +11,15 @@ import type { import { isSameReaction } from '../../../global/helpers'; import { selectChat, selectChatFullInfo } from '../../../global/selectors'; -import useLang from '../../../hooks/useLang'; + import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; import ReactionStaticEmoji from '../../common/ReactionStaticEmoji'; import Checkbox from '../../ui/Checkbox'; import FloatingActionButton from '../../ui/FloatingActionButton'; -import Spinner from '../../ui/Spinner'; import RadioGroup from '../../ui/RadioGroup'; +import Spinner from '../../ui/Spinner'; type OwnProps = { chatId: string; diff --git a/src/components/right/management/ManageUser.tsx b/src/components/right/management/ManageUser.tsx index eec6c4524..42c28c2d2 100644 --- a/src/components/right/management/ManageUser.tsx +++ b/src/components/right/management/ManageUser.tsx @@ -9,6 +9,7 @@ import type { ApiPhoto, ApiUser } from '../../../api/types'; import { ManagementProgress } from '../../../types'; import { SERVICE_NOTIFICATIONS_USER_ID } from '../../../config'; +import { isUserBot, selectIsChatMuted } from '../../../global/helpers'; import { selectChat, selectNotifyExceptions, @@ -17,20 +18,20 @@ import { selectUser, selectUserFullInfo, } from '../../../global/selectors'; -import { isUserBot, selectIsChatMuted } from '../../../global/helpers'; -import useFlag from '../../../hooks/useFlag'; -import useLang from '../../../hooks/useLang'; -import useHistoryBack from '../../../hooks/useHistoryBack'; +import useFlag from '../../../hooks/useFlag'; +import useHistoryBack from '../../../hooks/useHistoryBack'; +import useLang from '../../../hooks/useLang'; + +import Avatar from '../../common/Avatar'; +import PrivateChatInfo from '../../common/PrivateChatInfo'; +import Checkbox from '../../ui/Checkbox'; +import ConfirmDialog from '../../ui/ConfirmDialog'; +import FloatingActionButton from '../../ui/FloatingActionButton'; import InputText from '../../ui/InputText'; import ListItem from '../../ui/ListItem'; -import Checkbox from '../../ui/Checkbox'; -import FloatingActionButton from '../../ui/FloatingActionButton'; -import Spinner from '../../ui/Spinner'; -import PrivateChatInfo from '../../common/PrivateChatInfo'; -import ConfirmDialog from '../../ui/ConfirmDialog'; import SelectAvatar from '../../ui/SelectAvatar'; -import Avatar from '../../common/Avatar'; +import Spinner from '../../ui/Spinner'; import './Management.scss'; diff --git a/src/components/right/management/Management.async.tsx b/src/components/right/management/Management.async.tsx index 56dd82467..437a87631 100644 --- a/src/components/right/management/Management.async.tsx +++ b/src/components/right/management/Management.async.tsx @@ -1,9 +1,10 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './Management'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; import Loading from '../../ui/Loading'; diff --git a/src/components/right/management/Management.tsx b/src/components/right/management/Management.tsx index c3617058d..574682b4a 100644 --- a/src/components/right/management/Management.tsx +++ b/src/components/right/management/Management.tsx @@ -7,23 +7,23 @@ import { ManagementScreens } from '../../../types'; import { selectCurrentManagementType } from '../../../global/selectors'; -import ManageUser from './ManageUser'; -import ManageGroup from './ManageGroup'; -import ManageGroupPermissions from './ManageGroupPermissions'; -import ManageChatRemovedUsers from './ManageChatRemovedUsers'; import ManageChannel from './ManageChannel'; -import ManageChatPrivacyType from './ManageChatPrivacyType'; -import ManageDiscussion from './ManageDiscussion'; -import ManageGroupUserPermissions from './ManageGroupUserPermissions'; import ManageChatAdministrators from './ManageChatAdministrators'; +import ManageChatPrivacyType from './ManageChatPrivacyType'; +import ManageChatRemovedUsers from './ManageChatRemovedUsers'; +import ManageDiscussion from './ManageDiscussion'; +import ManageGroup from './ManageGroup'; import ManageGroupAdminRights from './ManageGroupAdminRights'; import ManageGroupMembers from './ManageGroupMembers'; +import ManageGroupPermissions from './ManageGroupPermissions'; +import ManageGroupUserPermissions from './ManageGroupUserPermissions'; import ManageGroupUserPermissionsCreate from './ManageGroupUserPermissionsCreate'; -import ManageInvites from './ManageInvites'; import ManageInvite from './ManageInvite'; -import ManageReactions from './ManageReactions'; import ManageInviteInfo from './ManageInviteInfo'; +import ManageInvites from './ManageInvites'; import ManageJoinRequests from './ManageJoinRequests'; +import ManageReactions from './ManageReactions'; +import ManageUser from './ManageUser'; export type OwnProps = { chatId: string; diff --git a/src/components/right/management/RemoveGroupUserModal.tsx b/src/components/right/management/RemoveGroupUserModal.tsx index 97c37dddc..92ae4b491 100644 --- a/src/components/right/management/RemoveGroupUserModal.tsx +++ b/src/components/right/management/RemoveGroupUserModal.tsx @@ -1,6 +1,7 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - useMemo, useState, memo, useCallback, + memo, useCallback, + useMemo, useState, } from '../../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../../global'; @@ -8,6 +9,7 @@ import type { ApiChat, ApiChatMember } from '../../../api/types'; import { filterUsersByName } from '../../../global/helpers'; import { selectChatFullInfo } from '../../../global/selectors'; + import useLang from '../../../hooks/useLang'; import ChatOrUserPicker from '../../common/ChatOrUserPicker'; diff --git a/src/components/right/statistics/MessageStatistics.async.tsx b/src/components/right/statistics/MessageStatistics.async.tsx index 8c1b330ac..c3f91b80e 100644 --- a/src/components/right/statistics/MessageStatistics.async.tsx +++ b/src/components/right/statistics/MessageStatistics.async.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './MessageStatistics'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const MessageStatisticsAsync: FC = (props) => { diff --git a/src/components/right/statistics/MessageStatistics.tsx b/src/components/right/statistics/MessageStatistics.tsx index e106777d5..20dd86191 100644 --- a/src/components/right/statistics/MessageStatistics.tsx +++ b/src/components/right/statistics/MessageStatistics.tsx @@ -1,16 +1,18 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useState, useEffect, useRef, + memo, useEffect, useRef, + useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { callApi } from '../../../api/gramjs'; -import type { ApiMessageStatistics, ApiMessagePublicForward, StatisticsGraph } from '../../../api/types'; +import type { ApiMessagePublicForward, ApiMessageStatistics, StatisticsGraph } from '../../../api/types'; import { selectChatFullInfo, selectTabState } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; -import useLang from '../../../hooks/useLang'; +import { callApi } from '../../../api/gramjs'; + import useForceUpdate from '../../../hooks/useForceUpdate'; +import useLang from '../../../hooks/useLang'; import Loading from '../../ui/Loading'; import StatisticsOverview from './StatisticsOverview'; diff --git a/src/components/right/statistics/Statistics.async.tsx b/src/components/right/statistics/Statistics.async.tsx index 10cee815c..908f8f42e 100644 --- a/src/components/right/statistics/Statistics.async.tsx +++ b/src/components/right/statistics/Statistics.async.tsx @@ -1,10 +1,12 @@ import type { FC } from '../../../lib/teact/teact'; import React from '../../../lib/teact/teact'; -import { Bundles } from '../../../util/moduleLoader'; import type { OwnProps } from './Statistics'; +import { Bundles } from '../../../util/moduleLoader'; + import useModuleLoader from '../../../hooks/useModuleLoader'; + import Loading from '../../ui/Loading'; const StatisticsAsync: FC = (props) => { diff --git a/src/components/right/statistics/Statistics.tsx b/src/components/right/statistics/Statistics.tsx index 90de84166..cd8e04424 100644 --- a/src/components/right/statistics/Statistics.tsx +++ b/src/components/right/statistics/Statistics.tsx @@ -1,22 +1,24 @@ import type { FC } from '../../../lib/teact/teact'; import React, { - memo, useState, useEffect, useRef, useMemo, + memo, useEffect, useMemo, + useRef, useState, } from '../../../lib/teact/teact'; import { getActions, withGlobal } from '../../../global'; -import { callApi } from '../../../api/gramjs'; import type { - ApiMessage, ApiChannelStatistics, ApiGroupStatistics, - StatisticsRecentMessage as StatisticsRecentMessageType, + ApiMessage, StatisticsGraph, + StatisticsRecentMessage as StatisticsRecentMessageType, } from '../../../api/types'; -import { selectChat, selectChatFullInfo, selectStatistics } from '../../../global/selectors'; +import { selectChat, selectChatFullInfo, selectStatistics } from '../../../global/selectors'; import buildClassName from '../../../util/buildClassName'; -import useLang from '../../../hooks/useLang'; +import { callApi } from '../../../api/gramjs'; + import useForceUpdate from '../../../hooks/useForceUpdate'; +import useLang from '../../../hooks/useLang'; import Loading from '../../ui/Loading'; import StatisticsOverview from './StatisticsOverview'; diff --git a/src/components/right/statistics/StatisticsOverview.tsx b/src/components/right/statistics/StatisticsOverview.tsx index 140d3cd00..4ebddc2f2 100644 --- a/src/components/right/statistics/StatisticsOverview.tsx +++ b/src/components/right/statistics/StatisticsOverview.tsx @@ -5,9 +5,10 @@ import type { ApiChannelStatistics, ApiGroupStatistics, ApiMessageStatistics, StatisticsOverviewItem, } from '../../../api/types'; -import { formatInteger, formatIntegerCompact } from '../../../util/textFormat'; -import { formatFullDate } from '../../../util/dateFormat'; import buildClassName from '../../../util/buildClassName'; +import { formatFullDate } from '../../../util/dateFormat'; +import { formatInteger, formatIntegerCompact } from '../../../util/textFormat'; + import useLang from '../../../hooks/useLang'; import './StatisticsOverview.scss'; diff --git a/src/components/right/statistics/StatisticsPublicForward.tsx b/src/components/right/statistics/StatisticsPublicForward.tsx index a60ee4f3d..1457a10e8 100644 --- a/src/components/right/statistics/StatisticsPublicForward.tsx +++ b/src/components/right/statistics/StatisticsPublicForward.tsx @@ -1,11 +1,11 @@ -import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; - import type { FC } from '../../../lib/teact/teact'; -import type { ApiMessagePublicForward } from '../../../api/types'; - +import React, { memo, useCallback, useMemo } from '../../../lib/teact/teact'; import { getActions } from '../../../global'; +import type { ApiMessagePublicForward } from '../../../api/types'; + import { getMainUsername } from '../../../global/helpers'; + import useLang from '../../../hooks/useLang'; import Avatar from '../../common/Avatar'; diff --git a/src/components/right/statistics/StatisticsRecentMessage.tsx b/src/components/right/statistics/StatisticsRecentMessage.tsx index ae1ecc7ff..b0e10899f 100644 --- a/src/components/right/statistics/StatisticsRecentMessage.tsx +++ b/src/components/right/statistics/StatisticsRecentMessage.tsx @@ -1,21 +1,21 @@ import type { FC } from '../../../lib/teact/teact'; import React, { memo, useCallback } from '../../../lib/teact/teact'; - -import type { LangFn } from '../../../hooks/useLang'; -import useLang from '../../../hooks/useLang'; import { getActions } from '../../../global'; import type { ApiMessage, StatisticsRecentMessage as StatisticsRecentMessageType } from '../../../api/types'; +import type { LangFn } from '../../../hooks/useLang'; -import buildClassName from '../../../util/buildClassName'; -import { formatDateTimeToString } from '../../../util/dateFormat'; import { getMessageMediaHash, getMessageMediaThumbDataUri, - getMessageVideo, getMessageRoundVideo, + getMessageVideo, } from '../../../global/helpers'; +import buildClassName from '../../../util/buildClassName'; +import { formatDateTimeToString } from '../../../util/dateFormat'; import { renderMessageSummary } from '../../common/helpers/renderMessageText'; + +import useLang from '../../../hooks/useLang'; import useMedia from '../../../hooks/useMedia'; import './StatisticsRecentMessage.scss'; diff --git a/src/components/story/MediaAreaOverlay.tsx b/src/components/story/MediaAreaOverlay.tsx index f662a1d5e..1401523f1 100644 --- a/src/components/story/MediaAreaOverlay.tsx +++ b/src/components/story/MediaAreaOverlay.tsx @@ -4,8 +4,8 @@ import { getActions } from '../../global'; import type { ApiMediaArea } from '../../api/types'; import type { IDimensions } from '../../global/types'; -import buildStyle from '../../util/buildStyle'; import buildClassName from '../../util/buildClassName'; +import buildStyle from '../../util/buildStyle'; import styles from './StoryViewer.module.scss'; diff --git a/src/components/story/MediaStory.tsx b/src/components/story/MediaStory.tsx index 9329d5e09..e0dc0adfc 100644 --- a/src/components/story/MediaStory.tsx +++ b/src/components/story/MediaStory.tsx @@ -10,11 +10,11 @@ import buildClassName from '../../util/buildClassName'; import stopEvent from '../../util/stopEvent'; import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; -import useMedia from '../../hooks/useMedia'; -import useLang from '../../hooks/useLang'; import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; -import useMenuPosition from '../../hooks/useMenuPosition'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; +import useMedia from '../../hooks/useMedia'; +import useMenuPosition from '../../hooks/useMenuPosition'; import Menu from '../ui/Menu'; import MenuItem from '../ui/MenuItem'; diff --git a/src/components/story/StealthModeModal.tsx b/src/components/story/StealthModeModal.tsx index ea5abdff5..f528a23cd 100644 --- a/src/components/story/StealthModeModal.tsx +++ b/src/components/story/StealthModeModal.tsx @@ -10,9 +10,9 @@ import { getServerTime } from '../../util/serverTime'; import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; -import Modal from '../ui/Modal'; import Button from '../ui/Button'; import ListItem from '../ui/ListItem'; +import Modal from '../ui/Modal'; import TextTimer from '../ui/TextTimer'; import styles from './StealthModeModal.module.scss'; diff --git a/src/components/story/Story.tsx b/src/components/story/Story.tsx index 0ca09fc29..a3cea6249 100644 --- a/src/components/story/Story.tsx +++ b/src/components/story/Story.tsx @@ -1,9 +1,9 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useRef, useState, } from '../../lib/teact/teact'; import { getActions, getGlobal, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiStealthMode, ApiStory, ApiTypeStory, ApiUser, } from '../../api/types'; @@ -12,44 +12,45 @@ import type { Signal } from '../../util/signals'; import { MAIN_THREAD_ID } from '../../api/types'; import { EDITABLE_STORY_INPUT_CSS_SELECTOR, EDITABLE_STORY_INPUT_ID } from '../../config'; -import buildClassName from '../../util/buildClassName'; -import renderText from '../common/helpers/renderText'; -import { formatMediaDuration, formatRelativeTime } from '../../util/dateFormat'; import { getUserFirstOrLastName } from '../../global/helpers'; -import { getServerTime } from '../../util/serverTime'; import { - selectChat, selectTabState, selectUserStory, selectUserStories, selectIsCurrentUserPremium, + selectChat, selectIsCurrentUserPremium, + selectTabState, selectUserStories, selectUserStory, } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; import captureKeyboardListeners from '../../util/captureKeyboardListeners'; +import { formatMediaDuration, formatRelativeTime } from '../../util/dateFormat'; import download from '../../util/download'; +import { getServerTime } from '../../util/serverTime'; +import renderText from '../common/helpers/renderText'; +import useUnsupportedMedia from '../../hooks/media/useUnsupportedMedia'; import useAppLayout, { getIsMobile } from '../../hooks/useAppLayout'; -import useLang from '../../hooks/useLang'; -import useStoryPreloader from './hooks/useStoryPreloader'; import useBackgroundMode from '../../hooks/useBackgroundMode'; -import useShowTransition from '../../hooks/useShowTransition'; -import useLastCallback from '../../hooks/useLastCallback'; +import useCanvasBlur from '../../hooks/useCanvasBlur'; import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; -import useFlag from '../../hooks/useFlag'; import useCurrentTimeSignal from '../../hooks/useCurrentTimeSignal'; import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; +import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import useLongPress from '../../hooks/useLongPress'; -import useUnsupportedMedia from '../../hooks/media/useUnsupportedMedia'; -import useCanvasBlur from '../../hooks/useCanvasBlur'; import useMediaTransition from '../../hooks/useMediaTransition'; +import useShowTransition from '../../hooks/useShowTransition'; +import useStoryPreloader from './hooks/useStoryPreloader'; import useStoryProps from './hooks/useStoryProps'; -import Button from '../ui/Button'; import Avatar from '../common/Avatar'; -import OptimizedVideo from '../ui/OptimizedVideo'; -import StoryProgress from './StoryProgress'; -import Composer from '../common/Composer'; -import MenuItem from '../ui/MenuItem'; -import DropdownMenu from '../ui/DropdownMenu'; -import Skeleton from '../ui/placeholder/Skeleton'; -import StoryCaption from './StoryCaption'; import AvatarList from '../common/AvatarList'; +import Composer from '../common/Composer'; +import Button from '../ui/Button'; +import DropdownMenu from '../ui/DropdownMenu'; +import MenuItem from '../ui/MenuItem'; +import OptimizedVideo from '../ui/OptimizedVideo'; +import Skeleton from '../ui/placeholder/Skeleton'; import MediaAreaOverlay from './MediaAreaOverlay'; +import StoryCaption from './StoryCaption'; +import StoryProgress from './StoryProgress'; import styles from './StoryViewer.module.scss'; diff --git a/src/components/story/StoryCaption.tsx b/src/components/story/StoryCaption.tsx index 631f99cae..09e30c590 100644 --- a/src/components/story/StoryCaption.tsx +++ b/src/components/story/StoryCaption.tsx @@ -1,16 +1,16 @@ import React, { memo, useEffect, useRef, useState, } from '../../lib/teact/teact'; -import { requestMutation } from '../../lib/fasterdom/fasterdom'; import { addExtraClass, removeExtraClass } from '../../lib/teact/teact-dom'; import type { ApiStory } from '../../api/types'; +import { requestMutation } from '../../lib/fasterdom/fasterdom'; import buildClassName from '../../util/buildClassName'; import { REM } from '../common/helpers/mediaDimensions'; -import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation'; import useLang from '../../hooks/useLang'; +import usePrevDuringAnimation from '../../hooks/usePrevDuringAnimation'; import useShowTransition from '../../hooks/useShowTransition'; import MessageText from '../common/MessageText'; diff --git a/src/components/story/StoryDeleteConfirmModal.tsx b/src/components/story/StoryDeleteConfirmModal.tsx index ea082d50a..816f95d62 100644 --- a/src/components/story/StoryDeleteConfirmModal.tsx +++ b/src/components/story/StoryDeleteConfirmModal.tsx @@ -1,5 +1,4 @@ import React, { memo, useCallback } from '../../lib/teact/teact'; - import { getActions } from '../../global'; import useLang from '../../hooks/useLang'; diff --git a/src/components/story/StoryPreview.tsx b/src/components/story/StoryPreview.tsx index ac325bde9..9c8a41278 100644 --- a/src/components/story/StoryPreview.tsx +++ b/src/components/story/StoryPreview.tsx @@ -4,9 +4,10 @@ import { getActions, withGlobal } from '../../global'; import type { ApiTypeStory, ApiUser, ApiUserStories } from '../../api/types'; import type { StoryViewerOrigin } from '../../types'; +import { getStoryMediaHash, getUserFirstOrLastName } from '../../global/helpers'; import { selectTabState } from '../../global/selectors'; import renderText from '../common/helpers/renderText'; -import { getStoryMediaHash, getUserFirstOrLastName } from '../../global/helpers'; + import useMedia from '../../hooks/useMedia'; import Avatar from '../common/Avatar'; diff --git a/src/components/story/StoryRibbon.tsx b/src/components/story/StoryRibbon.tsx index 31dce60bc..99469a4e4 100644 --- a/src/components/story/StoryRibbon.tsx +++ b/src/components/story/StoryRibbon.tsx @@ -3,10 +3,11 @@ import { withGlobal } from '../../global'; import type { ApiUser } from '../../api/types'; -import { getIsMobile } from '../../hooks/useAppLayout'; import buildClassName from '../../util/buildClassName'; -import useLang from '../../hooks/useLang'; + +import { getIsMobile } from '../../hooks/useAppLayout'; import useHorizontalScroll from '../../hooks/useHorizontalScroll'; +import useLang from '../../hooks/useLang'; import StoryRibbonButton from './StoryRibbonButton'; diff --git a/src/components/story/StoryRibbonButton.tsx b/src/components/story/StoryRibbonButton.tsx index 51fd16cfb..efb2d1e7f 100644 --- a/src/components/story/StoryRibbonButton.tsx +++ b/src/components/story/StoryRibbonButton.tsx @@ -4,12 +4,12 @@ import { getActions } from '../../global'; import type { ApiUser } from '../../api/types'; import { StoryViewerOrigin } from '../../types'; -import buildClassName from '../../util/buildClassName'; import { getUserFirstOrLastName } from '../../global/helpers'; +import buildClassName from '../../util/buildClassName'; import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; -import useLang from '../../hooks/useLang'; import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; import useMenuPosition from '../../hooks/useMenuPosition'; import useStoryPreloader from './hooks/useStoryPreloader'; diff --git a/src/components/story/StorySettings.tsx b/src/components/story/StorySettings.tsx index 416833f98..996ca407c 100644 --- a/src/components/story/StorySettings.tsx +++ b/src/components/story/StorySettings.tsx @@ -7,22 +7,22 @@ import type { ApiStory, ApiUser } from '../../api/types'; import type { ApiPrivacySettings, PrivacyVisibility } from '../../types'; import type { IconName } from '../../types/icons'; -import buildClassName from '../../util/buildClassName'; -import { selectTabState, selectUserStory } from '../../global/selectors'; import { getUserFullName } from '../../global/helpers'; +import { selectTabState, selectUserStory } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; import stopEvent from '../../util/stopEvent'; -import useLang from '../../hooks/useLang'; import useFlag from '../../hooks/useFlag'; +import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; -import Modal from '../ui/Modal'; -import ListItem from '../ui/ListItem'; -import Switcher from '../ui/Switcher'; import Button from '../ui/Button'; +import ListItem from '../ui/ListItem'; +import Modal from '../ui/Modal'; +import Switcher from '../ui/Switcher'; import Transition from '../ui/Transition'; -import CloseFriends from './privacy/CloseFriends'; import AllowDenyList from './privacy/AllowDenyList'; +import CloseFriends from './privacy/CloseFriends'; import styles from './StorySettings.module.scss'; diff --git a/src/components/story/StorySlides.tsx b/src/components/story/StorySlides.tsx index a4eca56fd..eb407299f 100644 --- a/src/components/story/StorySlides.tsx +++ b/src/components/story/StorySlides.tsx @@ -5,19 +5,19 @@ import { getGlobal, withGlobal } from '../../global'; import type { ApiUserStories } from '../../api/types'; -import { IS_FIREFOX, IS_SAFARI } from '../../util/windowEnvironment'; import { ANIMATION_END_DELAY } from '../../config'; import { selectIsStoryViewerOpen, selectTabState, selectUser } from '../../global/selectors'; -import { calculateOffsetX } from './helpers/dimensions'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; +import { IS_FIREFOX, IS_SAFARI } from '../../util/windowEnvironment'; +import { calculateOffsetX } from './helpers/dimensions'; +import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; +import useHistoryBack from '../../hooks/useHistoryBack'; import useLastCallback from '../../hooks/useLastCallback'; import usePrevious from '../../hooks/usePrevious'; -import useCurrentOrPrev from '../../hooks/useCurrentOrPrev'; import useSignal from '../../hooks/useSignal'; import useSlideSizes from './hooks/useSlideSizes'; -import useHistoryBack from '../../hooks/useHistoryBack'; import Story from './Story'; import StoryPreview from './StoryPreview'; diff --git a/src/components/story/StoryToggler.tsx b/src/components/story/StoryToggler.tsx index 97d3f482c..c8166ec66 100644 --- a/src/components/story/StoryToggler.tsx +++ b/src/components/story/StoryToggler.tsx @@ -4,8 +4,8 @@ import { getActions, withGlobal } from '../../global'; import type { ApiUser } from '../../api/types'; import { PREVIEW_AVATAR_COUNT } from '../../config'; -import buildClassName from '../../util/buildClassName'; import { selectTabState } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; import useLang from '../../hooks/useLang'; import useShowTransition from '../../hooks/useShowTransition'; diff --git a/src/components/story/StoryView.tsx b/src/components/story/StoryView.tsx index 5af091785..dd75258fb 100644 --- a/src/components/story/StoryView.tsx +++ b/src/components/story/StoryView.tsx @@ -3,18 +3,18 @@ import { getActions, withGlobal } from '../../global'; import type { ApiAvailableReaction, ApiStoryView, ApiUser } from '../../api/types'; +import { getUserFullName } from '../../global/helpers'; import { selectUser } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; -import { REM } from '../common/helpers/mediaDimensions'; import { formatDateAtTime } from '../../util/dateFormat'; -import { getUserFullName } from '../../global/helpers'; +import { REM } from '../common/helpers/mediaDimensions'; -import useLastCallback from '../../hooks/useLastCallback'; import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; -import ListItem, { type MenuItemContextAction } from '../ui/ListItem'; -import ReactionStaticEmoji from '../common/ReactionStaticEmoji'; import PrivateChatInfo from '../common/PrivateChatInfo'; +import ReactionStaticEmoji from '../common/ReactionStaticEmoji'; +import ListItem, { type MenuItemContextAction } from '../ui/ListItem'; import styles from './StoryViewModal.module.scss'; diff --git a/src/components/story/StoryViewModal.tsx b/src/components/story/StoryViewModal.tsx index 1e29c8709..85810fd4b 100644 --- a/src/components/story/StoryViewModal.tsx +++ b/src/components/story/StoryViewModal.tsx @@ -1,9 +1,9 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useMemo, useState, } from '../../lib/teact/teact'; import { getActions, withGlobal } from '../../global'; -import type { FC } from '../../lib/teact/teact'; import type { ApiStory, ApiStoryView } from '../../api/types'; import { @@ -20,20 +20,20 @@ import buildClassName from '../../util/buildClassName'; import { getServerTime } from '../../util/serverTime'; import renderText from '../common/helpers/renderText'; +import useDebouncedCallback from '../../hooks/useDebouncedCallback'; +import useFlag from '../../hooks/useFlag'; import useLang from '../../hooks/useLang'; import useLastCallback from '../../hooks/useLastCallback'; -import useFlag from '../../hooks/useFlag'; import useScrolledState from '../../hooks/useScrolledState'; -import useDebouncedCallback from '../../hooks/useDebouncedCallback'; -import Modal from '../ui/Modal'; -import ListItem from '../ui/ListItem'; import Button from '../ui/Button'; -import InfiniteScroll from '../ui/InfiniteScroll'; -import SearchInput from '../ui/SearchInput'; import DropdownMenu from '../ui/DropdownMenu'; +import InfiniteScroll from '../ui/InfiniteScroll'; +import ListItem from '../ui/ListItem'; import MenuItem from '../ui/MenuItem'; +import Modal from '../ui/Modal'; import PlaceholderChatInfo from '../ui/placeholder/PlaceholderChatInfo'; +import SearchInput from '../ui/SearchInput'; import StoryView from './StoryView'; import styles from './StoryViewModal.module.scss'; diff --git a/src/components/story/StoryViewer.async.tsx b/src/components/story/StoryViewer.async.tsx index 38bb5a4e0..b4b4cc29f 100644 --- a/src/components/story/StoryViewer.async.tsx +++ b/src/components/story/StoryViewer.async.tsx @@ -2,6 +2,7 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import { Bundles } from '../../util/moduleLoader'; + import useModuleLoader from '../../hooks/useModuleLoader'; interface OwnProps { diff --git a/src/components/story/StoryViewer.tsx b/src/components/story/StoryViewer.tsx index 1139cd5fd..63c02e387 100644 --- a/src/components/story/StoryViewer.tsx +++ b/src/components/story/StoryViewer.tsx @@ -6,34 +6,34 @@ import { getActions, withGlobal } from '../../global'; import type { ApiTypeStory } from '../../api/types'; import type { StoryViewerOrigin } from '../../types'; +import { ANIMATION_END_DELAY } from '../../config'; import { selectIsStoryViewerOpen, + selectPerformanceSettingsValue, selectTabState, selectUserStory, - selectPerformanceSettingsValue, } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; import captureEscKeyListener from '../../util/captureEscKeyListener'; import { disableDirectTextInput, enableDirectTextInput } from '../../util/directInputManager'; -import { animateOpening, animateClosing } from './helpers/ghostAnimation'; -import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; -import { dispatchPriorityPlaybackEvent } from '../../hooks/usePriorityPlaybackCheck'; -import buildClassName from '../../util/buildClassName'; -import { ANIMATION_END_DELAY } from '../../config'; +import { animateClosing, animateOpening } from './helpers/ghostAnimation'; import useFlag from '../../hooks/useFlag'; +import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; import useLang from '../../hooks/useLang'; import usePrevious from '../../hooks/usePrevious'; -import useStoryProps from './hooks/useStoryProps'; +import { dispatchPriorityPlaybackEvent } from '../../hooks/usePriorityPlaybackCheck'; import useSlideSizes from './hooks/useSlideSizes'; +import useStoryProps from './hooks/useStoryProps'; -import ShowTransition from '../ui/ShowTransition'; -import Button from '../ui/Button'; -import StorySlides from './StorySlides'; -import StoryDeleteConfirmModal from './StoryDeleteConfirmModal'; -import StoryViewModal from './StoryViewModal'; import ReportModal from '../common/ReportModal'; -import StorySettings from './StorySettings'; +import Button from '../ui/Button'; +import ShowTransition from '../ui/ShowTransition'; import StealthModeModal from './StealthModeModal'; +import StoryDeleteConfirmModal from './StoryDeleteConfirmModal'; +import StorySettings from './StorySettings'; +import StorySlides from './StorySlides'; +import StoryViewModal from './StoryViewModal'; import styles from './StoryViewer.module.scss'; diff --git a/src/components/story/helpers/ghostAnimation.ts b/src/components/story/helpers/ghostAnimation.ts index 05a77829e..bb397ab2a 100644 --- a/src/components/story/helpers/ghostAnimation.ts +++ b/src/components/story/helpers/ghostAnimation.ts @@ -1,17 +1,17 @@ import type { IDimensions } from '../../../global/types'; import { StoryViewerOrigin } from '../../../types'; -import { getUserStoryHtmlId } from '../../../global/helpers'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; -import fastBlur from '../../../lib/fastBlur'; -import windowSize from '../../../util/windowSize'; -import stopEvent from '../../../util/stopEvent'; import { ANIMATION_END_DELAY } from '../../../config'; -import { REM } from '../../common/helpers/mediaDimensions'; +import fastBlur from '../../../lib/fastBlur'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import { getUserStoryHtmlId } from '../../../global/helpers'; +import stopEvent from '../../../util/stopEvent'; import { IS_CANVAS_FILTER_SUPPORTED } from '../../../util/windowEnvironment'; +import windowSize from '../../../util/windowSize'; +import { REM } from '../../common/helpers/mediaDimensions'; -import styles from '../StoryViewer.module.scss'; import storyRibbonStyles from '../StoryRibbon.module.scss'; +import styles from '../StoryViewer.module.scss'; const ANIMATION_DURATION = 200; const OFFSET_DESKTOP = 3.5 * REM; diff --git a/src/components/story/hooks/useSlideSizes.ts b/src/components/story/hooks/useSlideSizes.ts index be19d701c..33487fac4 100644 --- a/src/components/story/hooks/useSlideSizes.ts +++ b/src/components/story/hooks/useSlideSizes.ts @@ -1,7 +1,9 @@ -import useWindowSize from '../../../hooks/useWindowSize'; import { useMemo } from '../../../lib/teact/teact'; + import { calculateSlideSizes } from '../helpers/dimensions'; +import useWindowSize from '../../../hooks/useWindowSize'; + export default function useSlideSizes() { const { width: windowWidth, height: windowHeight } = useWindowSize(); return useMemo(() => calculateSlideSizes(windowWidth, windowHeight), [windowWidth, windowHeight]); diff --git a/src/components/story/hooks/useStoryPreloader.ts b/src/components/story/hooks/useStoryPreloader.ts index d42af356e..eda9f42a7 100644 --- a/src/components/story/hooks/useStoryPreloader.ts +++ b/src/components/story/hooks/useStoryPreloader.ts @@ -3,8 +3,8 @@ import { getGlobal } from '../../../global'; import { ApiMediaFormat } from '../../../api/types'; -import { selectUserStories } from '../../../global/selectors'; import { getStoryMediaHash } from '../../../global/helpers'; +import { selectUserStories } from '../../../global/selectors'; import * as mediaLoader from '../../../util/mediaLoader'; import { pause } from '../../../util/schedulers'; diff --git a/src/components/story/hooks/useStoryProps.ts b/src/components/story/hooks/useStoryProps.ts index 9b3932cd0..8f688a4e3 100644 --- a/src/components/story/hooks/useStoryProps.ts +++ b/src/components/story/hooks/useStoryProps.ts @@ -1,8 +1,10 @@ import type { ApiTypeStory } from '../../../api/types'; -import { hasMessageText, getStoryMediaHash } from '../../../global/helpers'; -import useMedia from '../../../hooks/useMedia'; import { ApiMediaFormat } from '../../../api/types'; +import { getStoryMediaHash, hasMessageText } from '../../../global/helpers'; + +import useMedia from '../../../hooks/useMedia'; + export default function useStoryProps( story?: ApiTypeStory, isCurrentUserPremium = false, isDropdownMenuOpen = false, ) { diff --git a/src/components/story/privacy/AllowDenyList.tsx b/src/components/story/privacy/AllowDenyList.tsx index 0a22b66e4..da3f62d6f 100644 --- a/src/components/story/privacy/AllowDenyList.tsx +++ b/src/components/story/privacy/AllowDenyList.tsx @@ -1,11 +1,15 @@ import React, { memo, useMemo, useState } from '../../../lib/teact/teact'; -import Picker from '../../common/Picker'; -import { unique } from '../../../util/iteratees'; -import { filterUsersByName } from '../../../global/helpers'; + import type { ApiUser } from '../../../api/types'; -import useLang from '../../../hooks/useLang'; + +import { filterUsersByName } from '../../../global/helpers'; +import { unique } from '../../../util/iteratees'; import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import useLang from '../../../hooks/useLang'; + +import Picker from '../../common/Picker'; + interface OwnProps { id: string; contactListIds?: string[]; diff --git a/src/components/story/privacy/CloseFriends.tsx b/src/components/story/privacy/CloseFriends.tsx index 893a06f6e..7dbd2db39 100644 --- a/src/components/story/privacy/CloseFriends.tsx +++ b/src/components/story/privacy/CloseFriends.tsx @@ -5,9 +5,9 @@ import { getActions } from '../../../global'; import type { ApiUser } from '../../../api/types'; -import { unique } from '../../../util/iteratees'; import { filterUsersByName } from '../../../global/helpers'; import buildClassName from '../../../util/buildClassName'; +import { unique } from '../../../util/iteratees'; import useEffectWithPrevDeps from '../../../hooks/useEffectWithPrevDeps'; import useLang from '../../../hooks/useLang'; diff --git a/src/components/test/SubTest.tsx b/src/components/test/SubTest.tsx index b5de31ea4..34635dcdd 100644 --- a/src/components/test/SubTest.tsx +++ b/src/components/test/SubTest.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../lib/teact/teact'; import React, { useState } from '../../lib/teact/teact'; + import type { ApiUpdateAuthorizationStateType } from '../../api/types'; type OwnProps = { diff --git a/src/components/test/Test.tsx b/src/components/test/Test.tsx index f6565f351..be7cfc7ed 100644 --- a/src/components/test/Test.tsx +++ b/src/components/test/Test.tsx @@ -1,10 +1,11 @@ import type { FC } from '../../lib/teact/teact'; import React, { useState } from '../../lib/teact/teact'; import { withGlobal } from '../../global'; + import type { GlobalState } from '../../global/types'; -import SubTest from './SubTest'; import ErrorTest from './ErrorTest'; +import SubTest from './SubTest'; type StateProps = Pick & { globalRand: number; diff --git a/src/components/test/TestCleanupOrder.tsx b/src/components/test/TestCleanupOrder.tsx index 8efdbb77d..c41c64653 100644 --- a/src/components/test/TestCleanupOrder.tsx +++ b/src/components/test/TestCleanupOrder.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useLayoutEffect } from '../../lib/teact/teact'; +import React, { useEffect, useLayoutEffect, useState } from '../../lib/teact/teact'; const TestCleanupOrder = () => { const [, setRand] = useState(Math.random()); diff --git a/src/components/test/TestNoRedundancy.tsx b/src/components/test/TestNoRedundancy.tsx index b5b754f84..c491d8e90 100644 --- a/src/components/test/TestNoRedundancy.tsx +++ b/src/components/test/TestNoRedundancy.tsx @@ -2,6 +2,7 @@ import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; import { getGlobal, setGlobal, withGlobal } from '../../global'; + import type { GlobalState } from '../../global/types'; document.ondblclick = () => { diff --git a/src/components/ui/AvatarEditable.tsx b/src/components/ui/AvatarEditable.tsx index 37f3afe1c..df822be85 100644 --- a/src/components/ui/AvatarEditable.tsx +++ b/src/components/ui/AvatarEditable.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent } from 'react'; import type { FC } from '../../lib/teact/teact'; import React, { - useState, useEffect, memo, useCallback, + memo, useCallback, useEffect, useState, } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; diff --git a/src/components/ui/Badge.tsx b/src/components/ui/Badge.tsx index afb7f16ec..882884411 100644 --- a/src/components/ui/Badge.tsx +++ b/src/components/ui/Badge.tsx @@ -1,6 +1,5 @@ -import React, { memo } from '../../lib/teact/teact'; - import type { FC } from '../../lib/teact/teact'; +import React, { memo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx index e97158b71..7af151034 100644 --- a/src/components/ui/Button.tsx +++ b/src/components/ui/Button.tsx @@ -1,16 +1,15 @@ import type { MouseEvent as ReactMouseEvent, RefObject } from 'react'; - import type { FC } from '../../lib/teact/teact'; import React, { useRef, useState } from '../../lib/teact/teact'; -import { IS_TOUCH_ENV, MouseButton } from '../../util/windowEnvironment'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; +import { IS_TOUCH_ENV, MouseButton } from '../../util/windowEnvironment'; import useLastCallback from '../../hooks/useLastCallback'; -import Spinner from './Spinner'; import RippleEffect from './RippleEffect'; +import Spinner from './Spinner'; import './Button.scss'; diff --git a/src/components/ui/Checkbox.tsx b/src/components/ui/Checkbox.tsx index 9e8ea0088..966c9bfff 100644 --- a/src/components/ui/Checkbox.tsx +++ b/src/components/ui/Checkbox.tsx @@ -5,9 +5,10 @@ import React, { memo, useCallback, useRef } from '../../lib/teact/teact'; import type { IconName } from '../../types/icons'; import buildClassName from '../../util/buildClassName'; -import useLang from '../../hooks/useLang'; import renderText from '../common/helpers/renderText'; +import useLang from '../../hooks/useLang'; + import Spinner from './Spinner'; import './Checkbox.scss'; diff --git a/src/components/ui/CheckboxGroup.tsx b/src/components/ui/CheckboxGroup.tsx index d84165826..4f1e3b3c0 100644 --- a/src/components/ui/CheckboxGroup.tsx +++ b/src/components/ui/CheckboxGroup.tsx @@ -1,6 +1,6 @@ import type { ChangeEvent } from 'react'; import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, memo, useState } from '../../lib/teact/teact'; +import React, { memo, useCallback, useState } from '../../lib/teact/teact'; import Checkbox from './Checkbox'; diff --git a/src/components/ui/ConfirmDialog.tsx b/src/components/ui/ConfirmDialog.tsx index 9bd90aaa3..979214e88 100644 --- a/src/components/ui/ConfirmDialog.tsx +++ b/src/components/ui/ConfirmDialog.tsx @@ -4,11 +4,12 @@ import React, { memo, useCallback, useRef } from '../../lib/teact/teact'; import type { TextPart } from '../../types'; import buildClassName from '../../util/buildClassName'; -import useLang from '../../hooks/useLang'; -import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; -import Modal from './Modal'; +import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; +import useLang from '../../hooks/useLang'; + import Button from './Button'; +import Modal from './Modal'; type OwnProps = { isOpen: boolean; diff --git a/src/components/ui/CropModal.tsx b/src/components/ui/CropModal.tsx index 1a1acd15a..033dfcaab 100644 --- a/src/components/ui/CropModal.tsx +++ b/src/components/ui/CropModal.tsx @@ -1,15 +1,16 @@ import type { FC } from '../../lib/teact/teact'; import React, { - useEffect, useState, memo, useCallback, + memo, useCallback, useEffect, useState, } from '../../lib/teact/teact'; import { DEBUG } from '../../config'; -import { blobToFile, blobToDataUri } from '../../util/files'; +import { blobToDataUri, blobToFile } from '../../util/files'; + import useLang from '../../hooks/useLang'; import Button from './Button'; -import Modal from './Modal'; import Loading from './Loading'; +import Modal from './Modal'; import './CropModal.scss'; diff --git a/src/components/ui/Draggable.tsx b/src/components/ui/Draggable.tsx index 83d4bec4d..00dab9c33 100644 --- a/src/components/ui/Draggable.tsx +++ b/src/components/ui/Draggable.tsx @@ -1,14 +1,14 @@ +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useMemo, useRef, useState, } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; - import buildClassName from '../../util/buildClassName'; +import buildStyle from '../../util/buildStyle'; + +import useLang from '../../hooks/useLang'; import styles from './Draggable.module.scss'; -import useLang from '../../hooks/useLang'; -import buildStyle from '../../util/buildStyle'; type TPoint = { x: number; diff --git a/src/components/ui/DropdownMenu.tsx b/src/components/ui/DropdownMenu.tsx index 4f4c67b7f..2ec266947 100644 --- a/src/components/ui/DropdownMenu.tsx +++ b/src/components/ui/DropdownMenu.tsx @@ -1,11 +1,11 @@ +import type { FC } from '../../lib/teact/teact'; import React, { - useState, useRef, useCallback, useMemo, + useCallback, useMemo, + useRef, useState, } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; - -import Menu from './Menu'; import Button from './Button'; +import Menu from './Menu'; import './DropdownMenu.scss'; diff --git a/src/components/ui/FloatingActionButton.tsx b/src/components/ui/FloatingActionButton.tsx index 8dc67918a..d4df34f5e 100644 --- a/src/components/ui/FloatingActionButton.tsx +++ b/src/components/ui/FloatingActionButton.tsx @@ -1,9 +1,10 @@ +import type { FC } from '../../lib/teact/teact'; import React from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; import type { OwnProps as ButtonProps } from './Button'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; import Button from './Button'; diff --git a/src/components/ui/InfiniteScroll.tsx b/src/components/ui/InfiniteScroll.tsx index 7c5449f6e..993ebae68 100644 --- a/src/components/ui/InfiniteScroll.tsx +++ b/src/components/ui/InfiniteScroll.tsx @@ -1,16 +1,17 @@ import type { RefObject, UIEvent } from 'react'; +import type { FC } from '../../lib/teact/teact'; import React, { useEffect, useLayoutEffect, useMemo, useRef, } from '../../lib/teact/teact'; -import { requestForcedReflow } from '../../lib/fasterdom/fasterdom'; import { LoadMoreDirection } from '../../types'; -import type { FC } from '../../lib/teact/teact'; -import { debounce } from '../../util/schedulers'; -import resetScroll from '../../util/resetScroll'; -import { IS_ANDROID } from '../../util/windowEnvironment'; +import { requestForcedReflow } from '../../lib/fasterdom/fasterdom'; import buildStyle from '../../util/buildStyle'; +import resetScroll from '../../util/resetScroll'; +import { debounce } from '../../util/schedulers'; +import { IS_ANDROID } from '../../util/windowEnvironment'; + import useLastCallback from '../../hooks/useLastCallback'; type OwnProps = { diff --git a/src/components/ui/InputText.tsx b/src/components/ui/InputText.tsx index ac37e633f..8c924742f 100644 --- a/src/components/ui/InputText.tsx +++ b/src/components/ui/InputText.tsx @@ -5,6 +5,7 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; type OwnProps = { diff --git a/src/components/ui/ListItem.tsx b/src/components/ui/ListItem.tsx index d75bc035f..76babf7d1 100644 --- a/src/components/ui/ListItem.tsx +++ b/src/components/ui/ListItem.tsx @@ -1,26 +1,26 @@ import type { RefObject } from 'react'; import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { useRef } from '../../lib/teact/teact'; -import { requestMeasure } from '../../lib/fasterdom/fasterdom'; import type { IconName } from '../../types/icons'; -import { IS_TOUCH_ENV, MouseButton } from '../../util/windowEnvironment'; +import { requestMeasure } from '../../lib/fasterdom/fasterdom'; import buildClassName from '../../util/buildClassName'; +import { IS_TOUCH_ENV, MouseButton } from '../../util/windowEnvironment'; import renderText from '../common/helpers/renderText'; -import useLastCallback from '../../hooks/useLastCallback'; import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; -import useMenuPosition from '../../hooks/useMenuPosition'; +import { useFastClick } from '../../hooks/useFastClick'; import useFlag from '../../hooks/useFlag'; import useLang from '../../hooks/useLang'; -import { useFastClick } from '../../hooks/useFastClick'; +import useLastCallback from '../../hooks/useLastCallback'; +import useMenuPosition from '../../hooks/useMenuPosition'; -import RippleEffect from './RippleEffect'; +import Button from './Button'; import Menu from './Menu'; import MenuItem from './MenuItem'; import MenuSeparator from './MenuSeparator'; -import Button from './Button'; +import RippleEffect from './RippleEffect'; import './ListItem.scss'; diff --git a/src/components/ui/Menu.tsx b/src/components/ui/Menu.tsx index 9ae311721..20ad58da3 100644 --- a/src/components/ui/Menu.tsx +++ b/src/components/ui/Menu.tsx @@ -2,20 +2,20 @@ import React, { type FC, memo, useEffect, useRef, } from '../../lib/teact/teact'; -import { IS_BACKDROP_BLUR_SUPPORTED } from '../../util/windowEnvironment'; -import captureEscKeyListener from '../../util/captureEscKeyListener'; import buildClassName from '../../util/buildClassName'; import buildStyle from '../../util/buildStyle'; -import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; -import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; +import captureEscKeyListener from '../../util/captureEscKeyListener'; import freezeWhenClosed from '../../util/hoc/freezeWhenClosed'; +import { IS_BACKDROP_BLUR_SUPPORTED } from '../../util/windowEnvironment'; +import { preventMessageInputBlurWithBubbling } from '../middle/helpers/preventMessageInputBlur'; -import useShowTransition from '../../hooks/useShowTransition'; -import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; -import useVirtualBackdrop from '../../hooks/useVirtualBackdrop'; -import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; -import useHistoryBack from '../../hooks/useHistoryBack'; import useAppLayout from '../../hooks/useAppLayout'; +import useEffectWithPrevDeps from '../../hooks/useEffectWithPrevDeps'; +import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; +import useHistoryBack from '../../hooks/useHistoryBack'; +import useKeyboardListNavigation from '../../hooks/useKeyboardListNavigation'; +import useShowTransition from '../../hooks/useShowTransition'; +import useVirtualBackdrop from '../../hooks/useVirtualBackdrop'; import Portal from './Portal'; diff --git a/src/components/ui/MenuItem.tsx b/src/components/ui/MenuItem.tsx index 3e26a0d49..86d73a1f8 100644 --- a/src/components/ui/MenuItem.tsx +++ b/src/components/ui/MenuItem.tsx @@ -6,9 +6,9 @@ import type { IconName } from '../../types/icons'; import { IS_TEST } from '../../config'; import buildClassName from '../../util/buildClassName'; -import useLastCallback from '../../hooks/useLastCallback'; -import useLang from '../../hooks/useLang'; import useAppLayout from '../../hooks/useAppLayout'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; import './MenuItem.scss'; diff --git a/src/components/ui/MenuSeparator.tsx b/src/components/ui/MenuSeparator.tsx index 2608cef4b..b178b90f3 100644 --- a/src/components/ui/MenuSeparator.tsx +++ b/src/components/ui/MenuSeparator.tsx @@ -1,6 +1,5 @@ -import React from '../../lib/teact/teact'; - import type { FC } from '../../lib/teact/teact'; +import React from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx index 70d20ca94..e750c74ce 100644 --- a/src/components/ui/Modal.tsx +++ b/src/components/ui/Modal.tsx @@ -1,20 +1,20 @@ +import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { useEffect, useRef } from '../../lib/teact/teact'; -import type { FC, TeactNode } from '../../lib/teact/teact'; import type { TextPart } from '../../types'; -import captureKeyboardListeners from '../../util/captureKeyboardListeners'; -import trapFocus from '../../util/trapFocus'; import buildClassName from '../../util/buildClassName'; -import { enableDirectTextInput, disableDirectTextInput } from '../../util/directInputManager'; -import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; +import captureKeyboardListeners from '../../util/captureKeyboardListeners'; +import { disableDirectTextInput, enableDirectTextInput } from '../../util/directInputManager'; import freezeWhenClosed from '../../util/hoc/freezeWhenClosed'; +import trapFocus from '../../util/trapFocus'; -import useLastCallback from '../../hooks/useLastCallback'; -import useShowTransition from '../../hooks/useShowTransition'; -import useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps'; -import useLang from '../../hooks/useLang'; +import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; import useHistoryBack from '../../hooks/useHistoryBack'; +import useLang from '../../hooks/useLang'; +import useLastCallback from '../../hooks/useLastCallback'; +import useLayoutEffectWithPrevDeps from '../../hooks/useLayoutEffectWithPrevDeps'; +import useShowTransition from '../../hooks/useShowTransition'; import Button from './Button'; import Portal from './Portal'; diff --git a/src/components/ui/Notification.tsx b/src/components/ui/Notification.tsx index 4796c1d8e..cf14048bd 100644 --- a/src/components/ui/Notification.tsx +++ b/src/components/ui/Notification.tsx @@ -7,16 +7,17 @@ import React, { } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import type { TextPart } from '../../types'; import type { CallbackAction } from '../../global/types'; +import type { TextPart } from '../../types'; import { ANIMATION_END_DELAY } from '../../config'; -import useShowTransition from '../../hooks/useShowTransition'; import buildClassName from '../../util/buildClassName'; import captureEscKeyListener from '../../util/captureEscKeyListener'; -import Portal from './Portal'; +import useShowTransition from '../../hooks/useShowTransition'; + import Button from './Button'; +import Portal from './Portal'; import './Notification.scss'; diff --git a/src/components/ui/OptimizedVideo.tsx b/src/components/ui/OptimizedVideo.tsx index 618151ae8..51a77b4e4 100644 --- a/src/components/ui/OptimizedVideo.tsx +++ b/src/components/ui/OptimizedVideo.tsx @@ -1,10 +1,10 @@ import React, { memo, useMemo, useRef } from '../../lib/teact/teact'; -import useLastCallback from '../../hooks/useLastCallback'; -import useVideoAutoPause from '../middle/message/hooks/useVideoAutoPause'; -import useVideoCleanup from '../../hooks/useVideoCleanup'; import useBuffering from '../../hooks/useBuffering'; +import useLastCallback from '../../hooks/useLastCallback'; import useSyncEffect from '../../hooks/useSyncEffect'; +import useVideoCleanup from '../../hooks/useVideoCleanup'; +import useVideoAutoPause from '../middle/message/hooks/useVideoAutoPause'; type VideoProps = React.DetailedHTMLProps, HTMLVideoElement>; diff --git a/src/components/ui/Portal.ts b/src/components/ui/Portal.ts index 69f8e7f31..d41fc771a 100644 --- a/src/components/ui/Portal.ts +++ b/src/components/ui/Portal.ts @@ -1,5 +1,5 @@ import type { FC, VirtualElement } from '../../lib/teact/teact'; -import { useRef, useLayoutEffect } from '../../lib/teact/teact'; +import { useLayoutEffect, useRef } from '../../lib/teact/teact'; import TeactDOM from '../../lib/teact/teact-dom'; type OwnProps = { diff --git a/src/components/ui/ProgressSpinner.tsx b/src/components/ui/ProgressSpinner.tsx index 99bb1f24f..9299b2a1a 100644 --- a/src/components/ui/ProgressSpinner.tsx +++ b/src/components/ui/ProgressSpinner.tsx @@ -1,13 +1,14 @@ import type { FC } from '../../lib/teact/teact'; import React, { memo, useEffect, useRef } from '../../lib/teact/teact'; -import { DPR } from '../../util/windowEnvironment'; +import { requestMutation } from '../../lib/fasterdom/fasterdom'; +import { animate, timingFunctions } from '../../util/animation'; import buildClassName from '../../util/buildClassName'; +import { DPR } from '../../util/windowEnvironment'; + +import { useStateRef } from '../../hooks/useStateRef'; import './ProgressSpinner.scss'; -import { animate, timingFunctions } from '../../util/animation'; -import { requestMutation } from '../../lib/fasterdom/fasterdom'; -import { useStateRef } from '../../hooks/useStateRef'; const SIZES = { s: 42, m: 48, l: 54, xl: 52, diff --git a/src/components/ui/Radio.tsx b/src/components/ui/Radio.tsx index af51ceeb4..5747beba5 100644 --- a/src/components/ui/Radio.tsx +++ b/src/components/ui/Radio.tsx @@ -3,6 +3,7 @@ import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; import Spinner from './Spinner'; diff --git a/src/components/ui/RadioGroup.tsx b/src/components/ui/RadioGroup.tsx index 0f7cd565b..d3966e8d7 100644 --- a/src/components/ui/RadioGroup.tsx +++ b/src/components/ui/RadioGroup.tsx @@ -1,6 +1,6 @@ import type { ChangeEvent } from 'react'; import type { FC, TeactNode } from '../../lib/teact/teact'; -import React, { useCallback, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback } from '../../lib/teact/teact'; import Radio from './Radio'; diff --git a/src/components/ui/RangeSlider.tsx b/src/components/ui/RangeSlider.tsx index ff239c334..eb827f615 100644 --- a/src/components/ui/RangeSlider.tsx +++ b/src/components/ui/RangeSlider.tsx @@ -1,8 +1,9 @@ import type { ChangeEvent } from 'react'; import type { FC } from '../../lib/teact/teact'; -import React, { useCallback, useMemo, memo } from '../../lib/teact/teact'; +import React, { memo, useCallback, useMemo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; + import useLang from '../../hooks/useLang'; import './RangeSlider.scss'; diff --git a/src/components/ui/RippleEffect.tsx b/src/components/ui/RippleEffect.tsx index 697981b78..970db6daa 100644 --- a/src/components/ui/RippleEffect.tsx +++ b/src/components/ui/RippleEffect.tsx @@ -1,5 +1,6 @@ import type { FC } from '../../lib/teact/teact'; -import React, { useMemo, useState, memo } from '../../lib/teact/teact'; +import React, { memo, useMemo, useState } from '../../lib/teact/teact'; + import { debounce } from '../../util/schedulers'; import useLastCallback from '../../hooks/useLastCallback'; diff --git a/src/components/ui/SearchInput.tsx b/src/components/ui/SearchInput.tsx index f0f7e0b39..018b9e27b 100644 --- a/src/components/ui/SearchInput.tsx +++ b/src/components/ui/SearchInput.tsx @@ -1,16 +1,17 @@ import type { RefObject } from 'react'; import type { FC } from '../../lib/teact/teact'; import React, { - useRef, useEffect, memo, useCallback, + memo, useCallback, useEffect, useRef, } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; -import useFlag from '../../hooks/useFlag'; -import useLang from '../../hooks/useLang'; -import useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen'; -import Loading from './Loading'; +import useFlag from '../../hooks/useFlag'; +import useInputFocusOnOpen from '../../hooks/useInputFocusOnOpen'; +import useLang from '../../hooks/useLang'; + import Button from './Button'; +import Loading from './Loading'; import Transition from './Transition'; import './SearchInput.scss'; diff --git a/src/components/ui/SelectAvatar.tsx b/src/components/ui/SelectAvatar.tsx index 3ad1d081a..1fff6fed9 100644 --- a/src/components/ui/SelectAvatar.tsx +++ b/src/components/ui/SelectAvatar.tsx @@ -1,12 +1,12 @@ import type { RefObject } from 'react'; +import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useState } from '../../lib/teact/teact'; -import type { FC } from '../../lib/teact/teact'; +import { openSystemFilesDialog } from '../../util/systemFilesDialog'; import CropModal from './CropModal'; import styles from './SelectAvatar.module.scss'; -import { openSystemFilesDialog } from '../../util/systemFilesDialog'; type OwnProps = { onChange: (file: File) => void; diff --git a/src/components/ui/ShowTransition.tsx b/src/components/ui/ShowTransition.tsx index cc1f1718a..09559e937 100644 --- a/src/components/ui/ShowTransition.tsx +++ b/src/components/ui/ShowTransition.tsx @@ -1,10 +1,11 @@ import type { FC } from '../../lib/teact/teact'; import React, { useRef } from '../../lib/teact/teact'; -import useShowTransition from '../../hooks/useShowTransition'; -import usePrevious from '../../hooks/usePrevious'; import buildClassName from '../../util/buildClassName'; +import usePrevious from '../../hooks/usePrevious'; +import useShowTransition from '../../hooks/useShowTransition'; + type OwnProps = { isOpen: boolean; isCustom?: boolean; diff --git a/src/components/ui/Tab.tsx b/src/components/ui/Tab.tsx index a9f9c1ce5..efd5a3579 100644 --- a/src/components/ui/Tab.tsx +++ b/src/components/ui/Tab.tsx @@ -1,16 +1,18 @@ import type { FC } from '../../lib/teact/teact'; import React, { useEffect, useLayoutEffect, useRef } from '../../lib/teact/teact'; -import { requestForcedReflow, requestMutation } from '../../lib/fasterdom/fasterdom'; + import type { MenuItemContextAction } from './ListItem'; -import { MouseButton } from '../../util/windowEnvironment'; -import forceReflow from '../../util/forceReflow'; +import { requestForcedReflow, requestMutation } from '../../lib/fasterdom/fasterdom'; import buildClassName from '../../util/buildClassName'; +import forceReflow from '../../util/forceReflow'; +import { MouseButton } from '../../util/windowEnvironment'; import renderText from '../common/helpers/renderText'; -import useMenuPosition from '../../hooks/useMenuPosition'; + import useContextMenuHandlers from '../../hooks/useContextMenuHandlers'; import { useFastClick } from '../../hooks/useFastClick'; import useLastCallback from '../../hooks/useLastCallback'; +import useMenuPosition from '../../hooks/useMenuPosition'; import Menu from './Menu'; import MenuItem from './MenuItem'; diff --git a/src/components/ui/TabList.tsx b/src/components/ui/TabList.tsx index 5217ff917..cfca24df0 100644 --- a/src/components/ui/TabList.tsx +++ b/src/components/ui/TabList.tsx @@ -1,15 +1,15 @@ -import React, { memo, useRef, useEffect } from '../../lib/teact/teact'; - import type { FC } from '../../lib/teact/teact'; +import React, { memo, useEffect, useRef } from '../../lib/teact/teact'; + import type { MenuItemContextAction } from './ListItem'; import { ALL_FOLDER_ID } from '../../config'; -import { IS_ANDROID, IS_IOS } from '../../util/windowEnvironment'; import animateHorizontalScroll from '../../util/animateHorizontalScroll'; +import { IS_ANDROID, IS_IOS } from '../../util/windowEnvironment'; -import usePrevious from '../../hooks/usePrevious'; import useHorizontalScroll from '../../hooks/useHorizontalScroll'; import useLang from '../../hooks/useLang'; +import usePrevious from '../../hooks/usePrevious'; import Tab from './Tab'; diff --git a/src/components/ui/TextArea.tsx b/src/components/ui/TextArea.tsx index 0efa961eb..a8f1952ee 100644 --- a/src/components/ui/TextArea.tsx +++ b/src/components/ui/TextArea.tsx @@ -1,11 +1,13 @@ import type { ChangeEvent, FormEvent, RefObject } from 'react'; -import useLang from '../../hooks/useLang'; -import buildClassName from '../../util/buildClassName'; import type { FC } from '../../lib/teact/teact'; import React, { memo, useCallback, useEffect, useRef, } from '../../lib/teact/teact'; +import buildClassName from '../../util/buildClassName'; + +import useLang from '../../hooks/useLang'; + type OwnProps = { ref?: RefObject; id?: string; diff --git a/src/components/ui/TextTimer.tsx b/src/components/ui/TextTimer.tsx index ee7378b48..05d42491e 100644 --- a/src/components/ui/TextTimer.tsx +++ b/src/components/ui/TextTimer.tsx @@ -1,11 +1,11 @@ import React, { type FC, memo, useEffect } from '../../lib/teact/teact'; -import { getServerTime } from '../../util/serverTime'; import { formatMediaDuration } from '../../util/dateFormat'; +import { getServerTime } from '../../util/serverTime'; import useForceUpdate from '../../hooks/useForceUpdate'; -import useLang from '../../hooks/useLang'; import useInterval from '../../hooks/useInterval'; +import useLang from '../../hooks/useLang'; type OwnProps = { langKey: string; diff --git a/src/components/ui/Transition.tsx b/src/components/ui/Transition.tsx index 2ae70ece5..58941e002 100644 --- a/src/components/ui/Transition.tsx +++ b/src/components/ui/Transition.tsx @@ -3,16 +3,16 @@ import React, { useEffect, useLayoutEffect, useRef } from '../../lib/teact/teact import { addExtraClass, removeExtraClass, setExtraStyles, toggleExtraClass, } from '../../lib/teact/teact-dom'; -import { requestForcedReflow, requestMutation } from '../../lib/fasterdom/fasterdom'; - import { getGlobal } from '../../global'; -import buildClassName from '../../util/buildClassName'; -import forceReflow from '../../util/forceReflow'; -import { waitForAnimationEnd, waitForTransitionEnd } from '../../util/cssAnimationEndListeners'; -import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; +import { requestForcedReflow, requestMutation } from '../../lib/fasterdom/fasterdom'; import { selectCanAnimateInterface } from '../../global/selectors'; +import buildClassName from '../../util/buildClassName'; +import { waitForAnimationEnd, waitForTransitionEnd } from '../../util/cssAnimationEndListeners'; +import forceReflow from '../../util/forceReflow'; + import useForceUpdate from '../../hooks/useForceUpdate'; +import { dispatchHeavyAnimationEvent } from '../../hooks/useHeavyAnimationCheck'; import usePrevious from '../../hooks/usePrevious'; import './Transition.scss'; diff --git a/src/components/ui/placeholder/Skeleton.tsx b/src/components/ui/placeholder/Skeleton.tsx index 25f5dd9cf..4589e5d3d 100644 --- a/src/components/ui/placeholder/Skeleton.tsx +++ b/src/components/ui/placeholder/Skeleton.tsx @@ -1,6 +1,5 @@ -import React from '../../../lib/teact/teact'; - import type { FC } from '../../../lib/teact/teact'; +import React from '../../../lib/teact/teact'; import buildClassName from '../../../util/buildClassName'; import buildStyle from '../../../util/buildStyle'; diff --git a/src/electron/autoUpdates.ts b/src/electron/autoUpdates.ts index 85dc3b3a8..8489c76a0 100644 --- a/src/electron/autoUpdates.ts +++ b/src/electron/autoUpdates.ts @@ -1,11 +1,12 @@ -import { ipcMain } from 'electron'; import type { BrowserWindow } from 'electron'; +import { ipcMain } from 'electron'; import type { UpdateInfo } from 'electron-updater'; import { autoUpdater } from 'electron-updater'; -import { ElectronAction, ElectronEvent } from '../types/electron'; -import { IS_MAC_OS, forceQuit, windows } from './utils'; import type { WindowState } from './windowState'; +import { ElectronAction, ElectronEvent } from '../types/electron'; + +import { forceQuit, IS_MAC_OS, windows } from './utils'; let interval: NodeJS.Timer; const CHECK_UPDATE_INTERVAL = 5 * 60 * 1000; diff --git a/src/electron/main.ts b/src/electron/main.ts index babf27778..51e446123 100644 --- a/src/electron/main.ts +++ b/src/electron/main.ts @@ -5,8 +5,8 @@ import contextMenu from 'electron-context-menu'; import path from 'path'; import { initDeeplink } from './deeplink'; -import { createWindow, setupCloseHandlers, setupElectronActionHandlers } from './window'; import { IS_MAC_OS, IS_WINDOWS } from './utils'; +import { createWindow, setupCloseHandlers, setupElectronActionHandlers } from './window'; initDeeplink(); diff --git a/src/electron/preload.ts b/src/electron/preload.ts index 3c74bbaba..db1fde6fa 100644 --- a/src/electron/preload.ts +++ b/src/electron/preload.ts @@ -1,6 +1,6 @@ +import type { IpcRendererEvent } from 'electron'; import { contextBridge, ipcRenderer } from 'electron'; -import type { IpcRendererEvent } from 'electron'; import type { ElectronApi, ElectronEvent, TrafficLightPosition } from '../types/electron'; import { ElectronAction } from '../types/electron'; diff --git a/src/electron/utils.ts b/src/electron/utils.ts index 469522cdc..d26add0bf 100644 --- a/src/electron/utils.ts +++ b/src/electron/utils.ts @@ -1,5 +1,5 @@ -import { app } from 'electron'; import type { BrowserWindow, Point } from 'electron'; +import { app } from 'electron'; import type { TrafficLightPosition } from '../types/electron'; diff --git a/src/electron/window.ts b/src/electron/window.ts index d7cedf3db..49f979b7f 100644 --- a/src/electron/window.ts +++ b/src/electron/window.ts @@ -1,11 +1,12 @@ +import type { HandlerDetails } from 'electron'; import { app, BrowserWindow, ipcMain, shell, systemPreferences, } from 'electron'; -import type { HandlerDetails } from 'electron'; import path from 'path'; -import { ElectronAction, ElectronEvent } from '../types/electron'; import type { TrafficLightPosition } from '../types/electron'; +import { ElectronAction, ElectronEvent } from '../types/electron'; + import setupAutoUpdates from './autoUpdates'; import { processDeeplink } from './deeplink'; import { diff --git a/src/electron/windowState.ts b/src/electron/windowState.ts index 3bc56f3ca..15cd48e59 100644 --- a/src/electron/windowState.ts +++ b/src/electron/windowState.ts @@ -1,5 +1,4 @@ import type { BrowserWindow, Rectangle } from 'electron'; - import { screen } from 'electron'; import Store from 'electron-store'; diff --git a/src/global/actions/all.ts b/src/global/actions/all.ts index 83a5f755b..eaf9c5f6a 100644 --- a/src/global/actions/all.ts +++ b/src/global/actions/all.ts @@ -15,7 +15,6 @@ import './api/payments'; import './api/reactions'; import './api/statistics'; import './api/stories'; - import './ui/initial'; import './ui/chats'; import './ui/messages'; @@ -31,7 +30,6 @@ import './ui/mediaViewer'; import './ui/passcode'; import './ui/reactions'; import './ui/stories'; - import './apiUpdaters/initial'; import './apiUpdaters/chats'; import './apiUpdaters/messages'; diff --git a/src/global/actions/api/accounts.ts b/src/global/actions/api/accounts.ts index 2107a6138..a73ebaadf 100644 --- a/src/global/actions/api/accounts.ts +++ b/src/global/actions/api/accounts.ts @@ -1,10 +1,10 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { selectChat } from '../../selectors'; -import { callApi } from '../../../api/gramjs'; -import { translate } from '../../../util/langProvider'; -import { addUsers } from '../../reducers'; -import { buildCollectionByKey } from '../../../util/iteratees'; import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { translate } from '../../../util/langProvider'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { addUsers } from '../../reducers'; +import { selectChat } from '../../selectors'; addActionHandler('reportPeer', async (global, actions, payload): Promise => { const { diff --git a/src/global/actions/api/bots.ts b/src/global/actions/api/bots.ts index 8896e7a60..3f62f28e2 100644 --- a/src/global/actions/api/bots.ts +++ b/src/global/actions/api/bots.ts @@ -1,30 +1,29 @@ -import type { RequiredGlobalActions } from '../../index'; -import { - addActionHandler, getGlobal, setGlobal, -} from '../../index'; - -import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; import type { ApiChat, ApiChatType, ApiContact, ApiUrlAuthResult, ApiUser, } from '../../../api/types'; import type { InlineBotSettings } from '../../../types'; - +import type { RequiredGlobalActions } from '../../index'; +import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; import { MAIN_THREAD_ID } from '../../../api/types'; -import { callApi } from '../../../api/gramjs'; -import { - selectChat, selectChatMessage, selectCurrentChat, selectCurrentMessageList, selectTabState, selectBot, - selectIsTrustedBot, selectReplyingToId, selectSendAs, selectUser, selectThreadTopMessageId, selectUserFullInfo, -} from '../../selectors'; -import { addChats, addUsers, removeBlockedUser } from '../../reducers'; + +import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { buildCollectionByKey } from '../../../util/iteratees'; +import { translate } from '../../../util/langProvider'; +import PopupManager from '../../../util/PopupManager'; import { debounce } from '../../../util/schedulers'; -import { replaceInlineBotSettings, replaceInlineBotsIsLoading } from '../../reducers/bots'; import { getServerTime } from '../../../util/serverTime'; import { extractCurrentThemeParams } from '../../../util/themeStyle'; -import PopupManager from '../../../util/PopupManager'; +import { callApi } from '../../../api/gramjs'; +import { + addActionHandler, getGlobal, setGlobal, +} from '../../index'; +import { addChats, addUsers, removeBlockedUser } from '../../reducers'; +import { replaceInlineBotSettings, replaceInlineBotsIsLoading } from '../../reducers/bots'; import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { translate } from '../../../util/langProvider'; +import { + selectBot, selectChat, selectChatMessage, selectCurrentChat, selectCurrentMessageList, selectIsTrustedBot, + selectReplyingToId, selectSendAs, selectTabState, selectThreadTopMessageId, selectUser, selectUserFullInfo, +} from '../../selectors'; const GAMEE_URL = 'https://prizes.gamee.com/'; const TOP_PEERS_REQUEST_COOLDOWN = 60; // 1 min diff --git a/src/global/actions/api/calls.async.ts b/src/global/actions/api/calls.async.ts index 2ad924d62..f4a9a8f47 100644 --- a/src/global/actions/api/calls.async.ts +++ b/src/global/actions/api/calls.async.ts @@ -1,31 +1,30 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { - joinGroupCall, - startSharingScreen, - leaveGroupCall, - toggleStream, - isStreamEnabled, - setVolume, stopPhoneCall, -} from '../../../lib/secret-sauce'; - import type { ActionReturnType } from '../../types'; import { GROUP_CALL_VOLUME_MULTIPLIER } from '../../../config'; -import { callApi } from '../../../api/gramjs'; -import { selectChat, selectTabState, selectUser } from '../../selectors'; import { - selectActiveGroupCall, selectPhoneCallUser, -} from '../../selectors/calls'; + isStreamEnabled, + joinGroupCall, + leaveGroupCall, + setVolume, startSharingScreen, + stopPhoneCall, + toggleStream, +} from '../../../lib/secret-sauce'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { addUsers } from '../../reducers'; import { removeGroupCall, updateActiveGroupCall, } from '../../reducers/calls'; +import { updateTabState } from '../../reducers/tabs'; +import { selectChat, selectTabState, selectUser } from '../../selectors'; +import { + selectActiveGroupCall, selectPhoneCallUser, +} from '../../selectors/calls'; import { getGroupCallAudioContext, getGroupCallAudioElement, removeGroupCallAudioElement } from '../ui/calls'; import { loadFullChat } from './chats'; -import { addUsers } from '../../reducers'; -import { buildCollectionByKey } from '../../../util/iteratees'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; const HANG_UP_UI_DELAY = 500; diff --git a/src/global/actions/api/chats.ts b/src/global/actions/api/chats.ts index 3372dc8c5..3edaebf60 100644 --- a/src/global/actions/api/chats.ts +++ b/src/global/actions/api/chats.ts @@ -1,11 +1,11 @@ -import type { RequiredGlobalActions } from '../../index'; -import { - addActionHandler, getGlobal, setGlobal, -} from '../../index'; - import type { - ApiChat, ApiUser, ApiError, ApiChatMember, ApiChatFolder, ApiChatlistExportedInvite, + ApiChat, ApiChatFolder, ApiChatlistExportedInvite, + ApiChatMember, ApiError, ApiUser, } from '../../../api/types'; +import type { RequiredGlobalActions } from '../../index'; +import type { + ActionReturnType, GlobalState, TabArgs, +} from '../../types'; import { MAIN_THREAD_ID } from '../../../api/types'; import { ChatCreationProgress, @@ -13,78 +13,80 @@ import { NewChatMembersProgress, SettingsScreens, } from '../../../types'; -import type { - GlobalState, ActionReturnType, TabArgs, -} from '../../types'; import { + ALL_FOLDER_ID, ARCHIVED_FOLDER_ID, - TOP_CHAT_MESSAGES_PRELOAD_LIMIT, CHAT_LIST_LOAD_SLICE, + DEBUG, RE_TG_LINK, SERVICE_NOTIFICATIONS_USER_ID, + TME_WEB_DOMAINS, TMP_CHAT_ID, - ALL_FOLDER_ID, - DEBUG, + TOP_CHAT_MESSAGES_PRELOAD_LIMIT, TOPICS_SLICE, TOPICS_SLICE_SECOND_LOAD, - TME_WEB_DOMAINS, } from '../../../config'; +import { formatShareText, parseChooseParameter, processDeepLink } from '../../../util/deeplink'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { getOrderedIds } from '../../../util/folderManager'; +import { buildCollectionByKey, omit } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; +import { debounce, pause, throttle } from '../../../util/schedulers'; +import { extractCurrentThemeParams } from '../../../util/themeStyle'; import { callApi } from '../../../api/gramjs'; import { - addChats, - addUsers, - addUserStatuses, - replaceThreadParam, - updateChatListIds, - updateChats, - updateChat, - updateChatListSecondaryInfo, - updateManagementProgress, - leaveChat, - replaceUsers, - replaceUserStatuses, - replaceChats, - replaceChatListIds, - addChatMembers, - updateUser, - addMessages, - updateTopics, - deleteTopic, - updateTopic, - updateThreadInfo, - updateListedTopicIds, - updateChatFullInfo, - replaceChatFullInfo, - updateUserFullInfo, -} from '../../reducers'; -import { - selectChat, selectUser, selectChatListType, selectIsChatPinned, - selectChatFolder, selectSupportChat, selectChatByUsername, - selectCurrentMessageList, selectThreadInfo, selectCurrentChat, selectLastServiceNotification, - selectVisibleUsers, selectUserByPhoneNumber, selectDraft, selectThreadTopMessageId, - selectTabState, selectThreadOriginChat, selectThread, selectChatFullInfo, selectStickerSet, -} from '../../selectors'; -import { buildCollectionByKey, omit } from '../../../util/iteratees'; -import { debounce, pause, throttle } from '../../../util/schedulers'; -import { - isChatSummaryOnly, isChatArchived, isChatBasicGroup, isChatChannel, + isChatSummaryOnly, isChatSuperGroup, isUserBot, isUserId, } from '../../helpers'; -import { formatShareText, parseChooseParameter, processDeepLink } from '../../../util/deeplink'; +import { + addActionHandler, getGlobal, setGlobal, +} from '../../index'; +import { + addChatMembers, + addChats, + addMessages, + addUsers, + addUserStatuses, + deleteTopic, + leaveChat, + replaceChatFullInfo, + replaceChatListIds, + replaceChats, + replaceThreadParam, + replaceUsers, + replaceUserStatuses, + updateChat, + updateChatFullInfo, + updateChatListIds, + updateChatListSecondaryInfo, + updateChats, + updateListedTopicIds, + updateManagementProgress, + updateThreadInfo, + updateTopic, + updateTopics, + updateUser, + updateUserFullInfo, +} from '../../reducers'; import { updateGroupCall } from '../../reducers/calls'; -import { selectGroupCall } from '../../selectors/calls'; -import { getOrderedIds } from '../../../util/folderManager'; -import * as langProvider from '../../../util/langProvider'; -import { selectCurrentLimit } from '../../selectors/limits'; import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { extractCurrentThemeParams } from '../../../util/themeStyle'; +import { + selectChat, selectChatByUsername, + selectChatFolder, selectChatFullInfo, selectChatListType, selectCurrentChat, selectCurrentMessageList, selectDraft, + selectIsChatPinned, + selectLastServiceNotification, + selectStickerSet, + selectSupportChat, selectTabState, selectThread, selectThreadInfo, selectThreadOriginChat, selectThreadTopMessageId, + selectUser, selectUserByPhoneNumber, selectVisibleUsers, +} from '../../selectors'; +import { selectGroupCall } from '../../selectors/calls'; +import { selectCurrentLimit } from '../../selectors/limits'; const TOP_CHAT_MESSAGES_PRELOAD_INTERVAL = 100; const INFINITE_LOOP_MARKER = 100; diff --git a/src/global/actions/api/globalSearch.ts b/src/global/actions/api/globalSearch.ts index 122783682..feeafaa4d 100644 --- a/src/global/actions/api/globalSearch.ts +++ b/src/global/actions/api/globalSearch.ts @@ -1,26 +1,25 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - -import { callApi } from '../../../api/gramjs'; import type { - ApiChat, ApiTopic, ApiGlobalMessageSearchType, ApiMessage, ApiUser, + ApiChat, ApiGlobalMessageSearchType, ApiMessage, ApiTopic, ApiUser, } from '../../../api/types'; +import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; +import { GLOBAL_SEARCH_SLICE, GLOBAL_TOPIC_SEARCH_SLICE } from '../../../config'; +import { timestampPlusDay } from '../../../util/dateFormat'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { throttle } from '../../../util/schedulers'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { addChats, addMessages, addUsers, - updateTopics, updateGlobalSearch, updateGlobalSearchFetchingStatus, updateGlobalSearchResults, + updateTopics, } from '../../reducers'; -import { throttle } from '../../../util/schedulers'; import { selectChat, selectCurrentGlobalSearchQuery, selectTabState } from '../../selectors'; -import { buildCollectionByKey } from '../../../util/iteratees'; -import { GLOBAL_SEARCH_SLICE, GLOBAL_TOPIC_SEARCH_SLICE } from '../../../config'; -import { timestampPlusDay } from '../../../util/dateFormat'; -import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; const searchThrottled = throttle((cb) => cb(), 500, false); diff --git a/src/global/actions/api/initial.ts b/src/global/actions/api/initial.ts index b5a82b72d..e48d88137 100644 --- a/src/global/actions/api/initial.ts +++ b/src/global/actions/api/initial.ts @@ -1,41 +1,40 @@ -import { - addActionHandler, getGlobal, setGlobal, -} from '../../index'; +import type { ActionReturnType } from '../../types'; import { - initApi, callApi, callApiLocal, setShouldEnableDebugLog, -} from '../../../api/gramjs'; - -import { - LANG_CACHE_NAME, CUSTOM_BG_CACHE_NAME, + IS_TEST, + LANG_CACHE_NAME, + LOCK_SCREEN_ANIMATION_DURATION_MS, MEDIA_CACHE_NAME, MEDIA_CACHE_NAME_AVATARS, MEDIA_PROGRESSIVE_CACHE_NAME, - IS_TEST, - LOCK_SCREEN_ANIMATION_DURATION_MS, } from '../../../config'; +import { updateAppBadge } from '../../../util/appBadge'; +import * as cacheApi from '../../../util/cacheApi'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { unsubscribe } from '../../../util/notifications'; +import { clearEncryptedSession, encryptSession, forgetPasscode } from '../../../util/passcode'; +import { parseInitialLocationHash, resetInitialLocationHash } from '../../../util/routing'; +import { + clearLegacySessions, + clearStoredSession, + importLegacySession, + loadStoredSession, + storeSession, +} from '../../../util/sessions'; +import { forceWebsync } from '../../../util/websync'; import { IS_WEBM_SUPPORTED, MAX_BUFFER_SIZE, PLATFORM_ENV, } from '../../../util/windowEnvironment'; -import { unsubscribe } from '../../../util/notifications'; -import * as cacheApi from '../../../util/cacheApi'; -import { updateAppBadge } from '../../../util/appBadge'; import { - storeSession, - loadStoredSession, - clearStoredSession, - importLegacySession, - clearLegacySessions, -} from '../../../util/sessions'; -import { forceWebsync } from '../../../util/websync'; -import { addUsers, clearGlobalForLockScreen, updatePasscodeSettings } from '../../reducers'; -import { clearEncryptedSession, encryptSession, forgetPasscode } from '../../../util/passcode'; + callApi, callApiLocal, initApi, setShouldEnableDebugLog, +} from '../../../api/gramjs'; import { serializeGlobal } from '../../cache'; -import { parseInitialLocationHash, resetInitialLocationHash } from '../../../util/routing'; -import type { ActionReturnType } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { buildCollectionByKey } from '../../../util/iteratees'; +import { + addActionHandler, getGlobal, setGlobal, +} from '../../index'; +import { addUsers, clearGlobalForLockScreen, updatePasscodeSettings } from '../../reducers'; addActionHandler('initApi', async (global, actions): Promise => { if (!IS_TEST) { diff --git a/src/global/actions/api/localSearch.ts b/src/global/actions/api/localSearch.ts index 155864f8e..fdfc95da2 100644 --- a/src/global/actions/api/localSearch.ts +++ b/src/global/actions/api/localSearch.ts @@ -1,19 +1,14 @@ +import type { SharedMediaType } from '../../../types'; +import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; +import { type ApiChat, MAIN_THREAD_ID } from '../../../api/types'; + +import { MESSAGE_SEARCH_SLICE, SHARED_MEDIA_SLICE } from '../../../config'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { callApi } from '../../../api/gramjs'; import { addActionHandler, getGlobal, setGlobal, } from '../../index'; - -import { MAIN_THREAD_ID, type ApiChat } from '../../../api/types'; - -import { MESSAGE_SEARCH_SLICE, SHARED_MEDIA_SLICE } from '../../../config'; -import { callApi } from '../../../api/gramjs'; -import { - selectCurrentTextSearch, - selectCurrentMediaSearch, - selectCurrentMessageList, - selectChat, - selectThreadInfo, -} from '../../selectors'; -import { buildCollectionByKey } from '../../../util/iteratees'; import { addChatMessagesById, addChats, @@ -21,9 +16,13 @@ import { updateLocalMediaSearchResults, updateLocalTextSearchResults, } from '../../reducers'; -import type { SharedMediaType } from '../../../types'; -import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { + selectChat, + selectCurrentMediaSearch, + selectCurrentMessageList, + selectCurrentTextSearch, + selectThreadInfo, +} from '../../selectors'; addActionHandler('searchTextMessagesLocal', async (global, actions, payload): Promise => { const { tabId = getCurrentTabId() } = payload || {}; diff --git a/src/global/actions/api/management.ts b/src/global/actions/api/management.ts index d9bd84816..367f3e2e4 100644 --- a/src/global/actions/api/management.ts +++ b/src/global/actions/api/management.ts @@ -1,9 +1,12 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - -import { ManagementProgress } from '../../../types'; import type { ActionReturnType } from '../../types'; +import { ManagementProgress } from '../../../types'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; import { callApi } from '../../../api/gramjs'; +import { getUserFirstOrLastName } from '../../helpers'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { addUsers, updateChat, updateChatFullInfo, updateManagement, updateManagementProgress, } from '../../reducers'; @@ -11,10 +14,6 @@ import { selectChat, selectCurrentMessageList, selectTabState, selectUser, } from '../../selectors'; import { ensureIsSuperGroup } from './chats'; -import { getUserFirstOrLastName } from '../../helpers'; -import { buildCollectionByKey } from '../../../util/iteratees'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import * as langProvider from '../../../util/langProvider'; addActionHandler('checkPublicLink', async (global, actions, payload): Promise => { const { username, tabId = getCurrentTabId() } = payload; diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index 38ab8e2e4..11bbda551 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -1,25 +1,21 @@ -import type { RequiredGlobalActions } from '../../index'; -import { - addActionHandler, getActions, getGlobal, setGlobal, -} from '../../index'; - -import type { - ActionReturnType, GlobalState, TabArgs, -} from '../../types'; import type { ApiAttachment, ApiChat, ApiMessage, ApiMessageEntity, - ApiTypeReplyTo, ApiNewPoll, ApiOnProgress, ApiSticker, ApiStory, ApiStorySkipped, + ApiTypeReplyTo, ApiUser, ApiVideo, } from '../../../api/types'; +import type { RequiredGlobalActions } from '../../index'; +import type { + ActionReturnType, GlobalState, TabArgs, +} from '../../types'; import { MAIN_THREAD_ID, MESSAGE_DELETED } from '../../../api/types'; import { LoadMoreDirection } from '../../../types'; @@ -35,11 +31,25 @@ import { SUPPORTED_IMAGE_CONTENT_TYPES, SUPPORTED_VIDEO_CONTENT_TYPES, } from '../../../config'; -import { IS_IOS } from '../../../util/windowEnvironment'; -import { callApi, cancelApiProgress } from '../../../api/gramjs'; +import { ensureProtocol } from '../../../util/ensureProtocol'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { areSortedArraysIntersecting, buildCollectionByKey, omit, split, unique, } from '../../../util/iteratees'; +import { translate } from '../../../util/langProvider'; +import { debounce, onTickEnd, rafPromise } from '../../../util/schedulers'; +import { IS_IOS } from '../../../util/windowEnvironment'; +import { callApi, cancelApiProgress } from '../../../api/gramjs'; +import { + getMessageOriginalId, + getUserFullName, isChatChannel, + isDeletedUser, isMessageLocal, + isServiceNotificationMessage, + isUserBot, +} from '../../helpers'; +import { + addActionHandler, getActions, getGlobal, setGlobal, +} from '../../index'; import { addChatMessagesById, addChats, @@ -64,10 +74,10 @@ import { updateThreadUnreadFromForwardedMessage, updateTopic, } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; import { selectChat, selectChatMessage, - selectTranslationLanguage, selectCurrentChat, selectCurrentMessageList, selectCurrentViewedStory, @@ -95,23 +105,12 @@ import { selectThreadIdFromMessage, selectThreadOriginChat, selectThreadTopMessageId, + selectTranslationLanguage, selectUser, selectUserFullInfo, selectUserStory, selectViewportIds, } from '../../selectors'; -import { debounce, onTickEnd, rafPromise } from '../../../util/schedulers'; -import { - getMessageOriginalId, - getUserFullName, isChatChannel, - isDeletedUser, isMessageLocal, - isServiceNotificationMessage, - isUserBot, -} from '../../helpers'; -import { translate } from '../../../util/langProvider'; -import { ensureProtocol } from '../../../util/ensureProtocol'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { deleteMessages } from '../apiUpdaters/messages'; const AUTOLOGIN_TOKEN_KEY = 'autologin_token'; diff --git a/src/global/actions/api/payments.ts b/src/global/actions/api/payments.ts index e5afa4e5c..f105ca756 100644 --- a/src/global/actions/api/payments.ts +++ b/src/global/actions/api/payments.ts @@ -1,38 +1,37 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { callApi } from '../../../api/gramjs'; - -import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; import type { ApiInvoice, ApiRequestInputInvoice } from '../../../api/types'; +import type { ApiCredentials } from '../../../components/payment/PaymentModal'; +import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; import { PaymentStep } from '../../../types'; import { DEBUG_PAYMENT_SMART_GLOCAL } from '../../../config'; -import { - selectPaymentRequestId, - selectProviderPublishableKey, - selectStripeCredentials, - selectChatMessage, - selectChat, - selectPaymentFormId, - selectProviderPublicToken, - selectSmartGlocalCredentials, - selectPaymentInputInvoice, selectTabState, -} from '../../selectors'; -import { getStripeError } from '../../helpers'; -import { buildQueryString } from '../../../util/requestQuery'; -import { - updateShippingOptions, - setPaymentStep, - setRequestInfoId, - setPaymentForm, - setStripeCardInfo, - setReceipt, - closeInvoice, - setSmartGlocalCardInfo, addUsers, setInvoiceInfo, updatePayment, -} from '../../reducers'; -import { buildCollectionByKey } from '../../../util/iteratees'; -import { updateTabState } from '../../reducers/tabs'; import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import type { ApiCredentials } from '../../../components/payment/PaymentModal'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { buildQueryString } from '../../../util/requestQuery'; +import { callApi } from '../../../api/gramjs'; +import { getStripeError } from '../../helpers'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { + addUsers, closeInvoice, + setInvoiceInfo, setPaymentForm, + setPaymentStep, + setReceipt, + setRequestInfoId, + setSmartGlocalCardInfo, setStripeCardInfo, + updatePayment, + updateShippingOptions, +} from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; +import { + selectChat, + selectChatMessage, + selectPaymentFormId, + selectPaymentInputInvoice, selectPaymentRequestId, + selectProviderPublicToken, + selectProviderPublishableKey, + selectSmartGlocalCredentials, + selectStripeCredentials, + selectTabState, +} from '../../selectors'; addActionHandler('validateRequestedInfo', (global, actions, payload): ActionReturnType => { const { requestInfo, saveInfo, tabId = getCurrentTabId() } = payload; diff --git a/src/global/actions/api/reactions.ts b/src/global/actions/api/reactions.ts index dc80325e0..00b6dd81e 100644 --- a/src/global/actions/api/reactions.ts +++ b/src/global/actions/api/reactions.ts @@ -1,9 +1,20 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { callApi } from '../../../api/gramjs'; - import type { ActionReturnType } from '../../types'; import { ApiMediaFormat } from '../../../api/types'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey, omit } from '../../../util/iteratees'; +import * as mediaLoader from '../../../util/mediaLoader'; +import { callApi } from '../../../api/gramjs'; +import { + getDocumentMediaHash, + getUserReactions, isMessageLocal, isSameReaction, +} from '../../helpers'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { + addChatMessagesById, addChats, addUsers, updateChatMessage, +} from '../../reducers'; +import { addMessageReaction, subtractXForEmojiInteraction, updateUnreadReactions } from '../../reducers/reactions'; +import { updateTabState } from '../../reducers/tabs'; import { selectChat, selectChatMessage, @@ -14,17 +25,6 @@ import { selectPerformanceSettingsValue, selectTabState, } from '../../selectors'; -import { addMessageReaction, subtractXForEmojiInteraction, updateUnreadReactions } from '../../reducers/reactions'; -import { - addChatMessagesById, addChats, addUsers, updateChatMessage, -} from '../../reducers'; -import { updateTabState } from '../../reducers/tabs'; -import * as mediaLoader from '../../../util/mediaLoader'; -import { buildCollectionByKey, omit } from '../../../util/iteratees'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { - isSameReaction, getUserReactions, isMessageLocal, getDocumentMediaHash, -} from '../../helpers'; const INTERACTION_RANDOM_OFFSET = 40; diff --git a/src/global/actions/api/settings.ts b/src/global/actions/api/settings.ts index ee30e0178..022cb8309 100644 --- a/src/global/actions/api/settings.ts +++ b/src/global/actions/api/settings.ts @@ -1,32 +1,32 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - -import type { ActionReturnType, GlobalState } from '../../types'; -import type { - PrivacyVisibility, InputPrivacyRules, InputPrivacyContact, ApiPrivacySettings, -} from '../../../types'; import type { ApiUser, ApiUsername } from '../../../api/types'; +import type { + ApiPrivacySettings, + InputPrivacyContact, InputPrivacyRules, PrivacyVisibility, +} from '../../../types'; +import type { ActionReturnType, GlobalState } from '../../types'; import { ProfileEditProgress, UPLOADING_WALLPAPER_SLUG, } from '../../../types'; import { APP_CONFIG_REFETCH_INTERVAL, COUNTRIES_WITH_12H_TIME_FORMAT } from '../../../config'; -import { callApi } from '../../../api/gramjs'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { buildCollectionByKey } from '../../../util/iteratees'; -import { subscribe, unsubscribe, requestPermission } from '../../../util/notifications'; import { setTimeFormat } from '../../../util/langProvider'; +import { requestPermission, subscribe, unsubscribe } from '../../../util/notifications'; import requestActionTimeout from '../../../util/requestActionTimeout'; import { getServerTime } from '../../../util/serverTime'; -import { - selectChat, selectUser, selectTabState, selectUserFullInfo, -} from '../../selectors'; -import { - addUsers, addBlockedUser, updateChats, updateUser, removeBlockedUser, replaceSettings, updateNotifySettings, - addNotifyExceptions, updateChat, updateUserFullInfo, -} from '../../reducers'; +import { callApi } from '../../../api/gramjs'; import { isUserId } from '../../helpers'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { + addBlockedUser, addNotifyExceptions, addUsers, removeBlockedUser, replaceSettings, updateChat, updateChats, + updateNotifySettings, updateUser, updateUserFullInfo, +} from '../../reducers'; import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { + selectChat, selectTabState, selectUser, selectUserFullInfo, +} from '../../selectors'; addActionHandler('updateProfile', async (global, actions, payload): Promise => { const { diff --git a/src/global/actions/api/statistics.ts b/src/global/actions/api/statistics.ts index 2f37de122..00fc7905d 100644 --- a/src/global/actions/api/statistics.ts +++ b/src/global/actions/api/statistics.ts @@ -1,12 +1,12 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - -import { callApi } from '../../../api/gramjs'; -import { - updateStatistics, updateMessageStatistics, updateStatisticsGraph, addUsers, -} from '../../reducers'; -import { selectChatMessages, selectChat, selectChatFullInfo } from '../../selectors'; -import { buildCollectionByKey } from '../../../util/iteratees'; import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { + addUsers, + updateMessageStatistics, updateStatistics, updateStatisticsGraph, +} from '../../reducers'; +import { selectChat, selectChatFullInfo, selectChatMessages } from '../../selectors'; addActionHandler('loadStatistics', async (global, actions, payload): Promise => { const { chatId, isGroup, tabId = getCurrentTabId() } = payload; diff --git a/src/global/actions/api/stories.ts b/src/global/actions/api/stories.ts index 2cb9032e4..d32db6c72 100644 --- a/src/global/actions/api/stories.ts +++ b/src/global/actions/api/stories.ts @@ -1,9 +1,12 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { callApi } from '../../../api/gramjs'; - import type { ActionReturnType } from '../../types'; import { DEBUG, PREVIEW_AVATAR_COUNT } from '../../../config'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { translate } from '../../../util/langProvider'; +import { getServerTime } from '../../../util/serverTime'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { addStories, addStoriesForUser, @@ -20,13 +23,9 @@ import { updateUserStory, updateUsersWithStories, } from '../../reducers'; -import { buildCollectionByKey } from '../../../util/iteratees'; import { selectUser, selectUserStories, selectUserStory, } from '../../selectors'; -import { getServerTime } from '../../../util/serverTime'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { translate } from '../../../util/langProvider'; const INFINITE_LOOP_MARKER = 100; diff --git a/src/global/actions/api/symbols.ts b/src/global/actions/api/symbols.ts index 90bdc7517..94fd44119 100644 --- a/src/global/actions/api/symbols.ts +++ b/src/global/actions/api/symbols.ts @@ -1,35 +1,35 @@ +import type { + ApiError, ApiSticker, ApiStickerSet, ApiStickerSetInfo, +} from '../../../api/types'; import type { RequiredGlobalActions } from '../../index'; +import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; + +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey } from '../../../util/iteratees'; +import { translate } from '../../../util/langProvider'; +import * as langProvider from '../../../util/langProvider'; +import { pause, throttle } from '../../../util/schedulers'; +import searchWords from '../../../util/searchWords'; +import { callApi } from '../../../api/gramjs'; import { addActionHandler, getGlobal, setGlobal, } from '../../index'; - -import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; -import type { - ApiError, ApiSticker, ApiStickerSet, ApiStickerSetInfo, -} from '../../../api/types'; -import { callApi } from '../../../api/gramjs'; -import { pause, throttle } from '../../../util/schedulers'; import { - updateStickerSets, - updateStickerSet, - replaceAnimatedEmojis, - updateGifSearch, - updateStickersForEmoji, rebuildStickersForEmoji, + replaceAnimatedEmojis, updateCustomEmojiForEmoji, updateCustomEmojiSets, + updateGifSearch, updateRecentStatusCustomEmojis, updateStickerSearch, + updateStickerSet, + updateStickerSets, + updateStickersForEmoji, } from '../../reducers'; -import searchWords from '../../../util/searchWords'; -import { selectTabState, selectIsCurrentUserPremium, selectStickerSet } from '../../selectors'; -import { translate } from '../../../util/langProvider'; -import { selectCurrentLimit, selectPremiumLimit } from '../../selectors/limits'; -import * as langProvider from '../../../util/langProvider'; -import { buildCollectionByKey } from '../../../util/iteratees'; import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { selectIsCurrentUserPremium, selectStickerSet, selectTabState } from '../../selectors'; +import { selectCurrentLimit, selectPremiumLimit } from '../../selectors/limits'; const ADDED_SETS_THROTTLE = 200; const ADDED_SETS_THROTTLE_CHUNK = 10; diff --git a/src/global/actions/api/sync.ts b/src/global/actions/api/sync.ts index 43da30f20..f099518f5 100644 --- a/src/global/actions/api/sync.ts +++ b/src/global/actions/api/sync.ts @@ -1,16 +1,17 @@ -import type { RequiredGlobalActions } from '../../index'; -import { - addActionHandler, getActions, getGlobal, setGlobal, -} from '../../index'; import { addCallback } from '../../../lib/teact/teactn'; import type { ApiChat, ApiMessage } from '../../../api/types'; -import { MAIN_THREAD_ID } from '../../../api/types'; +import type { RequiredGlobalActions } from '../../index'; import type { ActionReturnType, GlobalState, Thread } from '../../types'; +import { MAIN_THREAD_ID } from '../../../api/types'; import { DEBUG, MESSAGE_LIST_SLICE, SERVICE_NOTIFICATIONS_USER_ID } from '../../../config'; -import { callApi } from '../../../api/gramjs'; +import { init as initFolderManager } from '../../../util/folderManager'; import { buildCollectionByKey } from '../../../util/iteratees'; +import { callApi } from '../../../api/gramjs'; +import { + addActionHandler, getActions, getGlobal, setGlobal, +} from '../../index'; import { addChatMessagesById, safeReplaceViewportIds, @@ -20,6 +21,7 @@ import { updateThreadInfos, updateUsers, } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; import { selectChatMessage, selectChatMessages, @@ -30,8 +32,6 @@ import { selectTabState, selectThreadInfo, } from '../../selectors'; -import { init as initFolderManager } from '../../../util/folderManager'; -import { updateTabState } from '../../reducers/tabs'; const RELEASE_STATUS_TIMEOUT = 15000; // 15 sec; diff --git a/src/global/actions/api/twoFaSettings.ts b/src/global/actions/api/twoFaSettings.ts index 86cee864f..59b02fd40 100644 --- a/src/global/actions/api/twoFaSettings.ts +++ b/src/global/actions/api/twoFaSettings.ts @@ -1,8 +1,8 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import type { ActionReturnType } from '../../types'; import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { replaceSettings, updateTwoFaSettings } from '../../reducers'; -import type { ActionReturnType } from '../../types'; addActionHandler('loadPasswordInfo', async (global): Promise => { const result = await callApi('getPasswordInfo'); diff --git a/src/global/actions/api/users.ts b/src/global/actions/api/users.ts index d2be3a615..242c214fe 100644 --- a/src/global/actions/api/users.ts +++ b/src/global/actions/api/users.ts @@ -1,19 +1,19 @@ +import type { ApiUser } from '../../../api/types'; +import type { ActionReturnType } from '../../types'; +import { ManagementProgress } from '../../../types'; + +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey, unique } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; +import { throttle } from '../../../util/schedulers'; +import { getServerTime } from '../../../util/serverTime'; +import { callApi } from '../../../api/gramjs'; +import { isUserBot, isUserId } from '../../helpers'; import { addActionHandler, getGlobal, setGlobal, } from '../../index'; - -import type { ApiUser } from '../../../api/types'; -import { ManagementProgress } from '../../../types'; - -import { throttle } from '../../../util/schedulers'; -import { buildCollectionByKey, unique } from '../../../util/iteratees'; -import { isUserBot, isUserId } from '../../helpers'; -import { callApi } from '../../../api/gramjs'; -import { - selectChat, selectCurrentMessageList, selectTabState, selectUser, selectUserFullInfo, -} from '../../selectors'; import { addChats, addUsers, @@ -23,15 +23,14 @@ import { updateChat, updateManagementProgress, updateUser, + updateUserFullInfo, updateUsers, updateUserSearch, updateUserSearchFetchingStatus, - updateUserFullInfo, } from '../../reducers'; -import { getServerTime } from '../../../util/serverTime'; -import * as langProvider from '../../../util/langProvider'; -import type { ActionReturnType } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { + selectChat, selectCurrentMessageList, selectTabState, selectUser, selectUserFullInfo, +} from '../../selectors'; const TOP_PEERS_REQUEST_COOLDOWN = 60; // 1 min const runThrottledForSearch = throttle((cb) => cb(), 500, false); diff --git a/src/global/actions/apiUpdaters/calls.async.ts b/src/global/actions/apiUpdaters/calls.async.ts index 4e447e2a7..5f8a06993 100644 --- a/src/global/actions/apiUpdaters/calls.async.ts +++ b/src/global/actions/apiUpdaters/calls.async.ts @@ -1,22 +1,23 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { selectActiveGroupCall, selectGroupCallParticipant, selectPhoneCallUser } from '../../selectors/calls'; -import { updateGroupCall, updateGroupCallParticipant } from '../../reducers/calls'; -import { buildCollectionByKey, omit } from '../../../util/iteratees'; +import type { ApiPhoneCall } from '../../../api/types'; import type { ApiCallProtocol } from '../../../lib/secret-sauce'; +import type { ActionReturnType } from '../../types'; + import { handleUpdateGroupCallConnection, handleUpdateGroupCallParticipants, joinPhoneCall, processSignalingMessage, } from '../../../lib/secret-sauce'; -import type { ApiPhoneCall } from '../../../api/types'; -import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; -import { callApi } from '../../../api/gramjs'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey, omit } from '../../../util/iteratees'; import * as langProvider from '../../../util/langProvider'; import { EMOJI_DATA, EMOJI_OFFSETS } from '../../../util/phoneCallEmojiConstants'; -import type { ActionReturnType } from '../../types'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { addUsers } from '../../reducers'; +import { updateGroupCall, updateGroupCallParticipant } from '../../reducers/calls'; +import { updateTabState } from '../../reducers/tabs'; +import { selectActiveGroupCall, selectGroupCallParticipant, selectPhoneCallUser } from '../../selectors/calls'; addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { const { activeGroupCallId } = global.groupCalls; diff --git a/src/global/actions/apiUpdaters/calls.ts b/src/global/actions/apiUpdaters/calls.ts index dc9023d28..875b93d1e 100644 --- a/src/global/actions/apiUpdaters/calls.ts +++ b/src/global/actions/apiUpdaters/calls.ts @@ -1,16 +1,17 @@ -import { addActionHandler, getGlobal } from '../../index'; -import { removeGroupCall, updateGroupCall, updateGroupCallParticipant } from '../../reducers/calls'; +import type { ActionReturnType } from '../../types'; + +import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { omit } from '../../../util/iteratees'; -import { selectChat } from '../../selectors'; -import { updateChat, updateChatFullInfo } from '../../reducers'; -import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; import { notifyAboutCall } from '../../../util/notifications'; +import { onTickEnd } from '../../../util/schedulers'; +import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; +import { addActionHandler, getGlobal } from '../../index'; +import { updateChat, updateChatFullInfo } from '../../reducers'; +import { removeGroupCall, updateGroupCall, updateGroupCallParticipant } from '../../reducers/calls'; +import { updateTabState } from '../../reducers/tabs'; +import { selectChat } from '../../selectors'; import { selectGroupCall, selectPhoneCallUser } from '../../selectors/calls'; import { checkNavigatorUserMediaPermissions, initializeSounds } from '../ui/calls'; -import { onTickEnd } from '../../../util/schedulers'; -import type { ActionReturnType } from '../../types'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { switch (update['@type']) { diff --git a/src/global/actions/apiUpdaters/chats.ts b/src/global/actions/apiUpdaters/chats.ts index 67676e97a..acdf31466 100644 --- a/src/global/actions/apiUpdaters/chats.ts +++ b/src/global/actions/apiUpdaters/chats.ts @@ -1,5 +1,3 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - import type { ApiMessage, ApiUpdateChat } from '../../../api/types'; import type { ActionReturnType } from '../../types'; import { MAIN_THREAD_ID } from '../../../api/types'; @@ -7,6 +5,9 @@ import { MAIN_THREAD_ID } from '../../../api/types'; import { ARCHIVED_FOLDER_ID, MAX_ACTIVE_PINNED_CHATS } from '../../../config'; import { buildCollectionByKey, omit } from '../../../util/iteratees'; import { closeMessageNotifications, notifyAboutMessage } from '../../../util/notifications'; +import { + addActionHandler, getGlobal, setGlobal, +} from '../../index'; import { leaveChat, replaceThreadParam, @@ -16,19 +17,19 @@ import { updateChatListType, updateTopic, } from '../../reducers'; -import { - selectChat, - selectCommonBoxChatId, - selectIsChatListed, - selectChatListType, - selectCurrentMessageList, - selectThreadParam, - selectChatFullInfo, - selectTabState, - selectTopicFromMessage, -} from '../../selectors'; import { updateUnreadReactions } from '../../reducers/reactions'; import { updateTabState } from '../../reducers/tabs'; +import { + selectChat, + selectChatFullInfo, + selectChatListType, + selectCommonBoxChatId, + selectCurrentMessageList, + selectIsChatListed, + selectTabState, + selectThreadParam, + selectTopicFromMessage, +} from '../../selectors'; const TYPING_STATUS_CLEAR_DELAY = 6000; // 6 seconds diff --git a/src/global/actions/apiUpdaters/initial.ts b/src/global/actions/apiUpdaters/initial.ts index 05802256b..5626cca9c 100644 --- a/src/global/actions/apiUpdaters/initial.ts +++ b/src/global/actions/apiUpdaters/initial.ts @@ -1,30 +1,29 @@ +import type { + ApiUpdateAuthorizationError, + ApiUpdateAuthorizationState, + ApiUpdateConnectionState, + ApiUpdateCurrentUser, + ApiUpdateServerTimeOffset, + ApiUpdateSession, +} from '../../../api/types'; import type { RequiredGlobalActions } from '../../index'; +import type { ActionReturnType, GlobalState } from '../../types'; + +import { SESSION_USER_KEY } from '../../../config'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { getShippingError, shouldClosePaymentModal } from '../../../util/getReadableErrorText'; +import { unique } from '../../../util/iteratees'; +import { setLanguage } from '../../../util/langProvider'; +import { clearWebTokenAuth } from '../../../util/routing'; +import { setServerTimeOffset } from '../../../util/serverTime'; +import { forceWebsync } from '../../../util/websync'; +import { isChatChannel, isChatSuperGroup } from '../../helpers'; import { addActionHandler, getGlobal, setGlobal, } from '../../index'; - -import type { ActionReturnType, GlobalState } from '../../types'; - -import type { - ApiUpdateAuthorizationState, - ApiUpdateAuthorizationError, - ApiUpdateConnectionState, - ApiUpdateSession, - ApiUpdateCurrentUser, - ApiUpdateServerTimeOffset, -} from '../../../api/types'; -import { SESSION_USER_KEY } from '../../../config'; import { updateUser, updateUserFullInfo } from '../../reducers'; -import { setLanguage } from '../../../util/langProvider'; -import { selectTabState } from '../../selectors'; -import { forceWebsync } from '../../../util/websync'; -import { getShippingError, shouldClosePaymentModal } from '../../../util/getReadableErrorText'; -import { clearWebTokenAuth } from '../../../util/routing'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { updateTabState } from '../../reducers/tabs'; -import { setServerTimeOffset } from '../../../util/serverTime'; -import { isChatChannel, isChatSuperGroup } from '../../helpers'; -import { unique } from '../../../util/iteratees'; +import { selectTabState } from '../../selectors'; addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { switch (update['@type']) { diff --git a/src/global/actions/apiUpdaters/messages.ts b/src/global/actions/apiUpdaters/messages.ts index 6aedad4ec..9588d13f7 100644 --- a/src/global/actions/apiUpdaters/messages.ts +++ b/src/global/actions/apiUpdaters/messages.ts @@ -1,67 +1,67 @@ -import type { RequiredGlobalActions } from '../../index'; -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - import type { ApiChat, ApiMessage, ApiPollResult, ApiReactions, ApiThreadInfo, } from '../../../api/types'; +import type { RequiredGlobalActions } from '../../index'; import type { - ActiveEmojiInteraction, ActionReturnType, GlobalState, RequiredGlobalState, + ActionReturnType, ActiveEmojiInteraction, GlobalState, RequiredGlobalState, } from '../../types'; import { MAIN_THREAD_ID } from '../../../api/types'; import { SERVICE_NOTIFICATIONS_USER_ID } from '../../../config'; -import { omit, pickTruthy, unique } from '../../../util/iteratees'; import { areDeepEqual } from '../../../util/areDeepEqual'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { omit, pickTruthy, unique } from '../../../util/iteratees'; import { notifyAboutMessage } from '../../../util/notifications'; +import { onTickEnd } from '../../../util/schedulers'; import { - updateChat, + checkIfHasUnreadReactions, getMessageContent, getMessageText, isActionMessage, + isMessageLocal, isUserId, +} from '../../helpers'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { + addViewportId, + clearMessageTranslation, deleteChatMessages, + deleteChatScheduledMessages, + deleteTopic, + removeChatFromChatLists, + replaceThreadParam, + updateChat, updateChatMessage, updateListedIds, - addViewportId, - updateThreadInfo, - replaceThreadParam, + updateMessageTranslations, updateScheduledMessage, - deleteChatScheduledMessages, + updateThreadInfo, updateThreadUnreadFromForwardedMessage, updateTopic, - deleteTopic, - updateMessageTranslations, - clearMessageTranslation, - removeChatFromChatLists, } from '../../reducers'; -import { - selectChatMessage, - selectChatMessages, - selectIsViewportNewest, - selectListedIds, - selectChatMessageByPollId, - selectCommonBoxChatId, - selectIsChatListed, - selectThreadInfo, - selectThreadByMessage, - selectPinnedIds, - selectScheduledMessage, - selectChatScheduledMessages, - selectIsMessageInCurrentMessageList, - selectScheduledIds, - selectCurrentMessageList, - selectViewportIds, - selectFirstUnreadId, - selectChat, - selectIsServiceChatReady, - selectThreadIdFromMessage, - selectTopicFromMessage, - selectTabState, - selectSendAs, -} from '../../selectors'; -import { - getMessageContent, isUserId, isMessageLocal, getMessageText, checkIfHasUnreadReactions, isActionMessage, -} from '../../helpers'; -import { onTickEnd } from '../../../util/schedulers'; import { updateUnreadReactions } from '../../reducers/reactions'; import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { + selectChat, + selectChatMessage, + selectChatMessageByPollId, + selectChatMessages, + selectChatScheduledMessages, + selectCommonBoxChatId, + selectCurrentMessageList, + selectFirstUnreadId, + selectIsChatListed, + selectIsMessageInCurrentMessageList, + selectIsServiceChatReady, + selectIsViewportNewest, + selectListedIds, + selectPinnedIds, + selectScheduledIds, + selectScheduledMessage, + selectSendAs, + selectTabState, + selectThreadByMessage, + selectThreadIdFromMessage, + selectThreadInfo, + selectTopicFromMessage, + selectViewportIds, +} from '../../selectors'; const ANIMATION_DELAY = 350; diff --git a/src/global/actions/apiUpdaters/misc.ts b/src/global/actions/apiUpdaters/misc.ts index 58ba40751..df2aa4591 100644 --- a/src/global/actions/apiUpdaters/misc.ts +++ b/src/global/actions/apiUpdaters/misc.ts @@ -1,8 +1,7 @@ -import { addActionHandler, setGlobal } from '../../index'; - import type { ActionReturnType } from '../../types'; import { PaymentStep } from '../../../types'; +import { addActionHandler, setGlobal } from '../../index'; import { addBlockedUser, addStoriesForUser, diff --git a/src/global/actions/apiUpdaters/payments.ts b/src/global/actions/apiUpdaters/payments.ts index 46aeedbfc..4d8e01e08 100644 --- a/src/global/actions/apiUpdaters/payments.ts +++ b/src/global/actions/apiUpdaters/payments.ts @@ -1,13 +1,13 @@ -import { addActionHandler } from '../../index'; - -import { IS_PRODUCTION_HOST } from '../../../util/windowEnvironment'; -import { closeInvoice } from '../../reducers'; -import * as langProvider from '../../../util/langProvider'; -import { formatCurrency } from '../../../util/formatCurrency'; -import { selectChatMessage, selectTabState } from '../../selectors'; -import { updateTabState } from '../../reducers/tabs'; import type { ActionReturnType } from '../../types'; +import { formatCurrency } from '../../../util/formatCurrency'; +import * as langProvider from '../../../util/langProvider'; +import { IS_PRODUCTION_HOST } from '../../../util/windowEnvironment'; +import { addActionHandler } from '../../index'; +import { closeInvoice } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; +import { selectChatMessage, selectTabState } from '../../selectors'; + addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { switch (update['@type']) { case 'updatePaymentStateCompleted': { diff --git a/src/global/actions/apiUpdaters/settings.ts b/src/global/actions/apiUpdaters/settings.ts index ccf22e3e7..b9a0b0c6d 100644 --- a/src/global/actions/apiUpdaters/settings.ts +++ b/src/global/actions/apiUpdaters/settings.ts @@ -1,10 +1,11 @@ -import { addActionHandler, setGlobal } from '../../index'; - -import { - addNotifyException, updateChat, updateTopic, updateNotifySettings, -} from '../../reducers'; import type { ActionReturnType } from '../../types'; +import { addActionHandler, setGlobal } from '../../index'; +import { + addNotifyException, updateChat, updateNotifySettings, + updateTopic, +} from '../../reducers'; + addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { switch (update['@type']) { case 'updateNotifySettings': { diff --git a/src/global/actions/apiUpdaters/symbols.ts b/src/global/actions/apiUpdaters/symbols.ts index 29a1528ad..07f1d2d83 100644 --- a/src/global/actions/apiUpdaters/symbols.ts +++ b/src/global/actions/apiUpdaters/symbols.ts @@ -1,8 +1,8 @@ -import { addActionHandler } from '../../index'; - -import { updateStickerSet } from '../../reducers'; import type { ActionReturnType } from '../../types'; +import { addActionHandler } from '../../index'; +import { updateStickerSet } from '../../reducers'; + addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { switch (update['@type']) { case 'updateStickerSet': { diff --git a/src/global/actions/apiUpdaters/twoFaSettings.ts b/src/global/actions/apiUpdaters/twoFaSettings.ts index 49691f3b4..5d47ce70c 100644 --- a/src/global/actions/apiUpdaters/twoFaSettings.ts +++ b/src/global/actions/apiUpdaters/twoFaSettings.ts @@ -1,6 +1,7 @@ -import { addActionHandler } from '../../index'; import type { ActionReturnType } from '../../types'; +import { addActionHandler } from '../../index'; + addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => { switch (update['@type']) { case 'updateTwoFaStateWaitCode': { diff --git a/src/global/actions/apiUpdaters/users.ts b/src/global/actions/apiUpdaters/users.ts index 4a54f9b00..dbb576ca2 100644 --- a/src/global/actions/apiUpdaters/users.ts +++ b/src/global/actions/apiUpdaters/users.ts @@ -1,13 +1,12 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - import type { ApiUserStatus } from '../../../api/types'; +import type { ActionReturnType, RequiredGlobalState } from '../../types'; +import { throttle } from '../../../util/schedulers'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { deleteContact, replaceUserStatuses, toggleUserStoriesHidden, updateUser, updateUserFullInfo, } from '../../reducers'; -import { throttle } from '../../../util/schedulers'; import { selectIsCurrentUserPremium, selectUser, selectUserFullInfo } from '../../selectors'; -import type { ActionReturnType, RequiredGlobalState } from '../../types'; const STATUS_UPDATE_THROTTLE = 3000; diff --git a/src/global/actions/ui/calls.ts b/src/global/actions/ui/calls.ts index 5850ad908..b20c48aad 100644 --- a/src/global/actions/ui/calls.ts +++ b/src/global/actions/ui/calls.ts @@ -1,31 +1,30 @@ +import type { ApiGroupCall } from '../../../api/types'; import type { RequiredGlobalActions } from '../../index'; +import type { + ActionReturnType, CallSound, GlobalState, TabArgs, +} from '../../types'; + import { requestNextMutation } from '../../../lib/fasterdom/fasterdom'; +import { copyTextToClipboard } from '../../../util/clipboard'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey, omit } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; +import safePlay from '../../../util/safePlay'; +import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; +import { callApi } from '../../../api/gramjs'; +import { getMainUsername } from '../../helpers'; import { addActionHandler, getGlobal, setGlobal, } from '../../index'; -import { callApi } from '../../../api/gramjs'; +import { addChats, addUsers } from '../../reducers'; +import { updateGroupCall } from '../../reducers/calls'; +import { updateTabState } from '../../reducers/tabs'; import { selectChat, selectChatFullInfo, selectTabState, selectUser, } from '../../selectors'; -import { copyTextToClipboard } from '../../../util/clipboard'; -import { fetchChatByUsername, loadFullChat } from '../api/chats'; - -import type { ApiGroupCall } from '../../../api/types'; -import type { - CallSound, ActionReturnType, GlobalState, TabArgs, -} from '../../types'; - -import { addChats, addUsers } from '../../reducers'; -import { updateGroupCall } from '../../reducers/calls'; import { selectActiveGroupCall, selectChatGroupCall, selectGroupCall } from '../../selectors/calls'; -import { getMainUsername } from '../../helpers'; -import { buildCollectionByKey, omit } from '../../../util/iteratees'; -import safePlay from '../../../util/safePlay'; -import { ARE_CALLS_SUPPORTED } from '../../../util/windowEnvironment'; -import * as langProvider from '../../../util/langProvider'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { fetchChatByUsername, loadFullChat } from '../api/chats'; // This is a tiny MP3 file that is silent - retrieved from https://bigsoundbank.com and then modified // eslint-disable-next-line max-len diff --git a/src/global/actions/ui/chats.ts b/src/global/actions/ui/chats.ts index 467543cb7..14e97c43b 100644 --- a/src/global/actions/ui/chats.ts +++ b/src/global/actions/ui/chats.ts @@ -1,19 +1,18 @@ -import { addActionHandler, setGlobal } from '../../index'; - -import { IS_ELECTRON } from '../../../config'; +import type { ActionReturnType } from '../../types'; import { MAIN_THREAD_ID } from '../../../api/types'; +import { IS_ELECTRON } from '../../../config'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { createMessageHashUrl } from '../../../util/routing'; +import { addActionHandler, setGlobal } from '../../index'; import { exitMessageSelectMode, replaceTabThreadParam, updateCurrentMessageList, updateRequestedChatTranslation, } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; import { selectChat, selectCurrentMessageList, selectTabState, } from '../../selectors'; import { closeLocalTextSearch } from './localSearch'; -import type { ActionReturnType } from '../../types'; -import { updateTabState } from '../../reducers/tabs'; -import { createMessageHashUrl } from '../../../util/routing'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; addActionHandler('openChat', (global, actions, payload): ActionReturnType => { const { diff --git a/src/global/actions/ui/globalSearch.ts b/src/global/actions/ui/globalSearch.ts index 01839cfd6..4b600506e 100644 --- a/src/global/actions/ui/globalSearch.ts +++ b/src/global/actions/ui/globalSearch.ts @@ -1,9 +1,9 @@ -import { addActionHandler } from '../../index'; +import type { ActionReturnType } from '../../types'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { addActionHandler } from '../../index'; import { updateGlobalSearch, updateGlobalSearchContent } from '../../reducers'; import { selectTabState } from '../../selectors'; -import type { ActionReturnType } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; const MAX_RECENTLY_FOUND_IDS = 10; diff --git a/src/global/actions/ui/initial.ts b/src/global/actions/ui/initial.ts index f98013733..2c37b3db6 100644 --- a/src/global/actions/ui/initial.ts +++ b/src/global/actions/ui/initial.ts @@ -1,28 +1,31 @@ import { addCallback } from '../../../lib/teact/teactn'; -import { requestMutation } from '../../../lib/fasterdom/fasterdom'; + +import type { ActionReturnType, GlobalState } from '../../types'; import { IS_ELECTRON } from '../../../config'; -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { - IS_ANDROID, IS_IOS, IS_MAC_OS, IS_SAFARI, IS_TOUCH_ENV, IS_WINDOWS, IS_LINUX, -} from '../../../util/windowEnvironment'; +import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { setLanguage } from '../../../util/langProvider'; +import { subscribe, unsubscribe } from '../../../util/notifications'; +import { decryptSessionByCurrentHash } from '../../../util/passcode'; +import { applyPerformanceSettings } from '../../../util/perfomanceSettings'; +import { hasStoredSession, storeSession } from '../../../util/sessions'; import switchTheme from '../../../util/switchTheme'; import { getSystemTheme, setSystemThemeChangeCallback } from '../../../util/systemTheme'; -import { - selectTabState, selectNotifySettings, selectTheme, selectPerformanceSettings, selectCanAnimateInterface, -} from '../../selectors'; import { startWebsync, stopWebsync } from '../../../util/websync'; -import { subscribe, unsubscribe } from '../../../util/notifications'; -import { clearCaching, setupCaching } from '../../cache'; -import { decryptSessionByCurrentHash } from '../../../util/passcode'; -import { hasStoredSession, storeSession } from '../../../util/sessions'; +import { + IS_ANDROID, IS_IOS, IS_LINUX, + IS_MAC_OS, IS_SAFARI, IS_TOUCH_ENV, IS_WINDOWS, +} from '../../../util/windowEnvironment'; import { callApi } from '../../../api/gramjs'; -import type { ActionReturnType, GlobalState } from '../../types'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { applyPerformanceSettings } from '../../../util/perfomanceSettings'; +import { clearCaching, setupCaching } from '../../cache'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { replaceSettings } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; +import { + selectCanAnimateInterface, + selectNotifySettings, selectPerformanceSettings, selectTabState, selectTheme, +} from '../../selectors'; const HISTORY_ANIMATION_DURATION = 450; diff --git a/src/global/actions/ui/localSearch.ts b/src/global/actions/ui/localSearch.ts index 3faede958..d687f4ef9 100644 --- a/src/global/actions/ui/localSearch.ts +++ b/src/global/actions/ui/localSearch.ts @@ -1,15 +1,15 @@ -import { addActionHandler } from '../../index'; +import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; +import { buildChatThreadKey } from '../../helpers'; +import { addActionHandler } from '../../index'; import { - updateLocalTextSearch, replaceLocalTextSearchResults, updateLocalMediaSearchType, + updateLocalTextSearch, } from '../../reducers'; -import { MEMO_EMPTY_ARRAY } from '../../../util/memo'; import { selectCurrentMessageList, selectTabState } from '../../selectors'; -import { buildChatThreadKey } from '../../helpers'; -import type { ActionReturnType, GlobalState, TabArgs } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; addActionHandler('openLocalTextSearch', (global, actions, payload): ActionReturnType => { const { tabId = getCurrentTabId() } = payload || {}; diff --git a/src/global/actions/ui/mediaViewer.ts b/src/global/actions/ui/mediaViewer.ts index 601a9b182..a1eb35b68 100644 --- a/src/global/actions/ui/mediaViewer.ts +++ b/src/global/actions/ui/mediaViewer.ts @@ -1,9 +1,10 @@ -import { addActionHandler } from '../../index'; import type { ActionReturnType } from '../../types'; + +import { DEFAULT_PLAYBACK_RATE } from '../../../config'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { addActionHandler } from '../../index'; import { updateTabState } from '../../reducers/tabs'; import { selectTabState } from '../../selectors'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { DEFAULT_PLAYBACK_RATE } from '../../../config'; addActionHandler('openMediaViewer', (global, actions, payload): ActionReturnType => { const { diff --git a/src/global/actions/ui/messages.ts b/src/global/actions/ui/messages.ts index 2448ad346..d0236b636 100644 --- a/src/global/actions/ui/messages.ts +++ b/src/global/actions/ui/messages.ts @@ -1,62 +1,62 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; - import type { ApiMessage } from '../../../api/types'; +import type { + ActionReturnType, + GlobalState, +} from '../../types'; import { MAIN_THREAD_ID } from '../../../api/types'; import { FocusDirection } from '../../../types'; -import type { - GlobalState, ActionReturnType, -} from '../../types'; import { ANIMATION_END_DELAY, - RELEASE_DATETIME, FAST_SMOOTH_MAX_DURATION, + RELEASE_DATETIME, SERVICE_NOTIFICATIONS_USER_ID, } from '../../../config'; +import { copyHtmlToClipboard } from '../../../util/clipboard'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { compact, findLast } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; +import parseMessageInput from '../../../util/parseMessageInput'; +import { getServerTime } from '../../../util/serverTime'; import { IS_TOUCH_ENV } from '../../../util/windowEnvironment'; +import versionNotification from '../../../versionNotification.txt'; +import { getMessageSummaryText, getSenderTitle, isChatChannel } from '../../helpers'; +import { renderMessageSummaryHtml } from '../../helpers/renderMessageSummaryHtml'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { + addActiveMessageMediaDownload, + cancelMessageMediaDownload, enterMessageSelectMode, - toggleMessageSelection, exitMessageSelectMode, - replaceThreadParam, replaceTabThreadParam, + replaceThreadParam, + toggleMessageSelection, updateFocusDirection, updateFocusedMessage, - cancelMessageMediaDownload, - addActiveMessageMediaDownload, } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; import { - selectCurrentChat, - selectViewportIds, - selectIsRightColumnShown, - selectCurrentMessageList, - selectChat, - selectThreadInfo, - selectChatMessages, selectAllowedMessageActions, - selectMessageIdsByGroupId, + selectChat, + selectChatMessages, + selectChatScheduledMessages, + selectCurrentChat, + selectCurrentMessageList, selectForwardedMessageIdsByGroupId, + selectIsRightColumnShown, selectIsViewportNewest, + selectMessageIdsByGroupId, + selectPinnedIds, selectReplyingToId, selectReplyStack, - selectSender, - selectChatScheduledMessages, - selectTabState, - selectRequestedMessageTranslationLanguage, - selectPinnedIds, selectRequestedChatTranslationLanguage, + selectRequestedMessageTranslationLanguage, + selectSender, + selectTabState, + selectThreadInfo, + selectViewportIds, } from '../../selectors'; -import { compact, findLast } from '../../../util/iteratees'; -import { getServerTime } from '../../../util/serverTime'; -import versionNotification from '../../../versionNotification.txt'; -import parseMessageInput from '../../../util/parseMessageInput'; -import { getMessageSummaryText, getSenderTitle, isChatChannel } from '../../helpers'; -import * as langProvider from '../../../util/langProvider'; -import { copyHtmlToClipboard } from '../../../util/clipboard'; -import { renderMessageSummaryHtml } from '../../helpers/renderMessageSummaryHtml'; -import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { getIsMobile } from '../../../hooks/useAppLayout'; const FOCUS_DURATION = 1500; diff --git a/src/global/actions/ui/misc.ts b/src/global/actions/ui/misc.ts index f49db717d..3a35c003f 100644 --- a/src/global/actions/ui/misc.ts +++ b/src/global/actions/ui/misc.ts @@ -1,15 +1,26 @@ +import { addCallback } from '../../../lib/teact/teactn'; + +import type { ApiError, ApiNotification } from '../../../api/types'; +import type { ActionReturnType, GlobalState } from '../../types'; +import { MAIN_THREAD_ID } from '../../../api/types'; + +import { + DEBUG, GLOBAL_STATE_CACHE_CUSTOM_EMOJI_LIMIT, INACTIVE_MARKER, IS_ELECTRON, + PAGE_TITLE, +} from '../../../config'; +import { getAllMultitabTokens, getCurrentTabId, reestablishMasterToSelf } from '../../../util/establishMultitabRole'; +import { getAllNotificationsCount } from '../../../util/folderManager'; +import generateUniqueId from '../../../util/generateUniqueId'; +import getReadableErrorText from '../../../util/getReadableErrorText'; +import { compact, unique } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; +import updateIcon from '../../../util/updateIcon'; +import { setPageTitle, setPageTitleInstant } from '../../../util/updatePageTitle'; +import { getAllowedAttachmentOptions, getChatTitle } from '../../helpers'; import { addActionHandler, getActions, getGlobal, setGlobal, } from '../../index'; - -import type { ApiError, ApiNotification } from '../../../api/types'; -import { MAIN_THREAD_ID } from '../../../api/types'; -import type { ActionReturnType, GlobalState } from '../../types'; - -import { - DEBUG, GLOBAL_STATE_CACHE_CUSTOM_EMOJI_LIMIT, INACTIVE_MARKER, PAGE_TITLE, IS_ELECTRON, -} from '../../../config'; -import getReadableErrorText from '../../../util/getReadableErrorText'; +import { updateTabState } from '../../reducers/tabs'; import { selectCanAnimateInterface, selectChat, @@ -19,17 +30,8 @@ import { selectIsTrustedBot, selectTabState, } from '../../selectors'; -import generateUniqueId from '../../../util/generateUniqueId'; -import { compact, unique } from '../../../util/iteratees'; -import { getAllMultitabTokens, getCurrentTabId, reestablishMasterToSelf } from '../../../util/establishMultitabRole'; -import { getAllNotificationsCount } from '../../../util/folderManager'; -import updateIcon from '../../../util/updateIcon'; -import { setPageTitle, setPageTitleInstant } from '../../../util/updatePageTitle'; -import { updateTabState } from '../../reducers/tabs'; + import { getIsMobile, getIsTablet } from '../../../hooks/useAppLayout'; -import * as langProvider from '../../../util/langProvider'; -import { getAllowedAttachmentOptions, getChatTitle } from '../../helpers'; -import { addCallback } from '../../../lib/teact/teactn'; export const APP_VERSION_URL = 'version.txt'; const MAX_STORED_EMOJIS = 8 * 4; // Represents four rows of recent emojis diff --git a/src/global/actions/ui/passcode.ts b/src/global/actions/ui/passcode.ts index 8eade0d40..470f4dbd5 100644 --- a/src/global/actions/ui/passcode.ts +++ b/src/global/actions/ui/passcode.ts @@ -1,17 +1,17 @@ -import { addActionHandler, setGlobal, getGlobal } from '../../index'; +import type { ActionReturnType } from '../../types'; +import { SettingsScreens } from '../../../types'; -import { clearPasscodeSettings, updatePasscodeSettings } from '../../reducers'; -import { clearStoredSession, loadStoredSession, storeSession } from '../../../util/sessions'; +import { getCurrentTabId, signalPasscodeHash } from '../../../util/establishMultitabRole'; +import { cloneDeep } from '../../../util/iteratees'; import { clearEncryptedSession, decryptSession, encryptSession, forgetPasscode, setupPasscode, } from '../../../util/passcode'; -import { forceUpdateCache, migrateCache, serializeGlobal } from '../../cache'; import { onBeforeUnload } from '../../../util/schedulers'; -import { cloneDeep } from '../../../util/iteratees'; +import { clearStoredSession, loadStoredSession, storeSession } from '../../../util/sessions'; +import { forceUpdateCache, migrateCache, serializeGlobal } from '../../cache'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; import { INITIAL_GLOBAL_STATE } from '../../initialState'; -import type { ActionReturnType } from '../../types'; -import { getCurrentTabId, signalPasscodeHash } from '../../../util/establishMultitabRole'; -import { SettingsScreens } from '../../../types'; +import { clearPasscodeSettings, updatePasscodeSettings } from '../../reducers'; let noLockOnUnload = false; onBeforeUnload(() => { diff --git a/src/global/actions/ui/payments.ts b/src/global/actions/ui/payments.ts index 497e8dd90..66045d965 100644 --- a/src/global/actions/ui/payments.ts +++ b/src/global/actions/ui/payments.ts @@ -1,10 +1,10 @@ -import { addActionHandler } from '../../index'; - -import { clearPayment, closeInvoice } from '../../reducers'; import type { ActionReturnType } from '../../types'; -import { selectTabState } from '../../selectors'; -import { updateTabState } from '../../reducers/tabs'; + import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { addActionHandler } from '../../index'; +import { clearPayment, closeInvoice } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; +import { selectTabState } from '../../selectors'; addActionHandler('closePaymentModal', (global, actions, payload): ActionReturnType => { const { tabId = getCurrentTabId() } = payload || {}; diff --git a/src/global/actions/ui/reactions.ts b/src/global/actions/ui/reactions.ts index 61ff74084..fbbdd081f 100644 --- a/src/global/actions/ui/reactions.ts +++ b/src/global/actions/ui/reactions.ts @@ -1,8 +1,7 @@ -import { addActionHandler } from '../../index'; - import type { ActionReturnType } from '../../types'; import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { addActionHandler } from '../../index'; import { updateTabState } from '../../reducers/tabs'; import { selectTabState } from '../../selectors'; diff --git a/src/global/actions/ui/settings.ts b/src/global/actions/ui/settings.ts index 213403a7d..2c2dc70af 100644 --- a/src/global/actions/ui/settings.ts +++ b/src/global/actions/ui/settings.ts @@ -1,22 +1,22 @@ import { addCallback } from '../../../lib/teact/teactn'; + +import type { ActionReturnType, GlobalState } from '../../types'; +import { SettingsScreens } from '../../../types'; + import { requestMutation } from '../../../lib/fasterdom/fasterdom'; +import { disableDebugConsole, initDebugConsole } from '../../../util/debugConsole'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { setLanguage, setTimeFormat } from '../../../util/langProvider'; +import { applyPerformanceSettings } from '../../../util/perfomanceSettings'; +import switchTheme from '../../../util/switchTheme'; +import { IS_IOS } from '../../../util/windowEnvironment'; +import { callApi, setShouldEnableDebugLog } from '../../../api/gramjs'; import { addActionHandler, getActions, getGlobal, setGlobal, } from '../../index'; - -import { SettingsScreens } from '../../../types'; -import type { ActionReturnType, GlobalState } from '../../types'; - import { replaceSettings, replaceThemeSettings } from '../../reducers'; -import switchTheme from '../../../util/switchTheme'; -import { setLanguage, setTimeFormat } from '../../../util/langProvider'; -import { IS_IOS } from '../../../util/windowEnvironment'; import { updateTabState } from '../../reducers/tabs'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { applyPerformanceSettings } from '../../../util/perfomanceSettings'; import { selectCanAnimateInterface, selectChatFolder } from '../../selectors'; -import { callApi, setShouldEnableDebugLog } from '../../../api/gramjs'; -import { disableDebugConsole, initDebugConsole } from '../../../util/debugConsole'; let prevGlobal: GlobalState | undefined; diff --git a/src/global/actions/ui/stickerSearch.ts b/src/global/actions/ui/stickerSearch.ts index a3ba26df4..3effb7648 100644 --- a/src/global/actions/ui/stickerSearch.ts +++ b/src/global/actions/ui/stickerSearch.ts @@ -1,7 +1,8 @@ +import type { ActionReturnType } from '../../types'; + +import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { addActionHandler } from '../../index'; import { updateTabState } from '../../reducers/tabs'; -import type { ActionReturnType } from '../../types'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; addActionHandler('setStickerSearchQuery', (global, actions, payload): ActionReturnType => { const { query, tabId = getCurrentTabId() } = payload!; diff --git a/src/global/actions/ui/stories.ts b/src/global/actions/ui/stories.ts index 67185b9f2..ef32866f4 100644 --- a/src/global/actions/ui/stories.ts +++ b/src/global/actions/ui/stories.ts @@ -1,9 +1,13 @@ -import { addActionHandler, getGlobal, setGlobal } from '../../index'; -import { callApi } from '../../../api/gramjs'; - -import type { ActionReturnType } from '../../types'; import type { ApiStoryView } from '../../../api/types'; +import type { ActionReturnType } from '../../types'; +import { copyTextToClipboard } from '../../../util/clipboard'; +import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { buildCollectionByKey, omit } from '../../../util/iteratees'; +import * as langProvider from '../../../util/langProvider'; +import { callApi } from '../../../api/gramjs'; +import { addActionHandler, getGlobal, setGlobal } from '../../index'; +import { addStoriesForUser, addUsers } from '../../reducers'; import { updateTabState } from '../../reducers/tabs'; import { selectCurrentViewedStory, @@ -13,12 +17,7 @@ import { selectUserFirstUnreadStoryId, selectUserStories, } from '../../selectors'; -import { getCurrentTabId } from '../../../util/establishMultitabRole'; -import { copyTextToClipboard } from '../../../util/clipboard'; import { fetchChatByUsername } from '../api/chats'; -import { addStoriesForUser, addUsers } from '../../reducers'; -import { buildCollectionByKey, omit } from '../../../util/iteratees'; -import * as langProvider from '../../../util/langProvider'; addActionHandler('openStoryViewer', async (global, actions, payload): Promise => { const { diff --git a/src/global/actions/ui/users.ts b/src/global/actions/ui/users.ts index e6d169a12..352a85beb 100644 --- a/src/global/actions/ui/users.ts +++ b/src/global/actions/ui/users.ts @@ -1,9 +1,9 @@ -import { addActionHandler } from '../../index'; - -import { closeNewContactDialog, updateUserSearch } from '../../reducers'; import type { ActionReturnType } from '../../types'; -import { updateTabState } from '../../reducers/tabs'; + import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { addActionHandler } from '../../index'; +import { closeNewContactDialog, updateUserSearch } from '../../reducers'; +import { updateTabState } from '../../reducers/tabs'; addActionHandler('setUserSearchQuery', (global, actions, payload): ActionReturnType => { const { diff --git a/src/global/cache.ts b/src/global/cache.ts index db69c0751..fd300d948 100644 --- a/src/global/cache.ts +++ b/src/global/cache.ts @@ -1,30 +1,34 @@ /* eslint-disable eslint-multitab-tt/no-immediate-global */ import { addCallback, removeCallback } from '../lib/teact/teactn'; -import { addActionHandler, getGlobal } from './index'; - import type { ActionReturnType, GlobalState, MessageList } from './types'; import { MAIN_THREAD_ID } from '../api/types'; -import { onBeforeUnload, onIdle, throttle } from '../util/schedulers'; import { + ALL_FOLDER_ID, + ANIMATION_LEVEL_MED, + ANIMATION_LEVEL_MIN, + ARCHIVED_FOLDER_ID, DEBUG, - GLOBAL_STATE_CACHE_DISABLED, - GLOBAL_STATE_CACHE_KEY, - GLOBAL_STATE_CACHE_USER_LIST_LIMIT, + DEFAULT_LIMITS, GLOBAL_STATE_CACHE_CHAT_LIST_LIMIT, GLOBAL_STATE_CACHE_CHATS_WITH_MESSAGES_LIMIT, GLOBAL_STATE_CACHE_CUSTOM_EMOJI_LIMIT, - ALL_FOLDER_ID, - ARCHIVED_FOLDER_ID, - DEFAULT_LIMITS, - ANIMATION_LEVEL_MIN, - ANIMATION_LEVEL_MED, + GLOBAL_STATE_CACHE_DISABLED, + GLOBAL_STATE_CACHE_KEY, + GLOBAL_STATE_CACHE_USER_LIST_LIMIT, } from '../config'; -import { isHeavyAnimating } from '../hooks/useHeavyAnimationCheck'; +import { getOrderedIds } from '../util/folderManager'; import { compact, pick, pickTruthy, unique, } from '../util/iteratees'; +import { encryptSession } from '../util/passcode'; +import { onBeforeUnload, onIdle, throttle } from '../util/schedulers'; +import { hasStoredSession } from '../util/sessions'; +import { isUserId } from './helpers'; +import { addActionHandler, getGlobal } from './index'; +import { INITIAL_GLOBAL_STATE, INITIAL_PERFORMANCE_STATE_MID, INITIAL_PERFORMANCE_STATE_MIN } from './initialState'; +import { clearGlobalForLockScreen } from './reducers'; import { selectChat, selectChatMessages, @@ -32,13 +36,9 @@ import { selectThreadOriginChat, selectVisibleUsers, } from './selectors'; -import { hasStoredSession } from '../util/sessions'; -import { INITIAL_GLOBAL_STATE, INITIAL_PERFORMANCE_STATE_MID, INITIAL_PERFORMANCE_STATE_MIN } from './initialState'; -import { isUserId } from './helpers'; -import { getOrderedIds } from '../util/folderManager'; -import { clearGlobalForLockScreen } from './reducers'; -import { encryptSession } from '../util/passcode'; + import { getIsMobile } from '../hooks/useAppLayout'; +import { isHeavyAnimating } from '../hooks/useHeavyAnimationCheck'; const UPDATE_THROTTLE = 5000; diff --git a/src/global/helpers/chats.ts b/src/global/helpers/chats.ts index 3159f7faf..37692d53e 100644 --- a/src/global/helpers/chats.ts +++ b/src/global/helpers/chats.ts @@ -1,25 +1,24 @@ import type { ApiChat, - ApiUser, - ApiChatBannedRights, ApiChatAdminRights, + ApiChatBannedRights, ApiChatFolder, ApiTopic, + ApiUser, } from '../../api/types'; +import type { LangFn } from '../../hooks/useLang'; +import type { NotifyException, NotifySettings } from '../../types'; import { MAIN_THREAD_ID, } from '../../api/types'; -import type { NotifyException, NotifySettings } from '../../types'; -import type { LangFn } from '../../hooks/useLang'; - import { ARCHIVED_FOLDER_ID, GENERAL_TOPIC_ID, REPLIES_USER_ID, TME_LINK_PREFIX, } from '../../config'; -import { orderBy } from '../../util/iteratees'; -import { getUserFirstOrLastName } from './users'; import { formatDateToString, formatTime } from '../../util/dateFormat'; +import { orderBy } from '../../util/iteratees'; import { prepareSearchWordsForNeedle } from '../../util/searchWords'; +import { getUserFirstOrLastName } from './users'; const FOREVER_BANNED_DATE = Date.now() / 1000 + 31622400; // 366 days diff --git a/src/global/helpers/getEmojiOnlyCountForMessage.ts b/src/global/helpers/getEmojiOnlyCountForMessage.ts index 093121950..57031620f 100644 --- a/src/global/helpers/getEmojiOnlyCountForMessage.ts +++ b/src/global/helpers/getEmojiOnlyCountForMessage.ts @@ -1,5 +1,6 @@ import type { ApiMessage } from '../../api/types'; import { ApiMessageEntityTypes } from '../../api/types'; + import parseEmojiOnlyString from '../../util/parseEmojiOnlyString'; export function getEmojiOnlyCountForMessage(content: ApiMessage['content'], groupedId?: string): number | undefined { diff --git a/src/global/helpers/media.ts b/src/global/helpers/media.ts index 7d3a6c187..db51ff367 100644 --- a/src/global/helpers/media.ts +++ b/src/global/helpers/media.ts @@ -1,4 +1,5 @@ import type { ApiPhoto, ApiStory } from '../../api/types'; + import { getVideoOrAudioBaseHash } from './messageMedia'; export function getVideoAvatarMediaHash(photo: ApiPhoto) { diff --git a/src/global/helpers/messageMedia.ts b/src/global/helpers/messageMedia.ts index 4b7cd05bf..824f5c6c7 100644 --- a/src/global/helpers/messageMedia.ts +++ b/src/global/helpers/messageMedia.ts @@ -19,8 +19,8 @@ import { IS_SAFARI, MAX_BUFFER_SIZE, } from '../../util/windowEnvironment'; -import { getMessageKey, isMessageLocal, matchLinkInMessageText } from './messages'; import { getDocumentHasPreview } from '../../components/common/helpers/documentInfo'; +import { getMessageKey, isMessageLocal, matchLinkInMessageText } from './messages'; type Target = 'micro' diff --git a/src/global/helpers/messageSummary.ts b/src/global/helpers/messageSummary.ts index c1e921513..364036579 100644 --- a/src/global/helpers/messageSummary.ts +++ b/src/global/helpers/messageSummary.ts @@ -1,12 +1,12 @@ import type { TeactNode } from '../../lib/teact/teact'; + import type { ApiMessage } from '../../api/types'; -import { ApiMessageEntityTypes } from '../../api/types'; -import { CONTENT_NOT_SUPPORTED } from '../../config'; -import { getGlobal } from '../index'; - import type { LangFn } from '../../hooks/useLang'; +import { ApiMessageEntityTypes } from '../../api/types'; +import { CONTENT_NOT_SUPPORTED } from '../../config'; import trimText from '../../util/trimText'; +import { getGlobal } from '../index'; import { getMessageText, getMessageTranscription } from './messages'; import { getUserFirstOrLastName } from './users'; diff --git a/src/global/helpers/messages.ts b/src/global/helpers/messages.ts index 2c1171eed..844813856 100644 --- a/src/global/helpers/messages.ts +++ b/src/global/helpers/messages.ts @@ -1,20 +1,20 @@ import type { ApiChat, ApiMessage, ApiMessageEntityTextUrl, ApiStory, ApiUser, } from '../../api/types'; -import { ApiMessageEntityTypes } from '../../api/types'; import type { LangFn } from '../../hooks/useLang'; +import { ApiMessageEntityTypes } from '../../api/types'; import { CONTENT_NOT_SUPPORTED, RE_LINK_TEMPLATE, SERVICE_NOTIFICATIONS_USER_ID, } from '../../config'; -import { getUserFullName } from './users'; -import { IS_OPUS_SUPPORTED, isWebpSupported } from '../../util/windowEnvironment'; -import { getChatTitle, isUserId } from './chats'; -import { getGlobal } from '../index'; import { areSortedArraysIntersecting, unique } from '../../util/iteratees'; import { getServerTime } from '../../util/serverTime'; +import { IS_OPUS_SUPPORTED, isWebpSupported } from '../../util/windowEnvironment'; +import { getGlobal } from '../index'; +import { getChatTitle, isUserId } from './chats'; +import { getUserFullName } from './users'; const RE_LINK = new RegExp(RE_LINK_TEMPLATE, 'i'); diff --git a/src/global/helpers/reactions.ts b/src/global/helpers/reactions.ts index 2b75667ea..16093ab79 100644 --- a/src/global/helpers/reactions.ts +++ b/src/global/helpers/reactions.ts @@ -1,10 +1,10 @@ import type { + ApiAvailableReaction, ApiChatReactions, ApiMessage, ApiReaction, - ApiReactions, ApiReactionCount, - ApiAvailableReaction, + ApiReactions, } from '../../api/types'; import type { GlobalState } from '../types'; diff --git a/src/global/helpers/renderMessageSummaryHtml.ts b/src/global/helpers/renderMessageSummaryHtml.ts index 67e9f5b41..01a2c808c 100644 --- a/src/global/helpers/renderMessageSummaryHtml.ts +++ b/src/global/helpers/renderMessageSummaryHtml.ts @@ -1,5 +1,6 @@ -import type { LangFn } from '../../hooks/useLang'; import type { ApiMessage } from '../../api/types'; +import type { LangFn } from '../../hooks/useLang'; + import { renderMessageText } from '../../components/common/helpers/renderMessageText'; import { getMessageSummaryDescription, getMessageSummaryEmoji } from './messageSummary'; diff --git a/src/global/helpers/users.ts b/src/global/helpers/users.ts index 9277584c0..b615386f7 100644 --- a/src/global/helpers/users.ts +++ b/src/global/helpers/users.ts @@ -1,12 +1,12 @@ import type { ApiChat, ApiUser, ApiUserStatus } from '../../api/types'; +import type { LangFn } from '../../hooks/useLang'; import { SERVICE_NOTIFICATIONS_USER_ID } from '../../config'; import { formatFullDate, formatTime } from '../../util/dateFormat'; import { orderBy } from '../../util/iteratees'; -import type { LangFn } from '../../hooks/useLang'; -import { getServerTime, getServerTimeOffset } from '../../util/serverTime'; -import { prepareSearchWordsForNeedle } from '../../util/searchWords'; import { formatPhoneNumber } from '../../util/phoneNumber'; +import { prepareSearchWordsForNeedle } from '../../util/searchWords'; +import { getServerTime, getServerTimeOffset } from '../../util/serverTime'; const USER_COLOR_KEYS = [1, 8, 5, 2, 7, 4, 6]; diff --git a/src/global/index.ts b/src/global/index.ts index 519bb0573..22b191797 100644 --- a/src/global/index.ts +++ b/src/global/index.ts @@ -1,7 +1,8 @@ import type { ActionOptions } from '../lib/teact/teactn'; import { typify } from '../lib/teact/teactn'; + import type { - GlobalState, ActionPayloads, RequiredActionPayloads, RequiredGlobalState, + ActionPayloads, GlobalState, RequiredActionPayloads, RequiredGlobalState, } from './types'; const typed = typify(); diff --git a/src/global/init.ts b/src/global/init.ts index 55a1278d7..ccee61f61 100644 --- a/src/global/init.ts +++ b/src/global/init.ts @@ -1,24 +1,24 @@ +import './intervals'; + +import type { ActionReturnType, GlobalState } from './types'; + +import { IS_MOCKED_CLIENT } from '../config'; +import { isCacheApiSupported } from '../util/cacheApi'; +import { getCurrentTabId, reestablishMasterToSelf } from '../util/establishMultitabRole'; +import { cloneDeep } from '../util/iteratees'; +import { Bundles, loadBundle } from '../util/moduleLoader'; +import { parseLocationHash } from '../util/routing'; +import { clearStoredSession } from '../util/sessions'; +import { IS_MULTITAB_SUPPORTED } from '../util/windowEnvironment'; +import { updateTabState } from './reducers/tabs'; +import { initCache, loadCache } from './cache'; +import { isLocalMessageId } from './helpers'; import { addActionHandler, getGlobal, setGlobal, } from './index'; - import { INITIAL_GLOBAL_STATE, INITIAL_TAB_STATE } from './initialState'; -import { IS_MULTITAB_SUPPORTED } from '../util/windowEnvironment'; -import { IS_MOCKED_CLIENT } from '../config'; -import { initCache, loadCache } from './cache'; -import { cloneDeep } from '../util/iteratees'; import { replaceTabThreadParam, replaceThreadParam, updatePasscodeSettings } from './reducers'; -import { clearStoredSession } from '../util/sessions'; -import { parseLocationHash } from '../util/routing'; import { selectTabState, selectThreadParam } from './selectors'; -import { Bundles, loadBundle } from '../util/moduleLoader'; -import { getCurrentTabId, reestablishMasterToSelf } from '../util/establishMultitabRole'; -import { updateTabState } from './reducers/tabs'; -import type { ActionReturnType, GlobalState } from './types'; -import { isLocalMessageId } from './helpers'; -import { isCacheApiSupported } from '../util/cacheApi'; - -import './intervals'; initCache(); diff --git a/src/global/initialState.ts b/src/global/initialState.ts index d4e70d61c..b0ba8e8db 100644 --- a/src/global/initialState.ts +++ b/src/global/initialState.ts @@ -1,5 +1,5 @@ -import type { TabState, GlobalState } from './types'; import type { PerformanceType } from '../types'; +import type { GlobalState, TabState } from './types'; import { NewChatMembersProgress } from '../types'; import { diff --git a/src/global/intervals.ts b/src/global/intervals.ts index fbd14ff35..04ae215c1 100644 --- a/src/global/intervals.ts +++ b/src/global/intervals.ts @@ -1,11 +1,11 @@ import { addCallback } from '../lib/teact/teactn'; -import { getGlobal, setGlobal } from '.'; import type { GlobalState } from './types'; import { getServerTime } from '../util/serverTime'; import { removeUserStory } from './reducers'; import { selectTabState } from './selectors'; +import { getGlobal, setGlobal } from '.'; const STORY_EXPIRATION_INTERVAL = 2 * 60 * 1000; // 2 min @@ -39,6 +39,7 @@ function stopIntervals() { } function checkStoryExpiration() { + // eslint-disable-next-line eslint-multitab-tt/no-immediate-global let global = getGlobal(); const serverTime = getServerTime(); diff --git a/src/global/reducers/bots.ts b/src/global/reducers/bots.ts index 51bf714cf..efaa815ee 100644 --- a/src/global/reducers/bots.ts +++ b/src/global/reducers/bots.ts @@ -1,8 +1,9 @@ -import type { GlobalState, TabArgs } from '../types'; import type { InlineBotSettings } from '../../types'; -import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; export function replaceInlineBotSettings( global: T, username: string, inlineBotSettings: InlineBotSettings | false, diff --git a/src/global/reducers/calls.ts b/src/global/reducers/calls.ts index 84ad9cda9..a6cb1aa8a 100644 --- a/src/global/reducers/calls.ts +++ b/src/global/reducers/calls.ts @@ -1,10 +1,11 @@ +import type { ApiGroupCall } from '../../api/types'; import type { GroupCallParticipant } from '../../lib/secret-sauce'; import type { GlobalState } from '../types'; -import type { ApiGroupCall } from '../../api/types'; -import { selectGroupCall } from '../selectors/calls'; + import { omit } from '../../util/iteratees'; -import { updateChatFullInfo } from './chats'; import { selectChat } from '../selectors'; +import { selectGroupCall } from '../selectors/calls'; +import { updateChatFullInfo } from './chats'; export function updateGroupCall( global: T, diff --git a/src/global/reducers/chats.ts b/src/global/reducers/chats.ts index def35cf03..a9f68f262 100644 --- a/src/global/reducers/chats.ts +++ b/src/global/reducers/chats.ts @@ -1,15 +1,15 @@ -import type { GlobalState } from '../types'; import type { ApiChat, ApiChatFullInfo, ApiChatMember, ApiPhoto, ApiTopic, } from '../../api/types'; +import type { GlobalState } from '../types'; import { ARCHIVED_FOLDER_ID } from '../../config'; +import { areDeepEqual } from '../../util/areDeepEqual'; import { areSortedArraysEqual, buildCollectionByKey, omit, unique, } from '../../util/iteratees'; import { selectChat, selectChatFullInfo } from '../selectors'; import { updateThread, updateThreadInfo } from './messages'; -import { areDeepEqual } from '../../util/areDeepEqual'; export function replaceChatListIds( global: T, diff --git a/src/global/reducers/globalSearch.ts b/src/global/reducers/globalSearch.ts index 79648dc66..ca56ba8b8 100644 --- a/src/global/reducers/globalSearch.ts +++ b/src/global/reducers/globalSearch.ts @@ -1,10 +1,11 @@ -import type { GlobalState, TabState, TabArgs } from '../types'; -import type { GlobalSearchContent } from '../../types'; import type { ApiGlobalMessageSearchType, ApiMessage } from '../../api/types'; -import { areSortedArraysEqual } from '../../util/iteratees'; -import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; +import type { GlobalSearchContent } from '../../types'; +import type { GlobalState, TabArgs, TabState } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { areSortedArraysEqual } from '../../util/iteratees'; +import { selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; const getComplexKey = (message: ApiMessage) => `${message.chatId}_${message.id}`; diff --git a/src/global/reducers/localSearch.ts b/src/global/reducers/localSearch.ts index 030070e42..9cff538e2 100644 --- a/src/global/reducers/localSearch.ts +++ b/src/global/reducers/localSearch.ts @@ -1,12 +1,12 @@ -import type { GlobalState, TabArgs } from '../types'; import type { ApiMessageSearchType } from '../../api/types'; - -import { areSortedArraysEqual, unique } from '../../util/iteratees'; import type { SharedMediaType } from '../../types'; -import { buildChatThreadKey } from '../helpers'; -import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { areSortedArraysEqual, unique } from '../../util/iteratees'; +import { buildChatThreadKey } from '../helpers'; +import { selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; interface TextSearchParams { isActive: boolean; diff --git a/src/global/reducers/management.ts b/src/global/reducers/management.ts index c1561b4ed..1e3ade25b 100644 --- a/src/global/reducers/management.ts +++ b/src/global/reducers/management.ts @@ -1,8 +1,9 @@ -import type { GlobalState, TabArgs } from '../types'; import type { ManagementProgress, ManagementState } from '../../types'; -import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; export function updateManagementProgress( global: T, progress: ManagementProgress, diff --git a/src/global/reducers/messages.ts b/src/global/reducers/messages.ts index d3ad58fa7..b673da336 100644 --- a/src/global/reducers/messages.ts +++ b/src/global/reducers/messages.ts @@ -1,39 +1,40 @@ -import type { - GlobalState, MessageList, MessageListType, TabArgs, Thread, TabThread, -} from '../types'; import type { ApiMessage, ApiSponsoredMessage, ApiThreadInfo, } from '../../api/types'; -import { MAIN_THREAD_ID } from '../../api/types'; import type { FocusDirection } from '../../types'; +import type { + GlobalState, MessageList, MessageListType, TabArgs, TabThread, + Thread, +} from '../types'; +import { MAIN_THREAD_ID } from '../../api/types'; import { IS_MOCKED_CLIENT, IS_TEST, MESSAGE_LIST_SLICE, MESSAGE_LIST_VIEWPORT_LIMIT, TMP_CHAT_ID, } from '../../config'; -import { - selectListedIds, - selectChatMessages, - selectViewportIds, - selectPinnedIds, - selectThreadInfo, - selectMessageIdsByGroupId, - selectChatScheduledMessages, - selectScheduledIds, - selectCurrentMessageIds, - selectChatMessage, - selectCurrentMessageList, - selectChat, - selectTabState, selectOutlyingLists, -} from '../selectors'; +import { getCurrentTabId } from '../../util/establishMultitabRole'; import { areSortedArraysEqual, omit, pickTruthy, unique, } from '../../util/iteratees'; -import { updateTabState } from './tabs'; -import { getCurrentTabId } from '../../util/establishMultitabRole'; import { isLocalMessageId, mergeIdRanges, orderHistoryIds, orderPinnedIds, } from '../helpers'; +import { + selectChat, + selectChatMessage, + selectChatMessages, + selectChatScheduledMessages, + selectCurrentMessageIds, + selectCurrentMessageList, + selectListedIds, + selectMessageIdsByGroupId, + selectOutlyingLists, + selectPinnedIds, + selectScheduledIds, + selectTabState, selectThreadInfo, + selectViewportIds, +} from '../selectors'; +import { updateTabState } from './tabs'; type MessageStoreSections = { byId: Record; diff --git a/src/global/reducers/passcode.ts b/src/global/reducers/passcode.ts index 2e2405704..4cbabecc0 100644 --- a/src/global/reducers/passcode.ts +++ b/src/global/reducers/passcode.ts @@ -1,4 +1,5 @@ import type { GlobalState, TabState } from '../types'; + import { INITIAL_GLOBAL_STATE, INITIAL_TAB_STATE } from '../initialState'; export function updatePasscodeSettings( diff --git a/src/global/reducers/payments.ts b/src/global/reducers/payments.ts index 742f0dcb1..14bd1a95d 100644 --- a/src/global/reducers/payments.ts +++ b/src/global/reducers/payments.ts @@ -1,11 +1,12 @@ -import type { GlobalState, TabState, TabArgs } from '../types'; -import type { ShippingOption, PaymentStep } from '../../types'; import type { ApiInvoice, ApiMessage, ApiPaymentForm, ApiReceipt, } from '../../api/types'; -import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; +import type { PaymentStep, ShippingOption } from '../../types'; +import type { GlobalState, TabArgs, TabState } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; export function updatePayment( global: T, update: Partial, diff --git a/src/global/reducers/reactions.ts b/src/global/reducers/reactions.ts index 1cb793ca5..45da98f44 100644 --- a/src/global/reducers/reactions.ts +++ b/src/global/reducers/reactions.ts @@ -1,16 +1,17 @@ -import type { GlobalState } from '../types'; import type { ApiChat, ApiMessage, ApiReaction } from '../../api/types'; +import type { GlobalState } from '../types'; import { MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN, MIN_SCREEN_WIDTH_FOR_STATIC_RIGHT_COLUMN } from '../../config'; +import windowSize from '../../util/windowSize'; import { MIN_LEFT_COLUMN_WIDTH, SIDE_COLUMN_MAX_WIDTH, } from '../../components/middle/helpers/calculateMiddleFooterTransforms'; -import windowSize from '../../util/windowSize'; -import { updateChat } from './chats'; -import { isSameReaction, isReactionChosen } from '../helpers'; -import { updateChatMessage } from './messages'; +import { isReactionChosen, isSameReaction } from '../helpers'; import { selectSendAs, selectTabState } from '../selectors'; +import { updateChat } from './chats'; +import { updateChatMessage } from './messages'; + import { getIsMobile } from '../../hooks/useAppLayout'; function getLeftColumnWidth(windowWidth: number) { diff --git a/src/global/reducers/settings.ts b/src/global/reducers/settings.ts index 03145ef32..0aa432f7b 100644 --- a/src/global/reducers/settings.ts +++ b/src/global/reducers/settings.ts @@ -1,8 +1,10 @@ -import type { GlobalState } from '../types'; -import type { - ISettings, IThemeSettings, ThemeKey, NotifyException, -} from '../../types'; import type { ApiNotifyException } from '../../api/types'; +import type { + ISettings, IThemeSettings, NotifyException, + ThemeKey, +} from '../../types'; +import type { GlobalState } from '../types'; + import { updateUserBlockedState } from './users'; export function replaceSettings(global: T, newSettings?: Partial): T { diff --git a/src/global/reducers/statistics.ts b/src/global/reducers/statistics.ts index c8480d995..3505fbdb2 100644 --- a/src/global/reducers/statistics.ts +++ b/src/global/reducers/statistics.ts @@ -1,10 +1,11 @@ -import type { GlobalState, TabArgs } from '../types'; import type { ApiChannelStatistics, ApiGroupStatistics, ApiMessageStatistics, StatisticsGraph, } from '../../api/types'; -import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; export function updateStatistics( global: T, chatId: string, statistics: ApiChannelStatistics | ApiGroupStatistics, diff --git a/src/global/reducers/stories.ts b/src/global/reducers/stories.ts index cc232884c..f8a42ce77 100644 --- a/src/global/reducers/stories.ts +++ b/src/global/reducers/stories.ts @@ -1,13 +1,15 @@ -import type { GlobalState, TabArgs } from '../types'; import type { - ApiUserStories, ApiStory, ApiStorySkipped, ApiStoryDeleted, ApiTypeStory, ApiStoryView, ApiStealthMode, + ApiStealthMode, + ApiStory, ApiStoryDeleted, ApiStorySkipped, ApiStoryView, ApiTypeStory, ApiUserStories, } from '../../api/types'; -import { orderBy, unique } from '../../util/iteratees'; -import { updateUser } from './users'; -import { selectTabState, selectUser, selectUserStories } from '../selectors'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; -import { updateTabState } from './tabs'; +import { orderBy, unique } from '../../util/iteratees'; import { getServerTime } from '../../util/serverTime'; +import { selectTabState, selectUser, selectUserStories } from '../selectors'; +import { updateTabState } from './tabs'; +import { updateUser } from './users'; export function addStories(global: T, newStoriesByUserId: Record): T { const updatedByUserId = Object.entries(newStoriesByUserId).reduce((acc, [userId, newUserStories]) => { diff --git a/src/global/reducers/symbols.ts b/src/global/reducers/symbols.ts index 28a20d5d4..9f49f53fa 100644 --- a/src/global/reducers/symbols.ts +++ b/src/global/reducers/symbols.ts @@ -1,9 +1,10 @@ -import type { GlobalState, TabArgs } from '../types'; import type { ApiSticker, ApiStickerSet, ApiVideo } from '../../api/types'; -import { buildCollectionByKey, unique } from '../../util/iteratees'; -import { selectTabState, selectCustomEmojiForEmoji, selectStickersForEmoji } from '../selectors'; -import { updateTabState } from './tabs'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { buildCollectionByKey, unique } from '../../util/iteratees'; +import { selectCustomEmojiForEmoji, selectStickersForEmoji, selectTabState } from '../selectors'; +import { updateTabState } from './tabs'; export function updateStickerSearch( global: T, diff --git a/src/global/reducers/tabs.ts b/src/global/reducers/tabs.ts index 1615ebffd..68e3f5ae0 100644 --- a/src/global/reducers/tabs.ts +++ b/src/global/reducers/tabs.ts @@ -1,4 +1,5 @@ -import type { GlobalState, TabState, TabArgs } from '../types'; +import type { GlobalState, TabArgs, TabState } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; export function updateTabState( diff --git a/src/global/reducers/translations.ts b/src/global/reducers/translations.ts index efb4c4309..9bd86e631 100644 --- a/src/global/reducers/translations.ts +++ b/src/global/reducers/translations.ts @@ -1,5 +1,5 @@ -import type { GlobalState, TabArgs, TranslatedMessage } from '../types'; import type { ApiFormattedText } from '../../api/types'; +import type { GlobalState, TabArgs, TranslatedMessage } from '../types'; import { getCurrentTabId } from '../../util/establishMultitabRole'; import { omit } from '../../util/iteratees'; diff --git a/src/global/reducers/users.ts b/src/global/reducers/users.ts index f0653142b..c7905cd46 100644 --- a/src/global/reducers/users.ts +++ b/src/global/reducers/users.ts @@ -1,13 +1,13 @@ -import type { GlobalState, TabArgs, TabState } from '../types'; import type { ApiUser, ApiUserFullInfo, ApiUserStatus } from '../../api/types'; +import type { GlobalState, TabArgs, TabState } from '../types'; +import { areDeepEqual } from '../../util/areDeepEqual'; +import { getCurrentTabId } from '../../util/establishMultitabRole'; import { omit, pick } from '../../util/iteratees'; import { MEMO_EMPTY_ARRAY } from '../../util/memo'; +import { selectTabState } from '../selectors'; import { updateChat } from './chats'; import { updateTabState } from './tabs'; -import { selectTabState } from '../selectors'; -import { getCurrentTabId } from '../../util/establishMultitabRole'; -import { areDeepEqual } from '../../util/areDeepEqual'; export function replaceUsers(global: T, newById: Record): T { return { diff --git a/src/global/selectors/calls.ts b/src/global/selectors/calls.ts index e2418b68a..71acc4be9 100644 --- a/src/global/selectors/calls.ts +++ b/src/global/selectors/calls.ts @@ -1,6 +1,7 @@ import type { GlobalState } from '../types'; -import { selectChat, selectChatFullInfo } from './chats'; + import { getMainUsername, isChatBasicGroup } from '../helpers'; +import { selectChat, selectChatFullInfo } from './chats'; import { selectUser } from './users'; export function selectChatGroupCall(global: T, chatId: string) { diff --git a/src/global/selectors/chats.ts b/src/global/selectors/chats.ts index 31ab62bf1..7bf07d7b5 100644 --- a/src/global/selectors/chats.ts +++ b/src/global/selectors/chats.ts @@ -1,26 +1,26 @@ -import type { ApiChatType, ApiChat, ApiChatFullInfo } from '../../api/types'; -import { MAIN_THREAD_ID } from '../../api/types'; +import type { ApiChat, ApiChatFullInfo, ApiChatType } from '../../api/types'; import type { GlobalState, TabArgs } from '../types'; +import { MAIN_THREAD_ID } from '../../api/types'; -import { - getPrivateChatUserId, - isChatChannel, - isUserId, - isHistoryClearMessage, - isUserBot, - isUserOnline, - getHasAdminRight, - isChatSuperGroup, -} from '../helpers'; -import { - selectBot, selectIsCurrentUserPremium, selectUser, selectUserFullInfo, -} from './users'; import { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID, MEMBERS_LOAD_SLICE, SERVICE_NOTIFICATIONS_USER_ID, } from '../../config'; -import { selectTabState } from './tabs'; import { getCurrentTabId } from '../../util/establishMultitabRole'; import { IS_TRANSLATION_SUPPORTED } from '../../util/windowEnvironment'; +import { + getHasAdminRight, + getPrivateChatUserId, + isChatChannel, + isChatSuperGroup, + isHistoryClearMessage, + isUserBot, + isUserId, + isUserOnline, +} from '../helpers'; +import { selectTabState } from './tabs'; +import { + selectBot, selectIsCurrentUserPremium, selectUser, selectUserFullInfo, +} from './users'; export function selectChat(global: T, chatId: string): ApiChat | undefined { return global.chats.byId[chatId]; diff --git a/src/global/selectors/globalSearch.ts b/src/global/selectors/globalSearch.ts index cf0472d34..84955eddb 100644 --- a/src/global/selectors/globalSearch.ts +++ b/src/global/selectors/globalSearch.ts @@ -1,6 +1,7 @@ import type { GlobalState, TabArgs } from '../types'; -import { selectTabState } from './tabs'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from './tabs'; export function selectCurrentGlobalSearchQuery( global: T, diff --git a/src/global/selectors/limits.ts b/src/global/selectors/limits.ts index 660536346..5fe6e0248 100644 --- a/src/global/selectors/limits.ts +++ b/src/global/selectors/limits.ts @@ -1,6 +1,7 @@ import type { ApiLimitType, GlobalState } from '../types'; -import { selectIsCurrentUserPremium } from './users'; + import { DEFAULT_LIMITS } from '../../config'; +import { selectIsCurrentUserPremium } from './users'; export function selectCurrentLimit(global: T, limit: ApiLimitType) { const { appConfig } = global; diff --git a/src/global/selectors/localSearch.ts b/src/global/selectors/localSearch.ts index 5d0c450d6..d94920747 100644 --- a/src/global/selectors/localSearch.ts +++ b/src/global/selectors/localSearch.ts @@ -1,8 +1,9 @@ import type { GlobalState, TabArgs } from '../types'; -import { selectCurrentMessageList } from './messages'; -import { buildChatThreadKey } from '../helpers'; -import { selectTabState } from './tabs'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { buildChatThreadKey } from '../helpers'; +import { selectCurrentMessageList } from './messages'; +import { selectTabState } from './tabs'; export function selectCurrentTextSearch( global: T, diff --git a/src/global/selectors/management.ts b/src/global/selectors/management.ts index 02acc540d..ad419d844 100644 --- a/src/global/selectors/management.ts +++ b/src/global/selectors/management.ts @@ -1,13 +1,13 @@ import type { GlobalState, TabArgs } from '../types'; -import { selectCurrentMessageList } from './messages'; -import { selectChat, selectIsChatWithSelf } from './chats'; +import { getCurrentTabId } from '../../util/establishMultitabRole'; import { getCanAddContact, isChatAdmin, isChatGroup, isUserBot, isUserId, } from '../helpers'; +import { selectChat, selectIsChatWithSelf } from './chats'; +import { selectCurrentMessageList } from './messages'; import { selectTabState } from './tabs'; -import { getCurrentTabId } from '../../util/establishMultitabRole'; import { selectUser } from './users'; export function selectManagement( diff --git a/src/global/selectors/messages.ts b/src/global/selectors/messages.ts index 2a9e6b3e2..427a1a810 100644 --- a/src/global/selectors/messages.ts +++ b/src/global/selectors/messages.ts @@ -1,6 +1,3 @@ -import type { - GlobalState, MessageListType, TabArgs, Thread, TabThread, ChatTranslatedMessages, -} from '../types'; import type { ApiChat, ApiMessage, @@ -9,24 +6,23 @@ import type { ApiStickerSetInfo, ApiUser, } from '../../api/types'; +import type { + ChatTranslatedMessages, + GlobalState, MessageListType, TabArgs, TabThread, Thread, +} from '../types'; import { ApiMessageEntityTypes, MAIN_THREAD_ID } from '../../api/types'; import { GENERAL_TOPIC_ID, REPLIES_USER_ID, SERVICE_NOTIFICATIONS_USER_ID, } from '../../config'; -import { IS_TRANSLATION_SUPPORTED } from '../../util/windowEnvironment'; +import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { findLast } from '../../util/iteratees'; import { MEMO_EMPTY_ARRAY } from '../../util/memo'; +import { getServerTime } from '../../util/serverTime'; +import { IS_TRANSLATION_SUPPORTED } from '../../util/windowEnvironment'; import { - selectChat, selectChatFullInfo, selectIsChatWithSelf, selectRequestedChatTranslationLanguage, -} from './chats'; -import { - selectBot, - selectIsCurrentUserPremium, - selectIsUserOrChatContact, - selectUser, - selectUserStatus, -} from './users'; -import { + canSendReaction, + getAllowedAttachmentOptions, getCanPostInChat, getHasAdminRight, getMessageAudio, @@ -45,21 +41,26 @@ import { isChatSuperGroup, isCommonBoxChat, isForwardedMessage, - isMessageLocal, + isLocalMessageId, isMessageFailed, isMessageLocal, + isMessageTranslatable, isOwnMessage, isServiceNotificationMessage, isUserId, isUserRightBanned, - canSendReaction, - getAllowedAttachmentOptions, - isLocalMessageId, isMessageFailed, isMessageTranslatable, } from '../helpers'; -import { findLast } from '../../util/iteratees'; -import { selectIsStickerFavorite } from './symbols'; -import { getServerTime } from '../../util/serverTime'; -import { selectTabState } from './tabs'; -import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { + selectChat, selectChatFullInfo, selectIsChatWithSelf, selectRequestedChatTranslationLanguage, +} from './chats'; import { selectUserStory } from './stories'; +import { selectIsStickerFavorite } from './symbols'; +import { selectTabState } from './tabs'; +import { + selectBot, + selectIsCurrentUserPremium, + selectIsUserOrChatContact, + selectUser, + selectUserStatus, +} from './users'; const MESSAGE_EDIT_ALLOWED_TIME = 172800; // 48 hours diff --git a/src/global/selectors/payments.ts b/src/global/selectors/payments.ts index c45096810..1003cc038 100644 --- a/src/global/selectors/payments.ts +++ b/src/global/selectors/payments.ts @@ -1,6 +1,7 @@ import type { GlobalState, TabArgs } from '../types'; -import { selectTabState } from './tabs'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from './tabs'; export function selectPaymentInputInvoice( global: T, diff --git a/src/global/selectors/statistics.ts b/src/global/selectors/statistics.ts index cb84f432b..d6fa06d5c 100644 --- a/src/global/selectors/statistics.ts +++ b/src/global/selectors/statistics.ts @@ -1,9 +1,9 @@ import type { GlobalState, TabArgs } from '../types'; -import { selectCurrentMessageList } from './messages'; -import { selectChatFullInfo } from './chats'; -import { selectTabState } from './tabs'; import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectChatFullInfo } from './chats'; +import { selectCurrentMessageList } from './messages'; +import { selectTabState } from './tabs'; export function selectStatistics( global: T, chatId: string, diff --git a/src/global/selectors/stories.ts b/src/global/selectors/stories.ts index 05636e85a..9500663d0 100644 --- a/src/global/selectors/stories.ts +++ b/src/global/selectors/stories.ts @@ -1,5 +1,6 @@ -import type { GlobalState, TabArgs } from '../types'; import type { ApiTypeStory, ApiUserStories } from '../../api/types'; +import type { GlobalState, TabArgs } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; import { selectTabState } from './tabs'; diff --git a/src/global/selectors/symbols.ts b/src/global/selectors/symbols.ts index 390b0d0b3..169e20c50 100644 --- a/src/global/selectors/symbols.ts +++ b/src/global/selectors/symbols.ts @@ -1,10 +1,10 @@ +import type { ApiSticker, ApiStickerSet, ApiStickerSetInfo } from '../../api/types'; import type { GlobalState, TabArgs } from '../types'; -import type { ApiStickerSetInfo, ApiSticker, ApiStickerSet } from '../../api/types'; import { RESTRICTED_EMOJI_SET_ID } from '../../config'; -import { selectIsCurrentUserPremium } from './users'; -import { selectTabState } from './tabs'; import { getCurrentTabId } from '../../util/establishMultitabRole'; +import { selectTabState } from './tabs'; +import { selectIsCurrentUserPremium } from './users'; export function selectIsStickerFavorite(global: T, sticker: ApiSticker) { const { stickers } = global.stickers.favorite; diff --git a/src/global/selectors/tabs.ts b/src/global/selectors/tabs.ts index 2373249b6..9844430d8 100644 --- a/src/global/selectors/tabs.ts +++ b/src/global/selectors/tabs.ts @@ -1,6 +1,8 @@ import type { - GlobalState, TabState, TabArgs, + GlobalState, TabArgs, + TabState, } from '../types'; + import { getCurrentTabId } from '../../util/establishMultitabRole'; export function selectTabState( diff --git a/src/global/selectors/ui.ts b/src/global/selectors/ui.ts index d8a3555c1..e822f4297 100644 --- a/src/global/selectors/ui.ts +++ b/src/global/selectors/ui.ts @@ -1,14 +1,14 @@ -import type { GlobalState, TabArgs } from '../types'; -import type { PerformanceTypeKey } from '../../types'; -import { NewChatMembersProgress, RightColumnContent } from '../../types'; import type { ApiMessage } from '../../api/types'; +import type { PerformanceTypeKey } from '../../types'; +import type { GlobalState, TabArgs } from '../types'; +import { NewChatMembersProgress, RightColumnContent } from '../../types'; -import { selectCurrentTextSearch } from './localSearch'; -import { selectIsStatisticsShown } from './statistics'; -import { selectCurrentManagement } from './management'; -import { selectTabState } from './tabs'; import { getCurrentTabId } from '../../util/establishMultitabRole'; import { getMessageVideo, getMessageWebPageVideo } from '../helpers'; +import { selectCurrentTextSearch } from './localSearch'; +import { selectCurrentManagement } from './management'; +import { selectIsStatisticsShown } from './statistics'; +import { selectTabState } from './tabs'; export function selectIsMediaViewerOpen( global: T, diff --git a/src/global/selectors/users.ts b/src/global/selectors/users.ts index c182b4dbb..fb086e743 100644 --- a/src/global/selectors/users.ts +++ b/src/global/selectors/users.ts @@ -1,7 +1,8 @@ -import type { GlobalState } from '../types'; import type { ApiChat, ApiUser, ApiUserFullInfo, ApiUserStatus, } from '../../api/types'; +import type { GlobalState } from '../types'; + import { isUserBot } from '../helpers'; export function selectUser(global: T, userId: string): ApiUser | undefined { diff --git a/src/global/types.ts b/src/global/types.ts index 8fb4d367b..41af1c31b 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -8,6 +8,9 @@ import type { ApiChatAdminRights, ApiChatBannedRights, ApiChatFolder, + ApiChatFullInfo, + ApiChatlistExportedInvite, + ApiChatlistInvite, ApiChatReactions, ApiChatType, ApiConfig, @@ -17,6 +20,7 @@ import type { ApiError, ApiExportedInvite, ApiFormattedText, + ApiGeoPoint, ApiGlobalMessageSearchType, ApiGroupCall, ApiGroupStatistics, @@ -42,9 +46,11 @@ import type { ApiSession, ApiSessionData, ApiSponsoredMessage, + ApiStealthMode, ApiSticker, ApiStickerSet, ApiStickerSetInfo, + ApiStoryView, ApiThemeParameters, ApiThreadInfo, ApiTranscription, @@ -53,20 +59,18 @@ import type { ApiUpdateAuthorizationStateType, ApiUpdateConnectionStateType, ApiUser, + ApiUserFullInfo, ApiUserStatus, + ApiUserStories, ApiVideo, ApiWallpaper, ApiWebPage, ApiWebSession, - ApiUserFullInfo, - ApiChatFullInfo, - ApiChatlistInvite, - ApiChatlistExportedInvite, - ApiUserStories, - ApiStoryView, - ApiStealthMode, - ApiGeoPoint, } from '../api/types'; +import type { ApiCredentials } from '../components/payment/PaymentModal'; +import type { FoldersActions } from '../hooks/reducers/useFoldersReducer'; +import type { ReducerAction } from '../hooks/useReducer'; +import type { P2pMessage } from '../lib/secret-sauce'; import type { ApiInvoiceContainer, ApiPrivacyKey, @@ -92,17 +96,13 @@ import type { PerformanceType, PrivacyVisibility, ProfileEditProgress, + ProfileTabType, SettingsScreens, SharedMediaType, ShippingOption, - ThemeKey, - ProfileTabType, StoryViewerOrigin, + ThemeKey, } from '../types'; -import type { P2pMessage } from '../lib/secret-sauce'; -import type { ApiCredentials } from '../components/payment/PaymentModal'; -import type { FoldersActions } from '../hooks/reducers/useFoldersReducer'; -import type { ReducerAction } from '../hooks/useReducer'; export type MessageListType = 'thread' diff --git a/src/hooks/media/useUnsupportedMedia.ts b/src/hooks/media/useUnsupportedMedia.ts index 1dff92098..dea24b884 100644 --- a/src/hooks/media/useUnsupportedMedia.ts +++ b/src/hooks/media/useUnsupportedMedia.ts @@ -1,8 +1,9 @@ import { useEffect, useState } from '../../lib/teact/teact'; import { getActions } from '../../global'; -import useLastCallback from '../useLastCallback'; -import useLang from '../useLang'; + import { IS_MOBILE } from '../../util/windowEnvironment'; +import useLang from '../useLang'; +import useLastCallback from '../useLastCallback'; const NOTIFICATION_DURATION = 8000; diff --git a/src/hooks/reducers/useFoldersReducer.ts b/src/hooks/reducers/useFoldersReducer.ts index c1924df8b..a2771cd69 100644 --- a/src/hooks/reducers/useFoldersReducer.ts +++ b/src/hooks/reducers/useFoldersReducer.ts @@ -1,8 +1,8 @@ -import type { StateReducer, Dispatch } from '../useReducer'; import type { ApiChatFolder } from '../../api/types'; import type { IconName } from '../../types/icons'; +import type { Dispatch, StateReducer } from '../useReducer'; -import { pick, omit } from '../../util/iteratees'; +import { omit, pick } from '../../util/iteratees'; import useReducer from '../useReducer'; export type FolderChatType = { diff --git a/src/hooks/reducers/usePaymentReducer.ts b/src/hooks/reducers/usePaymentReducer.ts index e38fede47..a0a45ec71 100644 --- a/src/hooks/reducers/usePaymentReducer.ts +++ b/src/hooks/reducers/usePaymentReducer.ts @@ -1,4 +1,5 @@ -import type { StateReducer, Dispatch } from '../useReducer'; +import type { Dispatch, StateReducer } from '../useReducer'; + import useReducer from '../useReducer'; export type FormState = { diff --git a/src/hooks/reducers/useTwoFaReducer.ts b/src/hooks/reducers/useTwoFaReducer.ts index 5a70f7fc4..6cb96cc61 100644 --- a/src/hooks/reducers/useTwoFaReducer.ts +++ b/src/hooks/reducers/useTwoFaReducer.ts @@ -1,4 +1,5 @@ -import type { StateReducer, Dispatch } from '../useReducer'; +import type { Dispatch, StateReducer } from '../useReducer'; + import useReducer from '../useReducer'; export type TwoFaActions = ( diff --git a/src/hooks/scroll/useTopOverscroll.tsx b/src/hooks/scroll/useTopOverscroll.tsx index a67a5e6ac..a683e332c 100644 --- a/src/hooks/scroll/useTopOverscroll.tsx +++ b/src/hooks/scroll/useTopOverscroll.tsx @@ -1,11 +1,10 @@ import React, { useEffect, useRef } from '../../lib/teact/teact'; + import { forceMutation, requestMutation } from '../../lib/fasterdom/fasterdom'; - -import { IS_IOS, IS_SAFARI } from '../../util/windowEnvironment'; import { stopScrollInertia } from '../../util/resetScroll'; - -import useLastCallback from '../useLastCallback'; +import { IS_IOS, IS_SAFARI } from '../../util/windowEnvironment'; import useDebouncedCallback from '../useDebouncedCallback'; +import useLastCallback from '../useLastCallback'; const MOUSE_WHEEL_DEBOUNCE = 250; const TRIGGER_HEIGHT = 1; diff --git a/src/hooks/stickers/useColorFilter.ts b/src/hooks/stickers/useColorFilter.ts index ac1072fb2..0eb400afc 100644 --- a/src/hooks/stickers/useColorFilter.ts +++ b/src/hooks/stickers/useColorFilter.ts @@ -1,4 +1,5 @@ import { useEffect } from '../../lib/teact/teact'; + import { hexToRgb } from '../../util/switchTheme'; const SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; diff --git a/src/hooks/stickers/useDynamicColorListener.ts b/src/hooks/stickers/useDynamicColorListener.ts index feda5dab3..d055256f7 100644 --- a/src/hooks/stickers/useDynamicColorListener.ts +++ b/src/hooks/stickers/useDynamicColorListener.ts @@ -1,6 +1,6 @@ import { useEffect, useLayoutEffect, useState } from '../../lib/teact/teact'; -import { getPropertyHexColor } from '../../util/themeStyle'; +import { getPropertyHexColor } from '../../util/themeStyle'; import useLastCallback from '../useLastCallback'; import useResizeObserver from '../useResizeObserver'; diff --git a/src/hooks/useAppLayout.ts b/src/hooks/useAppLayout.ts index 62ede8d39..1f0f0422f 100644 --- a/src/hooks/useAppLayout.ts +++ b/src/hooks/useAppLayout.ts @@ -1,13 +1,13 @@ +import { useEffect } from '../lib/teact/teact'; + import { MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN, MOBILE_SCREEN_LANDSCAPE_MAX_HEIGHT, MOBILE_SCREEN_LANDSCAPE_MAX_WIDTH, MOBILE_SCREEN_MAX_WIDTH, } from '../config'; -import { useEffect } from '../lib/teact/teact'; - -import { IS_IOS } from '../util/windowEnvironment'; import { createCallbackManager } from '../util/callbacks'; +import { IS_IOS } from '../util/windowEnvironment'; import { updateSizes } from '../util/windowSize'; import useForceUpdate from './useForceUpdate'; diff --git a/src/hooks/useAsyncResolvers.ts b/src/hooks/useAsyncResolvers.ts index a63b79155..4b162f082 100644 --- a/src/hooks/useAsyncResolvers.ts +++ b/src/hooks/useAsyncResolvers.ts @@ -1,9 +1,9 @@ -import type { Signal } from '../util/signals'; import type { Scheduler } from '../util/schedulers'; +import type { Signal } from '../util/signals'; -import useThrottledCallback from './useThrottledCallback'; import useDebouncedCallback from './useDebouncedCallback'; import useDerivedSignal from './useDerivedSignal'; +import useThrottledCallback from './useThrottledCallback'; export function useThrottledResolver( resolver: () => T, diff --git a/src/hooks/useAudioPlayer.ts b/src/hooks/useAudioPlayer.ts index c1f6ba766..8350ba9f4 100644 --- a/src/hooks/useAudioPlayer.ts +++ b/src/hooks/useAudioPlayer.ts @@ -1,19 +1,19 @@ import { useEffect, useRef, useState } from '../lib/teact/teact'; import { getActions, getGlobal } from '../global'; -import { PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION } from '../config'; import type { Track, TrackId } from '../util/audioPlayer'; -import { register } from '../util/audioPlayer'; -import { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio'; import type { MediaSessionHandlers } from '../util/mediaSession'; + +import { PLAYBACK_RATE_FOR_AUDIO_MIN_DURATION } from '../config'; +import { selectTabState } from '../global/selectors'; +import { register } from '../util/audioPlayer'; import { registerMediaSession, setPlaybackState, setPositionState, updateMetadata, } from '../util/mediaSession'; -import { selectTabState } from '../global/selectors'; - +import { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio'; import useEffectWithPrevDeps from './useEffectWithPrevDeps'; -import useSyncEffect from './useSyncEffect'; import useLastCallback from './useLastCallback'; +import useSyncEffect from './useSyncEffect'; type Handler = (e: Event) => void; diff --git a/src/hooks/useBeforeUnload.ts b/src/hooks/useBeforeUnload.ts index 6e0eceee8..89914ef2c 100644 --- a/src/hooks/useBeforeUnload.ts +++ b/src/hooks/useBeforeUnload.ts @@ -1,7 +1,6 @@ import { useEffect } from '../lib/teact/teact'; import { onBeforeUnload } from '../util/schedulers'; - import useLastCallback from './useLastCallback'; export default function useBeforeUnload(callback: AnyToVoidFunction) { diff --git a/src/hooks/useBlurSync.ts b/src/hooks/useBlurSync.ts index 3e0baa5a4..a3b7747a1 100644 --- a/src/hooks/useBlurSync.ts +++ b/src/hooks/useBlurSync.ts @@ -1,9 +1,9 @@ import { useRef } from '../lib/teact/teact'; import fastBlur from '../lib/fastBlur'; -import useSyncEffect from './useSyncEffect'; -import useBlur from './useBlur'; import { imgToCanvas } from '../util/files'; +import useBlur from './useBlur'; +import useSyncEffect from './useSyncEffect'; const RADIUS = 2; const ITERATIONS = 2; diff --git a/src/hooks/useBuffering.ts b/src/hooks/useBuffering.ts index 086873531..38a4be09c 100644 --- a/src/hooks/useBuffering.ts +++ b/src/hooks/useBuffering.ts @@ -1,9 +1,9 @@ import type React from '../lib/teact/teact'; import { useMemo, useState } from '../lib/teact/teact'; -import { debounce } from '../util/schedulers'; -import { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio'; -import { areDeepEqual } from '../util/areDeepEqual'; +import { areDeepEqual } from '../util/areDeepEqual'; +import { isSafariPatchInProgress } from '../util/patchSafariProgressiveAudio'; +import { debounce } from '../util/schedulers'; import useLastCallback from './useLastCallback'; type BufferingEvent = (e: Event | React.SyntheticEvent) => void; diff --git a/src/hooks/useCanvasBlur.ts b/src/hooks/useCanvasBlur.ts index 9027d8003..73183e208 100644 --- a/src/hooks/useCanvasBlur.ts +++ b/src/hooks/useCanvasBlur.ts @@ -1,8 +1,8 @@ import { useEffect, useRef } from '../lib/teact/teact'; -import { requestMeasure, requestMutation } from '../lib/fasterdom/fasterdom'; -import { IS_CANVAS_FILTER_SUPPORTED } from '../util/windowEnvironment'; import fastBlur from '../lib/fastBlur'; +import { requestMeasure, requestMutation } from '../lib/fasterdom/fasterdom'; +import { IS_CANVAS_FILTER_SUPPORTED } from '../util/windowEnvironment'; import useSyncEffect from './useSyncEffect'; const RADIUS = 2; diff --git a/src/hooks/useChatContextActions.ts b/src/hooks/useChatContextActions.ts index 2af123b83..d6e85b39e 100644 --- a/src/hooks/useChatContextActions.ts +++ b/src/hooks/useChatContextActions.ts @@ -4,12 +4,13 @@ import { getActions } from '../global'; import type { ApiChat, ApiUser } from '../api/types'; import type { MenuItemContextAction } from '../components/ui/ListItem'; -import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../util/windowEnvironment'; import { IS_ELECTRON, SERVICE_NOTIFICATIONS_USER_ID } from '../config'; import { - isChatArchived, getCanDeleteChat, isUserId, isChatChannel, isChatGroup, + getCanDeleteChat, isChatArchived, isChatChannel, isChatGroup, + isUserId, } from '../global/helpers'; import { compact } from '../util/iteratees'; +import { IS_OPEN_IN_NEW_TAB_SUPPORTED } from '../util/windowEnvironment'; import useLang from './useLang'; const useChatContextActions = ({ diff --git a/src/hooks/useConnectionStatus.ts b/src/hooks/useConnectionStatus.ts index d1f070583..dffa8a3f2 100644 --- a/src/hooks/useConnectionStatus.ts +++ b/src/hooks/useConnectionStatus.ts @@ -1,7 +1,7 @@ import type { GlobalState } from '../global/types'; +import type { LangFn } from './useLang'; import useBrowserOnline from './useBrowserOnline'; -import type { LangFn } from './useLang'; export enum ConnectionStatus { waitingForNetwork, diff --git a/src/hooks/useContextMenuHandlers.ts b/src/hooks/useContextMenuHandlers.ts index 224524ace..ef368e6d1 100644 --- a/src/hooks/useContextMenuHandlers.ts +++ b/src/hooks/useContextMenuHandlers.ts @@ -1,12 +1,14 @@ import type { RefObject } from 'react'; -import type { Signal } from '../util/signals'; -import { useState, useEffect } from '../lib/teact/teact'; +import { useEffect, useState } from '../lib/teact/teact'; import { addExtraClass, removeExtraClass } from '../lib/teact/teact-dom'; -import { requestMutation } from '../lib/fasterdom/fasterdom'; import type { IAnchorPosition } from '../types'; +import type { Signal } from '../util/signals'; + +import { requestMutation } from '../lib/fasterdom/fasterdom'; import { - IS_TOUCH_ENV, IS_PWA, IS_IOS, + IS_IOS, + IS_PWA, IS_TOUCH_ENV, } from '../util/windowEnvironment'; import useLastCallback from './useLastCallback'; diff --git a/src/hooks/useCoordsInSharedCanvas.ts b/src/hooks/useCoordsInSharedCanvas.ts index cfc8b5d94..ae72990ab 100644 --- a/src/hooks/useCoordsInSharedCanvas.ts +++ b/src/hooks/useCoordsInSharedCanvas.ts @@ -3,11 +3,10 @@ import { } from '../lib/teact/teact'; import { round } from '../util/math'; - import useLastCallback from './useLastCallback'; import useResizeObserver from './useResizeObserver'; -import useThrottledCallback from './useThrottledCallback'; import useSharedIntersectionObserver from './useSharedIntersectionObserver'; +import useThrottledCallback from './useThrottledCallback'; const THROTTLE_MS = 150; diff --git a/src/hooks/useCurrentTimeSignal.ts b/src/hooks/useCurrentTimeSignal.ts index f936ba8fa..a5d6f1979 100644 --- a/src/hooks/useCurrentTimeSignal.ts +++ b/src/hooks/useCurrentTimeSignal.ts @@ -1,6 +1,7 @@ -import { createSignal } from '../util/signals'; import { useEffect } from '../lib/teact/teact'; +import { createSignal } from '../util/signals'; + export const [getCurrentTime, setCurrentTime] = createSignal(0); export default function useCurrentTimeSignal() { diff --git a/src/hooks/useDebouncedMemo.ts b/src/hooks/useDebouncedMemo.ts index 65e7d3209..a340984e0 100644 --- a/src/hooks/useDebouncedMemo.ts +++ b/src/hooks/useDebouncedMemo.ts @@ -1,9 +1,9 @@ import { useCallback, useRef, useState } from '../lib/teact/teact'; +import useForceUpdate from './useForceUpdate'; +import useHeavyAnimationCheck, { isHeavyAnimating } from './useHeavyAnimationCheck'; import useRunDebounced from './useRunDebounced'; import useSyncEffect from './useSyncEffect'; -import useHeavyAnimationCheck, { isHeavyAnimating } from './useHeavyAnimationCheck'; -import useForceUpdate from './useForceUpdate'; export default function useDebouncedMemo( resolverFn: () => R, ms: number, dependencies: D, diff --git a/src/hooks/useDerivedSignal.ts b/src/hooks/useDerivedSignal.ts index c00498485..5fe38b720 100644 --- a/src/hooks/useDerivedSignal.ts +++ b/src/hooks/useDerivedSignal.ts @@ -1,9 +1,9 @@ import type { Signal } from '../util/signals'; -import useSyncEffect from './useSyncEffect'; import useSignal from './useSignal'; -import { useStateRef } from './useStateRef'; import { useSignalEffect } from './useSignalEffect'; +import { useStateRef } from './useStateRef'; +import useSyncEffect from './useSyncEffect'; type SyncResolver = () => T; type AsyncResolver = (setter: (newValue: T) => void) => void; diff --git a/src/hooks/useDerivedState.ts b/src/hooks/useDerivedState.ts index cd5f6ed66..cf9a77be2 100644 --- a/src/hooks/useDerivedState.ts +++ b/src/hooks/useDerivedState.ts @@ -3,9 +3,9 @@ import { useRef } from '../lib/teact/teact'; import type { Signal } from '../util/signals'; import useForceUpdate from './useForceUpdate'; -import useSyncEffect from './useSyncEffect'; -import { useStateRef } from './useStateRef'; import { useSignalEffect } from './useSignalEffect'; +import { useStateRef } from './useStateRef'; +import useSyncEffect from './useSyncEffect'; type SyncResolver = () => T; type AsyncResolver = (setter: (newValue: T) => void) => void; diff --git a/src/hooks/useElectronDrag.ts b/src/hooks/useElectronDrag.ts index 9d84cd524..782c1daaf 100644 --- a/src/hooks/useElectronDrag.ts +++ b/src/hooks/useElectronDrag.ts @@ -1,5 +1,6 @@ import type { RefObject } from 'react'; import { useEffect, useRef } from '../lib/teact/teact'; + import { IS_ELECTRON } from '../config'; import { IS_MAC_OS } from '../util/windowEnvironment'; diff --git a/src/hooks/useEnsureCustomEmoji.ts b/src/hooks/useEnsureCustomEmoji.ts index a9800c7a7..be902324b 100644 --- a/src/hooks/useEnsureCustomEmoji.ts +++ b/src/hooks/useEnsureCustomEmoji.ts @@ -1,6 +1,6 @@ import { getActions, getGlobal } from '../global'; -import { addCustomEmojiInputRenderCallback } from '../util/customEmojiManager'; +import { addCustomEmojiInputRenderCallback } from '../util/customEmojiManager'; import { throttle } from '../util/schedulers'; let LOAD_QUEUE = new Set(); diff --git a/src/hooks/useFocusAfterAnimation.tsx b/src/hooks/useFocusAfterAnimation.tsx index b7925ceba..8954024e1 100644 --- a/src/hooks/useFocusAfterAnimation.tsx +++ b/src/hooks/useFocusAfterAnimation.tsx @@ -1,9 +1,9 @@ import type { RefObject } from 'react'; -import { requestMutation } from '../lib/fasterdom/fasterdom'; - -import { IS_TOUCH_ENV } from '../util/windowEnvironment'; import { useEffect } from '../lib/teact/teact'; +import { requestMutation } from '../lib/fasterdom/fasterdom'; +import { IS_TOUCH_ENV } from '../util/windowEnvironment'; + const DEFAULT_DURATION = 400; export default function useFocusAfterAnimation( diff --git a/src/hooks/useFolderManager.ts b/src/hooks/useFolderManager.ts index 435f73eb4..8f7a9ebf3 100644 --- a/src/hooks/useFolderManager.ts +++ b/src/hooks/useFolderManager.ts @@ -1,12 +1,12 @@ import { useEffect } from '../lib/teact/teact'; import { - getOrderedIds, - getUnreadCounters, - getChatsCount, + addChatsCountCallback, addOrderedIdsCallback, addUnreadCountersCallback, - addChatsCountCallback, + getChatsCount, + getOrderedIds, + getUnreadCounters, } from '../util/folderManager'; import useForceUpdate from './useForceUpdate'; diff --git a/src/hooks/useForumPanelRender.ts b/src/hooks/useForumPanelRender.ts index d5040b171..6f2ab6b70 100644 --- a/src/hooks/useForumPanelRender.ts +++ b/src/hooks/useForumPanelRender.ts @@ -1,7 +1,7 @@ import { useRef } from '../lib/teact/teact'; -import useLastCallback from './useLastCallback'; import useForceUpdate from './useForceUpdate'; +import useLastCallback from './useLastCallback'; import useSyncEffect from './useSyncEffect'; export default function useForumPanelRender(isForumPanelOpen = false) { diff --git a/src/hooks/useFullscreen.ts b/src/hooks/useFullscreen.ts index 8a368c778..d5bb1907e 100644 --- a/src/hooks/useFullscreen.ts +++ b/src/hooks/useFullscreen.ts @@ -1,8 +1,9 @@ -import { useLayoutEffect, useState, useEffect } from '../lib/teact/teact'; -import { IS_IOS } from '../util/windowEnvironment'; +import { useEffect, useLayoutEffect, useState } from '../lib/teact/teact'; import { ElectronEvent } from '../types/electron'; +import { IS_IOS } from '../util/windowEnvironment'; + type RefType = { current: HTMLVideoElement | null; }; diff --git a/src/hooks/useHeavyAnimationCheck.ts b/src/hooks/useHeavyAnimationCheck.ts index 4087b3e99..d69e5f3f4 100644 --- a/src/hooks/useHeavyAnimationCheck.ts +++ b/src/hooks/useHeavyAnimationCheck.ts @@ -1,7 +1,6 @@ import { useEffect } from '../lib/teact/teact'; import { createCallbackManager } from '../util/callbacks'; - import useLastCallback from './useLastCallback'; // Make sure to end even if end callback was not called (which was some hardly-reproducible bug) diff --git a/src/hooks/useHistoryBack.ts b/src/hooks/useHistoryBack.ts index 69dc5f6fe..e8229fc85 100644 --- a/src/hooks/useHistoryBack.ts +++ b/src/hooks/useHistoryBack.ts @@ -1,13 +1,12 @@ import { useCallback, useRef } from '../lib/teact/teact'; import { getActions } from '../lib/teact/teactn'; -import { requestMeasure } from '../lib/fasterdom/fasterdom'; import { IS_TEST } from '../config'; +import { requestMeasure } from '../lib/fasterdom/fasterdom'; import { IS_IOS } from '../util/windowEnvironment'; - -import useSyncEffect from './useSyncEffect'; import useEffectOnce from './useEffectOnce'; import useLastCallback from './useLastCallback'; +import useSyncEffect from './useSyncEffect'; const PATH_BASE = `${window.location.pathname}${window.location.search}`; // Carefully selected by swiping and observing visual changes diff --git a/src/hooks/useHotkeys.ts b/src/hooks/useHotkeys.ts index 427e6898c..756fd780c 100644 --- a/src/hooks/useHotkeys.ts +++ b/src/hooks/useHotkeys.ts @@ -1,6 +1,7 @@ import { useEffect } from '../lib/teact/teact'; -import { getHotkeyMatcher } from '../util/parseHotkey'; + import { createCallbackManager } from '../util/callbacks'; +import { getHotkeyMatcher } from '../util/parseHotkey'; const IGNORE_TAGS = new Set(['INPUT', 'TEXTAREA', 'SELECT']); diff --git a/src/hooks/useInfiniteScroll.ts b/src/hooks/useInfiniteScroll.ts index 746829688..b2c667ae6 100644 --- a/src/hooks/useInfiniteScroll.ts +++ b/src/hooks/useInfiniteScroll.ts @@ -1,10 +1,10 @@ import { useRef } from '../lib/teact/teact'; + import { LoadMoreDirection } from '../types'; import { areSortedArraysEqual } from '../util/iteratees'; - -import useLastCallback from './useLastCallback'; import useForceUpdate from './useForceUpdate'; +import useLastCallback from './useLastCallback'; import usePrevious from './usePrevious'; type GetMore = (args: { direction: LoadMoreDirection }) => void; diff --git a/src/hooks/useInputFocusOnOpen.ts b/src/hooks/useInputFocusOnOpen.ts index 48d047a6c..4ae63597b 100644 --- a/src/hooks/useInputFocusOnOpen.ts +++ b/src/hooks/useInputFocusOnOpen.ts @@ -1,7 +1,7 @@ import type { RefObject } from 'react'; import { useEffect } from '../lib/teact/teact'; -import { requestMutation } from '../lib/fasterdom/fasterdom'; +import { requestMutation } from '../lib/fasterdom/fasterdom'; import useAppLayout from './useAppLayout'; // Focus slows down animation, also it breaks transition layout in Chrome diff --git a/src/hooks/useIntersectionObserver.ts b/src/hooks/useIntersectionObserver.ts index 661b000c8..82ceebcdc 100644 --- a/src/hooks/useIntersectionObserver.ts +++ b/src/hooks/useIntersectionObserver.ts @@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from '../lib/teact/teact'; import type { Scheduler } from '../util/schedulers'; import { - throttle, debounce, throttleWith, + debounce, throttle, throttleWith, } from '../util/schedulers'; import useHeavyAnimationCheck from './useHeavyAnimationCheck'; import useLastCallback from './useLastCallback'; diff --git a/src/hooks/useKeyboardListNavigation.ts b/src/hooks/useKeyboardListNavigation.ts index 09685ecd8..bc0b07a9d 100644 --- a/src/hooks/useKeyboardListNavigation.ts +++ b/src/hooks/useKeyboardListNavigation.ts @@ -1,5 +1,5 @@ import type { RefObject } from 'react'; -import { useState, useEffect } from '../lib/teact/teact'; +import { useEffect, useState } from '../lib/teact/teact'; import useLastCallback from './useLastCallback'; diff --git a/src/hooks/useLang.ts b/src/hooks/useLang.ts index d9516fe5e..7db0f3b1a 100644 --- a/src/hooks/useLang.ts +++ b/src/hooks/useLang.ts @@ -1,7 +1,6 @@ import * as langProvider from '../util/langProvider'; - -import useForceUpdate from './useForceUpdate'; import useEffectOnce from './useEffectOnce'; +import useForceUpdate from './useForceUpdate'; export type LangFn = langProvider.LangFn; diff --git a/src/hooks/useMediaWithLoadProgress.ts b/src/hooks/useMediaWithLoadProgress.ts index 83644e9f9..215764e6d 100644 --- a/src/hooks/useMediaWithLoadProgress.ts +++ b/src/hooks/useMediaWithLoadProgress.ts @@ -2,10 +2,11 @@ import { useEffect, useMemo, useRef, useState, } from '../lib/teact/teact'; -import { IS_PROGRESSIVE_SUPPORTED } from '../util/windowEnvironment'; import { ApiMediaFormat } from '../api/types'; -import { throttle } from '../util/schedulers'; + import * as mediaLoader from '../util/mediaLoader'; +import { throttle } from '../util/schedulers'; +import { IS_PROGRESSIVE_SUPPORTED } from '../util/windowEnvironment'; import useForceUpdate from './useForceUpdate'; import useUniqueId from './useUniqueId'; diff --git a/src/hooks/useMenuPosition.ts b/src/hooks/useMenuPosition.ts index c61e25347..74571685f 100644 --- a/src/hooks/useMenuPosition.ts +++ b/src/hooks/useMenuPosition.ts @@ -1,4 +1,5 @@ -import { useState, useEffect } from '../lib/teact/teact'; +import { useEffect, useState } from '../lib/teact/teact'; + import type { IAnchorPosition } from '../types'; interface Layout { diff --git a/src/hooks/useMessageMediaMetadata.ts b/src/hooks/useMessageMediaMetadata.ts index 07a0868c0..eeebe8351 100644 --- a/src/hooks/useMessageMediaMetadata.ts +++ b/src/hooks/useMessageMediaMetadata.ts @@ -7,13 +7,12 @@ import type { import { getAudioHasCover, getChatAvatarHash, getChatTitle, getMessageContent, getMessageMediaHash, getSenderTitle, } from '../global/helpers'; +import { resizeImage, scaleImage } from '../util/imageResize'; import { buildMediaMetadata } from '../util/mediaSession'; -import { scaleImage, resizeImage } from '../util/imageResize'; import { AVATAR_FULL_DIMENSIONS } from '../components/common/helpers/mediaDimensions'; - +import useAsync from './useAsync'; import useLang from './useLang'; import useMedia from './useMedia'; -import useAsync from './useAsync'; import telegramLogoPath from '../assets/telegram-logo-filled.svg'; diff --git a/src/hooks/useModuleLoader.ts b/src/hooks/useModuleLoader.ts index 14c9fbf27..55426ef37 100644 --- a/src/hooks/useModuleLoader.ts +++ b/src/hooks/useModuleLoader.ts @@ -1,8 +1,8 @@ import { useEffect } from '../lib/teact/teact'; import type { BundleModules, Bundles } from '../util/moduleLoader'; -import { getModuleFromMemory, loadModule, addLoadListener } from '../util/moduleLoader'; +import { addLoadListener, getModuleFromMemory, loadModule } from '../util/moduleLoader'; import useForceUpdate from './useForceUpdate'; const useModuleLoader = >( diff --git a/src/hooks/useMouseInside.ts b/src/hooks/useMouseInside.ts index 400887fa6..00c8d6ec2 100644 --- a/src/hooks/useMouseInside.ts +++ b/src/hooks/useMouseInside.ts @@ -1,7 +1,6 @@ import { useEffect, useRef } from '../lib/teact/teact'; import { IS_TOUCH_ENV } from '../util/windowEnvironment'; - import useLastCallback from './useLastCallback'; const MENU_CLOSE_TIMEOUT = 250; diff --git a/src/hooks/useNativeCopySelectedMessages.ts b/src/hooks/useNativeCopySelectedMessages.ts index f05544707..2edc09145 100644 --- a/src/hooks/useNativeCopySelectedMessages.ts +++ b/src/hooks/useNativeCopySelectedMessages.ts @@ -1,5 +1,5 @@ -import { useHotkeys } from './useHotkeys'; import getMessageIdsForSelectedText from '../util/getMessageIdsForSelectedText'; +import { useHotkeys } from './useHotkeys'; const useNativeCopySelectedMessages = (copyMessagesByIds: ({ messageIds }: { messageIds?: number[] }) => void) => { function handleCopy(e: KeyboardEvent) { diff --git a/src/hooks/usePictureInPicture.ts b/src/hooks/usePictureInPicture.ts index d20c24379..600169916 100644 --- a/src/hooks/usePictureInPicture.ts +++ b/src/hooks/usePictureInPicture.ts @@ -1,8 +1,9 @@ -import { useLayoutEffect, useCallback, useState } from '../lib/teact/teact'; +import { useCallback, useLayoutEffect, useState } from '../lib/teact/teact'; + import { DEBUG } from '../config'; -import { IS_IOS, IS_PWA } from '../util/windowEnvironment'; import safePlay, { getIsVideoPlaying } from '../util/safePlay'; import { createSignal } from '../util/signals'; +import { IS_IOS, IS_PWA } from '../util/windowEnvironment'; type RefType = { current: HTMLVideoElement | null; diff --git a/src/hooks/usePrevDuringAnimation.ts b/src/hooks/usePrevDuringAnimation.ts index ce7cef04f..31cfb51a8 100644 --- a/src/hooks/usePrevDuringAnimation.ts +++ b/src/hooks/usePrevDuringAnimation.ts @@ -1,7 +1,7 @@ import { useRef } from '../lib/teact/teact'; -import usePrevious from './usePrevious'; import useForceUpdate from './useForceUpdate'; +import usePrevious from './usePrevious'; import useSyncEffect from './useSyncEffect'; export default function usePrevDuringAnimation(current: T, duration?: number) { diff --git a/src/hooks/usePreventPinchZoomGesture.ts b/src/hooks/usePreventPinchZoomGesture.ts index 4ed5f883a..c63965e71 100644 --- a/src/hooks/usePreventPinchZoomGesture.ts +++ b/src/hooks/usePreventPinchZoomGesture.ts @@ -1,4 +1,5 @@ import { useEffect } from '../lib/teact/teact'; + import { IS_IOS, IS_PWA, IS_TOUCH_ENV } from '../util/windowEnvironment'; const metaViewport = document.querySelector('meta[name="viewport"]'); diff --git a/src/hooks/usePriorityPlaybackCheck.ts b/src/hooks/usePriorityPlaybackCheck.ts index 27c6e6828..3f9383a4f 100644 --- a/src/hooks/usePriorityPlaybackCheck.ts +++ b/src/hooks/usePriorityPlaybackCheck.ts @@ -1,7 +1,6 @@ import { useEffect } from '../lib/teact/teact'; import { createCallbackManager } from '../util/callbacks'; - import useLastCallback from './useLastCallback'; const startCallbacks = createCallbackManager(); diff --git a/src/hooks/useResize.ts b/src/hooks/useResize.ts index f58ab410e..572721ab9 100644 --- a/src/hooks/useResize.ts +++ b/src/hooks/useResize.ts @@ -1,9 +1,9 @@ import type { RefObject } from 'react'; -import { useState, useEffect, useLayoutEffect } from '../lib/teact/teact'; -import { requestMutation } from '../lib/fasterdom/fasterdom'; +import { useEffect, useLayoutEffect, useState } from '../lib/teact/teact'; -import useLastCallback from './useLastCallback'; +import { requestMutation } from '../lib/fasterdom/fasterdom'; import useFlag from './useFlag'; +import useLastCallback from './useLastCallback'; export function useResize( elementRef: RefObject, diff --git a/src/hooks/useSchedule.tsx b/src/hooks/useSchedule.tsx index af5ee1065..9b376914d 100644 --- a/src/hooks/useSchedule.tsx +++ b/src/hooks/useSchedule.tsx @@ -3,9 +3,8 @@ import React, { useState } from '../lib/teact/teact'; import { SCHEDULED_WHEN_ONLINE } from '../config'; import { getDayStartAt } from '../util/dateFormat'; import { getServerTimeOffset } from '../util/serverTime'; - -import useLastCallback from './useLastCallback'; import useLang from './useLang'; +import useLastCallback from './useLastCallback'; import CalendarModal from '../components/common/CalendarModal.async'; diff --git a/src/hooks/useSelectorSignal.ts b/src/hooks/useSelectorSignal.ts index 497dd2c0c..58a692369 100644 --- a/src/hooks/useSelectorSignal.ts +++ b/src/hooks/useSelectorSignal.ts @@ -1,11 +1,11 @@ +import { addCallback } from '../lib/teact/teactn'; +import { getGlobal } from '../global'; + import type { GlobalState } from '../global/types'; import type { Signal, SignalSetter } from '../util/signals'; -import { getGlobal } from '../global'; import { createSignal } from '../util/signals'; - import useEffectOnce from './useEffectOnce'; -import { addCallback } from '../lib/teact/teactn'; /* This hook is a more performant variation of the standard React `useSelector` hook. It allows to: diff --git a/src/hooks/useShowTransition.ts b/src/hooks/useShowTransition.ts index a6dce31f1..811eb9745 100644 --- a/src/hooks/useShowTransition.ts +++ b/src/hooks/useShowTransition.ts @@ -1,4 +1,5 @@ import { useRef, useState } from '../lib/teact/teact'; + import buildClassName from '../util/buildClassName'; const CLOSE_DURATION = 350; diff --git a/src/hooks/useSignal.ts b/src/hooks/useSignal.ts index 0cc490b2c..096f7a850 100644 --- a/src/hooks/useSignal.ts +++ b/src/hooks/useSignal.ts @@ -1,4 +1,5 @@ import { useRef } from '../lib/teact/teact'; + import { createSignal } from '../util/signals'; export default function useSignal(initial?: T) { diff --git a/src/hooks/useSignalEffect.ts b/src/hooks/useSignalEffect.ts index 222d54160..13c2db02c 100644 --- a/src/hooks/useSignalEffect.ts +++ b/src/hooks/useSignalEffect.ts @@ -1,4 +1,5 @@ import { useRef } from '../lib/teact/teact'; + import { cleanupEffect, isSignal } from '../util/signals'; import useEffectOnce from './useEffectOnce'; diff --git a/src/hooks/useSyncEffect.ts b/src/hooks/useSyncEffect.ts index 82e65add3..dc5153e3e 100644 --- a/src/hooks/useSyncEffect.ts +++ b/src/hooks/useSyncEffect.ts @@ -1,6 +1,7 @@ -import usePrevious from './usePrevious'; import { useRef } from '../lib/teact/teact'; + import useEffectOnce from './useEffectOnce'; +import usePrevious from './usePrevious'; export default function useSyncEffect( effect: (args: T | readonly []) => NoneToVoidFunction | void, diff --git a/src/hooks/useThrottledCallback.ts b/src/hooks/useThrottledCallback.ts index 129c07b6d..adc408ee1 100644 --- a/src/hooks/useThrottledCallback.ts +++ b/src/hooks/useThrottledCallback.ts @@ -1,6 +1,7 @@ import { useCallback, useMemo } from '../lib/teact/teact'; import type { Scheduler } from '../util/schedulers'; + import { throttle, throttleWith } from '../util/schedulers'; export default function useThrottledCallback( diff --git a/src/hooks/useThumbnail.ts b/src/hooks/useThumbnail.ts index ee3973bee..3a8a3e962 100644 --- a/src/hooks/useThumbnail.ts +++ b/src/hooks/useThumbnail.ts @@ -1,13 +1,13 @@ import { useLayoutEffect, useMemo, useState } from '../lib/teact/teact'; +import { getGlobal } from '../global'; import type { ApiMessage, ApiSticker } from '../api/types'; import { DEBUG } from '../config'; -import { isWebpSupported } from '../util/windowEnvironment'; -import { EMPTY_IMAGE_DATA_URI, webpToPngBase64 } from '../util/webpToPng'; import { getMessageMediaThumbDataUri } from '../global/helpers'; import { selectTheme } from '../global/selectors'; -import { getGlobal } from '../global'; +import { EMPTY_IMAGE_DATA_URI, webpToPngBase64 } from '../util/webpToPng'; +import { isWebpSupported } from '../util/windowEnvironment'; export default function useThumbnail(media?: ApiMessage | ApiSticker) { const isMessage = media && 'content' in media; diff --git a/src/hooks/useUniqueId.ts b/src/hooks/useUniqueId.ts index de91b7320..6d37e1802 100644 --- a/src/hooks/useUniqueId.ts +++ b/src/hooks/useUniqueId.ts @@ -1,4 +1,5 @@ import { useRef } from '../lib/teact/teact'; + import generateUniqueId from '../util/generateUniqueId'; export default function useUniqueId() { diff --git a/src/hooks/useVideoCleanup.ts b/src/hooks/useVideoCleanup.ts index a87a3a5a8..a269d1487 100644 --- a/src/hooks/useVideoCleanup.ts +++ b/src/hooks/useVideoCleanup.ts @@ -1,5 +1,6 @@ import type { RefObject } from 'react'; import { useEffect } from '../lib/teact/teact'; + import { requestNextMutation } from '../lib/fasterdom/fasterdom'; // Fix for memory leak when unmounting video element diff --git a/src/index.tsx b/src/index.tsx index 07ceba9b6..582ddac5c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,24 +1,23 @@ import './util/handleError'; import './util/setupServiceWorker'; +import './global/init'; import React from './lib/teact/teact'; import TeactDOM from './lib/teact/teact-dom'; -import { enableStrict, requestMutation } from './lib/fasterdom/fasterdom'; - import { getActions, getGlobal, } from './global'; -import updateWebmanifest from './util/updateWebmanifest'; -import { IS_MULTITAB_SUPPORTED } from './util/windowEnvironment'; -import './global/init'; import { DEBUG, MULTITAB_LOCALSTORAGE_KEY, STRICTERDOM_ENABLED, } from './config'; +import { enableStrict, requestMutation } from './lib/fasterdom/fasterdom'; +import { selectTabState } from './global/selectors'; import { establishMultitabRole, subscribeToMasterChange } from './util/establishMultitabRole'; import { requestGlobal, subscribeToMultitabBroadcastChannel } from './util/multitab'; import { onBeforeUnload } from './util/schedulers'; -import { selectTabState } from './global/selectors'; +import updateWebmanifest from './util/updateWebmanifest'; +import { IS_MULTITAB_SUPPORTED } from './util/windowEnvironment'; import App from './components/App'; diff --git a/src/lib/croppie.ts b/src/lib/croppie.ts index b073458f0..aadbf9f87 100644 --- a/src/lib/croppie.ts +++ b/src/lib/croppie.ts @@ -1,4 +1,5 @@ import Croppie from 'croppie'; + import 'croppie/croppie.css'; export default Croppie; diff --git a/src/lib/fasterdom/fasterdom.ts b/src/lib/fasterdom/fasterdom.ts index b3389b4a3..dc46dd01a 100644 --- a/src/lib/fasterdom/fasterdom.ts +++ b/src/lib/fasterdom/fasterdom.ts @@ -1,6 +1,5 @@ -import { fastRaf, throttleWith } from '../../util/schedulers'; import safeExec from '../../util/safeExec'; - +import { fastRaf, throttleWith } from '../../util/schedulers'; import { setPhase } from './stricterdom'; let pendingMeasureTasks: NoneToVoidFunction[] = []; diff --git a/src/lib/gramjs/client/downloadFile.ts b/src/lib/gramjs/client/downloadFile.ts index a0214e382..aaebbdc7c 100644 --- a/src/lib/gramjs/client/downloadFile.ts +++ b/src/lib/gramjs/client/downloadFile.ts @@ -1,11 +1,13 @@ import BigInt from 'big-integer'; -import Api from '../tl/api'; -import type TelegramClient from './TelegramClient'; -import { sleep } from '../Helpers'; -import { getDownloadPartSize } from '../Utils'; -import errors from '../errors'; + import Deferred from '../../../util/Deferred'; import { Foreman } from '../../../util/foreman'; +import errors from '../errors'; +import Api from '../tl/api'; + +import { sleep } from '../Helpers'; +import { getDownloadPartSize } from '../Utils'; +import type TelegramClient from './TelegramClient'; interface OnProgress { isCanceled?: boolean; diff --git a/src/lib/mediaWorker/index.worker.ts b/src/lib/mediaWorker/index.worker.ts index e18ca192e..e16316ee8 100644 --- a/src/lib/mediaWorker/index.worker.ts +++ b/src/lib/mediaWorker/index.worker.ts @@ -1,9 +1,9 @@ -import type { RLottieApi } from '../rlottie/rlottie.worker'; -import type { VideoPreviewApi } from '../video-preview/video-preview.worker'; - import '../rlottie/rlottie.worker'; import '../video-preview/video-preview.worker'; +import type { RLottieApi } from '../rlottie/rlottie.worker'; +import type { VideoPreviewApi } from '../video-preview/video-preview.worker'; + export type MediaWorkerApi = RLottieApi & VideoPreviewApi; diff --git a/src/lib/rlottie/RLottie.ts b/src/lib/rlottie/RLottie.ts index abba2652a..c230e9592 100644 --- a/src/lib/rlottie/RLottie.ts +++ b/src/lib/rlottie/RLottie.ts @@ -1,13 +1,13 @@ -import { requestMeasure, requestMutation } from '../fasterdom/fasterdom'; - -import { - DPR, IS_SAFARI, IS_ANDROID, IS_IOS, -} from '../../util/windowEnvironment'; import { animate } from '../../util/animation'; import cycleRestrict from '../../util/cycleRestrict'; +import Deferred from '../../util/Deferred'; import generateUniqueId from '../../util/generateUniqueId'; import launchMediaWorkers, { MAX_WORKERS } from '../../util/launchMediaWorkers'; -import Deferred from '../../util/Deferred'; +import { + DPR, IS_ANDROID, IS_IOS, + IS_SAFARI, +} from '../../util/windowEnvironment'; +import { requestMeasure, requestMutation } from '../fasterdom/fasterdom'; interface Params { size: number; diff --git a/src/lib/rlottie/rlottie.worker.ts b/src/lib/rlottie/rlottie.worker.ts index 823f0a4c9..6a3577090 100644 --- a/src/lib/rlottie/rlottie.worker.ts +++ b/src/lib/rlottie/rlottie.worker.ts @@ -1,7 +1,9 @@ import { inflate } from 'pako/dist/pako_inflate'; -import { createWorkerInterface } from '../../util/createPostMessageInterface'; + import type { CancellableCallback } from '../../util/PostMessageConnector'; +import { createWorkerInterface } from '../../util/createPostMessageInterface'; + importScripts(new URL('./rlottie-wasm.js', import.meta.url)); declare const Module: any; diff --git a/src/lib/teact/teact-dom.ts b/src/lib/teact/teact-dom.ts index 6c4321d1d..4c9e288c0 100644 --- a/src/lib/teact/teact-dom.ts +++ b/src/lib/teact/teact-dom.ts @@ -1,4 +1,5 @@ import type { ChangeEvent } from 'react'; + import type { VirtualElement, VirtualElementChildren, @@ -8,6 +9,10 @@ import type { VirtualElementReal, VirtualElementTag, } from './teact'; + +import { DEBUG } from '../../config'; +import { unique } from '../../util/iteratees'; +import { addEventListener, removeAllDelegatedListeners, removeEventListener } from './dom-events'; import { captureImmediateEffects, hasElementChanged, @@ -18,9 +23,6 @@ import { unmountComponent, VirtualType, } from './teact'; -import { DEBUG } from '../../config'; -import { addEventListener, removeAllDelegatedListeners, removeEventListener } from './dom-events'; -import { unique } from '../../util/iteratees'; interface VirtualDomHead { children: [VirtualElement] | []; diff --git a/src/lib/teact/teactn.tsx b/src/lib/teact/teactn.tsx index 4d1c0f5c5..286e65e84 100644 --- a/src/lib/teact/teactn.tsx +++ b/src/lib/teact/teactn.tsx @@ -1,17 +1,17 @@ /* eslint-disable eslint-multitab-tt/set-global-only-variable */ import type { FC, FC_withDebug, Props } from './teact'; -import React, { DEBUG_resolveComponentName, useEffect } from './teact'; -import { requestMeasure } from '../fasterdom/fasterdom'; import { DEBUG, DEBUG_MORE } from '../../config'; -import { throttleWithTickEnd } from '../../util/schedulers'; import arePropsShallowEqual, { logUnequalProps } from '../../util/arePropsShallowEqual'; -import { orderBy } from '../../util/iteratees'; import { handleError } from '../../util/handleError'; +import { orderBy } from '../../util/iteratees'; +import { throttleWithTickEnd } from '../../util/schedulers'; +import { requestMeasure } from '../fasterdom/fasterdom'; +import React, { DEBUG_resolveComponentName, useEffect } from './teact'; import useForceUpdate from '../../hooks/useForceUpdate'; -import useUniqueId from '../../hooks/useUniqueId'; import { isHeavyAnimating } from '../../hooks/useHeavyAnimationCheck'; +import useUniqueId from '../../hooks/useUniqueId'; export default React; diff --git a/src/lib/video-preview/MP4Demuxer.ts b/src/lib/video-preview/MP4Demuxer.ts index 30cb85fba..e53821a97 100644 --- a/src/lib/video-preview/MP4Demuxer.ts +++ b/src/lib/video-preview/MP4Demuxer.ts @@ -1,5 +1,6 @@ -import type { MP4ArrayBuffer, MP4VideoTrack, MP4Info } from 'mp4box'; +import type { MP4ArrayBuffer, MP4Info, MP4VideoTrack } from 'mp4box'; import MP4Box, { DataStream } from 'mp4box'; + import { requestPart } from './requestPart'; const META_PART_SIZE = 128 * 1024; diff --git a/src/lib/video-preview/VideoPreview.ts b/src/lib/video-preview/VideoPreview.ts index c399ad3e1..38c59b339 100644 --- a/src/lib/video-preview/VideoPreview.ts +++ b/src/lib/video-preview/VideoPreview.ts @@ -1,9 +1,9 @@ -import { requestMutation } from '../fasterdom/fasterdom'; - -import { callApi } from '../../api/gramjs'; import { ApiMediaFormat } from '../../api/types'; -import { IS_ANDROID, IS_IOS } from '../../util/windowEnvironment'; + import launchMediaWorkers, { MAX_WORKERS } from '../../util/launchMediaWorkers'; +import { IS_ANDROID, IS_IOS } from '../../util/windowEnvironment'; +import { callApi } from '../../api/gramjs'; +import { requestMutation } from '../fasterdom/fasterdom'; const IS_MOBILE = IS_ANDROID || IS_IOS; const PREVIEW_SIZE_RATIO = (IS_ANDROID || IS_IOS) ? 0.3 : 0.25; diff --git a/src/lib/video-preview/video-preview.worker.ts b/src/lib/video-preview/video-preview.worker.ts index fe64adc95..4e7e82c97 100644 --- a/src/lib/video-preview/video-preview.worker.ts +++ b/src/lib/video-preview/video-preview.worker.ts @@ -1,5 +1,7 @@ -import { createWorkerInterface } from '../../util/createPostMessageInterface'; import type { CancellableCallback } from '../../util/PostMessageConnector'; + +import { createWorkerInterface } from '../../util/createPostMessageInterface'; + import { MP4Demuxer } from './MP4Demuxer'; let decoder: any; diff --git a/src/serviceWorker/index.ts b/src/serviceWorker/index.ts index 6ec298655..5851d67c4 100644 --- a/src/serviceWorker/index.ts +++ b/src/serviceWorker/index.ts @@ -1,15 +1,14 @@ import { DEBUG, ELECTRON_HOST_URL, IS_ELECTRON } from '../config'; -import { respondForProgressive } from './progressive'; -import { respondForDownload } from './download'; -import { respondWithCache, clearAssetCache, respondWithCacheNetworkFirst } from './assetCache'; -import { - handlePush, - handleNotificationClick, - handleClientMessage as handleNotificationMessage, -} from './pushNotification'; -import { respondForShare, handleClientMessage as handleShareMessage } from './share'; - import { pause } from '../util/schedulers'; +import { clearAssetCache, respondWithCache, respondWithCacheNetworkFirst } from './assetCache'; +import { respondForDownload } from './download'; +import { respondForProgressive } from './progressive'; +import { + handleClientMessage as handleNotificationMessage, + handleNotificationClick, + handlePush, +} from './pushNotification'; +import { handleClientMessage as handleShareMessage, respondForShare } from './share'; declare const self: ServiceWorkerGlobalScope; diff --git a/src/serviceWorker/progressive.ts b/src/serviceWorker/progressive.ts index 52d406c1e..e602fca9e 100644 --- a/src/serviceWorker/progressive.ts +++ b/src/serviceWorker/progressive.ts @@ -1,11 +1,11 @@ -import { pause } from '../util/schedulers'; -import generateUniqueId from '../util/generateUniqueId'; import { DEBUG, MEDIA_CACHE_MAX_BYTES, MEDIA_PROGRESSIVE_CACHE_DISABLED, MEDIA_PROGRESSIVE_CACHE_NAME, } from '../config'; +import generateUniqueId from '../util/generateUniqueId'; +import { pause } from '../util/schedulers'; declare const self: ServiceWorkerGlobalScope; diff --git a/src/styles/index.scss b/src/styles/index.scss index 3e7d5b9ac..4e96a021f 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -126,7 +126,6 @@ body.cursor-ew-resize { .no-selection { user-select: none !important; - -webkit-user-select: none !important; } .clearfix::after { diff --git a/src/types/icons/index.ts b/src/types/icons/index.ts index a0316f398..6c37deaa2 100644 --- a/src/types/icons/index.ts +++ b/src/types/icons/index.ts @@ -1,4 +1,4 @@ -import type { FontIconName } from './font'; import type { DeviceIconName } from './device'; +import type { FontIconName } from './font'; export type IconName = FontIconName | DeviceIconName; diff --git a/src/types/index.ts b/src/types/index.ts index ec87f298c..c82b6576f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,5 @@ import type { TeactNode } from '../lib/teact/teact'; + import type { ApiBotInlineMediaResult, ApiBotInlineResult, ApiBotInlineSwitchPm, ApiBotInlineSwitchWebview, diff --git a/src/util/animateHorizontalScroll.ts b/src/util/animateHorizontalScroll.ts index 3cb4b1947..1c1c7ca4d 100644 --- a/src/util/animateHorizontalScroll.ts +++ b/src/util/animateHorizontalScroll.ts @@ -1,8 +1,8 @@ import { getGlobal } from '../global'; -import { animate } from './animation'; import { requestMutation } from '../lib/fasterdom/fasterdom'; import { selectCanAnimateInterface } from '../global/selectors'; +import { animate } from './animation'; const DEFAULT_DURATION = 300; diff --git a/src/util/animateScroll.ts b/src/util/animateScroll.ts index ef65375ae..b59637a20 100644 --- a/src/util/animateScroll.ts +++ b/src/util/animateScroll.ts @@ -1,18 +1,19 @@ -import { requestMeasure, requestMutation } from '../lib/fasterdom/fasterdom'; import { getGlobal } from '../global'; import { FocusDirection } from '../types'; import { - FAST_SMOOTH_MIN_DURATION, - FAST_SMOOTH_MAX_DURATION, FAST_SMOOTH_MAX_DISTANCE, + FAST_SMOOTH_MAX_DURATION, + FAST_SMOOTH_MIN_DURATION, FAST_SMOOTH_SHORT_TRANSITION_MAX_DISTANCE, } from '../config'; -import { IS_ANDROID } from './windowEnvironment'; -import { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck'; -import { animateSingle, cancelSingleAnimation } from './animation'; +import { requestMeasure, requestMutation } from '../lib/fasterdom/fasterdom'; import { selectCanAnimateInterface } from '../global/selectors'; +import { animateSingle, cancelSingleAnimation } from './animation'; +import { IS_ANDROID } from './windowEnvironment'; + +import { dispatchHeavyAnimationEvent } from '../hooks/useHeavyAnimationCheck'; type Params = Parameters; diff --git a/src/util/animation.ts b/src/util/animation.ts index 07ccf3f95..13f5a98ad 100644 --- a/src/util/animation.ts +++ b/src/util/animation.ts @@ -1,4 +1,5 @@ import type { Scheduler } from './schedulers'; + import { requestMeasure } from '../lib/fasterdom/fasterdom'; interface AnimationInstance { diff --git a/src/util/appBadge.ts b/src/util/appBadge.ts index 480c97f93..c9f81aaa6 100644 --- a/src/util/appBadge.ts +++ b/src/util/appBadge.ts @@ -1,5 +1,6 @@ -import { DEBUG } from '../config'; import { getGlobal } from '../global'; + +import { DEBUG } from '../config'; import { selectTabState } from '../global/selectors'; export function updateAppBadge(unreadCount: number) { diff --git a/src/util/audioPlayer.ts b/src/util/audioPlayer.ts index 56ad6937c..13ff6421d 100644 --- a/src/util/audioPlayer.ts +++ b/src/util/audioPlayer.ts @@ -1,15 +1,15 @@ import { getActions, getGlobal } from '../global'; -import { requestNextMutation } from '../lib/fasterdom/fasterdom'; -import { AudioOrigin, GlobalSearchContent } from '../types'; import type { ApiMessage } from '../api/types'; - -import { IS_SAFARI } from './windowEnvironment'; -import safePlay from './safePlay'; -import { patchSafariProgressiveAudio, isSafariPatchInProgress } from './patchSafariProgressiveAudio'; import type { MessageKey } from '../global/helpers'; +import { AudioOrigin, GlobalSearchContent } from '../types'; + +import { requestNextMutation } from '../lib/fasterdom/fasterdom'; import { getMessageKey, parseMessageKey } from '../global/helpers'; import { selectCurrentMessageList, selectTabState } from '../global/selectors'; +import { isSafariPatchInProgress, patchSafariProgressiveAudio } from './patchSafariProgressiveAudio'; +import safePlay from './safePlay'; +import { IS_SAFARI } from './windowEnvironment'; type Handler = (eventName: string, e: Event) => void; export type TrackId = `${MessageKey}-${number}`; diff --git a/src/util/captureEvents.ts b/src/util/captureEvents.ts index 058fff5b4..fa9e1de1b 100644 --- a/src/util/captureEvents.ts +++ b/src/util/captureEvents.ts @@ -1,7 +1,7 @@ -import { IS_IOS } from './windowEnvironment'; import { Lethargy } from './lethargy'; import { clamp, round } from './math'; import { debounce } from './schedulers'; +import { IS_IOS } from './windowEnvironment'; import windowSize from './windowSize'; export enum SwipeDirection { diff --git a/src/util/createPostMessageInterface.ts b/src/util/createPostMessageInterface.ts index c7602fc37..64e00fb80 100644 --- a/src/util/createPostMessageInterface.ts +++ b/src/util/createPostMessageInterface.ts @@ -1,5 +1,6 @@ import type { - CancellableCallback, OriginMessageEvent, OriginMessageData, WorkerMessageData, ApiUpdate, + ApiUpdate, + CancellableCallback, OriginMessageData, OriginMessageEvent, WorkerMessageData, } from './PostMessageConnector'; import { DEBUG } from '../config'; diff --git a/src/util/customEmojiManager.ts b/src/util/customEmojiManager.ts index 37350a50d..8c6aadf51 100644 --- a/src/util/customEmojiManager.ts +++ b/src/util/customEmojiManager.ts @@ -1,21 +1,21 @@ import { addCallback } from '../lib/teact/teactn'; -import { requestMutation } from '../lib/fasterdom/fasterdom'; import { getGlobal } from '../global'; -import { ApiMediaFormat } from '../api/types'; import type { ApiSticker } from '../api/types'; import type { GlobalState } from '../global/types'; +import { ApiMediaFormat } from '../api/types'; -import { selectCanPlayAnimatedEmojis } from '../global/selectors'; +import { requestMutation } from '../lib/fasterdom/fasterdom'; import { getStickerPreviewHash } from '../global/helpers'; +import { selectCanPlayAnimatedEmojis } from '../global/selectors'; +import { createCallbackManager } from './callbacks'; +import generateUniqueId from './generateUniqueId'; import * as mediaLoader from './mediaLoader'; import { throttle } from './schedulers'; -import generateUniqueId from './generateUniqueId'; import { IS_WEBM_SUPPORTED } from './windowEnvironment'; -import { createCallbackManager } from './callbacks'; -import placeholderSrc from '../assets/square.svg'; import blankSrc from '../assets/blank.png'; +import placeholderSrc from '../assets/square.svg'; type CustomEmojiLoadCallback = (customEmojis: GlobalState['customEmojis']) => void; type CustomEmojiInputRenderCallback = (emojiId: string) => void; diff --git a/src/util/dateFormat.ts b/src/util/dateFormat.ts index ca848eb55..a6749856b 100644 --- a/src/util/dateFormat.ts +++ b/src/util/dateFormat.ts @@ -1,5 +1,6 @@ import type { LangFn } from '../hooks/useLang'; import type { TimeFormat } from '../types'; + import withCache from './withCache'; const WEEKDAYS_FULL = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; diff --git a/src/util/emoji.ts b/src/util/emoji.ts index 34ec73f3e..963da6120 100644 --- a/src/util/emoji.ts +++ b/src/util/emoji.ts @@ -1,6 +1,5 @@ import { requestMutation } from '../lib/fasterdom/fasterdom'; import EMOJI_REGEX, { removeVS16s } from '../lib/twemojiRegex'; - import withCache from './withCache'; // Due to the fact that emoji from Apple do not contain some characters, it is necessary to remove them from emoji-data diff --git a/src/util/establishMultitabRole.ts b/src/util/establishMultitabRole.ts index 7ae484ce6..6216c45f7 100644 --- a/src/util/establishMultitabRole.ts +++ b/src/util/establishMultitabRole.ts @@ -1,7 +1,7 @@ -import { createCallbackManager } from './callbacks'; import { ESTABLISH_BROADCAST_CHANNEL_NAME } from '../config'; -import { IS_MULTITAB_SUPPORTED } from './windowEnvironment'; +import { createCallbackManager } from './callbacks'; import { getPasscodeHash, setPasscodeHash } from './passcode'; +import { IS_MULTITAB_SUPPORTED } from './windowEnvironment'; const ESTABLISH_TIMEOUT = 100; diff --git a/src/util/focusEditableElement.ts b/src/util/focusEditableElement.ts index f1a70dd57..7c317bdab 100644 --- a/src/util/focusEditableElement.ts +++ b/src/util/focusEditableElement.ts @@ -1,5 +1,5 @@ -import { IS_TOUCH_ENV } from './windowEnvironment'; import { requestMeasure } from '../lib/fasterdom/fasterdom'; +import { IS_TOUCH_ENV } from './windowEnvironment'; export default function focusEditableElement(element: HTMLElement, force?: boolean, forcePlaceCaretAtEnd?: boolean) { if (!force && element === document.activeElement) { diff --git a/src/util/folderManager.ts b/src/util/folderManager.ts index 8eb530a01..79b114131 100644 --- a/src/util/folderManager.ts +++ b/src/util/folderManager.ts @@ -1,20 +1,20 @@ import { addCallback } from '../lib/teact/teactn'; import { addActionHandler, getGlobal } from '../global'; +import type { ApiChat, ApiChatFolder, ApiUser } from '../api/types'; import type { GlobalState } from '../global/types'; import type { NotifyException, NotifySettings } from '../types'; -import type { ApiChat, ApiChatFolder, ApiUser } from '../api/types'; +import type { CallbackManager } from './callbacks'; import { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID, DEBUG, SERVICE_NOTIFICATIONS_USER_ID, } from '../config'; -import { selectNotifySettings, selectNotifyExceptions, selectTabState } from '../global/selectors'; import { selectIsChatMuted } from '../global/helpers'; -import { onIdle, throttle } from './schedulers'; -import { areSortedArraysEqual, unique } from './iteratees'; +import { selectNotifyExceptions, selectNotifySettings, selectTabState } from '../global/selectors'; import arePropsShallowEqual from './arePropsShallowEqual'; -import type { CallbackManager } from './callbacks'; import { createCallbackManager } from './callbacks'; +import { areSortedArraysEqual, unique } from './iteratees'; +import { onIdle, throttle } from './schedulers'; interface FolderSummary { id: number; diff --git a/src/util/handleError.ts b/src/util/handleError.ts index e9cf0830d..663078edb 100644 --- a/src/util/handleError.ts +++ b/src/util/handleError.ts @@ -1,6 +1,6 @@ import { DEBUG_ALERT_MSG } from '../config'; -import { throttle } from './schedulers'; import { getAllMultitabTokens } from './establishMultitabRole'; +import { throttle } from './schedulers'; import { IS_MULTITAB_SUPPORTED } from './windowEnvironment'; // eslint-disable-next-line prefer-destructuring diff --git a/src/util/hoc/freezeWhenClosed.ts b/src/util/hoc/freezeWhenClosed.ts index 67744d4f4..fa299036f 100644 --- a/src/util/hoc/freezeWhenClosed.ts +++ b/src/util/hoc/freezeWhenClosed.ts @@ -1,4 +1,4 @@ -import { useRef, type FC, type Props } from '../../lib/teact/teact'; +import { type FC, type Props, useRef } from '../../lib/teact/teact'; export default function freezeWhenClosed(Component: T) { function ComponentWrapper(props: Props) { diff --git a/src/util/langProvider.ts b/src/util/langProvider.ts index 2870c6d37..0a095ef60 100644 --- a/src/util/langProvider.ts +++ b/src/util/langProvider.ts @@ -6,11 +6,11 @@ import type { LangCode, TimeFormat } from '../types'; import { DEFAULT_LANG_CODE, DEFAULT_LANG_PACK, LANG_CACHE_NAME, LANG_PACKS, } from '../config'; -import * as cacheApi from './cacheApi'; import { callApi } from '../api/gramjs'; +import * as cacheApi from './cacheApi'; import { createCallbackManager } from './callbacks'; -import { formatInteger } from './textFormat'; import { fallbackLangPackInitial } from './fallbackLangPackInitial'; +import { formatInteger } from './textFormat'; export interface LangFn { (key: string, value?: any, format?: 'i', pluralValue?: number): string; diff --git a/src/util/languageDetection.ts b/src/util/languageDetection.ts index 9c51382ea..f56a8bc22 100644 --- a/src/util/languageDetection.ts +++ b/src/util/languageDetection.ts @@ -2,8 +2,9 @@ import type { FastTextApi } from '../lib/fasttextweb/fasttext.worker'; import type { Connector } from './PostMessageConnector'; import { IS_TRANSLATION_SUPPORTED } from './windowEnvironment'; -import { createConnector } from './PostMessageConnector'; + import Deferred from './Deferred'; +import { createConnector } from './PostMessageConnector'; const WORKER_INIT_DELAY = 4000; diff --git a/src/util/launchMediaWorkers.ts b/src/util/launchMediaWorkers.ts index 1724cbb0e..9ec9841aa 100644 --- a/src/util/launchMediaWorkers.ts +++ b/src/util/launchMediaWorkers.ts @@ -2,6 +2,7 @@ import type { MediaWorkerApi } from '../lib/mediaWorker/index.worker'; import type { Connector } from './PostMessageConnector'; import { IS_TEST } from '../config'; + import { createConnector } from './PostMessageConnector'; export const MAX_WORKERS = Math.min(navigator.hardwareConcurrency || 4, 4); diff --git a/src/util/mediaLoader.ts b/src/util/mediaLoader.ts index 3722c866f..5b47c7b64 100644 --- a/src/util/mediaLoader.ts +++ b/src/util/mediaLoader.ts @@ -8,16 +8,17 @@ import { } from '../api/types'; import { - DEBUG, MEDIA_CACHE_DISABLED, MEDIA_CACHE_NAME, MEDIA_CACHE_NAME_AVATARS, IS_ELECTRON, ELECTRON_HOST_URL, + DEBUG, ELECTRON_HOST_URL, + IS_ELECTRON, MEDIA_CACHE_DISABLED, MEDIA_CACHE_NAME, MEDIA_CACHE_NAME_AVATARS, } from '../config'; import { callApi, cancelApiProgress } from '../api/gramjs'; import * as cacheApi from './cacheApi'; import { fetchBlob } from './files'; +import { oggToWav } from './oggToWav'; +import { webpToPng } from './webpToPng'; import { IS_OPUS_SUPPORTED, IS_PROGRESSIVE_SUPPORTED, isWebpSupported, } from './windowEnvironment'; -import { oggToWav } from './oggToWav'; -import { webpToPng } from './webpToPng'; const asCacheApiType = { [ApiMediaFormat.BlobUrl]: cacheApi.Type.Blob, diff --git a/src/util/multitab.ts b/src/util/multitab.ts index 7875264e2..be15e32ef 100644 --- a/src/util/multitab.ts +++ b/src/util/multitab.ts @@ -1,14 +1,13 @@ /* eslint-disable eslint-multitab-tt/set-global-only-variable */ +import { addCallback } from '../lib/teact/teactn'; import { getActions, getGlobal, setGlobal } from '../global'; -import type { MethodArgs, Methods } from '../api/gramjs/methods/types'; import type { LocalDb } from '../api/gramjs/localDb'; +import type { MethodArgs, Methods } from '../api/gramjs/methods/types'; import type { ApiInitialArgs } from '../api/types'; import type { GlobalState } from '../global/types'; -import { IS_MULTITAB_SUPPORTED } from './windowEnvironment'; import { DATA_BROADCAST_CHANNEL_NAME, MULTITAB_LOCALSTORAGE_KEY } from '../config'; -import { deepMerge } from './deepMerge'; import { selectTabState } from '../global/selectors'; import { callApiLocal, @@ -19,10 +18,11 @@ import { updateFullLocalDb, updateLocalDb, } from '../api/gramjs'; -import { addCallback } from '../lib/teact/teactn'; import { deepDiff } from './deepDiff'; +import { deepMerge } from './deepMerge'; import { getCurrentTabId, signalPasscodeHash, subscribeToTokenDied } from './establishMultitabRole'; import { omit } from './iteratees'; +import { IS_MULTITAB_SUPPORTED } from './windowEnvironment'; type BroadcastChannelRequestGlobal = { type: 'requestGlobal'; diff --git a/src/util/notifications.ts b/src/util/notifications.ts index 02cd76380..9cadb3f7d 100644 --- a/src/util/notifications.ts +++ b/src/util/notifications.ts @@ -1,13 +1,14 @@ -import { callApi } from '../api/gramjs'; +import { getActions, getGlobal, setGlobal } from '../global'; + import type { - ApiChat, ApiMessage, ApiPhoneCall, ApiUser, ApiPeerReaction, + ApiChat, ApiMessage, ApiPeerReaction, + ApiPhoneCall, ApiUser, } from '../api/types'; import { ApiMediaFormat } from '../api/types'; -import { renderActionMessageText } from '../components/common/helpers/renderActionMessageText'; + import { APP_NAME, DEBUG, IS_ELECTRON, IS_TEST, } from '../config'; -import { getActions, getGlobal, setGlobal } from '../global'; import { getChatAvatarHash, getChatTitle, @@ -24,19 +25,21 @@ import { } from '../global/helpers'; import { addNotifyExceptions, replaceSettings } from '../global/reducers'; import { + selectChat, selectChatMessage, selectCurrentMessageList, - selectTopicFromMessage, selectNotifyExceptions, selectNotifySettings, + selectTopicFromMessage, selectUser, - selectChat, } from '../global/selectors'; -import { IS_SERVICE_WORKER_SUPPORTED, IS_TOUCH_ENV } from './windowEnvironment'; +import { callApi } from '../api/gramjs'; +import { renderActionMessageText } from '../components/common/helpers/renderActionMessageText'; +import { buildCollectionByKey } from './iteratees'; import { translate } from './langProvider'; import * as mediaLoader from './mediaLoader'; import { debounce } from './schedulers'; -import { buildCollectionByKey } from './iteratees'; +import { IS_SERVICE_WORKER_SUPPORTED, IS_TOUCH_ENV } from './windowEnvironment'; function getDeviceToken(subscription: PushSubscription) { const data = subscription.toJSON(); diff --git a/src/util/parseMessageInput.ts b/src/util/parseMessageInput.ts index f23eada5b..ffe82fc28 100644 --- a/src/util/parseMessageInput.ts +++ b/src/util/parseMessageInput.ts @@ -1,5 +1,6 @@ -import type { ApiMessageEntity, ApiFormattedText } from '../api/types'; +import type { ApiFormattedText, ApiMessageEntity } from '../api/types'; import { ApiMessageEntityTypes } from '../api/types'; + import { RE_LINK_TEMPLATE } from '../config'; import { IS_EMOJI_SUPPORTED } from './windowEnvironment'; diff --git a/src/util/passcode.ts b/src/util/passcode.ts index 46a0df27f..b497da839 100644 --- a/src/util/passcode.ts +++ b/src/util/passcode.ts @@ -1,5 +1,5 @@ -import * as cacheApi from './cacheApi'; import { PASSCODE_CACHE_NAME } from '../config'; +import * as cacheApi from './cacheApi'; const IV_LENGTH = 12; const SALT = 'harder better faster stronger'; diff --git a/src/util/requestActionTimeout.ts b/src/util/requestActionTimeout.ts index 874a5d8b4..b3d8d3e08 100644 --- a/src/util/requestActionTimeout.ts +++ b/src/util/requestActionTimeout.ts @@ -1,4 +1,5 @@ import { getActions } from '../global'; + import type { CallbackAction } from '../global/types'; const callbacks = new Map(); diff --git a/src/util/resetScroll.ts b/src/util/resetScroll.ts index bfe9af1e0..ecd753c19 100644 --- a/src/util/resetScroll.ts +++ b/src/util/resetScroll.ts @@ -1,5 +1,5 @@ -import { IS_IOS } from './windowEnvironment'; import forceReflow from './forceReflow'; +import { IS_IOS } from './windowEnvironment'; const resetScroll = (container: HTMLDivElement, scrollTop?: number) => { if (IS_IOS) { diff --git a/src/util/routing.ts b/src/util/routing.ts index b72166e10..1bd43b182 100644 --- a/src/util/routing.ts +++ b/src/util/routing.ts @@ -1,5 +1,6 @@ import type { MessageListType } from '../global/types'; import { MAIN_THREAD_ID } from '../api/types'; + import { IS_MOCKED_CLIENT } from '../config'; let parsedInitialLocationHash: Record | undefined; diff --git a/src/util/setTooltipItemVisible.ts b/src/util/setTooltipItemVisible.ts index 4d05d0556..fc52c235d 100644 --- a/src/util/setTooltipItemVisible.ts +++ b/src/util/setTooltipItemVisible.ts @@ -1,6 +1,6 @@ +import animateScroll from './animateScroll'; import findInViewport from './findInViewport'; import isFullyVisible from './isFullyVisible'; -import animateScroll from './animateScroll'; const VIEWPORT_MARGIN = 8; const SCROLL_MARGIN = 10; diff --git a/src/util/setupServiceWorker.ts b/src/util/setupServiceWorker.ts index 9fa7c777d..da4ad545e 100644 --- a/src/util/setupServiceWorker.ts +++ b/src/util/setupServiceWorker.ts @@ -1,9 +1,10 @@ -import { DEBUG, DEBUG_MORE, IS_TEST } from '../config'; import { getActions } from '../global'; + +import { DEBUG, DEBUG_MORE, IS_TEST } from '../config'; import { formatShareText } from './deeplink'; -import { IS_ANDROID, IS_IOS, IS_SERVICE_WORKER_SUPPORTED } from './windowEnvironment'; import { validateFiles } from './files'; import { notifyClientReady, playNotifySoundDebounced } from './notifications'; +import { IS_ANDROID, IS_IOS, IS_SERVICE_WORKER_SUPPORTED } from './windowEnvironment'; type WorkerAction = { type: string; diff --git a/src/util/signals.ts b/src/util/signals.ts index 790298d55..09dbca1bb 100644 --- a/src/util/signals.ts +++ b/src/util/signals.ts @@ -1,4 +1,5 @@ import type { CallbackManager } from './callbacks'; + import { createCallbackManager } from './callbacks'; interface SignalState { diff --git a/src/util/switchTheme.ts b/src/util/switchTheme.ts index a307eeb65..8203bc7ad 100644 --- a/src/util/switchTheme.ts +++ b/src/util/switchTheme.ts @@ -1,12 +1,10 @@ -import { requestMutation } from '../lib/fasterdom/fasterdom'; - import type { ISettings } from '../types'; +import { requestMutation } from '../lib/fasterdom/fasterdom'; +import themeColors from '../styles/themes.json'; import { animate } from './animation'; import { lerp } from './math'; -import themeColors from '../styles/themes.json'; - type RGBAColor = { r: number; g: number; diff --git a/src/util/textFormat.ts b/src/util/textFormat.ts index 6021cadb5..446755e5b 100644 --- a/src/util/textFormat.ts +++ b/src/util/textFormat.ts @@ -1,4 +1,5 @@ import type { LangFn } from '../hooks/useLang'; + import EMOJI_REGEX from '../lib/twemojiRegex'; import { fixNonStandardEmoji } from './emoji'; import withCache from './withCache'; diff --git a/src/util/voiceRecording.ts b/src/util/voiceRecording.ts index f59f0a50c..87810c94b 100644 --- a/src/util/voiceRecording.ts +++ b/src/util/voiceRecording.ts @@ -1,4 +1,5 @@ import type { IOpusRecorder } from 'opus-recorder'; + import { requestMeasure } from '../lib/fasterdom/fasterdom'; export type Result = { blob: Blob; duration: number; waveform: number[] }; diff --git a/src/util/webpToPng.ts b/src/util/webpToPng.ts index 1a7c05e80..0bdd4a194 100644 --- a/src/util/webpToPng.ts +++ b/src/util/webpToPng.ts @@ -1,6 +1,6 @@ -import { isWebpSupported } from './windowEnvironment'; -import { dataUriToBlob, blobToDataUri } from './files'; +import { blobToDataUri, dataUriToBlob } from './files'; import { pause } from './schedulers'; +import { isWebpSupported } from './windowEnvironment'; const WORKER_INITIALIZATION_TIMEOUT = 2000; diff --git a/src/util/websync.ts b/src/util/websync.ts index b1c613504..c2126bec0 100644 --- a/src/util/websync.ts +++ b/src/util/websync.ts @@ -1,7 +1,9 @@ -import { - DEBUG, IS_MOCKED_CLIENT, IS_ELECTRON, APP_CODE_NAME, -} from '../config'; import { getGlobal } from '../global'; + +import { + APP_CODE_NAME, + DEBUG, IS_ELECTRON, IS_MOCKED_CLIENT, +} from '../config'; import { hasStoredSession } from './sessions'; const WEBSYNC_URLS = [ diff --git a/src/util/windowEnvironment.ts b/src/util/windowEnvironment.ts index 7ed9d6446..2925e5438 100644 --- a/src/util/windowEnvironment.ts +++ b/src/util/windowEnvironment.ts @@ -1,6 +1,6 @@ import { - IS_TEST, IS_ELECTRON, + IS_TEST, PRODUCTION_HOSTNAME, } from '../config'; diff --git a/src/util/windowSize.ts b/src/util/windowSize.ts index b81ef990d..59706e4c4 100644 --- a/src/util/windowSize.ts +++ b/src/util/windowSize.ts @@ -1,7 +1,8 @@ import type { IDimensions } from '../global/types'; + +import { requestMutation } from '../lib/fasterdom/fasterdom'; import { throttle } from './schedulers'; import { IS_IOS } from './windowEnvironment'; -import { requestMutation } from '../lib/fasterdom/fasterdom'; const WINDOW_ORIENTATION_CHANGE_THROTTLE_MS = 100; const WINDOW_RESIZE_THROTTLE_MS = 250; diff --git a/webpack.config.ts b/webpack.config.ts index c36d1044c..f99f6d8d4 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -1,7 +1,12 @@ -import path from 'path'; -import fs from 'fs'; -import dotenv from 'dotenv'; +import 'webpack-dev-server'; +import StatoscopeWebpackPlugin from '@statoscope/webpack-plugin'; +import dotenv from 'dotenv'; +import fs from 'fs'; +import { GitRevisionPlugin } from 'git-revision-webpack-plugin'; +import HtmlWebpackPlugin from 'html-webpack-plugin'; +import MiniCssExtractPlugin from 'mini-css-extract-plugin'; +import path from 'path'; import type { Compiler, Configuration } from 'webpack'; import { ContextReplacementPlugin, @@ -10,11 +15,6 @@ import { NormalModuleReplacementPlugin, ProvidePlugin, } from 'webpack'; -import HtmlWebpackPlugin from 'html-webpack-plugin'; -import MiniCssExtractPlugin from 'mini-css-extract-plugin'; -import { GitRevisionPlugin } from 'git-revision-webpack-plugin'; -import StatoscopeWebpackPlugin from '@statoscope/webpack-plugin'; -import 'webpack-dev-server'; import { version as appVersion } from './package.json';