diff --git a/src/app/features/profile/components/profile-information/profile-information.component.html b/src/app/features/profile/components/profile-information/profile-information.component.html index 27c9d715e..d9b6f8aa6 100644 --- a/src/app/features/profile/components/profile-information/profile-information.component.html +++ b/src/app/features/profile/components/profile-information/profile-information.component.html @@ -87,7 +87,7 @@

{{ 'settings.profileSettings.tabs.employment' | translate }}

- +
} @@ -95,7 +95,7 @@

{{ 'settings.profileSettings.tabs.employment' | translate }}

{{ 'settings.profileSettings.tabs.education' | translate }}

- + } diff --git a/src/app/features/profile/components/profile-information/profile-information.component.ts b/src/app/features/profile/components/profile-information/profile-information.component.ts index bf0735973..0424ba49b 100644 --- a/src/app/features/profile/components/profile-information/profile-information.component.ts +++ b/src/app/features/profile/components/profile-information/profile-information.component.ts @@ -10,12 +10,21 @@ import { EducationHistoryComponent, EmploymentHistoryComponent } from '@osf/shar import { SOCIAL_LINKS } from '@osf/shared/constants'; import { IS_MEDIUM } from '@osf/shared/helpers'; import { UserModel } from '@osf/shared/models'; +import { SortByDatePipe } from '@osf/shared/pipes'; import { mapUserSocials } from '../../helpers'; @Component({ selector: 'osf-profile-information', - imports: [Button, EmploymentHistoryComponent, EducationHistoryComponent, TranslatePipe, DatePipe, NgOptimizedImage], + imports: [ + Button, + EmploymentHistoryComponent, + EducationHistoryComponent, + TranslatePipe, + DatePipe, + NgOptimizedImage, + SortByDatePipe, + ], templateUrl: './profile-information.component.html', styleUrl: './profile-information.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/settings/notifications/constants/notifications-constants.ts b/src/app/features/settings/notifications/constants/notifications-constants.ts index 7b6bbf1de..943f9a041 100644 --- a/src/app/features/settings/notifications/constants/notifications-constants.ts +++ b/src/app/features/settings/notifications/constants/notifications-constants.ts @@ -7,10 +7,6 @@ export const SUBSCRIPTION_EVENTS: SubscriptionEventModel[] = [ event: SubscriptionEvent.GlobalFileUpdated, labelKey: 'settings.notifications.notificationPreferences.items.files', }, - { - event: SubscriptionEvent.GlobalMentions, - labelKey: 'settings.notifications.notificationPreferences.items.mentions', - }, { event: SubscriptionEvent.GlobalReviews, labelKey: 'settings.notifications.notificationPreferences.items.preprints', diff --git a/src/app/shared/models/user/date-sortable.model.ts b/src/app/shared/models/user/date-sortable.model.ts new file mode 100644 index 000000000..f7b6b6b68 --- /dev/null +++ b/src/app/shared/models/user/date-sortable.model.ts @@ -0,0 +1,4 @@ +export interface DateSortable { + startYear: number; + startMonth: number; +} diff --git a/src/app/shared/models/user/index.ts b/src/app/shared/models/user/index.ts index 2674003fa..2fb58f7e0 100644 --- a/src/app/shared/models/user/index.ts +++ b/src/app/shared/models/user/index.ts @@ -1,3 +1,4 @@ +export * from './date-sortable.model'; export * from './education.model'; export * from './employment.model'; export * from './social.model'; diff --git a/src/app/shared/pipes/index.ts b/src/app/shared/pipes/index.ts index 1d8de41af..62ee21a18 100644 --- a/src/app/shared/pipes/index.ts +++ b/src/app/shared/pipes/index.ts @@ -4,4 +4,5 @@ export { DecodeHtmlPipe } from './decode-html.pipe'; export { FileSizePipe } from './file-size.pipe'; export { InterpolatePipe } from './interpolate.pipe'; export { MonthYearPipe } from './month-year.pipe'; +export { SortByDatePipe } from './sort-by-date.pipe'; export { WrapFnPipe } from './wrap-fn.pipe'; diff --git a/src/app/shared/pipes/sort-by-date.pipe.ts b/src/app/shared/pipes/sort-by-date.pipe.ts new file mode 100644 index 000000000..653ffa268 --- /dev/null +++ b/src/app/shared/pipes/sort-by-date.pipe.ts @@ -0,0 +1,20 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import { DateSortable } from '../models'; + +@Pipe({ + name: 'sortByDate', + standalone: true, +}) +export class SortByDatePipe implements PipeTransform { + transform(items: T[] | null | undefined): T[] { + if (!items || items.length === 0) return []; + + return [...items].sort((a, b) => { + if (a.startYear !== b.startYear) { + return b.startYear - a.startYear; + } + return b.startMonth - a.startMonth; + }); + } +}