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:
Meier Lukas
2024-01-02 15:36:59 +01:00
committed by GitHub
parent fa19966fcc
commit 782897527f
48 changed files with 1226 additions and 81 deletions

View 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>
);
};