Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p-message styleClass="w-full" icon="fas fa-triangle-exclamation" severity="warn">
{{ 'preprints.details.warningBanner' | translate }}
</p-message>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideNoopAnimations } from '@angular/platform-browser/animations';

import { PreprintWarningBannerComponent } from './preprint-warning-banner.component';

import { OSFTestingModule } from '@testing/osf.testing.module';

describe('PreprintWarningBannerComponent', () => {
let component: PreprintWarningBannerComponent;
let fixture: ComponentFixture<PreprintWarningBannerComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [PreprintWarningBannerComponent, OSFTestingModule],
providers: [provideNoopAnimations()],
}).compileComponents();

fixture = TestBed.createComponent(PreprintWarningBannerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});

it('should show correct icon and text', () => {
const banner: HTMLElement = fixture.nativeElement;
const icon = banner.querySelector('i');
const text = banner.querySelector('span');
expect(icon).toBeDefined();
expect(text).toBeDefined();
expect(icon?.getAttribute('ng-reflect-ng-class')).toEqual('fas fa-triangle-exclamation');
expect(text?.textContent?.trim()).toEqual('preprints.details.warningBanner');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TranslatePipe } from '@ngx-translate/core';

import { Message } from 'primeng/message';

import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'osf-preprint-warning-banner',
imports: [TranslatePipe, Message],
templateUrl: './preprint-warning-banner.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PreprintWarningBannerComponent {
//
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ <h1>{{ preprint()!.title }}</h1>
</section>

<section class="flex-1 flex flex-column gap-2 bg-white py-2 px-3 md:px-4">
@if (isOsfPreprint()) {
<osf-preprint-warning-banner />
}
@if (moderationStatusBannerVisible()) {
<osf-moderation-status-banner
[provider]="preprintProvider()!"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ describe.skip('PreprintDetailsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

it('isOsfPreprint should be true if providerId === osf', () => {
expect(component.isOsfPreprint()).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import { ReviewPermissions, UserPermissions } from '@shared/enums';
import { MetaTagsService } from '@shared/services';
import { ContributorsSelectors } from '@shared/stores';

import { PreprintWarningBannerComponent } from '../../components/preprint-details/preprint-warning-banner/preprint-warning-banner.component';

import { environment } from 'src/environments/environment';

@Component({
Expand All @@ -64,6 +66,7 @@ import { environment } from 'src/environments/environment';
StatusBannerComponent,
TranslatePipe,
PreprintTombstoneComponent,
PreprintWarningBannerComponent,
ModerationStatusBannerComponent,
MakeDecisionComponent,
],
Expand Down Expand Up @@ -235,6 +238,10 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
);
});

isOsfPreprint = computed(() => {
return this.providerId() === 'osf';
});

moderationStatusBannerVisible = computed(() => {
return (
this.moderationMode() &&
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2088,6 +2088,7 @@
"moderatorFeedback": "Moderator Feedback",
"showModeratorFeedback": "Show moderator feedback"
},
"warningBanner": "OSF preprints are not peer reviewed and acceptance into OSF preprints is not an indicator of scholarly merit.",
"withdrawDialog": {
"title": "Withdraw {{preprintWord}}",
"withdrawalExplanation": "You are about to withdraw this version of your {{singularPreprintWord}}. Withdrawing a version will remove it from public view but will not affect other versions of this {{singularPreprintWord}}, if available.",
Expand Down