Some improvements

This commit is contained in:
Max 2025-02-02 17:48:11 +03:00
parent 0eb840b82a
commit 6054bc0403
2 changed files with 13 additions and 2 deletions

View File

@ -1,6 +1,8 @@
import { Avatar, Badge, Card, Flex, Separator, Text } from "@radix-ui/themes";
import { useQuery } from "@tanstack/react-query";
import { useAtomValue } from "jotai";
import { userAtom } from "../../AtomStore/AtomStore";
import { axiosLocalhost } from "../../api/axios/axios";
type TUserCard = {
username?: string;
@ -10,6 +12,15 @@ type TUserCard = {
export default function UserCard(props: TUserCard) {
const user = useAtomValue(userAtom);
const { data } = useQuery({
queryKey: [`userCard${props.userId}`],
queryFn: async () => {
const response = await axiosLocalhost.get(`/users/${props.userId}`);
return response.data;
},
enabled: !!props.userId,
});
const getInitials = (username: string): string => {
const result = username
.split(" ")

View File

@ -3,11 +3,11 @@ import { loremText } from "../../constants/loremText";
export default function UserProfilePage() {
return (
<Flex direction={"column"} className="flex-grow-[8]">
<Flex direction={"column"} className="flex-grow-[8] overflow-hidden">
<ScrollArea
type="auto"
scrollbars="vertical"
className="flex-grow-[1] min-h-0 pr-5"
className="flex-grow-[1] pr-5"
>
<Text>
<p className="text-justify">{loremText}</p>