Message / Buttons: Do not show arrow for t.me links

This commit is contained in:
Alexander Zinchuk 2021-06-29 17:23:34 +03:00
parent f3e66ad75e
commit 92a17c6cf1
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,8 @@ import React, { FC } from '../../../lib/teact/teact';
import { ApiKeyboardButton, ApiMessage } from '../../../api/types';
import { RE_TME_LINK } from '../../../config';
import Button from '../../ui/Button';
import './InlineButtons.scss';
@ -24,7 +26,7 @@ const InlineButtons: FC<OwnProps> = ({ message, onClick }) => {
onClick={() => onClick({ button })}
>
{button.text}
{button.type === 'url' && <i className="icon-arrow-right" />}
{button.type === 'url' && !button.value!.match(RE_TME_LINK) && <i className="icon-arrow-right" />}
</Button>
))}
</div>

View File

@ -23,7 +23,7 @@ export default function useFocusMessage(
messagesContainer,
elementRef.current,
// `noFocusHighlight` always called from “scroll-to-bottom” buttons
noFocusHighlight ? 'end' : 'center',
noFocusHighlight ? 'end' : 'centerOrTop',
FOCUS_MARGIN,
focusDirection === undefined ? FOCUS_MAX_OFFSET : RELOCATED_FOCUS_OFFSET,
focusDirection,