Some improvements
This commit is contained in:
parent
0eb840b82a
commit
6054bc0403
@ -1,6 +1,8 @@
|
|||||||
import { Avatar, Badge, Card, Flex, Separator, Text } from "@radix-ui/themes";
|
import { Avatar, Badge, Card, Flex, Separator, Text } from "@radix-ui/themes";
|
||||||
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { useAtomValue } from "jotai";
|
import { useAtomValue } from "jotai";
|
||||||
import { userAtom } from "../../AtomStore/AtomStore";
|
import { userAtom } from "../../AtomStore/AtomStore";
|
||||||
|
import { axiosLocalhost } from "../../api/axios/axios";
|
||||||
|
|
||||||
type TUserCard = {
|
type TUserCard = {
|
||||||
username?: string;
|
username?: string;
|
||||||
@ -10,6 +12,15 @@ type TUserCard = {
|
|||||||
export default function UserCard(props: TUserCard) {
|
export default function UserCard(props: TUserCard) {
|
||||||
const user = useAtomValue(userAtom);
|
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 getInitials = (username: string): string => {
|
||||||
const result = username
|
const result = username
|
||||||
.split(" ")
|
.split(" ")
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import { loremText } from "../../constants/loremText";
|
|||||||
|
|
||||||
export default function UserProfilePage() {
|
export default function UserProfilePage() {
|
||||||
return (
|
return (
|
||||||
<Flex direction={"column"} className="flex-grow-[8]">
|
<Flex direction={"column"} className="flex-grow-[8] overflow-hidden">
|
||||||
<ScrollArea
|
<ScrollArea
|
||||||
type="auto"
|
type="auto"
|
||||||
scrollbars="vertical"
|
scrollbars="vertical"
|
||||||
className="flex-grow-[1] min-h-0 pr-5"
|
className="flex-grow-[1] pr-5"
|
||||||
>
|
>
|
||||||
<Text>
|
<Text>
|
||||||
<p className="text-justify">{loremText}</p>
|
<p className="text-justify">{loremText}</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user