feat: add widget preview pages (#9)
* feat: add widget definition system * fix: wrong typecheck command in turbo generator * chore: fix formatting * feat: add widget preview page * chore: fix formatting and type errors * chore: fix from widget edit modal and remove some never casts * chore: address pull request feedback
This commit is contained in:
32
apps/nextjs/src/components/user-avatar.tsx
Normal file
32
apps/nextjs/src/components/user-avatar.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { auth } from "@homarr/auth";
|
||||
import type { AvatarProps, MantineSize } from "@homarr/ui";
|
||||
import { Avatar } from "@homarr/ui";
|
||||
|
||||
interface UserAvatarProps {
|
||||
size: MantineSize;
|
||||
}
|
||||
|
||||
export const UserAvatar = async ({ size }: UserAvatarProps) => {
|
||||
const currentSession = await auth();
|
||||
|
||||
const commonProps = {
|
||||
size,
|
||||
color: "primaryColor",
|
||||
} satisfies Partial<AvatarProps>;
|
||||
|
||||
if (!currentSession) return <Avatar {...commonProps} />;
|
||||
if (currentSession.user.image)
|
||||
return (
|
||||
<Avatar
|
||||
{...commonProps}
|
||||
src={currentSession.user.image}
|
||||
alt={currentSession.user.name!}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<Avatar {...commonProps}>
|
||||
{currentSession.user.name!.substring(0, 2).toUpperCase()}
|
||||
</Avatar>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user