2022-05-25 15:50:31 +00:00
|
|
|
import { UserData } from "../utils/telegram";
|
2022-05-27 00:46:30 +00:00
|
|
|
import { TelegramAvatar } from "./TelegramAvatar";
|
2022-05-25 15:50:31 +00:00
|
|
|
|
|
|
|
interface TelegramUserLinkProps {
|
|
|
|
u: UserData
|
|
|
|
}
|
|
|
|
|
2022-05-27 00:46:30 +00:00
|
|
|
export function TelegramUser({u}: TelegramUserLinkProps) {
|
2022-05-25 15:50:31 +00:00
|
|
|
|
|
|
|
if(u.username) return (
|
|
|
|
<a href={`https://t.me/${u.username}`}>
|
2022-05-27 00:46:30 +00:00
|
|
|
<TelegramAvatar u={u}/>
|
2022-05-25 15:50:31 +00:00
|
|
|
{u.username}
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
else if(u.last_name) return (
|
|
|
|
<span>
|
2022-05-27 00:46:30 +00:00
|
|
|
<TelegramAvatar u={u}/>
|
2022-05-25 15:50:31 +00:00
|
|
|
{u.first_name} {u.last_name}
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
else return (
|
|
|
|
<span>
|
2022-05-27 00:46:30 +00:00
|
|
|
<TelegramAvatar u={u}/>
|
|
|
|
{u.first_name}
|
2022-05-25 15:50:31 +00:00
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|