fix(react): use chat name from the route

This commit is contained in:
Pavel Prichodko 2022-05-23 14:44:05 +02:00
parent 7265ec260c
commit b8348c40f3
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import React from 'react' import React from 'react'
import { useMatch } from 'react-router-dom'
import { PinIcon } from '~/src/icons/pin-icon' import { PinIcon } from '~/src/icons/pin-icon'
import { Avatar, DialogTrigger, Flex, Text } from '~/src/system' import { Avatar, DialogTrigger, Flex, Text } from '~/src/system'
@ -13,13 +15,14 @@ interface Props {
export const ChatInfo = (props: Props) => { export const ChatInfo = (props: Props) => {
const { chat } = props const { chat } = props
const { params } = useMatch(':id')! // eslint-disable-line @typescript-eslint/no-non-null-assertion
if (chat.type == 'channel') { if (chat.type == 'channel') {
return ( return (
<Flex align="center" gap="2"> <Flex align="center" gap="2">
<Avatar size={36} src={chat.imageUrl} /> <Avatar size={36} src={chat.imageUrl} />
<div> <div>
<Text>#general</Text> <Text>#{params.id}</Text>
<Flex align="center"> <Flex align="center">
<Text size={12} color="gray"> <Text size={12} color="gray">
<DialogTrigger> <DialogTrigger>