File tree Expand file tree Collapse file tree 4 files changed +70
-5
lines changed
Expand file tree Collapse file tree 4 files changed +70
-5
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ const styleForProgressBar = computed(() => `width: ${percent}%`);
8787}
8888.tab-item .progress-bar div {
8989 height : 6px ;
90- background-color : var (--main-color );
90+ background-color : var (--progress-bar );
9191}
9292.flex-grow-2 {
9393 flex-grow : 2 ;
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" header-block" >
3+ <p >{{ title }} ({{ countOfSites }} sites)</p >
4+ <p class =" time" >{{ summaryTimeString }}</p >
5+ </div >
6+ </template >
7+
8+ <script lang="ts">
9+ export default {
10+ name: ' TabItemHeader' ,
11+ };
12+ </script >
13+
14+ <script lang="ts" setup>
15+ import { computed } from ' vue' ;
16+ import { convertSummaryTimeToString } from ' ../utils/converter' ;
17+ import { TypeOfList } from ' ../utils/enums' ;
18+
19+ const props = defineProps <{
20+ listType: TypeOfList ;
21+ summaryTime: number ;
22+ countOfSites: number ;
23+ firstDay: Date ;
24+ }>();
25+
26+ const title = computed (() => {
27+ if (props .listType == TypeOfList .Today ) return ' Today' ;
28+ if (props .listType == TypeOfList .All ) return ` Aggregate data since ${props .firstDay } ` ;
29+ });
30+
31+ const summaryTimeString = computed (() => convertSummaryTimeToString (props .summaryTime ));
32+ </script >
33+
34+ <style scoped>
35+ .header-block {
36+ background-color : var (--popup-header );
37+ padding : 1px 0 ;
38+ text-align : center ;
39+ }
40+ p {
41+ font-size : 14px ;
42+ margin : 5px ;
43+ }
44+ .time {
45+ font-size : 16px ;
46+ font-weight : 600 ;
47+ }
48+ </style >
Original file line number Diff line number Diff line change 11<template >
2- <TabItem
3- v-for =" (tab, i) of tabs"
4- :key =" i"
5- :tab =" tab"
2+ <TabItemHeader
3+ :listType =" type"
64 :summaryTime =" summaryTime"
5+ :countOfSites =" countOfSites"
6+ :firstDay =" firstDay"
77 />
8+ <TabItem v-for =" (tab, i) of tabs" :key =" i" :tab =" tab" :summaryTime =" summaryTime" />
89</template >
910
1011<script lang="ts">
@@ -16,9 +17,15 @@ export default {
1617<script lang="ts" setup>
1718import { computed , onMounted , ref } from ' vue' ;
1819import TabItem from ' ../components/TabItem.vue' ;
20+ import TabItemHeader from ' ../components/TabItemHeader.vue' ;
1921import { injectTabsRepository } from ' ../repository/inject-tabs-repository' ;
2022import { Tab } from ' ../entity/tab' ;
2123import { todayLocalDate } from ' ../utils/today' ;
24+ import { TypeOfList } from ' ../utils/enums' ;
25+
26+ const props = defineProps <{
27+ type: TypeOfList ;
28+ }>();
2229
2330const tabs = ref <Tab []>();
2431const summaryTime = computed (() => {
@@ -32,6 +39,11 @@ const summaryTime = computed(() => {
3239 : 0 ;
3340});
3441
42+ const countOfSites = computed (() => tabs .value ?.length );
43+ const firstDay = computed (() => {
44+ if (props .type == TypeOfList .All ) return ;
45+ });
46+
3547onMounted (async () => {
3648 const repo = await injectTabsRepository ();
3749 let unSortedTabs = repo .getTodayTabs ();
Original file line number Diff line number Diff line change 1+ export enum TypeOfList {
2+ Today ,
3+ All ,
4+ ByDays ,
5+ }
You can’t perform that action at this time.
0 commit comments