diff --git a/apps/infoalloggi/src/components/chat/chat-sidebar.tsx b/apps/infoalloggi/src/components/chat/chat-sidebar.tsx
index fae1438..0bbdf1c 100644
--- a/apps/infoalloggi/src/components/chat/chat-sidebar.tsx
+++ b/apps/infoalloggi/src/components/chat/chat-sidebar.tsx
@@ -1,4 +1,4 @@
-import { Check, CheckCheck, Search, SquarePen } from "lucide-react";
+import { Check, CheckCheck, Crown, Search, SquarePen } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/router";
import { useCallback, useState } from "react";
@@ -159,15 +159,21 @@ export const ChatSidebar = ({
)}
onClick={() => handleChatSelection(chat.chatid)}
>
-
+ {chat.id === userId ? (
+
+
+
+ ) : (
+
+ )}
{isDesktop && (
-
{chat.username}
+
{chat.id === userId ? "Admin Infoalloggi" : chat.username}
{chat.etichette.map((etichetta) => (
{
- return await getUserHandler({ db, id: input.id });
+ return await getUserHandler(input.id);
}),
getUsers: adminProcedure.query(async () => {
@@ -96,7 +96,7 @@ export const usersRouter = createTRPCRouter({
return await editAnagraficaHandler({ ...input });
}),
getActiveUsersWithoutChat: adminProcedure.query(async () => {
- return await getActiveUserWithoutChatHandler({ db });
+ return await getActiveUserWithoutChatHandler();
}),
getUsersWChatInfo: adminProcedure.query(async () => {
diff --git a/apps/infoalloggi/src/server/controllers/user.controller.ts b/apps/infoalloggi/src/server/controllers/user.controller.ts
index 50bd186..cf45e15 100644
--- a/apps/infoalloggi/src/server/controllers/user.controller.ts
+++ b/apps/infoalloggi/src/server/controllers/user.controller.ts
@@ -10,7 +10,7 @@ import type { Etichette } from "~/schemas/public/Etichette";
import type { Users, UsersId, UsersUpdate } from "~/schemas/public/Users";
import type { UsersAnagraficaUpdate } from "~/schemas/public/UsersAnagrafica";
import { getComuni, getNazioni } from "~/server/controllers/catasto.controller";
-import { db, type Querier } from "~/server/db";
+import { db } from "~/server/db";
import { startsWithVowel, titleCase } from "~/utils/utils";
export const editAccountHandler = async ({
@@ -101,13 +101,7 @@ export const blockUserHandler = async (id: UsersId) => {
});
};
-export const getUserHandler = async ({
- db,
- id,
-}: {
- db: Querier;
- id: UsersId;
-}) => {
+export const getUserHandler = async (id: UsersId) => {
try {
const user = await db
.selectFrom("users")
@@ -134,11 +128,7 @@ export type NonNullableUser = {
username: NonNullable;
nome: string | null;
};
-export const getActiveUserWithoutChatHandler = async ({
- db,
-}: {
- db: Querier;
-}) => {
+export const getActiveUserWithoutChatHandler = async () => {
try {
const users = await db
.selectFrom("users")