diff --git a/js/src/types/sorting.model.ts b/js/src/types/sorting.model.ts new file mode 100644 index 000000000..57271875c --- /dev/null +++ b/js/src/types/sorting.model.ts @@ -0,0 +1,19 @@ +import { EventSortField, SortDirection } from "./enums"; + +export interface ISorting { + title: string; + orderBy: EventSortField; + direction: SortDirection; +} + +export class SortingUpcoming implements ISorting { + title = "Upcoming Events"; + orderBy = EventSortField.BEGINS_ON; + direction = SortDirection.ASC; +} + +export class SortingCreated implements ISorting { + title = "Recently created Events"; + orderBy = EventSortField.INSERTED_AT; + direction = SortDirection.DESC; +} diff --git a/js/src/views/Home.vue b/js/src/views/Home.vue index 8bb25d623..24034e735 100644 --- a/js/src/views/Home.vue +++ b/js/src/views/Home.vue @@ -51,15 +51,7 @@ >

- {{ - $t( - config && - config.instanceHomepageSorting === - InstanceHomepageSorting.UPCOMING - ? "Upcoming Events" - : "Last published events" - ) - }} + {{ $t(this.sorting.title) }}

@@ -297,15 +289,7 @@ />

- {{ - $t( - config && - config.instanceHomepageSorting === - InstanceHomepageSorting.UPCOMING - ? "Upcoming Events" - : "Last published events" - ) - }} + {{ $t(this.sorting.title) }}

@@ -337,12 +321,7 @@