diff --git a/src/components/AddColumn/PublicTimeline.vue b/src/components/AddColumn/PublicTimeline.vue index f91f7e4a..583dca21 100644 --- a/src/components/AddColumn/PublicTimeline.vue +++ b/src/components/AddColumn/PublicTimeline.vue @@ -14,7 +14,7 @@
{{value.name}} -
{{status.id}}
+
{{status.id}}
void type Instance = string type Timeline = { @@ -61,6 +63,12 @@ export default class AddColumn extends Vue { return this.instance != '' } + public sortedStatus(statuses: Map): Map { + return statuses.sortByValue((s1, s2): number => { + return s1.created_at > s2.created_at ? -1 : 1 + }) + } + public addTL() { let timeline: Timeline = { name: this.instance } diff --git a/src/extensions/map-sortbyvalue.ts b/src/extensions/map-sortbyvalue.ts new file mode 100644 index 00000000..282df10d --- /dev/null +++ b/src/extensions/map-sortbyvalue.ts @@ -0,0 +1,9 @@ + +interface Map { + sortByValue(f: (value1: V, value2: V) => number): Map +} +Map.prototype.sortByValue = function (f: (value1: any, value2: any) => number): Map { + return new Map([...(this as Map)].sort((keyValue1, keyValue2) => { + return f(keyValue1[1], keyValue2[1]); + })) +} \ No newline at end of file