This commit is contained in:
or-else
2026-01-20 12:58:58 +03:00
parent a54ae70746
commit 234fb48b93
21 changed files with 179 additions and 76 deletions
+2 -2
View File
@@ -346,11 +346,11 @@ class CallPanel extends React.PureComponent {
}
handleDataChannelClose(event) {
console.log('close data channel:', event);
console.info('close data channel:', event);
}
handleDataChannelEvent(event) {
console.log('data channel event:', event);
console.info('data channel event:', event);
const channel = event.channel;
channel.onerror = this.handleDataChannelError;
channel.onmessage = this.handleDataChannelMessage;
+17 -3
View File
@@ -2,7 +2,7 @@
import React from 'react';
import { FormattedMessage, injectIntl } from 'react-intl';
import { Drafty, Tinode } from 'tinode-sdk';
import { Drafty, Tinode, TheCard } from 'tinode-sdk';
import Attachment from './attachment.jsx';
import LetterTile from './letter-tile.jsx';
@@ -10,6 +10,7 @@ import ReceivedMarker from './received-marker.jsx'
import { fullFormatter } from '../lib/formatters.js';
import { sanitizeUrl } from '../lib/utils.js';
import HashNavigation from '../lib/navigation.js';
class BaseChatMessage extends React.PureComponent {
constructor(props) {
@@ -55,13 +56,26 @@ class BaseChatMessage extends React.PureComponent {
this.handleQuoteClick(e);
break;
case 'contact_chat':
e.preventDefault();
try {
// tinode:topic/usr123abc -> usr123abc
const pathname = new URL(e.target.dataset.val)?.pathname;
const parts = pathname.split('/').filter(Boolean);
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', parts.pop() || ''));
} catch (error) {
console.error("Invalid URL:", error);
}
break;
case 'contact_find':
e.preventDefault();
console.log('Contact click handling not implemented yet.', action, e.target.dataset);
let hashUrl = HashNavigation.setUrlSidePanel(window.location.hash, 'newtpk');
hashUrl = HashNavigation.addUrlParam(hashUrl, 'q', e.target.dataset.val);
hashUrl = HashNavigation.addUrlParam(hashUrl, 'tab', 'find');
HashNavigation.navigateTo(hashUrl);
break;
default:
// No special handling; let the browser deal with it.
console.log('Unhandled drafty action.', action, e.target.dataset);
console.info('Unhandled drafty action.', action, e.target.dataset);
break;
}
}
+3 -2
View File
@@ -8,7 +8,7 @@ export default class SearchContacts extends React.PureComponent {
this.state = {
edited: false,
search: ''
search: this.props.initialQuery || ''
};
this.handleSearchChange = this.handleSearchChange.bind(this);
@@ -47,7 +47,8 @@ export default class SearchContacts extends React.PureComponent {
if (e.key === 'Enter') {
this.handleSearch(e);
} else if (e.key === 'Escape') {
this.handleClear();
e.stopPropagation();
this.handleClear(e);
}
}
+17 -13
View File
@@ -71,20 +71,24 @@ class TheCardMini extends React.PureComponent {
</div>
</div>
<div className="contact-actions">
{uid &&
<a className="flat-button" data-val={uid} onClick={this.props.onChatClick}>
<FormattedMessage id="chat_now" defaultMessage="Chat"
description="Label for message button in contact card" />
</a>
{uid ?
<>
<a className="flat-button" data-val={uid} onClick={this.props.onChatClick}>
<FormattedMessage id="chat_now" defaultMessage="Chat"
description="Label for message button in contact card" />
</a>
<div className="divider"></div>
</>
: contacts.length > 0 ?
<>
<a className="flat-button" data-val={contacts.join(',')} onClick={this.props.onFindClick}>
<FormattedMessage id="find_user" defaultMessage="Find"
description="Label for search button in contact card" />
</a>
<div className="divider"></div>
</>
: null
}
{uid && <div className="divider"></div>}
{contacts.length > 0 &&
<a className="flat-button" data-val={contacts.join(',')} onClick={this.props.onChatClick}>
<FormattedMessage id="find_user" defaultMessage="Find"
description="Label for search button in contact card" />
</a>
}
{contacts.length > 0 && <div className="divider"></div>}
<a className="flat-button" onClick={this.handleDownload}>
<FormattedMessage id="save_action" defaultMessage="Save" description="Label for Save button" />
</a>