Skip to content

Commit

Permalink
change: Folder.assignedBy as list
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiMiyo committed Oct 18, 2024
1 parent c09a482 commit 563e840
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/pages/Content/ContentHeader/ContentHeader.less
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
margin-right: .25em;
}

#assigned-by-link {
.assigned-by-link {
margin-left: .25em;
}
}
Expand Down
11 changes: 9 additions & 2 deletions src/pages/Content/ContentHeader/ContentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function ContentHeader() {

const author = new ProfileClass(context.content.author);
const assignedBy = context.content.assignedBy && !context.watchingProfile
? new ProfileClass(context.content.assignedBy)
? context.content.assignedBy.map(ProfileClass.new)
: undefined;

const materialCount = context.materials.length;
Expand Down Expand Up @@ -51,7 +51,14 @@ export function ContentHeader() {
<div id="assigned-info">
<i id="assigned-by-icon" className="bi bi-pin-angle-fill" />
Atribuído a você por
<Link id="assigned-by-link" to={`/profile/${assignedBy.user.name}`}>{ assignedBy.fullname }</Link>
{
assignedBy.map( ( p, i, arr ) => {
return <>
<Link className="assigned-by-link" to={`/profile/${p.user.name}`} key={p.id}>{ p.fullname }</Link>
{ arr.length - 1 !== i && ', ' }
</>
} )
}
</div>
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/Profile/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function fetchProfilePageData(username: string | undefined): Promis
UniversimeApi.Profile.competences({username}),
UniversimeApi.Profile.links({username}),
UniversimeApi.Profile.recommendations({username}),
UniversimeApi.Profile.folders({username, assignedOnly: true}),
UniversimeApi.Profile.folders({username}),
UniversimeApi.Profile.educations({username}),
UniversimeApi.Profile.experiences({username}),
isOwnProfile ? UniversimeApi.Capacity.foldersAssignedBy({username}) : Promise.resolve(undefined),
Expand Down
2 changes: 0 additions & 2 deletions src/services/UniversimeApi/Profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export type ProfileIdAndUsername_RequestDTO = {
};

export type ProfileFolders_RequestDTO = ProfileIdAndUsername_RequestDTO & {
assignedOnly?: boolean;
};

export type ProfileGet_ResponseDTO = ApiResponse<{ profile: Profile }>;
Expand Down Expand Up @@ -102,6 +101,5 @@ export async function folders(body: ProfileFolders_RequestDTO) {
return (await api.post<ProfileFolders_ResponseDTO>("/profile/folders", {
profileId: body.profileId,
username: body.username,
assignedOnly: body.assignedOnly,
})).data;
}
7 changes: 3 additions & 4 deletions src/types/Capacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,19 @@ export type Folder = {
author: Profile;
publicFolder: boolean;
grantedAccessGroups: Group[];
assignedBy?: Profile;
assignedBy?: Profile[];
favorite?: true;
canEdit: boolean;

grantsBadgeToCompetences: CompetenceType[]
};

export type FolderProfile = {
author: Profile;
profile: Profile;
assignedBy: Profile;
assignedTo: Profile;
folder: Folder;

id: string;
assigned: boolean;
created: string;

doneUntilNow: number;
Expand Down

0 comments on commit 563e840

Please sign in to comment.