Skip to content

Commit a2c7f0e

Browse files
committed
fix(preprint-details): updated views and downloads
1 parent 1c2e5bd commit a2c7f0e

File tree

10 files changed

+80
-25
lines changed

10 files changed

+80
-25
lines changed

src/app/features/preprints/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export { GeneralInformationComponent } from './preprint-details/general-informat
55
export { ModerationStatusBannerComponent } from './preprint-details/moderation-status-banner/moderation-status-banner.component';
66
export { PreprintFileSectionComponent } from './preprint-details/preprint-file-section/preprint-file-section.component';
77
export { PreprintMakeDecisionComponent } from './preprint-details/preprint-make-decision/preprint-make-decision.component';
8+
export { PreprintMetricsInfoComponent } from './preprint-details/preprint-metrics-info/preprint-metrics-info.component';
89
export { PreprintTombstoneComponent } from './preprint-details/preprint-tombstone/preprint-tombstone.component';
910
export { PreprintWarningBannerComponent } from './preprint-details/preprint-warning-banner/preprint-warning-banner.component';
1011
export { ShareAndDownloadComponent } from './preprint-details/share-and-download/share-and-download.component';

src/app/features/preprints/components/preprint-details/general-information/general-information.component.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
<p-card>
22
@if (preprint()) {
33
@let preprintValue = preprint()!;
4+
45
<div class="flex flex-column gap-4">
6+
<section class="flex flex-column gap-2">
7+
<h3>{{ 'preprints.preprintStepper.review.sections.metadata.authors' | translate }}</h3>
8+
9+
<div class="flex flex-column gap-1 line-height-2 md:flex-row">
10+
<osf-contributors-list [contributors]="bibliographicContributors()"></osf-contributors-list>
11+
12+
@if (areContributorsLoading()) {
13+
<p-skeleton width="10rem" height="1.25rem" />
14+
}
15+
</div>
16+
</section>
17+
518
<section class="flex flex-column gap-2">
619
<h3>{{ 'preprints.preprintStepper.common.labels.abstract' | translate }}</h3>
720
<osf-truncated-text [maxVisibleLines]="2" [text]="preprintValue.description" />
@@ -21,18 +34,6 @@ <h3>{{ 'preprints.details.supplementalMaterials' | translate }}</h3>
2134
</section>
2235
}
2336

24-
<section class="flex flex-column gap-2">
25-
<h3>{{ 'preprints.preprintStepper.review.sections.metadata.authors' | translate }}</h3>
26-
27-
<div class="flex flex-column gap-1 line-height-2 md:flex-row">
28-
<osf-contributors-list [contributors]="bibliographicContributors()"></osf-contributors-list>
29-
30-
@if (areContributorsLoading()) {
31-
<p-skeleton width="10rem" height="1.25rem" />
32-
}
33-
</div>
34-
</section>
35-
3637
@if (preprintProvider()?.assertionsEnabled) {
3738
<section class="flex flex-column gap-2">
3839
<h3>{{ 'preprints.preprintStepper.review.sections.authorAssertions.conflictOfInterest' | translate }}</h3>

src/app/features/preprints/components/preprint-details/preprint-file-section/preprint-file-section.component.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
<section
2-
class="p-card p-card-body card gap-4 file-section-height"
3-
[class.medium]="isMedium()"
4-
[class.large]="isLarge()"
5-
[class.small]="!isMedium() && !isLarge()"
6-
>
1+
<section class="p-card p-card-body card gap-4 file-section-height">
72
@if (safeLink()) {
83
<iframe
94
[src]="safeLink()"
105
(load)="isIframeLoading = false"
116
[hidden]="isIframeLoading"
12-
title="Rendering of document"
7+
[title]="'preprints.details.file.renderingDocument' | translate"
138
allowfullscreen=""
149
width="100%"
1510
class="flex-1 border-none"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<p-card>
2+
@if (metrics()) {
3+
<div class="flex flex-row gap-1 font-bold">
4+
<span>{{ 'preprints.details.share.views' | translate }}: {{ metrics()!.views }}</span>
5+
<span>|</span>
6+
<span>{{ 'preprints.details.share.downloads' | translate }}: {{ metrics()!.downloads }}</span>
7+
</div>
8+
}
9+
</p-card>

src/app/features/preprints/components/preprint-details/preprint-metrics-info/preprint-metrics-info.component.scss

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { PreprintMetricsInfoComponent } from './preprint-metrics-info.component';
4+
5+
describe('PreprintMetricsInfoComponent', () => {
6+
let component: PreprintMetricsInfoComponent;
7+
let fixture: ComponentFixture<PreprintMetricsInfoComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [PreprintMetricsInfoComponent],
12+
}).compileComponents();
13+
14+
fixture = TestBed.createComponent(PreprintMetricsInfoComponent);
15+
component = fixture.componentInstance;
16+
fixture.detectChanges();
17+
});
18+
19+
it('should create', () => {
20+
expect(component).toBeTruthy();
21+
});
22+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { TranslatePipe } from '@ngx-translate/core';
2+
3+
import { Card } from 'primeng/card';
4+
5+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
6+
7+
import { PreprintMetrics } from '@osf/features/preprints/models';
8+
9+
@Component({
10+
selector: 'osf-preprint-metrics-info',
11+
imports: [Card, TranslatePipe],
12+
templateUrl: './preprint-metrics-info.component.html',
13+
styleUrl: './preprint-metrics-info.component.scss',
14+
changeDetection: ChangeDetectionStrategy.OnPush,
15+
})
16+
export class PreprintMetricsInfoComponent {
17+
metrics = input<PreprintMetrics>();
18+
}

src/app/features/preprints/pages/preprint-details/preprint-details.component.html

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ <h1>{{ preprint()?.title }}</h1>
4242

4343
<div class="flex flex-column justify-content-end gap-2 md:flex-row">
4444
@if (isPreprintLoading() || isPreprintProviderLoading() || areContributorsLoading()) {
45-
<p-skeleton width="10rem" height="2.25rem" />
46-
<p-skeleton width="10rem" height="2.25rem" />
47-
<p-skeleton width="10rem" height="2.25rem" />
45+
<p-skeleton width="11rem" height="2.75rem" />
46+
<p-skeleton width="11rem" height="2.75rem" />
47+
<p-skeleton width="11rem" height="2.75rem" />
48+
<p-skeleton width="2.75rem" height="2.75rem" />
49+
<p-skeleton width="5rem" height="2.75rem" />
4850
} @else {
4951
@if (editButtonVisible()) {
5052
<p-button
@@ -71,6 +73,8 @@ <h1>{{ preprint()?.title }}</h1>
7173
(click)="handleWithdrawClicked()"
7274
/>
7375
}
76+
77+
<osf-preprint-share-and-download [preprintProvider]="preprintProvider()" />
7478
}
7579
</div>
7680
</section>
@@ -99,16 +103,18 @@ <h1>{{ preprint()?.title }}</h1>
99103

100104
@if (!preprint()?.dateWithdrawn) {
101105
<section class="flex-1 flex flex-column gap-4 align-items-start lg:flex-row">
102-
<section class="w-12 lg:w-6">
106+
<section class="w-12 lg:w-8">
103107
<osf-preprint-file-section [providerReviewsWorkflow]="preprintProvider()?.reviewsWorkflow || null" />
104108
</section>
105109

106-
<section class="flex flex-column gap-4 w-12 lg:w-6">
107-
<osf-preprint-share-and-download [preprintProvider]="preprintProvider()" />
110+
<section class="flex flex-column gap-4 w-12 lg:w-4">
108111
<osf-preprint-general-information
109112
[preprintProvider]="preprintProvider()"
110113
(preprintVersionSelected)="fetchPreprint($event)"
111114
/>
115+
116+
<osf-preprint-metrics-info [metrics]="preprint()?.metrics"></osf-preprint-metrics-info>
117+
112118
<osf-preprint-additional-info [preprintProviderId]="providerId()" />
113119
</section>
114120
</section>

src/app/features/preprints/pages/preprint-details/preprint-details.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
ModerationStatusBannerComponent,
3434
PreprintFileSectionComponent,
3535
PreprintMakeDecisionComponent,
36+
PreprintMetricsInfoComponent,
3637
PreprintTombstoneComponent,
3738
ShareAndDownloadComponent,
3839
StatusBannerComponent,
@@ -73,6 +74,7 @@ import { PreprintWarningBannerComponent } from '../../components/preprint-detail
7374
PreprintWarningBannerComponent,
7475
ModerationStatusBannerComponent,
7576
PreprintMakeDecisionComponent,
77+
PreprintMetricsInfoComponent,
7678
RouterLink,
7779
],
7880
templateUrl: './preprint-details.component.html',

src/assets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,7 @@
23172317
"noDoi": "No DOI"
23182318
},
23192319
"file": {
2320+
"renderingDocument": "Rendering document",
23202321
"version": "Version: {{version}}",
23212322
"downloadVersion": "Version {{version}}, {{date}}",
23222323
"downloadPreviousVersion": "Download previous version",

0 commit comments

Comments
 (0)