mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Rewrite activity log page in dashboard
This commit is contained in:
parent
13aa3c9efa
commit
3bad9f0378
8 changed files with 272 additions and 16 deletions
34
src/components/UserAvatar.tsx
Normal file
34
src/components/UserAvatar.tsx
Normal file
|
@ -0,0 +1,34 @@
|
|||
import React, { FC } from 'react';
|
||||
import type { UserDto } from '@jellyfin/sdk/lib/generated-client/models/user-dto';
|
||||
import Avatar from '@mui/material/Avatar';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
|
||||
import { useApi } from 'hooks/useApi';
|
||||
|
||||
interface UserAvatarProps {
|
||||
user?: UserDto
|
||||
showTitle?: boolean
|
||||
}
|
||||
|
||||
const UserAvatar: FC<UserAvatarProps> = ({ user, showTitle = false }) => {
|
||||
const { api } = useApi();
|
||||
const theme = useTheme();
|
||||
|
||||
return user ? (
|
||||
<Avatar
|
||||
alt={user.Name ?? undefined}
|
||||
title={showTitle && user.Name ? user.Name : undefined}
|
||||
src={
|
||||
api && user.Id && user.PrimaryImageTag ?
|
||||
`${api.basePath}/Users/${user.Id}/Images/Primary?tag=${user.PrimaryImageTag}` :
|
||||
undefined
|
||||
}
|
||||
sx={{
|
||||
bgcolor: theme.palette.primary.dark,
|
||||
color: 'inherit'
|
||||
}}
|
||||
/>
|
||||
) : null;
|
||||
};
|
||||
|
||||
export default UserAvatar;
|
Loading…
Add table
Add a link
Reference in a new issue