mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-27 05:50:03 +00:00
76fec39670
- Re-did litely theme. - Increased spacing. - Fixed up navbar to not full width. - Made login/sign up stand out. - Made thumbnails have a light background. - Removed btn-sm, made almost all buttons bigger. - Made all badges lighter. - Made card backgrounds transparent. - Fixes #888
61 lines
1.4 KiB
TypeScript
Vendored
61 lines
1.4 KiB
TypeScript
Vendored
import { Component } from 'inferno';
|
|
import { Link } from 'inferno-router';
|
|
import { UserView } from '../interfaces';
|
|
import {
|
|
pictrsAvatarThumbnail,
|
|
showAvatars,
|
|
hostname,
|
|
isCakeDay,
|
|
} from '../utils';
|
|
import { CakeDay } from './cake-day';
|
|
|
|
interface UserOther {
|
|
name: string;
|
|
id?: number; // Necessary if its federated
|
|
avatar?: string;
|
|
local?: boolean;
|
|
actor_id?: string;
|
|
published?: string;
|
|
}
|
|
|
|
interface UserListingProps {
|
|
user: UserView | UserOther;
|
|
realLink?: boolean;
|
|
}
|
|
|
|
export class UserListing extends Component<UserListingProps, any> {
|
|
constructor(props: any, context: any) {
|
|
super(props, context);
|
|
}
|
|
|
|
render() {
|
|
let user = this.props.user;
|
|
let local = user.local == null ? true : user.local;
|
|
let name_: string, link: string;
|
|
|
|
if (local) {
|
|
name_ = user.name;
|
|
link = `/u/${user.name}`;
|
|
} else {
|
|
name_ = `${user.name}@${hostname(user.actor_id)}`;
|
|
link = !this.props.realLink ? `/user/${user.id}` : user.actor_id;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<Link className="text-info" to={link}>
|
|
{user.avatar && showAvatars() && (
|
|
<img
|
|
style="width: 2rem; height: 2rem;"
|
|
src={pictrsAvatarThumbnail(user.avatar)}
|
|
class="rounded-circle mr-2"
|
|
/>
|
|
)}
|
|
<span>{name_}</span>
|
|
</Link>
|
|
|
|
{isCakeDay(user.published) && <CakeDay creatorName={name_} />}
|
|
</>
|
|
);
|
|
}
|
|
}
|