mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 18:08:17 -07:00
use LinkButton in UserCardBox
This commit is contained in:
parent
b27b559d21
commit
6eb6d75797
@ -4,19 +4,10 @@ import { formatDistanceToNow } from 'date-fns';
|
||||
import { getLocaleWithSuffix } from '../../../utils/dateFnsLocale';
|
||||
import globalize from '../../../lib/globalize';
|
||||
import IconButtonElement from '../../../elements/IconButtonElement';
|
||||
import LinkButton from '../../../elements/emby-button/LinkButton';
|
||||
import escapeHTML from 'escape-html';
|
||||
import { getDefaultBackgroundClass } from '../../cardbuilder/cardBuilderUtils';
|
||||
|
||||
const createLinkElement = ({ user, renderImgUrl }: { user: UserDto, renderImgUrl: string }) => ({
|
||||
__html: `<a
|
||||
is="emby-linkbutton"
|
||||
class="cardContent"
|
||||
href="#/dashboard/users/profile?userId=${user.Id}"
|
||||
>
|
||||
${renderImgUrl}
|
||||
</a>`
|
||||
});
|
||||
|
||||
type IProps = {
|
||||
user?: UserDto;
|
||||
};
|
||||
@ -55,22 +46,21 @@ const UserCardBox: FunctionComponent<IProps> = ({ user = {} }: IProps) => {
|
||||
const lastSeen = getLastSeenText(user.LastActivityDate);
|
||||
|
||||
const renderImgUrl = imgUrl ?
|
||||
`<div class='${imageClass}' style='background-image:url(${imgUrl})'></div>` :
|
||||
`<div class='${imageClass} ${getDefaultBackgroundClass(user.Name)} flex align-items-center justify-content-center'>
|
||||
<span class='material-icons cardImageIcon person' aria-hidden='true'></span>
|
||||
</div>`;
|
||||
<div className={imageClass} style={{ backgroundImage: `url(${imgUrl})` }} /> :
|
||||
<div className={`${imageClass} ${getDefaultBackgroundClass(user.Name)} flex align-items-center justify-content-center`}>
|
||||
<span className='material-icons cardImageIcon person' aria-hidden='true'></span>
|
||||
</div>;
|
||||
|
||||
return (
|
||||
<div data-userid={user.Id} data-username={user.Name} className={cssClass}>
|
||||
<div className='cardBox visualCardBox'>
|
||||
<div className='cardScalable visualCardBox-cardScalable'>
|
||||
<div className='cardPadder cardPadder-square'></div>
|
||||
<div
|
||||
dangerouslySetInnerHTML={createLinkElement({
|
||||
user: user,
|
||||
renderImgUrl: renderImgUrl
|
||||
})}
|
||||
/>
|
||||
<LinkButton
|
||||
className='cardContent'
|
||||
href={`#/dashboard/users/profile?userId=${user.Id}`}>
|
||||
{renderImgUrl}
|
||||
</LinkButton>
|
||||
</div>
|
||||
<div className='cardFooter visualCardBox-cardFooter'>
|
||||
<div
|
||||
|
Loading…
Reference in New Issue
Block a user