forked from potsda.mn/mobilizon
Changed interface to consts
(cherry picked from commit 238f4f28a31944f98feddedf5fa24714c4328ebc) upstream PR is https://framagit.org/framasoft/mobilizon/-/merge_requests/1236
This commit is contained in:
parent
03b2e1f634
commit
19561da63d
|
@ -1,19 +1,13 @@
|
||||||
import { EventSortField, SortDirection } from "./enums";
|
import { EventSortField, SortDirection } from "./enums";
|
||||||
|
|
||||||
export interface ISorting {
|
export const SORTING_UPCOMING = {
|
||||||
title: string;
|
title: "Upcoming Events",
|
||||||
orderBy: EventSortField;
|
orderBy: EventSortField.BEGINS_ON,
|
||||||
direction: SortDirection;
|
direction: SortDirection.ASC,
|
||||||
}
|
};
|
||||||
|
|
||||||
export class SortingUpcoming implements ISorting {
|
export const SORTING_CREATED = {
|
||||||
title = "Upcoming Events";
|
title: "Recently created Events",
|
||||||
orderBy = EventSortField.BEGINS_ON;
|
orderBy: EventSortField.INSERTED_AT,
|
||||||
direction = SortDirection.ASC;
|
direction: SortDirection.DESC,
|
||||||
}
|
};
|
||||||
|
|
||||||
export class SortingCreated implements ISorting {
|
|
||||||
title = "Recently created Events";
|
|
||||||
orderBy = EventSortField.INSERTED_AT;
|
|
||||||
direction = SortDirection.DESC;
|
|
||||||
}
|
|
||||||
|
|
|
@ -278,11 +278,7 @@ import RouteName from "../router/name";
|
||||||
import { IEvent } from "../types/event.model";
|
import { IEvent } from "../types/event.model";
|
||||||
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
||||||
import { CONFIG } from "../graphql/config";
|
import { CONFIG } from "../graphql/config";
|
||||||
import {
|
import { SORTING_UPCOMING, SORTING_CREATED } from "../types/sorting.model";
|
||||||
ISorting,
|
|
||||||
SortingCreated,
|
|
||||||
SortingUpcoming,
|
|
||||||
} from "../types/sorting.model";
|
|
||||||
import { IConfig } from "../types/config.model";
|
import { IConfig } from "../types/config.model";
|
||||||
import { IFollowedGroupEvent } from "../types/followedGroupEvent.model";
|
import { IFollowedGroupEvent } from "../types/followedGroupEvent.model";
|
||||||
import Subtitle from "../components/Utils/Subtitle.vue";
|
import Subtitle from "../components/Utils/Subtitle.vue";
|
||||||
|
@ -461,12 +457,12 @@ export default class Home extends Vue {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get sorting(): ISorting {
|
get sorting() {
|
||||||
switch (this.config?.instanceHomepageSorting) {
|
switch (this.config?.instanceHomepageSorting) {
|
||||||
case InstanceHomepageSorting.UPCOMING:
|
case InstanceHomepageSorting.UPCOMING:
|
||||||
return new SortingUpcoming();
|
return SORTING_UPCOMING;
|
||||||
default:
|
default:
|
||||||
return new SortingCreated();
|
return SORTING_CREATED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue