fix(react): use chat name from the route

This commit is contained in:
Pavel Prichodko 2022-05-23 14:44:05 +02:00
parent ca36082f55
commit fb147e7929
No known key found for this signature in database
GPG Key ID: 8E4C82D464215E83
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>