diff --git a/api/functions/graphql/types/users.js b/api/functions/graphql/types/users.js index f9d7bdf..3ec0a8a 100644 --- a/api/functions/graphql/types/users.js +++ b/api/functions/graphql/types/users.js @@ -72,7 +72,6 @@ const BaseUser = interfaceType({ }).then(d => d.map(item => item.tournament)) } }) - t.nonNull.list.nonNull.field('projects', { type: "Project", resolve: async (parent) => { diff --git a/src/features/Profiles/Components/Avatar/Avatar.tsx b/src/features/Profiles/Components/Avatar/Avatar.tsx index 5ceae65..73d9518 100644 --- a/src/features/Profiles/Components/Avatar/Avatar.tsx +++ b/src/features/Profiles/Components/Avatar/Avatar.tsx @@ -16,7 +16,9 @@ export default function Avatar({ src, alt, className, width = 40, renderTooltip setTooltipRef, setTriggerRef, visible, - } = usePopperTooltip(); + } = usePopperTooltip({ + + }); return ( <> @@ -28,7 +30,7 @@ export default function Avatar({ src, alt, className, width = 40, renderTooltip (renderTooltip && visible) && (
{renderTooltip()} diff --git a/src/features/Profiles/pages/ProfilePage/AboutCard/AboutCard.tsx b/src/features/Profiles/pages/ProfilePage/AboutCard/AboutCard.tsx index d1efa14..daf76c6 100644 --- a/src/features/Profiles/pages/ProfilePage/AboutCard/AboutCard.tsx +++ b/src/features/Profiles/pages/ProfilePage/AboutCard/AboutCard.tsx @@ -100,11 +100,11 @@ export default function AboutCard({ user, isOwner }: Props) { : NotificationsService.info(" Copied to clipboard", { icon: "📋" })} > } + } +
    + {projects.map(project => { + return +
  • + +
    +

    {project.title}

    +

    {project.category.icon} {project.category.title}

    +
    +
  • + + })} +
+ + ) +} diff --git a/src/features/Profiles/pages/ProfilePage/ProfilePage.tsx b/src/features/Profiles/pages/ProfilePage/ProfilePage.tsx index d722052..f4fdac1 100644 --- a/src/features/Profiles/pages/ProfilePage/ProfilePage.tsx +++ b/src/features/Profiles/pages/ProfilePage/ProfilePage.tsx @@ -12,6 +12,7 @@ import SkillsCard from "./SkillsCard/SkillsCard" import TournamentsCard from "./TournamentsCard/TournamentsCard" import { MEDIA_QUERIES } from "src/utils/theme" import SimilarMakersCard from "./SimilarMakersCard/SimilarMakersCard" +import MakerProjectsCard from "./MakerProjectsCard/MakerProjectsCard" export default function ProfilePage() { @@ -65,6 +66,7 @@ export default function ProfilePage() { @@ -74,6 +76,7 @@ export default function ProfilePage() { + diff --git a/src/features/Profiles/pages/ProfilePage/profile.graphql b/src/features/Profiles/pages/ProfilePage/profile.graphql index 76829c8..dfa428e 100644 --- a/src/features/Profiles/pages/ProfilePage/profile.graphql +++ b/src/features/Profiles/pages/ProfilePage/profile.graphql @@ -17,6 +17,17 @@ query profile($profileId: Int!) { start_date end_date } + projects { + id + hashtag + title + thumbnail_image + category { + id + icon + title + } + } similar_makers { id name diff --git a/src/features/Projects/pages/ProjectPage/Components/MakersCard/MakersCard.tsx b/src/features/Projects/pages/ProjectPage/Components/MakersCard/MakersCard.tsx index 7a9e2b5..29c86f0 100644 --- a/src/features/Projects/pages/ProjectPage/Components/MakersCard/MakersCard.tsx +++ b/src/features/Projects/pages/ProjectPage/Components/MakersCard/MakersCard.tsx @@ -2,6 +2,7 @@ import { Link } from 'react-router-dom' import Badge from 'src/Components/Badge/Badge' import Card from 'src/Components/Card/Card' import Avatar from 'src/features/Profiles/Components/Avatar/Avatar' +import { sortMembersByRole } from 'src/features/Projects/utils/helperFunctions' import { ProjectDetailsQuery } from 'src/graphql' import { createRoute } from 'src/utils/routing' @@ -20,7 +21,7 @@ export default function MakersCard({ members, recruit_roles }: Props) {
{members.length === 0 &&

Not listed

} - {members.map(m => + {sortMembersByRole(members).map(m => } {project.members.length > 0 && -
+

MAKERS

- {project.members.map(m => + {sortMembersByRole(project.members).map(m =>
+ renderTooltip={() =>

{m.user.name}

diff --git a/src/features/Projects/pages/ProjectPage/ProjectPage.tsx b/src/features/Projects/pages/ProjectPage/ProjectPage.tsx index 2f22c69..453933d 100644 --- a/src/features/Projects/pages/ProjectPage/ProjectPage.tsx +++ b/src/features/Projects/pages/ProjectPage/ProjectPage.tsx @@ -70,7 +70,7 @@ export default function ProjectPage() {
-
{isMediumScreen ? diff --git a/src/features/Projects/utils/helperFunctions.ts b/src/features/Projects/utils/helperFunctions.ts new file mode 100644 index 0000000..0c44550 --- /dev/null +++ b/src/features/Projects/utils/helperFunctions.ts @@ -0,0 +1,11 @@ +import { Team_Member_Role } from "src/graphql"; + +export function sortMembersByRole(members: T[]) { + return [...members].sort((a, b) => { + if (a.role === b.role) return 0 + if (a.role === Team_Member_Role.Owner) return -1; + if (b.role === Team_Member_Role.Owner) return +1; + if (a.role === Team_Member_Role.Admin) return -1; + return +1; + }) +} \ No newline at end of file diff --git a/src/graphql/index.tsx b/src/graphql/index.tsx index 6d813b1..ce72b90 100644 --- a/src/graphql/index.tsx +++ b/src/graphql/index.tsx @@ -1030,7 +1030,7 @@ export type ProfileQueryVariables = Exact<{ }>; -export type ProfileQuery = { __typename?: 'Query', profile: { __typename?: 'User', id: number, name: string, avatar: string, join_date: any, role: string | null, jobTitle: string | null, lightning_address: string | null, website: string | null, twitter: string | null, discord: string | null, github: string | null, linkedin: string | null, bio: string | null, location: string | null, stories: Array<{ __typename?: 'Story', id: number, title: string, createdAt: any, tags: Array<{ __typename?: 'Tag', id: number, title: string, icon: string | null }> }>, tournaments: Array<{ __typename?: 'Tournament', id: number, title: string, thumbnail_image: string, start_date: any, end_date: any }>, similar_makers: Array<{ __typename?: 'User', id: number, name: string, avatar: string, jobTitle: string | null }>, skills: Array<{ __typename?: 'MakerSkill', id: number, title: string }>, roles: Array<{ __typename?: 'MakerRole', id: number, title: string, icon: string, level: RoleLevelEnum }> } | null }; +export type ProfileQuery = { __typename?: 'Query', profile: { __typename?: 'User', id: number, name: string, avatar: string, join_date: any, role: string | null, jobTitle: string | null, lightning_address: string | null, website: string | null, twitter: string | null, discord: string | null, github: string | null, linkedin: string | null, bio: string | null, location: string | null, stories: Array<{ __typename?: 'Story', id: number, title: string, createdAt: any, tags: Array<{ __typename?: 'Tag', id: number, title: string, icon: string | null }> }>, tournaments: Array<{ __typename?: 'Tournament', id: number, title: string, thumbnail_image: string, start_date: any, end_date: any }>, projects: Array<{ __typename?: 'Project', id: number, hashtag: string, title: string, thumbnail_image: string, category: { __typename?: 'Category', id: number, icon: string | null, title: string } }>, similar_makers: Array<{ __typename?: 'User', id: number, name: string, avatar: string, jobTitle: string | null }>, skills: Array<{ __typename?: 'MakerSkill', id: number, title: string }>, roles: Array<{ __typename?: 'MakerRole', id: number, title: string, icon: string, level: RoleLevelEnum }> } | null }; export type CategoryPageQueryVariables = Exact<{ categoryId: Scalars['Int']; @@ -2311,6 +2311,17 @@ export const ProfileDocument = gql` start_date end_date } + projects { + id + hashtag + title + thumbnail_image + category { + id + icon + title + } + } similar_makers { id name diff --git a/src/mocks/data/users.ts b/src/mocks/data/users.ts index a2eb85d..8177b82 100644 --- a/src/mocks/data/users.ts +++ b/src/mocks/data/users.ts @@ -179,7 +179,7 @@ export const users: (User & MyProfile)[] = [{ skills: randomItems(7, ...allMakersSkills), tournaments, similar_makers, - projects, + projects: projects.slice(0, 3), }, { id: 441, @@ -219,7 +219,7 @@ export const users: (User & MyProfile)[] = [{ skills: randomItems(7, ...allMakersSkills), tournaments, similar_makers, - projects, + projects: projects.slice(0, 3), }, { id: 422, @@ -258,7 +258,7 @@ export const users: (User & MyProfile)[] = [{ skills: randomItems(7, ...allMakersSkills), tournaments, similar_makers, - projects, + projects: projects.slice(0, 3), }, { id: 511, @@ -297,7 +297,7 @@ export const users: (User & MyProfile)[] = [{ skills: randomItems(7, ...allMakersSkills), tournaments, similar_makers, - projects, + projects: projects.slice(0, 3), }]