Skip to content

Commit df7b769

Browse files
authored
Fix/519 token bugs (#296)
* fix(menu): added new items * fix(menu): updated naming * fix(menu): changed overview to discover and replaced some icons * fix(menu): added margin * fix(menu): fixed links to discover * fix(preprints): fixed routes * fix(icons): updated menu icons * fix(icons): removed fantastic icons package * fix(icons): removed unused svg icons * fix(icons): updated icons and image across app * fix(sign-up): added message for sign-up error * fix(tokens): fixed bugs * fix(project-settings): fixed region and affiliations * fix(settings): fixed redirect url * fix(settings): updated notifications and removed comments * fix(project-settings): fixed notifications and wiki settings
1 parent 2189d17 commit df7b769

68 files changed

Lines changed: 806 additions & 711 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.

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/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
}

src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import { TranslatePipe } from '@ngx-translate/core';
22

33
import { Button } from 'primeng/button';
4-
import { SelectModule } from 'primeng/select';
54

65
import { ChangeDetectionStrategy, Component, input, output, signal } from '@angular/core';
76
import { FormsModule } from '@angular/forms';
87

8+
import { SelectComponent } from '@osf/shared/components';
9+
910
import { RightControl } from '../../models';
1011

1112
@Component({
1213
selector: 'osf-project-detail-setting-accordion',
13-
imports: [SelectModule, FormsModule, Button, TranslatePipe],
14+
imports: [FormsModule, Button, SelectComponent, TranslatePipe],
1415
templateUrl: './project-detail-setting-accordion.component.html',
1516
changeDetection: ChangeDetectionStrategy.OnPush,
1617
})
1718
export class ProjectDetailSettingAccordionComponent {
1819
emitValueChange = output<{ index: number; value: boolean | string }>();
1920
title = input<string>();
2021
rightControls = input.required<RightControl[] | undefined>();
22+
disabledRightControls = input(false);
23+
2124
expanded = signal(false);
2225

2326
toggle() {

src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.html

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,18 @@ <h2 class="pb-4">{{ 'myProjects.settings.emailNotifications' | translate }}</h2>
33

44
<p class="pb-4">{{ 'myProjects.settings.emailNotificationsText' | translate }}</p>
55

6-
<osf-project-detail-setting-accordion
7-
(emitValueChange)="changeEmittedValue($event)"
8-
[rightControls]="allAccordionData"
9-
[title]="title()"
10-
>
11-
<div class="flex align-items-baseline gap-2">
12-
<i class="fas fa-minus text-sm icon-space"></i>
13-
<span>
14-
{{ subscriptionEvent.Comments | notificationDescription: notifications()?.[0]?.frequency | translate }}
15-
</span>
16-
</div>
17-
18-
<div class="flex align-items-baseline gap-2 mt-2">
19-
<i class="fas fa-minus text-sm icon-space"></i>
20-
<span>
21-
{{ subscriptionEvent.FileUpdated | notificationDescription: notifications()?.[1]?.frequency | translate }}
22-
</span>
23-
</div>
24-
</osf-project-detail-setting-accordion>
6+
@if (notifications().length) {
7+
<osf-project-detail-setting-accordion
8+
(emitValueChange)="changeEmittedValue($event)"
9+
[rightControls]="allAccordionData"
10+
[title]="title()"
11+
>
12+
<div class="flex align-items-baseline gap-2 mt-2">
13+
<i class="fas fa-minus text-sm icon-space"></i>
14+
<span>
15+
{{ subscriptionEvent.FileUpdated | notificationDescription: notifications()[0].frequency | translate }}
16+
</span>
17+
</div>
18+
</osf-project-detail-setting-accordion>
19+
}
2520
</p-card>

src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { Card } from 'primeng/card';
44

55
import { ChangeDetectionStrategy, Component, effect, input, output } from '@angular/core';
66

7-
import { NotificationSubscription } from '@osf/features/settings/notifications/models';
87
import { SubscriptionEvent, SubscriptionFrequency } from '@osf/shared/enums';
8+
import { NotificationSubscription } from '@osf/shared/models';
99

1010
import { RightControl } from '../../models';
1111
import { NotificationDescriptionPipe } from '../../pipes';
@@ -19,9 +19,9 @@ import { ProjectDetailSettingAccordionComponent } from '../project-detail-settin
1919
changeDetection: ChangeDetectionStrategy.OnPush,
2020
})
2121
export class ProjectSettingNotificationsComponent {
22-
notificationEmitValue = output<{ event: SubscriptionEvent; frequency: SubscriptionFrequency }>();
22+
notifications = input.required<NotificationSubscription[]>();
2323
title = input<string>();
24-
notifications = input<NotificationSubscription[]>();
24+
notificationEmitValue = output<NotificationSubscription>();
2525

2626
allAccordionData: RightControl[] | undefined = [];
2727

@@ -33,31 +33,22 @@ export class ProjectSettingNotificationsComponent {
3333

3434
constructor() {
3535
effect(() => {
36-
this.allAccordionData = this.notifications()?.map((notification) => {
37-
if (notification.event === SubscriptionEvent.Comments) {
38-
return {
39-
label: 'settings.notifications.notificationPreferences.items.comments',
40-
value: notification.frequency as string,
41-
type: 'dropdown',
42-
options: this.subscriptionFrequencyOptions,
43-
event: notification.event,
44-
} as RightControl;
45-
} else {
46-
return {
47-
label: 'settings.notifications.notificationPreferences.items.files',
48-
value: notification.frequency as string,
49-
type: 'dropdown',
50-
options: this.subscriptionFrequencyOptions,
51-
event: notification.event,
52-
} as RightControl;
53-
}
36+
this.allAccordionData = this.notifications().map((notification) => {
37+
return {
38+
label: 'settings.notifications.notificationPreferences.items.files',
39+
value: notification.frequency as string,
40+
type: 'dropdown',
41+
options: this.subscriptionFrequencyOptions,
42+
event: notification.event,
43+
} as RightControl;
5444
});
5545
});
5646
}
5747

5848
changeEmittedValue(emittedValue: { index: number; value: boolean | string }): void {
5949
if (this.allAccordionData) {
6050
this.notificationEmitValue.emit({
51+
id: this.notifications()[0].id,
6152
event: this.allAccordionData[emittedValue.index].event as SubscriptionEvent,
6253
frequency: emittedValue.value as SubscriptionFrequency,
6354
});

src/app/features/project/settings/components/settings-access-requests-card/settings-access-requests-card.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ <h2 class="pb-4">{{ 'myProjects.settings.accessRequests' | translate }}</h2>
99
id="accessRequest"
1010
name="ongoing"
1111
></p-checkbox>
12+
1213
<label class="input-label ml-2" for="accessRequest">
1314
{{ 'myProjects.settings.accessRequestsText' | translate }}
1415
</label>

src/app/features/project/settings/components/settings-commenting-card/settings-commenting-card.component.html

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/app/features/project/settings/components/settings-commenting-card/settings-commenting-card.component.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)