From cc96134e2f8875792cc695872f5b4a56f2382328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Tue, 22 Dec 2020 10:05:56 +0100 Subject: [PATCH] fix: add last seen as sort option --- frontend/src/component/feature/list/list-component.jsx | 3 +++ frontend/src/component/feature/list/list-container.jsx | 2 ++ 2 files changed, 5 insertions(+) diff --git a/frontend/src/component/feature/list/list-component.jsx b/frontend/src/component/feature/list/list-component.jsx index eb7681eeb1..ace6bffc6f 100644 --- a/frontend/src/component/feature/list/list-component.jsx +++ b/frontend/src/component/feature/list/list-component.jsx @@ -117,6 +117,9 @@ export default class FeatureListComponent extends React.Component { Created + + Last seen + Strategies diff --git a/frontend/src/component/feature/list/list-container.jsx b/frontend/src/component/feature/list/list-container.jsx index 1ca51def01..90a57e88e3 100644 --- a/frontend/src/component/feature/list/list-container.jsx +++ b/frontend/src/component/feature/list/list-container.jsx @@ -45,6 +45,8 @@ export const mapStateToPropsConfigurable = isFeature => state => { ); } else if (settings.sort === 'created') { features = features.sort((a, b) => (new Date(a.createdAt) > new Date(b.createdAt) ? -1 : 1)); + } else if (settings.sort === 'Last seen') { + features = features.sort((a, b) => (new Date(a.lastSeenAt) > new Date(b.lastSeenAt) ? -1 : 1)); } else if (settings.sort === 'name') { features = features.sort((a, b) => { if (a.name < b.name) {