Skip to content
Snippets Groups Projects
Commit d42cd5c7 authored by Julian's avatar Julian
Browse files

Display time and sender better

parent 975b79b9
No related branches found
No related tags found
1 merge request!1125Resolve "[Vue] Notifications look ugly"
Pipeline #102912 failed
......@@ -9,9 +9,20 @@
<v-list-item-content>
<v-list-item-title>{{ notification.title }}</v-list-item-title>
<v-list-item-subtitle>
<v-icon>mdi-clock-outline</v-icon>
{{ notification.created }}
<v-list-item-subtitle class="caption">
<v-chip color="primary" label x-small outlined>{{ notification.sender }}</v-chip>
<v-icon>mdi-circle-small</v-icon>
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<span
v-bind="attrs"
v-on="on"
>{{ $d(new Date(notification.created), dateFormat(new Date(notification.created))) }}</span>
</template>
<span>{{ $d(new Date(notification.created), "long") }}</span>
</v-tooltip>
</v-list-item-subtitle>
<v-list-item-subtitle>
......@@ -52,10 +63,6 @@
<span>{{ $t("notifications.more_information") }}</span>
</v-tooltip>
</v-list-item-action>
<v-list-item-icon>
<v-chip color="primary">{{ notification.sender }}</v-chip>
</v-list-item-icon>
</v-list-item>
</template>
</ApolloMutation>
......@@ -69,5 +76,15 @@ export default {
required: true,
},
},
methods: {
dateFormat(date) {
let now = new Date();
if (now.getFullYear() === date.getFullYear() && now.getMonth() === date.getMonth() && now.getDate() === date.getDate()) {
return "timeOnly"
} else {
return "short"
}
}
}
};
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment