Skip to content

Commit 9acf585

Browse files
authored
Fix/784 bug (#491)
* fix(citation-format): fixed citation * fix(contributors): fixed deactivated contributor bug * fix(status): fixed registry status * fix(toast): fixed toast message for mobile * fix(dashboard): fixed responsive
1 parent d347254 commit 9acf585

File tree

17 files changed

+69
-97
lines changed

17 files changed

+69
-97
lines changed

src/app/features/analytics/components/view-duplicates/view-duplicates.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ <h2 class="flex align-items-center gap-2">
5656
<span class="font-bold">{{ 'common.labels.contributors' | translate }}:</span>
5757
@for (contributor of duplicate.contributors; track contributor.id) {
5858
<div>
59-
<a [routerLink]="['/user', contributor.id]" class="font-bold"> {{ contributor.fullName }}</a>
59+
<a class="font-bold" [routerLink]="['/user', contributor.userId]"> {{ contributor.fullName }}</a>
6060
<span>{{ $last ? '' : ',' }}</span>
6161
</div>
6262
}

src/app/features/home/pages/dashboard/dashboard.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,31 @@ <h1>{{ 'home.loggedIn.hosting.title' | translate }}</h1>
111111
data-test-products-collections
112112
>
113113
<img
114+
class="max-w-full"
114115
src="assets/images/dashboard/products/osf-collections.png"
115116
[alt]="'home.loggedIn.dashboard.images.osfCollectionsImageAltText' | translate"
116117
/>
117118
</a>
118119

119120
<a routerLink="/institutions">
120121
<img
122+
class="max-w-full"
121123
src="assets/images/dashboard/products/osf-institutions.png"
122124
[alt]="'home.loggedIn.dashboard.images.osfInstitutionsImageAltText' | translate"
123125
/>
124126
</a>
125127

126128
<a routerLink="/registries">
127129
<img
130+
class="max-w-full"
128131
src="assets/images/dashboard/products/osf-registries.png"
129132
[alt]="'home.loggedIn.dashboard.images.osfRegistriesImageAltTest' | translate"
130133
/>
131134
</a>
132135

133136
<a routerLink="/preprints">
134137
<img
138+
class="max-w-full"
135139
src="assets/images/dashboard/products/osf-preprints.png"
136140
[alt]="'home.loggedIn.dashboard.images.osfPreprintsImageAltTest' | translate"
137141
/>
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ContributorsMapper } from '@osf/shared/mappers';
12
import { MyResourcesItem, MyResourcesItemGetResponseJsonApi } from '@osf/shared/models';
23

34
export class MyResourcesMapper {
@@ -9,13 +10,7 @@ export class MyResourcesMapper {
910
dateCreated: response.attributes.date_created,
1011
dateModified: response.attributes.date_modified,
1112
isPublic: response.attributes.public,
12-
contributors:
13-
response.embeds?.bibliographic_contributors?.data?.map((contributor) => ({
14-
familyName: contributor.embeds.users.data?.attributes.family_name,
15-
fullName: contributor.embeds.users.data?.attributes.full_name,
16-
givenName: contributor.embeds.users.data?.attributes.given_name,
17-
middleName: contributor.embeds.users.data?.attributes.middle_name,
18-
})) ?? [],
13+
contributors: ContributorsMapper.getContributorShortInfo(response.embeds?.bibliographic_contributors?.data),
1914
};
2015
}
2116
}

src/app/features/registry/components/registry-statuses/registry-statuses.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77
<p-accordion-content>
88
<div class="flex flex-column pt-4 gap-2">
99
<h3 class="font-normal">{{ 'registry.overview.statuses.' + registry()?.status + '.short' | translate }}</h3>
10-
<div class="flex">
11-
<p>
10+
<p>
11+
<span>
1212
{{
1313
'registry.overview.statuses.' + registry()?.status + '.long'
1414
| translate: { embargoEndDate: embargoEndDate }
1515
}}
16-
</p>
16+
</span>
1717

1818
@if (isAccepted()) {
19-
<a class="font-bold ml-1" [routerLink]="['/', registry()?.associatedProjectId]">
19+
<a class="font-bold" [routerLink]="['/', registry()?.associatedProjectId]">
2020
{{ 'registry.overview.statuses.accepted.project' | translate }}</a
2121
>.
2222
}
23-
</div>
23+
</p>
2424

2525
@if (canEdit()) {
2626
@if (canWithdraw()) {

src/app/shared/components/my-projects-table/my-projects-table.component.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ describe('MyProjectsTableComponent', () => {
3434
dateModified: '2024-01-01T10:00:00Z',
3535
contributors: [
3636
{
37-
familyName: 'John Doe',
37+
id: '1',
38+
userId: 'user1',
3839
fullName: 'Jane Smith',
39-
middleName: 'Jane Smith',
40-
givenName: 'Jane Smith',
4140
},
4241
],
4342
type: '',

src/app/shared/components/registration-card/registration-card.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ <h2 class="align-self-center word-break-word">
3939
<strong>{{ 'project.overview.metadata.contributors' | translate }}:</strong>
4040
<span class="contributors">
4141
@for (contributor of registrationData().contributors; track contributor) {
42-
<a class="font-bold" [routerLink]="['/user', contributor.id]">{{ contributor.fullName }}</a>
42+
<a class="font-bold" [routerLink]="['/user', contributor.userId]">{{ contributor.fullName }}</a>
4343
@if (!$last) {
4444
<span>, </span>
4545
}

src/app/shared/components/toast/toast.component.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
<p-toast class="toast-container" position="top-right" [preventOpenDuplicates]="true" key="osf">
1+
<p-toast
2+
class="toast-container"
3+
position="top-right"
4+
[preventOpenDuplicates]="true"
5+
key="osf"
6+
[breakpoints]="{ '576px': { width: '80%' } }"
7+
>
28
<ng-template let-message pTemplate="message">
39
<div class="font-medium w-full">{{ message.summary | translate: message.data?.translationParams }}</div>
410
</ng-template>

src/app/shared/mappers/contributors/contributors.mapper.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ import {
1111
} from '@osf/shared/models';
1212

1313
export class ContributorsMapper {
14-
static fromResponse(response: ContributorDataJsonApi[]): ContributorModel[] {
15-
return response.map((contributor) => this.fromContributorResponse(contributor));
14+
static fromResponse(response: ContributorDataJsonApi[] | undefined): ContributorModel[] {
15+
if (!response) {
16+
return [];
17+
}
18+
19+
return response
20+
.filter((contributor) => !contributor?.embeds?.users?.errors)
21+
.map((contributor) => this.fromContributorResponse(contributor));
1622
}
1723

1824
static fromContributorResponse(response: ContributorDataJsonApi): ContributorModel {
@@ -33,7 +39,7 @@ export class ContributorsMapper {
3339
};
3440
}
3541

36-
static getContributorShortInfo(response: ContributorDataJsonApi[]): ContributorShortInfoModel[] {
42+
static getContributorShortInfo(response: ContributorDataJsonApi[] | undefined): ContributorShortInfoModel[] {
3743
const contributors = this.fromResponse(response);
3844

3945
return contributors.map((contributor) => ({

src/app/shared/mappers/duplicates.mapper.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { ResponseJsonApi } from '@shared/models';
22

3-
import { DuplicateJsonApi, DuplicatesWithTotal } from 'src/app/shared/models/duplicates';
3+
import { DuplicateJsonApi, DuplicatesWithTotal } from '../models/duplicates';
4+
5+
import { ContributorsMapper } from './contributors';
46

57
export class DuplicatesMapper {
68
static fromDuplicatesJsonApiResponse(response: ResponseJsonApi<DuplicateJsonApi[]>): DuplicatesWithTotal {
@@ -14,14 +16,7 @@ export class DuplicatesMapper {
1416
dateModified: duplicate.attributes.date_modified,
1517
public: duplicate.attributes.public,
1618
currentUserPermissions: duplicate.attributes.current_user_permissions,
17-
contributors: duplicate.embeds.bibliographic_contributors.data.map((contributor) => ({
18-
familyName: contributor.embeds.users.data.attributes.family_name,
19-
fullName: contributor.embeds.users.data.attributes.full_name,
20-
givenName: contributor.embeds.users.data.attributes.given_name,
21-
middleName: contributor.embeds.users.data.attributes.middle_name,
22-
id: contributor.embeds.users.data.id,
23-
type: contributor.embeds.users.data.type,
24-
})),
19+
contributors: ContributorsMapper.getContributorShortInfo(duplicate.embeds.bibliographic_contributors.data),
2520
})),
2621
totalCount: response.meta.total,
2722
};

src/app/shared/mappers/registration/registration.mapper.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
SchemaResponseDataJsonApi,
1010
} from '@osf/shared/models';
1111

12+
import { ContributorsMapper } from '../contributors';
13+
1214
import { MapRegistryStatus } from './map-registry-status.mapper';
1315

1416
export class RegistrationMapper {
@@ -66,11 +68,7 @@ export class RegistrationMapper {
6668
registrationTemplate: registration.embeds?.registration_schema?.data?.attributes?.name || '',
6769
registry: registration.embeds?.provider?.data?.attributes?.name || '',
6870
public: registration.attributes.public,
69-
contributors:
70-
registration.embeds?.bibliographic_contributors?.data.map((contributor) => ({
71-
id: contributor.id,
72-
fullName: contributor.embeds?.users?.data.attributes.full_name,
73-
})) || [],
71+
contributors: ContributorsMapper.getContributorShortInfo(registration.embeds?.bibliographic_contributors?.data),
7472
currentUserPermissions: registration.attributes.current_user_permissions,
7573
};
7674
}
@@ -93,11 +91,7 @@ export class RegistrationMapper {
9391
hasMaterials: registration.attributes.has_materials,
9492
hasPapers: registration.attributes.has_papers,
9593
hasSupplements: registration.attributes.has_supplements,
96-
contributors:
97-
registration.embeds?.bibliographic_contributors?.data.map((contributor) => ({
98-
id: contributor.embeds.users.data.id,
99-
fullName: contributor.embeds.users.data.attributes.full_name,
100-
})) || [],
94+
contributors: ContributorsMapper.getContributorShortInfo(registration.embeds?.bibliographic_contributors?.data),
10195
rootParentId: registration.relationships.root?.data?.id,
10296
currentUserPermissions: registration.attributes.current_user_permissions,
10397
};

0 commit comments

Comments
 (0)