[Refactoring] Remove unused parameters (#3396)
This commit is contained in:
parent
6a47d14388
commit
44060a239e
@ -50,7 +50,8 @@
|
|||||||
"getActions": true,
|
"getActions": true,
|
||||||
"useFlag": [false, true, true],
|
"useFlag": [false, true, true],
|
||||||
"useForceUpdate": true,
|
"useForceUpdate": true,
|
||||||
"useReducer": [false, true]
|
"useReducer": [false, true],
|
||||||
|
"useLastCallback": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -128,7 +128,7 @@ const ProfileInfo: FC<OwnProps & StateProps> = ({
|
|||||||
}
|
}
|
||||||
}, [userId, loadFullUser, connectionState, forceShowSelf]);
|
}, [userId, loadFullUser, connectionState, forceShowSelf]);
|
||||||
|
|
||||||
usePhotosPreload(user || chat, photos, currentPhotoIndex);
|
usePhotosPreload(photos, currentPhotoIndex);
|
||||||
|
|
||||||
const handleProfilePhotoClick = useLastCallback(() => {
|
const handleProfilePhotoClick = useLastCallback(() => {
|
||||||
openMediaViewer({
|
openMediaViewer({
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { ApiChat, ApiPhoto, ApiUser } from '../../../api/types';
|
import type { ApiPhoto } from '../../../api/types';
|
||||||
import { ApiMediaFormat } from '../../../api/types';
|
import { ApiMediaFormat } from '../../../api/types';
|
||||||
import { useEffect } from '../../../lib/teact/teact';
|
import { useEffect } from '../../../lib/teact/teact';
|
||||||
import * as mediaLoader from '../../../util/mediaLoader';
|
import * as mediaLoader from '../../../util/mediaLoader';
|
||||||
@ -6,7 +6,6 @@ import * as mediaLoader from '../../../util/mediaLoader';
|
|||||||
const PHOTOS_TO_PRELOAD = 4;
|
const PHOTOS_TO_PRELOAD = 4;
|
||||||
|
|
||||||
export default function usePhotosPreload(
|
export default function usePhotosPreload(
|
||||||
profile: ApiUser | ApiChat | undefined,
|
|
||||||
photos: ApiPhoto[],
|
photos: ApiPhoto[],
|
||||||
currentIndex: number,
|
currentIndex: number,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -83,9 +83,7 @@ const MediaViewerSlides: FC<OwnProps> = ({
|
|||||||
selectMedia,
|
selectMedia,
|
||||||
isVideo,
|
isVideo,
|
||||||
isGif,
|
isGif,
|
||||||
isPhoto,
|
|
||||||
isOpen,
|
isOpen,
|
||||||
hasFooter,
|
|
||||||
withAnimation,
|
withAnimation,
|
||||||
isHidden,
|
isHidden,
|
||||||
...rest
|
...rest
|
||||||
|
|||||||
@ -104,7 +104,7 @@ const ActionMessage: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
useOnIntersect(ref, observeIntersectionForReading);
|
useOnIntersect(ref, observeIntersectionForReading);
|
||||||
useEnsureMessage(message.chatId, message.replyToMessageId, targetMessage);
|
useEnsureMessage(message.chatId, message.replyToMessageId, targetMessage);
|
||||||
useFocusMessage(ref, message.id, message.chatId, isFocused, focusDirection, noFocusHighlight, isJustAdded);
|
useFocusMessage(ref, message.chatId, isFocused, focusDirection, noFocusHighlight, isJustAdded);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!message.isPinned) return undefined;
|
if (!message.isPinned) return undefined;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ const Invoice: FC<OwnProps> = ({
|
|||||||
|
|
||||||
if (photoUrl) {
|
if (photoUrl) {
|
||||||
const contentEl = ref.current!.closest<HTMLDivElement>(MESSAGE_CONTENT_SELECTOR)!;
|
const contentEl = ref.current!.closest<HTMLDivElement>(MESSAGE_CONTENT_SELECTOR)!;
|
||||||
getCustomAppendixBg(photoUrl, false, isInSelectMode, isSelected, theme).then((appendixBg) => {
|
getCustomAppendixBg(photoUrl, false, isSelected, theme).then((appendixBg) => {
|
||||||
contentEl.style.setProperty('--appendix-bg', appendixBg);
|
contentEl.style.setProperty('--appendix-bg', appendixBg);
|
||||||
contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');
|
contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');
|
||||||
});
|
});
|
||||||
|
|||||||
@ -502,7 +502,6 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
selectMessage,
|
selectMessage,
|
||||||
ref,
|
ref,
|
||||||
messageId,
|
messageId,
|
||||||
isAlbum,
|
|
||||||
Boolean(isInSelectMode),
|
Boolean(isInSelectMode),
|
||||||
Boolean(canReply),
|
Boolean(canReply),
|
||||||
Boolean(isProtected),
|
Boolean(isProtected),
|
||||||
@ -511,7 +510,6 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
chatId,
|
chatId,
|
||||||
isContextMenuShown,
|
isContextMenuShown,
|
||||||
quickReactionRef,
|
quickReactionRef,
|
||||||
isOwn,
|
|
||||||
isInDocumentGroupNotLast,
|
isInDocumentGroupNotLast,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -670,7 +668,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useFocusMessage(
|
useFocusMessage(
|
||||||
ref, messageId, chatId, isFocused, focusDirection, noFocusHighlight, isResizingContainer, isJustAdded,
|
ref, chatId, isFocused, focusDirection, noFocusHighlight, isResizingContainer, isJustAdded,
|
||||||
);
|
);
|
||||||
|
|
||||||
const signature = (isChannel && message.postAuthorTitle)
|
const signature = (isChannel && message.postAuthorTitle)
|
||||||
|
|||||||
@ -158,7 +158,7 @@ const Photo: FC<OwnProps> = ({
|
|||||||
|
|
||||||
const contentEl = ref.current!.closest<HTMLDivElement>(MESSAGE_CONTENT_SELECTOR)!;
|
const contentEl = ref.current!.closest<HTMLDivElement>(MESSAGE_CONTENT_SELECTOR)!;
|
||||||
if (fullMediaData) {
|
if (fullMediaData) {
|
||||||
getCustomAppendixBg(fullMediaData, isOwn, isInSelectMode, isSelected, theme).then((appendixBg) => {
|
getCustomAppendixBg(fullMediaData, isOwn, isSelected, theme).then((appendixBg) => {
|
||||||
requestMutation(() => {
|
requestMutation(() => {
|
||||||
contentEl.style.setProperty('--appendix-bg', appendixBg);
|
contentEl.style.setProperty('--appendix-bg', appendixBg);
|
||||||
contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');
|
contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const SELECTED_APPENDIX_COLORS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function getCustomAppendixBg(
|
export default function getCustomAppendixBg(
|
||||||
src: string, isOwn: boolean, inSelectMode?: boolean, isSelected?: boolean, theme?: ISettings['theme'],
|
src: string, isOwn: boolean, isSelected?: boolean, theme?: ISettings['theme'],
|
||||||
) {
|
) {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
return Promise.resolve(SELECTED_APPENDIX_COLORS[theme || 'light'][isOwn ? 'outgoing' : 'incoming']);
|
return Promise.resolve(SELECTED_APPENDIX_COLORS[theme || 'light'][isOwn ? 'outgoing' : 'incoming']);
|
||||||
|
|||||||
@ -12,7 +12,6 @@ const FOCUS_MARGIN = 20;
|
|||||||
|
|
||||||
export default function useFocusMessage(
|
export default function useFocusMessage(
|
||||||
elementRef: { current: HTMLDivElement | null },
|
elementRef: { current: HTMLDivElement | null },
|
||||||
messageId: number,
|
|
||||||
chatId: string,
|
chatId: string,
|
||||||
isFocused?: boolean,
|
isFocused?: boolean,
|
||||||
focusDirection?: FocusDirection,
|
focusDirection?: FocusDirection,
|
||||||
|
|||||||
@ -24,7 +24,6 @@ export default function useOuterHandlers(
|
|||||||
selectMessage: (e?: React.MouseEvent<HTMLDivElement, MouseEvent>, groupedId?: string) => void,
|
selectMessage: (e?: React.MouseEvent<HTMLDivElement, MouseEvent>, groupedId?: string) => void,
|
||||||
containerRef: RefObject<HTMLDivElement>,
|
containerRef: RefObject<HTMLDivElement>,
|
||||||
messageId: number,
|
messageId: number,
|
||||||
isAlbum: boolean,
|
|
||||||
isInSelectMode: boolean,
|
isInSelectMode: boolean,
|
||||||
canReply: boolean,
|
canReply: boolean,
|
||||||
isProtected: boolean,
|
isProtected: boolean,
|
||||||
@ -33,7 +32,6 @@ export default function useOuterHandlers(
|
|||||||
chatId: string,
|
chatId: string,
|
||||||
isContextMenuShown: boolean,
|
isContextMenuShown: boolean,
|
||||||
quickReactionRef: RefObject<HTMLDivElement>,
|
quickReactionRef: RefObject<HTMLDivElement>,
|
||||||
isOwn: boolean,
|
|
||||||
shouldHandleMouseLeave: boolean,
|
shouldHandleMouseLeave: boolean,
|
||||||
) {
|
) {
|
||||||
const { setReplyingToId, sendDefaultReaction } = getActions();
|
const { setReplyingToId, sendDefaultReaction } = getActions();
|
||||||
|
|||||||
@ -493,7 +493,7 @@ export function updateThreadInfos<T extends GlobalState>(
|
|||||||
global: T, chatId: string, updates: Partial<ApiThreadInfo>[],
|
global: T, chatId: string, updates: Partial<ApiThreadInfo>[],
|
||||||
): T {
|
): T {
|
||||||
updates.forEach((update) => {
|
updates.forEach((update) => {
|
||||||
global = updateThreadInfo(global, update.chatId!, update.threadId!, update);
|
global = updateThreadInfo(global, chatId, update.threadId!, update);
|
||||||
});
|
});
|
||||||
|
|
||||||
return global;
|
return global;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user