import React, { memo } from '../../../lib/teact/teact'; import type { ApiUser } from '../../../api/types'; import buildClassName from '../../../util/buildClassName'; import renderText from '../../common/helpers/renderText'; import useLastCallback from '../../../hooks/useLastCallback'; import Avatar from '../../common/Avatar'; import ListItem from '../../ui/ListItem'; import './ChatCommand.scss'; type OwnProps = { command: string; description: string; peer?: ApiUser; withAvatar?: boolean; focus?: boolean; clickArg: T; onClick: (arg: T) => void; }; // eslint-disable-next-line @typescript-eslint/comma-dangle const ChatCommand = ({ withAvatar, focus, command, description, peer, clickArg, onClick, }: OwnProps) => { const handleClick = useLastCallback(() => { onClick(clickArg); }); return ( {withAvatar && ( )}
/{command} {renderText(description)}
); }; export default memo(ChatCommand);