mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 00:50:56 -05:00
Show tooltip for long statuses.
This commit is contained in:
parent
cf7dd6f99b
commit
9bbbf5ffc8
3 changed files with 14 additions and 4 deletions
|
@ -2,15 +2,25 @@ import { User } from "revolt.js";
|
|||
import { Users } from "revolt.js/dist/api/objects";
|
||||
|
||||
import { Text } from "preact-i18n";
|
||||
import Tooltip from "../Tooltip";
|
||||
|
||||
interface Props {
|
||||
user: User;
|
||||
tooltip?: boolean;
|
||||
}
|
||||
|
||||
export default function UserStatus({ user }: Props) {
|
||||
export default function UserStatus({ user, tooltip }: Props) {
|
||||
if (user.online) {
|
||||
if (user.status?.text) {
|
||||
return <>{user.status?.text}</>;
|
||||
if (tooltip) {
|
||||
return (
|
||||
<Tooltip arrow={undefined} content={ user.status.text }>
|
||||
{ user.status.text }
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
return <>{user.status.text}</>;
|
||||
}
|
||||
|
||||
if (user.status?.presence === Users.Presence.Busy) {
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
> * {
|
||||
* {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
|
|
@ -152,7 +152,7 @@ export function UserProfile({ user_id, onClose, dummy, dummyProfile }: Props) {
|
|||
</Localizer>
|
||||
{user.status?.text && (
|
||||
<span className={styles.status}>
|
||||
<UserStatus user={user} />
|
||||
<UserStatus user={user} tooltip />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue