diff --git a/apps/nextjs/src/app/[locale]/manage/users/_components/user-list.component.tsx b/apps/nextjs/src/app/[locale]/manage/users/_components/user-list.tsx
similarity index 87%
rename from apps/nextjs/src/app/[locale]/manage/users/_components/user-list.component.tsx
rename to apps/nextjs/src/app/[locale]/manage/users/_components/user-list.tsx
index 8759f5d8d..501476467 100644
--- a/apps/nextjs/src/app/[locale]/manage/users/_components/user-list.component.tsx
+++ b/apps/nextjs/src/app/[locale]/manage/users/_components/user-list.tsx
@@ -2,7 +2,7 @@
import { useMemo } from "react";
import Link from "next/link";
-import { Avatar, Button, Group, Text, ThemeIcon, Title } from "@mantine/core";
+import { Anchor, Button, Group, Text, ThemeIcon, Title } from "@mantine/core";
import { IconCheck } from "@tabler/icons-react";
import type { MRT_ColumnDef } from "mantine-react-table";
import { MantineReactTable, useMantineReactTable } from "mantine-react-table";
@@ -10,6 +10,7 @@ import { MantineReactTable, useMantineReactTable } from "mantine-react-table";
import type { RouterOutputs } from "@homarr/api";
import { clientApi } from "@homarr/api/client";
import { useI18n, useScopedI18n } from "@homarr/translation/client";
+import { UserAvatar } from "@homarr/ui";
interface UserListComponentProps {
initialUserList: RouterOutputs["user"]["getAll"];
@@ -29,12 +30,12 @@ export const UserListComponent = ({ initialUserList }: UserListComponentProps) =
header: t("user.field.username.label"),
grow: 100,
Cell: ({ renderedCellValue, row }) => (
-
-
-
+
+
+
{renderedCellValue}
-
-
+
+
),
},
{
diff --git a/apps/nextjs/src/app/[locale]/manage/users/create/_components/create-user-stepper.tsx b/apps/nextjs/src/app/[locale]/manage/users/create/_components/create-user-stepper.tsx
index 7526e821a..bf5630f54 100644
--- a/apps/nextjs/src/app/[locale]/manage/users/create/_components/create-user-stepper.tsx
+++ b/apps/nextjs/src/app/[locale]/manage/users/create/_components/create-user-stepper.tsx
@@ -1,17 +1,18 @@
"use client";
import { useCallback, useMemo, useState } from "react";
-import { Avatar, Card, PasswordInput, Stack, Stepper, Text, TextInput, Title } from "@mantine/core";
+import { Card, PasswordInput, Stack, Stepper, Text, TextInput, Title } from "@mantine/core";
import { IconUserCheck } from "@tabler/icons-react";
import { clientApi } from "@homarr/api/client";
import { useZodForm } from "@homarr/form";
import { showErrorNotification } from "@homarr/notifications";
import { useScopedI18n } from "@homarr/translation/client";
+import { UserAvatar } from "@homarr/ui";
import { validation, z } from "@homarr/validation";
import { createCustomErrorParams } from "@homarr/validation/form";
-import { StepperNavigationComponent } from "./stepper-navigation.component";
+import { StepperNavigationComponent } from "./stepper-navigation";
export const UserCreateStepperComponent = () => {
const t = useScopedI18n("management.page.user.create");
@@ -150,7 +151,7 @@ export const UserCreateStepperComponent = () => {
- {generalForm.values.username}
+
{generalForm.values.username}
diff --git a/apps/nextjs/src/app/[locale]/manage/users/create/_components/stepper-navigation.component.tsx b/apps/nextjs/src/app/[locale]/manage/users/create/_components/stepper-navigation.tsx
similarity index 100%
rename from apps/nextjs/src/app/[locale]/manage/users/create/_components/stepper-navigation.component.tsx
rename to apps/nextjs/src/app/[locale]/manage/users/create/_components/stepper-navigation.tsx
diff --git a/apps/nextjs/src/app/[locale]/manage/users/page.tsx b/apps/nextjs/src/app/[locale]/manage/users/page.tsx
index 79048e506..af56c3266 100644
--- a/apps/nextjs/src/app/[locale]/manage/users/page.tsx
+++ b/apps/nextjs/src/app/[locale]/manage/users/page.tsx
@@ -3,7 +3,7 @@ import { getScopedI18n } from "@homarr/translation/server";
import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
import { createMetaTitle } from "~/metadata";
-import { UserListComponent } from "./_components/user-list.component";
+import { UserListComponent } from "./_components/user-list";
export async function generateMetadata() {
const t = await getScopedI18n("management.page.user.list");
diff --git a/apps/nextjs/src/components/layout/header/user.tsx b/apps/nextjs/src/components/layout/header/user.tsx
index 5b5590bc7..6ec355630 100644
--- a/apps/nextjs/src/components/layout/header/user.tsx
+++ b/apps/nextjs/src/components/layout/header/user.tsx
@@ -1,13 +1,13 @@
import { UnstyledButton } from "@mantine/core";
-import { UserAvatar } from "~/components/user-avatar";
+import { CurrentUserAvatar } from "~/components/user-avatar";
import { UserAvatarMenu } from "~/components/user-avatar-menu";
export const UserButton = () => {
return (
-
+
);
diff --git a/apps/nextjs/src/components/user-avatar.tsx b/apps/nextjs/src/components/user-avatar.tsx
index 9ddfba554..ce0cdb77b 100644
--- a/apps/nextjs/src/components/user-avatar.tsx
+++ b/apps/nextjs/src/components/user-avatar.tsx
@@ -1,24 +1,19 @@
-import type { AvatarProps, MantineSize } from "@mantine/core";
-import { Avatar } from "@mantine/core";
+import type { MantineSize } from "@mantine/core";
import { auth } from "@homarr/auth/next";
+import { UserAvatar } from "@homarr/ui";
interface UserAvatarProps {
size: MantineSize;
}
-export const UserAvatar = async ({ size }: UserAvatarProps) => {
+export const CurrentUserAvatar = async ({ size }: UserAvatarProps) => {
const currentSession = await auth();
- const commonProps = {
- size,
- color: "primaryColor",
- } satisfies Partial;
+ const user = {
+ name: currentSession?.user.name ?? null,
+ image: currentSession?.user.image ?? null,
+ };
- if (!currentSession?.user) return ;
- if (currentSession.user.image)
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- return ;
-
- return {currentSession.user.name?.substring(0, 2).toUpperCase()};
+ return ;
};
diff --git a/packages/ui/src/components/user-avatar.tsx b/packages/ui/src/components/user-avatar.tsx
index 805be9c9b..87ffca28e 100644
--- a/packages/ui/src/components/user-avatar.tsx
+++ b/packages/ui/src/components/user-avatar.tsx
@@ -12,15 +12,10 @@ interface UserAvatarProps {
}
export const UserAvatar = ({ user, size }: UserAvatarProps) => {
- const commonProps = {
- size,
- color: "primaryColor",
- } satisfies Partial;
-
- if (!user?.name) return ;
+ if (!user?.name) return ;
if (user.image) {
- return ;
+ return ;
}
- return {user.name.substring(0, 2).toUpperCase()};
+ return ;
};