From 949a8ab3a601d2b41be676e43d36afddcade8ccd Mon Sep 17 00:00:00 2001 From: Douglas Sebastian Date: Fri, 1 Dec 2023 22:13:37 -0300 Subject: [PATCH] change: use ProfileClass on GroupContext --- src/pages/Group/Group.tsx | 5 +++-- src/pages/Group/GroupContext.tsx | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/Group/Group.tsx b/src/pages/Group/Group.tsx index f1fdff8d..9075aeb6 100644 --- a/src/pages/Group/Group.tsx +++ b/src/pages/Group/Group.tsx @@ -5,6 +5,7 @@ import { GroupContext, GroupIntro, GroupTabRenderer, GroupTabs, fetchGroupPageDa import { ProfileInfo } from "@/components/ProfileInfo/ProfileInfo"; import { AuthContext } from "@/contexts/Auth"; import "./Group.less"; +import { ProfileClass } from "@/types/Profile"; export function GroupPage() { const page = useLoaderData() as GroupPageLoaderResponse; @@ -72,11 +73,11 @@ export function GroupPage() { group: data.group!, loggedData: { isParticipant: data.loggedData?.isParticipant!, - profile: data.loggedData?.profile!, + profile: new ProfileClass(data.loggedData?.profile!), links: data.loggedData?.links ?? [], groups: data.loggedData?.groups ?? [], }, - participants: data.participants, + participants: data.participants.map(ProfileClass.new), subgroups: data.subGroups, currentContent: undefined, diff --git a/src/pages/Group/GroupContext.tsx b/src/pages/Group/GroupContext.tsx index 61fbe989..0d5730b8 100644 --- a/src/pages/Group/GroupContext.tsx +++ b/src/pages/Group/GroupContext.tsx @@ -1,13 +1,13 @@ import { createContext } from "react"; import { Group } from "@/types/Group"; -import { Profile } from "@/types/Profile"; +import { type ProfileClass } from "@/types/Profile"; import type { Content, Folder } from "@/types/Capacity"; import { Link } from "@/types/Link"; export type GroupContextType = null | { group: Group; subgroups: Group[]; - participants: Profile[]; + participants: ProfileClass[]; folders: Folder[]; currentContent: Folder | undefined; @@ -33,7 +33,7 @@ export type GroupContextType = null | { loggedData: { isParticipant: boolean; - profile: Profile; + profile: ProfileClass; links: Link[]; groups: Group[]; };