Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions components/charts/AverageResponseTime.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template>
<v-container class="text-center py-10">
<v-row justify="center" v-if="chartdata">
<v-col
v-for="(person, index) in chartdata.messagesPerPerson"
:key="index"
cols="12"
sm="6"
md="4"
class="mb-5"
>
<div class="text-h4 font-weight-bold">
{{ $t("averageResponseTimeFor", { name: person.name }) }}
</div>
<div class="text-h5">
{{
person.averageResponseTime !== null
? formatResponseTime(person.averageResponseTime)
: $t("noDataAvailable")
}}
</div>
</v-col>
</v-row>
<div v-else class="text-h5">
{{ $t("noDataAvailable") }}
</div>
</v-container>
</template>

<script>
import { Chat } from "~/utils/transformChatData";

export default {
name: "AverageResponseTime",
props: {
chartdata: {
type: new Chat(),
required: true,
},
},
methods: {
formatResponseTime(timeInMillis) {
const seconds = Math.floor((timeInMillis / 1000) % 60);
const minutes = Math.floor((timeInMillis / (1000 * 60)) % 60);
const hours = Math.floor((timeInMillis / (1000 * 60 * 60)) % 24);
console.log({ hours, minutes, seconds });

if (hours > 0) {
return this.$t("responseTimeHours", { hours, minutes, seconds });
} else if (minutes > 0) {
return this.$t("responseTimeMinutes", { minutes, seconds });
} else {
return this.$t("responseTimeSeconds", { seconds });
}
},
},
};
</script>

<style scoped></style>
8 changes: 8 additions & 0 deletions components/charts/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
</v-col>
</v-row>

<div class="text-h3 font-weight-bold pt-10">
{{ $t("averageResponseTime") }}
</div>
<AverageResponseTime :chartdata="chat" class="px-10" />

<div class="text-h3 font-weight-bold pt-10">{{ $t("wordCloud") }}</div>
<ChartsWordCloud id="wordcloud" :chartdata="chat" class="px-10" />

Expand Down Expand Up @@ -107,7 +112,10 @@
</template>

<script>
import AverageResponseTime from "~/components/charts/AverageResponseTime.vue";

export default {
components: { AverageResponseTime },
props: ["chat", "attachments", "isValidSubscription"],
};
</script>
2 changes: 1 addition & 1 deletion components/charts/WordCloud.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { withoutEmoji } from "emoji-aware";
import stopwords from "stopwords-de";

export default {
name: "WordCloud",
name: "WordCloud",
props: {
chartdata: new Chat(),
minWordLength: {
Expand Down
Loading