= ({
noStatusOrTyping
avatarSize="medium"
status={seenByUser ? formatDateAtTime(lang, seenByUser * 1000) : undefined}
- statusIcon="icon-message-read"
+ statusIcon="message-read"
/>
,
);
diff --git a/src/components/middle/ScrollDownButton.tsx b/src/components/middle/ScrollDownButton.tsx
index 803f96e33..ed7384085 100644
--- a/src/components/middle/ScrollDownButton.tsx
+++ b/src/components/middle/ScrollDownButton.tsx
@@ -1,6 +1,8 @@
import type { FC } from '../../lib/teact/teact';
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';
@@ -13,7 +15,7 @@ import MenuItem from '../ui/MenuItem';
import styles from './ScrollDownButton.module.scss';
type OwnProps = {
- icon: string;
+ icon: IconName;
ariaLabelLang: string;
unreadCount?: number;
onClick: VoidFunction;
diff --git a/src/components/middle/message/helpers/copyOptions.ts b/src/components/middle/message/helpers/copyOptions.ts
index c7f0dbb26..105e7c968 100644
--- a/src/components/middle/message/helpers/copyOptions.ts
+++ b/src/components/middle/message/helpers/copyOptions.ts
@@ -1,6 +1,8 @@
import type { ApiMessage } from '../../../../api/types';
import { ApiMediaFormat } from '../../../../api/types';
+import type { IconName } from '../../../../types/icons';
+
import * as mediaLoader from '../../../../util/mediaLoader';
import {
getMessageContact,
@@ -23,7 +25,7 @@ import { renderMessageText } from '../../../common/helpers/renderMessageText';
type ICopyOptions = {
label: string;
- icon: string;
+ icon: IconName;
handler: () => void;
}[];
diff --git a/src/components/payment/Checkout.tsx b/src/components/payment/Checkout.tsx
index dc828c839..e410c84fe 100644
--- a/src/components/payment/Checkout.tsx
+++ b/src/components/payment/Checkout.tsx
@@ -5,6 +5,7 @@ import type { FC } from '../../lib/teact/teact';
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';
@@ -247,7 +248,7 @@ function renderCheckoutItem({
}: {
title : string | undefined;
label: string | undefined;
- icon?: string;
+ icon?: IconName;
onClick?: NoneToVoidFunction;
customIcon?: string;
}) {
diff --git a/src/components/right/Profile.tsx b/src/components/right/Profile.tsx
index 5aeeeae72..e728f0f8e 100644
--- a/src/components/right/Profile.tsx
+++ b/src/components/right/Profile.tsx
@@ -59,7 +59,7 @@ import Transition from '../ui/Transition';
import InfiniteScroll from '../ui/InfiniteScroll';
import TabList from '../ui/TabList';
import Spinner from '../ui/Spinner';
-import ListItem from '../ui/ListItem';
+import ListItem, { type MenuItemContextAction } from '../ui/ListItem';
import PrivateChatInfo from '../common/PrivateChatInfo';
import ProfileInfo from '../common/ProfileInfo';
import Document from '../common/Document';
@@ -342,7 +342,7 @@ const Profile: FC
= ({
}
const canRenderContent = useAsyncRendering([chatId, topicId, resultType, renderingActiveTab], renderingDelay);
- function getMemberContextAction(memberId: string) {
+ function getMemberContextAction(memberId: string): MenuItemContextAction[] | undefined {
return memberId === currentUserId || !canDeleteMembers ? undefined : [{
title: lang('lng_context_remove_from_group'),
icon: 'stop',
diff --git a/src/components/right/management/ManageChatRemovedUsers.tsx b/src/components/right/management/ManageChatRemovedUsers.tsx
index b63d31009..3d916d966 100644
--- a/src/components/right/management/ManageChatRemovedUsers.tsx
+++ b/src/components/right/management/ManageChatRemovedUsers.tsx
@@ -12,7 +12,7 @@ import useHistoryBack from '../../../hooks/useHistoryBack';
import useFlag from '../../../hooks/useFlag';
import PrivateChatInfo from '../../common/PrivateChatInfo';
-import ListItem from '../../ui/ListItem';
+import ListItem, { type MenuItemContextAction } from '../../ui/ListItem';
import FloatingActionButton from '../../ui/FloatingActionButton';
import RemoveGroupUserModal from './RemoveGroupUserModal';
@@ -62,7 +62,7 @@ const ManageChatRemovedUsers: FC = ({
return lang('UserRemovedBy', getUserFullName(kickedByUser));
}, [lang, usersById]);
- const getContextActions = useCallback((member: ApiChatMember) => {
+ const getContextActions = useCallback((member: ApiChatMember): MenuItemContextAction[] | undefined => {
if (!chat) {
return undefined;
}
diff --git a/src/components/right/management/ManageGroupMembers.tsx b/src/components/right/management/ManageGroupMembers.tsx
index 629df1f18..9db24aae9 100644
--- a/src/components/right/management/ManageGroupMembers.tsx
+++ b/src/components/right/management/ManageGroupMembers.tsx
@@ -19,7 +19,7 @@ import useKeyboardListNavigation from '../../../hooks/useKeyboardListNavigation'
import PrivateChatInfo from '../../common/PrivateChatInfo';
import NothingFound from '../../common/NothingFound';
-import ListItem from '../../ui/ListItem';
+import ListItem, { type MenuItemContextAction } from '../../ui/ListItem';
import InputText from '../../ui/InputText';
import InfiniteScroll from '../../ui/InfiniteScroll';
import Loading from '../../ui/Loading';
@@ -165,7 +165,7 @@ const ManageGroupMembers: FC = ({
onBack: onClose,
});
- function getMemberContextAction(memberId: string) {
+ function getMemberContextAction(memberId: string): MenuItemContextAction[] | undefined {
return memberId === currentUserId || !canDeleteMembers ? undefined : [{
title: lang('lng_context_remove_from_group'),
icon: 'stop',
diff --git a/src/components/right/management/ManageInvites.tsx b/src/components/right/management/ManageInvites.tsx
index 52294b950..bd3da413d 100644
--- a/src/components/right/management/ManageInvites.tsx
+++ b/src/components/right/management/ManageInvites.tsx
@@ -20,7 +20,7 @@ import useInterval from '../../../hooks/useInterval';
import useForceUpdate from '../../../hooks/useForceUpdate';
import useFlag from '../../../hooks/useFlag';
-import ListItem from '../../ui/ListItem';
+import ListItem, { type MenuItemContextAction } from '../../ui/ListItem';
import NothingFound from '../../common/NothingFound';
import Button from '../../ui/Button';
import ConfirmDialog from '../../ui/ConfirmDialog';
@@ -237,7 +237,7 @@ const ManageInvites: FC = ({
};
const prepareContextActions = (invite: ApiExportedInvite) => {
- const actions = [];
+ const actions: MenuItemContextAction[] = [];
actions.push({
title: lang('Copy'),
icon: 'copy',
diff --git a/src/components/story/StorySettings.tsx b/src/components/story/StorySettings.tsx
index 03c1a2580..416833f98 100644
--- a/src/components/story/StorySettings.tsx
+++ b/src/components/story/StorySettings.tsx
@@ -5,6 +5,7 @@ import { getActions, withGlobal } from '../../global';
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';
@@ -44,7 +45,7 @@ interface PrivacyOption {
name: string;
value: PrivacyVisibility;
color: [string, string];
- icon: string;
+ icon: IconName;
actions?: PrivacyAction;
}
diff --git a/src/components/story/StoryView.tsx b/src/components/story/StoryView.tsx
index 4121c2e63..5af091785 100644
--- a/src/components/story/StoryView.tsx
+++ b/src/components/story/StoryView.tsx
@@ -12,7 +12,7 @@ import { getUserFullName } from '../../global/helpers';
import useLastCallback from '../../hooks/useLastCallback';
import useLang from '../../hooks/useLang';
-import ListItem from '../ui/ListItem';
+import ListItem, { type MenuItemContextAction } from '../ui/ListItem';
import ReactionStaticEmoji from '../common/ReactionStaticEmoji';
import PrivateChatInfo from '../common/PrivateChatInfo';
@@ -54,7 +54,7 @@ const StoryView = ({
const { isContact } = user || {};
const fullName = getUserFullName(user);
- const actions = [];
+ const actions: MenuItemContextAction[] = [];
if (!isUserBlocked) {
if (!areStoriesBlocked) {
@@ -134,7 +134,7 @@ const StoryView = ({
userId={storyView.userId}
noStatusOrTyping
status={formatDateAtTime(lang, storyView.date * 1000)}
- statusIcon="icon-message-read"
+ statusIcon="message-read"
withStory
forceShowSelf
/>
diff --git a/src/components/ui/Checkbox.tsx b/src/components/ui/Checkbox.tsx
index fa85041ff..9e8ea0088 100644
--- a/src/components/ui/Checkbox.tsx
+++ b/src/components/ui/Checkbox.tsx
@@ -2,6 +2,8 @@ import type { ChangeEvent } from 'react';
import type { FC, TeactNode } from '../../lib/teact/teact';
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';
@@ -17,7 +19,7 @@ type OwnProps = {
label: TeactNode;
subLabel?: string;
checked: boolean;
- rightIcon?: string;
+ rightIcon?: IconName;
disabled?: boolean;
tabIndex?: number;
round?: boolean;
diff --git a/src/components/ui/ListItem.tsx b/src/components/ui/ListItem.tsx
index 1cd6c20d5..d75bc035f 100644
--- a/src/components/ui/ListItem.tsx
+++ b/src/components/ui/ListItem.tsx
@@ -3,6 +3,8 @@ 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 buildClassName from '../../util/buildClassName';
import renderText from '../common/helpers/renderText';
@@ -24,7 +26,7 @@ import './ListItem.scss';
type MenuItemContextActionItem = {
title: string;
- icon: string;
+ icon: IconName;
destructive?: boolean;
handler?: () => void;
};
@@ -41,9 +43,10 @@ export type MenuItemContextAction =
interface OwnProps {
ref?: RefObject;
buttonRef?: RefObject;
- icon?: string;
+ icon?: IconName;
+ iconClassName?: string;
leftElement?: TeactNode;
- secondaryIcon?: string;
+ secondaryIcon?: IconName;
rightElement?: TeactNode;
buttonClassName?: string;
className?: string;
@@ -74,6 +77,7 @@ const ListItem: FC = ({
ref,
buttonRef,
icon,
+ iconClassName,
leftElement,
buttonClassName,
menuBubbleClassName,
@@ -234,7 +238,7 @@ const ListItem: FC = ({
>
{leftElement}
{icon && (
-
+
)}
{multiline && ({children}
)}
{!multiline && children}
diff --git a/src/components/ui/MenuItem.tsx b/src/components/ui/MenuItem.tsx
index 059028d5a..3e26a0d49 100644
--- a/src/components/ui/MenuItem.tsx
+++ b/src/components/ui/MenuItem.tsx
@@ -1,6 +1,8 @@
import type { FC } from '../../lib/teact/teact';
import React from '../../lib/teact/teact';
+import type { IconName } from '../../types/icons';
+
import { IS_TEST } from '../../config';
import buildClassName from '../../util/buildClassName';
@@ -11,7 +13,7 @@ import useAppLayout from '../../hooks/useAppLayout';
import './MenuItem.scss';
export type MenuItemProps = {
- icon?: string;
+ icon?: IconName | 'A' | 'K';
isCharIcon?: boolean;
customIcon?: React.ReactNode;
className?: string;
diff --git a/src/hooks/reducers/useFoldersReducer.ts b/src/hooks/reducers/useFoldersReducer.ts
index e7d94f1ff..c1924df8b 100644
--- a/src/hooks/reducers/useFoldersReducer.ts
+++ b/src/hooks/reducers/useFoldersReducer.ts
@@ -1,11 +1,12 @@
import type { StateReducer, Dispatch } from '../useReducer';
import type { ApiChatFolder } from '../../api/types';
+import type { IconName } from '../../types/icons';
import { pick, omit } from '../../util/iteratees';
import useReducer from '../useReducer';
export type FolderChatType = {
- icon: string;
+ icon: IconName;
title: string;
key: keyof Pick