3030 </div >
3131 <div class =" row" >
3232 <div class =" block" >
33- <div class =" header" >The most active day</div >
34- <p >{{ data.mostActiveDay.date.toLocaleDateString() }}</p >
35- <p >{{ convertSummaryTimeToString(data.mostActiveDay.summaryTime) }}</p >
33+ <div class =" header" >
34+ The most active day
35+ <div class =" tooltip" >
36+ <img
37+ v-if =" isIncludedCurrentForActiveDays"
38+ src =" ../assets/icons/today.svg"
39+ height =" 20"
40+ class =" most-day"
41+ @click =" excludeTodayFromMostActive()"
42+ />
43+ <img
44+ v-if =" !isIncludedCurrentForActiveDays"
45+ src =" ../assets/icons/no-today.svg"
46+ height =" 20"
47+ class =" most-day"
48+ @click =" excludeTodayFromMostActive()"
49+ />
50+ <span class =" tooltiptext" >{{
51+ isIncludedCurrentForActiveDays
52+ ? 'Today is included in the statistics. Click if you want to exclude today.'
53+ : 'Today is excluded from the statistics. Click if you want to include today.'
54+ }}</span >
55+ </div >
56+ </div >
57+ <p >{{ mostActiveDay }}</p >
58+ <p >{{ mostActiveDayTime }}</p >
3659 </div >
3760 <div class =" block" >
38- <div class =" header" >The most inactive day</div >
39- <p >{{ data.mostInactiveDay.date.toLocaleDateString() }}</p >
40- <p >{{ convertSummaryTimeToString(data.mostInactiveDay.summaryTime) }}</p >
61+ <div class =" header" >
62+ The most inactive day
63+ <div class =" tooltip" >
64+ <img
65+ v-if =" isIncludedCurrentForInActiveDays"
66+ src =" ../assets/icons/today.svg"
67+ height =" 20"
68+ class =" most-day"
69+ @click =" excludeTodayFromMostInActive()"
70+ />
71+ <img
72+ v-if =" !isIncludedCurrentForInActiveDays"
73+ src =" ../assets/icons/no-today.svg"
74+ height =" 20"
75+ class =" most-day"
76+ @click =" excludeTodayFromMostInActive()"
77+ />
78+ <span class =" tooltiptext" >{{
79+ isIncludedCurrentForInActiveDays
80+ ? 'Today is included in the statistics. Click if you want to exclude today.'
81+ : 'Today is excluded from the statistics. Click if you want to include today.'
82+ }}</span >
83+ </div >
84+ </div >
85+ <p >{{ mostInActiveDay }}</p >
86+ <p >
87+ {{ mostInActiveDayTime }}
88+ </p >
4189 </div >
4290 </div >
4391 </div >
@@ -50,12 +98,57 @@ export default {
5098 </script >
5199
52100<script lang="ts" setup>
101+ import { computed , onMounted , ref } from ' vue' ;
53102import { OverallStats } from ' ../dto/tabListSummary' ;
54103import { convertSummaryTimeToString } from ' ../utils/converter' ;
55104
56105const props = defineProps <{
57106 data: OverallStats ;
58107}>();
108+
109+ onMounted (() => {
110+ isIncludedCurrentForActiveDays .value = true ;
111+ isIncludedCurrentForInActiveDays .value = true ;
112+ });
113+
114+ const isIncludedCurrentForActiveDays = ref <boolean >();
115+ const isIncludedCurrentForInActiveDays = ref <boolean >();
116+
117+ const mostActiveDay = computed (() =>
118+ isIncludedCurrentForActiveDays .value
119+ ? props .data .mostActiveDay .date .toLocaleDateString ()
120+ : props .data .mostActiveDayExceptToday ?.date .toLocaleDateString (),
121+ );
122+
123+ const mostActiveDayTime = computed (() =>
124+ isIncludedCurrentForActiveDays .value
125+ ? convertSummaryTimeToString (props .data .mostActiveDay .summaryTime )
126+ : props .data .mostActiveDayExceptToday != null
127+ ? convertSummaryTimeToString (props .data .mostActiveDayExceptToday .summaryTime )
128+ : ' -' ,
129+ );
130+
131+ const mostInActiveDay = computed (() =>
132+ isIncludedCurrentForInActiveDays .value
133+ ? props .data .mostInactiveDay .date .toLocaleDateString ()
134+ : props .data .mostInactiveDayExceptToday ?.date .toLocaleDateString (),
135+ );
136+
137+ const mostInActiveDayTime = computed (() =>
138+ isIncludedCurrentForInActiveDays .value
139+ ? convertSummaryTimeToString (props .data .mostInactiveDay .summaryTime )
140+ : props .data .mostInactiveDayExceptToday != null
141+ ? convertSummaryTimeToString (props .data .mostInactiveDayExceptToday .summaryTime )
142+ : ' -' ,
143+ );
144+
145+ function excludeTodayFromMostActive() {
146+ isIncludedCurrentForActiveDays .value = ! isIncludedCurrentForActiveDays .value ;
147+ }
148+
149+ function excludeTodayFromMostInActive() {
150+ isIncludedCurrentForInActiveDays .value = ! isIncludedCurrentForInActiveDays .value ;
151+ }
59152 </script >
60153
61154<style scoped>
@@ -89,4 +182,8 @@ const props = defineProps<{
89182 font-size : 13px ;
90183 color : rgb (59 , 59 , 59 );
91184}
185+ .most-day {
186+ cursor : pointer ;
187+ margin-left : 5px ;
188+ }
92189 </style >
0 commit comments