diff --git a/app/javascript/dashboard/components/ui/TimeAgo.vue b/app/javascript/dashboard/components/ui/TimeAgo.vue new file mode 100644 index 000000000..c262a8aa0 --- /dev/null +++ b/app/javascript/dashboard/components/ui/TimeAgo.vue @@ -0,0 +1,88 @@ + + + + diff --git a/app/javascript/dashboard/components/ui/stories/TimeAgo.stories.js b/app/javascript/dashboard/components/ui/stories/TimeAgo.stories.js new file mode 100644 index 000000000..606b2d1d4 --- /dev/null +++ b/app/javascript/dashboard/components/ui/stories/TimeAgo.stories.js @@ -0,0 +1,30 @@ +import TimeAgo from 'dashboard/components/ui/TimeAgo'; + +export default { + title: 'Components/TimeAgo', + component: TimeAgo, + argTypes: { + isAutoRefreshEnabled: { + control: { + type: 'boolean', + }, + }, + timestamp: { + control: { + type: 'text, date, number', + }, + }, + }, +}; + +const Template = (args, { argTypes }) => ({ + props: Object.keys(argTypes), + components: { TimeAgo }, + template: '', +}); + +export const TimeAgoView = Template.bind({}); +TimeAgoView.args = { + timestamp: 1549843200, + isAutoRefreshEnabled: false, +}; diff --git a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue index 78e8c1988..61ee5e198 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ConversationCard.vue @@ -87,7 +87,7 @@

- {{ dynamicTime(chat.timestamp) }} + {{ unreadCount > 9 ? '9+' : unreadCount }}
@@ -123,6 +123,7 @@ import InboxName from '../InboxName'; import inboxMixin from 'shared/mixins/inboxMixin'; import ConversationContextMenu from './contextMenu/Index.vue'; import alertMixin from 'shared/mixins/alertMixin'; +import timeAgo from 'dashboard/components/ui/TimeAgo'; const ATTACHMENT_ICONS = { image: 'image', @@ -138,6 +139,7 @@ export default { InboxName, Thumbnail, ConversationContextMenu, + timeAgo, }, mixins: [