recently closed tabs

This commit is contained in:
Jan Prochazka
2020-10-10 17:43:16 +02:00
parent 598c48069a
commit a07d99c731
6 changed files with 46 additions and 22 deletions

View File

@@ -1,8 +1,9 @@
import React from 'react';
import _ from 'lodash';
import moment from 'moment';
import { getIconImage } from '../icons';
const openedTabAppObject = () => ({ tabid, props, selected, icon, title, busy }, { setOpenedTabs }) => {
const closedTabAppObject = () => ({ tabid, props, selected, icon, title, closedTime, busy }, { setOpenedTabs }) => {
const key = tabid;
const Icon = (props) => getIconImage(icon, props);
const isBold = !!selected;
@@ -12,11 +13,12 @@ const openedTabAppObject = () => ({ tabid, props, selected, icon, title, busy },
files.map((x) => ({
...x,
selected: x.tabid == tabid,
closedTime: x.tabid == tabid ? undefined : x.closedTime,
}))
);
};
return { title, key, Icon, isBold, onClick, isBusy: busy };
return { title: `${title} ${moment(closedTime).fromNow()}`, key, Icon, isBold, onClick, isBusy: busy };
};
export default openedTabAppObject;
export default closedTabAppObject;