mirror of
https://github.com/flarum/core.git
synced 2025-10-12 23:44:27 +02:00
Convert common helpers to Typescript (#2541)
This commit is contained in:
12
js/src/common/helpers/username.tsx
Normal file
12
js/src/common/helpers/username.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import * as Mithril from 'mithril';
|
||||
import User from '../models/User';
|
||||
|
||||
/**
|
||||
* The `username` helper displays a user's username in a <span class="username">
|
||||
* tag. If the user doesn't exist, the username will be displayed as [deleted].
|
||||
*/
|
||||
export default function username(user: User): Mithril.Vnode {
|
||||
const name = (user && user.displayName()) || app.translator.trans('core.lib.username.deleted_text');
|
||||
|
||||
return <span className="username">{name}</span>;
|
||||
}
|
Reference in New Issue
Block a user