From c806a7b3c7cc91a2991ffc1c9a2358e8fad65a62 Mon Sep 17 00:00:00 2001 From: 778a69cd <778a69cd@potsda.mn> Date: Mon, 3 Apr 2023 13:18:37 +0200 Subject: [PATCH] Revert "Changed interface to consts" This reverts commit e40558ce7895d29bf831df68520ea0e95fd8667c. --- js/src/types/sorting.model.ts | 26 ++++++++++++++++---------- js/src/views/Home.vue | 12 ++++++++---- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/js/src/types/sorting.model.ts b/js/src/types/sorting.model.ts index 86b76c721..57271875c 100644 --- a/js/src/types/sorting.model.ts +++ b/js/src/types/sorting.model.ts @@ -1,13 +1,19 @@ import { EventSortField, SortDirection } from "./enums"; -export const SORTING_UPCOMING = { - title: "Upcoming Events", - orderBy: EventSortField.BEGINS_ON, - direction: SortDirection.ASC, -}; +export interface ISorting { + title: string; + orderBy: EventSortField; + direction: SortDirection; +} -export const SORTING_CREATED = { - title: "Recently created Events", - orderBy: EventSortField.INSERTED_AT, - direction: SortDirection.DESC, -}; +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 c3f36b9e5..5dc66419d 100644 --- a/js/src/views/Home.vue +++ b/js/src/views/Home.vue @@ -278,7 +278,11 @@ import RouteName from "../router/name"; import { IEvent } from "../types/event.model"; import DateComponent from "../components/Event/DateCalendarIcon.vue"; import { CONFIG } from "../graphql/config"; -import { SORTING_UPCOMING, SORTING_CREATED } from "../types/sorting.model"; +import { + ISorting, + SortingCreated, + SortingUpcoming, +} from "../types/sorting.model"; import { IConfig } from "../types/config.model"; import { IFollowedGroupEvent } from "../types/followedGroupEvent.model"; import Subtitle from "../components/Utils/Subtitle.vue"; @@ -457,12 +461,12 @@ export default class Home extends Vue { ); } - get sorting() { + get sorting(): ISorting { switch (this.config?.instanceHomepageSorting) { case InstanceHomepageSorting.UPCOMING: - return SORTING_UPCOMING; + return new SortingUpcoming(); default: - return SORTING_CREATED; + return new SortingCreated(); } }