Skip to content

Commit ca2ff0a

Browse files
Merge branch 'main' of github.com:CenterForOpenScience/angular-osf into feat/502-add-community-metadata
2 parents dabeb9f + cafeaaf commit ca2ff0a

76 files changed

Lines changed: 885 additions & 714 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p-message styleClass="w-full" icon="fas fa-triangle-exclamation" severity="warn">
2+
{{ 'preprints.details.warningBanner' | translate }}
3+
</p-message>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { provideNoopAnimations } from '@angular/platform-browser/animations';
3+
4+
import { PreprintWarningBannerComponent } from './preprint-warning-banner.component';
5+
6+
import { OSFTestingModule } from '@testing/osf.testing.module';
7+
8+
describe('PreprintWarningBannerComponent', () => {
9+
let component: PreprintWarningBannerComponent;
10+
let fixture: ComponentFixture<PreprintWarningBannerComponent>;
11+
12+
beforeEach(async () => {
13+
await TestBed.configureTestingModule({
14+
imports: [PreprintWarningBannerComponent, OSFTestingModule],
15+
providers: [provideNoopAnimations()],
16+
}).compileComponents();
17+
18+
fixture = TestBed.createComponent(PreprintWarningBannerComponent);
19+
component = fixture.componentInstance;
20+
fixture.detectChanges();
21+
});
22+
23+
it('should create', () => {
24+
expect(component).toBeTruthy();
25+
});
26+
27+
it('should show correct icon and text', () => {
28+
const banner: HTMLElement = fixture.nativeElement;
29+
const icon = banner.querySelector('i');
30+
const text = banner.querySelector('span');
31+
expect(icon).toBeDefined();
32+
expect(text).toBeDefined();
33+
expect(icon?.getAttribute('ng-reflect-ng-class')).toEqual('fas fa-triangle-exclamation');
34+
expect(text?.textContent?.trim()).toEqual('preprints.details.warningBanner');
35+
});
36+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { TranslatePipe } from '@ngx-translate/core';
2+
3+
import { Message } from 'primeng/message';
4+
5+
import { ChangeDetectionStrategy, Component } from '@angular/core';
6+
7+
@Component({
8+
selector: 'osf-preprint-warning-banner',
9+
imports: [TranslatePipe, Message],
10+
templateUrl: './preprint-warning-banner.component.html',
11+
changeDetection: ChangeDetectionStrategy.OnPush,
12+
})
13+
export class PreprintWarningBannerComponent {
14+
//
15+
}

src/app/features/preprints/components/stepper/review-step/review-step.component.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ <h3>
2828
}}
2929
</h3>
3030
<div class="flex flex-row gap-2 align-items-center">
31-
<img [src]="provider()?.squareColorNoTransparentImageUrl" alt="Provider logo" height="36" width="36" />
31+
<img
32+
class="fit-contain"
33+
[src]="provider()?.squareColorNoTransparentImageUrl"
34+
alt="Provider logo"
35+
height="36"
36+
width="36"
37+
/>
3238
<p>{{ provider()?.name }}</p>
3339
</div>
3440
</section>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ <h1>{{ preprint()!.title }}</h1>
6868
</section>
6969

7070
<section class="flex-1 flex flex-column gap-2 bg-white py-2 px-3 md:px-4">
71+
@if (isOsfPreprint()) {
72+
<osf-preprint-warning-banner />
73+
}
7174
@if (moderationStatusBannerVisible()) {
7275
<osf-moderation-status-banner
7376
[provider]="preprintProvider()!"

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,8 @@ describe.skip('PreprintDetailsComponent', () => {
6969
it('should create', () => {
7070
expect(component).toBeTruthy();
7171
});
72+
73+
it('isOsfPreprint should be true if providerId === osf', () => {
74+
expect(component.isOsfPreprint()).toBeTruthy();
75+
});
7276
});

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import { ReviewPermissions, UserPermissions } from '@shared/enums';
5050
import { MetaTagsService } from '@shared/services';
5151
import { ContributorsSelectors } from '@shared/stores';
5252

53+
import { PreprintWarningBannerComponent } from '../../components/preprint-details/preprint-warning-banner/preprint-warning-banner.component';
54+
5355
import { environment } from 'src/environments/environment';
5456

5557
@Component({
@@ -64,6 +66,7 @@ import { environment } from 'src/environments/environment';
6466
StatusBannerComponent,
6567
TranslatePipe,
6668
PreprintTombstoneComponent,
69+
PreprintWarningBannerComponent,
6770
ModerationStatusBannerComponent,
6871
MakeDecisionComponent,
6972
],
@@ -235,6 +238,10 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
235238
);
236239
});
237240

241+
isOsfPreprint = computed(() => {
242+
return this.providerId() === 'osf';
243+
});
244+
238245
moderationStatusBannerVisible = computed(() => {
239246
return (
240247
this.moderationMode() &&

src/app/features/project/project.routes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
import { ActivityLogsState } from '@osf/shared/stores/activity-logs';
1616

1717
import { CollectionsModerationState } from '../moderation/store/collections-moderation';
18-
import { NotificationSubscriptionState } from '../settings/notifications/store';
1918

2019
import { AnalyticsState } from './analytics/store';
2120
import { SettingsState } from './settings/store';
@@ -63,7 +62,7 @@ export const projectRoutes: Routes = [
6362
{
6463
path: 'settings',
6564
loadComponent: () => import('../project/settings/settings.component').then((mod) => mod.SettingsComponent),
66-
providers: [provideStates([SettingsState, ViewOnlyLinkState, NotificationSubscriptionState])],
65+
providers: [provideStates([SettingsState, ViewOnlyLinkState])],
6766
},
6867
{
6968
path: 'contributors',

src/app/features/project/settings/components/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export { ProjectDetailSettingAccordionComponent } from './project-detail-setting-accordion/project-detail-setting-accordion.component';
22
export { ProjectSettingNotificationsComponent } from './project-setting-notifications/project-setting-notifications.component';
33
export { SettingsAccessRequestsCardComponent } from './settings-access-requests-card/settings-access-requests-card.component';
4-
export { SettingsCommentingCardComponent } from './settings-commenting-card/settings-commenting-card.component';
4+
export { SettingsProjectAffiliationComponent } from './settings-project-affiliation/settings-project-affiliation.component';
55
export { SettingsProjectFormCardComponent } from './settings-project-form-card/settings-project-form-card.component';
66
export { SettingsRedirectLinkComponent } from './settings-redirect-link/settings-redirect-link.component';
77
export { SettingsStorageLocationCardComponent } from './settings-storage-location-card/settings-storage-location-card.component';
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div
2-
class="flex justify-between align-items-center mb-2 w-full border-bottom-1 border-gray-300 gap-2 flex-column sm:flex-row sm:gap-4"
2+
class="flex justify-content-between align-items-center mb-2 w-full border-bottom-1 border-gray-300 gap-2 flex-column sm:flex-row sm:gap-4"
33
>
44
<div class="flex align-items-center gap-2 cursor-pointer w-full sm:w-5">
55
<p-button
66
[icon]="expanded() ? 'fas fa-minus' : 'fas fa-plus'"
77
variant="text"
88
severity="contrast"
9-
(click)="toggle()"
9+
(onClick)="toggle()"
1010
></p-button>
1111

1212
<span class="font-medium text-color">{{ title() }}</span>
@@ -22,32 +22,21 @@
2222
</span>
2323
}
2424

25-
<p-select
26-
class="accordion-dropdown"
25+
<osf-select
26+
[noBorder]="true"
2727
[options]="control.options"
28-
[(ngModel)]="control.value"
29-
(ngModelChange)="emitValueChange.emit({ index: index, value: control.value })"
30-
>
31-
<ng-template let-item pTemplate="item">
32-
<span>{{ item.label | translate }}</span>
33-
</ng-template>
34-
35-
<ng-template let-item pTemplate="selectedItem">
36-
{{ item.label | translate }}
37-
</ng-template>
38-
</p-select>
28+
[(selectedValue)]="control.value"
29+
[disabled]="disabledRightControls()"
30+
(changeValue)="emitValueChange.emit({ index: index, value: control.value })"
31+
></osf-select>
3932
</div>
4033
}
4134
</div>
4235
}
4336
</div>
4437

4538
@if (expanded()) {
46-
<div
47-
class="mt-2 pl-5 border-bottom-1 border-gray-300"
48-
[attr.id]="'accordion-content-' + title()"
49-
[attr.aria-labelledby]="'accordion-label-' + title()"
50-
>
39+
<div class="mt-2 pl-5 border-bottom-1 border-gray-300">
5140
<ng-content></ng-content>
5241
</div>
5342
}

0 commit comments

Comments
 (0)