Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Commit

Permalink
fix: display correct skills
Browse files Browse the repository at this point in the history
  • Loading branch information
pupixipup committed Feb 23, 2024
1 parent 76b4ff6 commit 71b52f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { IUserResponse } from '@teameights/types';
export const useGetUserByName = (username: string): { data: IUserResponse | undefined } => {
const users = useGetUsers(JSON.stringify({ username: username }));

return { data: users?.data?.pages[0]?.data[0] ?? undefined };
return { data: users?.data?.pages[0]?.data[0] };
};
7 changes: 3 additions & 4 deletions client/src/app/(main)/[username]/profile/ui/fields/skills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,25 @@ export const Skills = () => {
const { data: user } = useGetUserByName(username as string);
const skills = {
coreTools: {
badge: BadgeIcon,
badge: ( { data }: { data: string }) => <BadgeIcon data={data} isActive={true} />,
title: 'Core Tools',
},
additionalTools: {
badge: BadgeText,
title: 'Additional Tools',
},
};

return (
<Flex gap='24px' direction='column'>
{user?.skills &&
{user!.skills &&
Object.entries(skills).map(skill => {
const skillName = skill[0] as keyof typeof skills;
const Badge = skills[skillName].badge;
return (
<Flex key={skillName} direction='column' gap='8px'>
<Typography>{skills[skillName].title}</Typography>
<Flex wrap='wrap' gap='8px'>
{user?.skills?.coreTools.map((lang: string) => <Badge key={lang} data={lang} />)}
{user?.skills![skillName]?.map((lang: string) => <Badge key={lang} data={lang} />)}
</Flex>
</Flex>
);
Expand Down

0 comments on commit 71b52f5

Please sign in to comment.