mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-21 15:32:32 +00:00
Changed interface to consts
This commit is contained in:
parent
da2ae333c9
commit
238f4f28a3
2 changed files with 14 additions and 24 deletions
|
@ -1,19 +1,13 @@
|
|||
import { EventSortField, SortDirection } from "./enums";
|
||||
|
||||
export interface ISorting {
|
||||
title: string;
|
||||
orderBy: EventSortField;
|
||||
direction: SortDirection;
|
||||
}
|
||||
export const SORTING_UPCOMING = {
|
||||
title: "Upcoming Events",
|
||||
orderBy: EventSortField.BEGINS_ON,
|
||||
direction: SortDirection.ASC,
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
export const SORTING_CREATED = {
|
||||
title: "Recently created Events",
|
||||
orderBy: EventSortField.INSERTED_AT,
|
||||
direction: SortDirection.DESC,
|
||||
};
|
||||
|
|
|
@ -341,11 +341,7 @@ import RouteName from "../router/name";
|
|||
import { IEvent } from "../types/event.model";
|
||||
import DateComponent from "../components/Event/DateCalendarIcon.vue";
|
||||
import { CONFIG } from "../graphql/config";
|
||||
import {
|
||||
ISorting,
|
||||
SortingCreated,
|
||||
SortingUpcoming,
|
||||
} from "../types/sorting.model";
|
||||
import { SORTING_UPCOMING, SORTING_CREATED } from "../types/sorting.model";
|
||||
import { IConfig } from "../types/config.model";
|
||||
import { IFollowedGroupEvent } from "../types/followedGroupEvent.model";
|
||||
import Subtitle from "../components/Utils/Subtitle.vue";
|
||||
|
@ -524,12 +520,12 @@ export default class Home extends Vue {
|
|||
);
|
||||
}
|
||||
|
||||
get sorting(): ISorting {
|
||||
get sorting() {
|
||||
switch (this.config?.instanceHomepageSorting) {
|
||||
case InstanceHomepageSorting.UPCOMING:
|
||||
return new SortingUpcoming();
|
||||
return SORTING_UPCOMING;
|
||||
default:
|
||||
return new SortingCreated();
|
||||
return SORTING_CREATED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue