fix(chat): truncate CAIP-2 address when displaying in summary/header
This commit is contained in:
parent
2e15c447dc
commit
9f3aa00864
@ -1,4 +1,5 @@
|
|||||||
import { demoAddressResolver } from '@/config/chatConstants'
|
import { demoAddressResolver } from '@/config/chatConstants'
|
||||||
|
import { truncate } from '@/utils/HelperUtil'
|
||||||
import { Card, Text } from '@nextui-org/react'
|
import { Card, Text } from '@nextui-org/react'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import NextLink from 'next/link'
|
import NextLink from 'next/link'
|
||||||
@ -40,7 +41,7 @@ export default function ChatSummaryCard({ peerAccount, topic, latestMessage }: I
|
|||||||
<ChatAvatar />
|
<ChatAvatar />
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
<Text h5 css={{ marginLeft: '$9' }}>
|
<Text h5 css={{ marginLeft: '$9' }}>
|
||||||
{demoAddressResolver[peerAccount] ?? peerAccount}
|
{demoAddressResolver[peerAccount] ?? truncate(peerAccount, 24)}
|
||||||
</Text>
|
</Text>
|
||||||
<Text h6 weight="normal" css={{ marginLeft: '$9' }}>
|
<Text h6 weight="normal" css={{ marginLeft: '$9' }}>
|
||||||
{latestMessage ?? ''}
|
{latestMessage ?? ''}
|
||||||
|
@ -9,6 +9,7 @@ import PageHeader from '@/components/PageHeader'
|
|||||||
import { demoAddressResolver } from '@/config/chatConstants'
|
import { demoAddressResolver } from '@/config/chatConstants'
|
||||||
import SettingsStore from '@/store/SettingsStore'
|
import SettingsStore from '@/store/SettingsStore'
|
||||||
import { chatClient } from '@/utils/WalletConnectUtil'
|
import { chatClient } from '@/utils/WalletConnectUtil'
|
||||||
|
import { truncate } from '@/utils/HelperUtil'
|
||||||
|
|
||||||
const ChatContainer = styled('div', {
|
const ChatContainer = styled('div', {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -65,7 +66,7 @@ export default function ChatPage() {
|
|||||||
function getChatTitle() {
|
function getChatTitle() {
|
||||||
if (typeof query.peerAccount !== 'string') return ''
|
if (typeof query.peerAccount !== 'string') return ''
|
||||||
|
|
||||||
return demoAddressResolver[query.peerAccount] ?? query.peerAccount
|
return demoAddressResolver[query.peerAccount] ?? truncate(query.peerAccount, 24)
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user