fix(react): use chat name from the route
This commit is contained in:
parent
ca36082f55
commit
fb147e7929
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue