forked from potsda.mn/mobilizon
Revert "Changed interface to consts"
This reverts commit e40558ce7895d29bf831df68520ea0e95fd8667c.
This commit is contained in:
parent
1019a46d16
commit
c806a7b3c7
|
@ -1,13 +1,19 @@
|
||||||
import { EventSortField, SortDirection } from "./enums";
|
import { EventSortField, SortDirection } from "./enums";
|
||||||
|
|
||||||
export const SORTING_UPCOMING = {
|
export interface ISorting {
|
||||||
title: "Upcoming Events",
|
title: string;
|
||||||
orderBy: EventSortField.BEGINS_ON,
|
orderBy: EventSortField;
|
||||||
direction: SortDirection.ASC,
|
direction: SortDirection;
|
||||||
};
|
}
|
||||||
|
|
||||||
export const SORTING_CREATED = {
|
export class SortingUpcoming implements ISorting {
|
||||||
title: "Recently created Events",
|
title = "Upcoming Events";
|
||||||
orderBy: EventSortField.INSERTED_AT,
|
orderBy = EventSortField.BEGINS_ON;
|
||||||
direction: SortDirection.DESC,
|
direction = SortDirection.ASC;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
export class SortingCreated implements ISorting {
|
||||||
|
title = "Recently created Events";
|
||||||
|
orderBy = EventSortField.INSERTED_AT;
|
||||||
|
direction = SortDirection.DESC;
|
||||||
|
}
|
||||||
|
|
|
@ -278,7 +278,11 @@ 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 { SORTING_UPCOMING, SORTING_CREATED } from "../types/sorting.model";
|
import {
|
||||||
|
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";
|
||||||
|
@ -457,12 +461,12 @@ export default class Home extends Vue {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get sorting() {
|
get sorting(): ISorting {
|
||||||
switch (this.config?.instanceHomepageSorting) {
|
switch (this.config?.instanceHomepageSorting) {
|
||||||
case InstanceHomepageSorting.UPCOMING:
|
case InstanceHomepageSorting.UPCOMING:
|
||||||
return SORTING_UPCOMING;
|
return new SortingUpcoming();
|
||||||
default:
|
default:
|
||||||
return SORTING_CREATED;
|
return new SortingCreated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue