Skip to content

Commit 43dd5ea

Browse files
committed
Dashboard
1 parent 86c116f commit 43dd5ea

File tree

13 files changed

+71
-40
lines changed

13 files changed

+71
-40
lines changed

src/_locales/de/messages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@
226226
"mostVisited": {
227227
"message": "Die meistbesuchte Website "
228228
},
229-
"timeChart": {
230-
"message": "Die heutige Zeit"
229+
"dashboard": {
230+
"message": "Dashboard"
231231
},
232232
"timeChartDescription": {
233233
"message": "Dies ist eine stundenweise Zeitleiste für den Tag"

src/_locales/en/messages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@
226226
"mostVisited": {
227227
"message": "Most visited website "
228228
},
229-
"timeChart": {
230-
"message": "Today's time"
229+
"dashboard": {
230+
"message": "Dashboard"
231231
},
232232
"timeChartDescription": {
233233
"message": "This is a chart of time during the day by the hour"

src/_locales/ru/messages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@
226226
"mostVisited": {
227227
"message": "Самый посещаемый сайт "
228228
},
229-
"timeChart": {
230-
"message": "Время сегодня"
229+
"dashboard": {
230+
"message": "Дашборд"
231231
},
232232
"timeChartDescription": {
233233
"message": "Это график времени в течение дня по часам"

src/assets/css/general.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
:root {
2+
--main-color: #6ebf5d;
3+
--popup-header: #efefef;
4+
--progress-bar: #428bff;
5+
}
6+
17
.float-right {
28
float: right;
39
}

src/assets/css/main.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
:root {
2-
--main-color: #6ebf5d;
3-
--popup-header: #efefef;
4-
--progress-bar: #428bff;
5-
}
61
::-webkit-scrollbar-track {
72
border-radius: 10px;
83
background-color: #f5f5f5;

src/components/BadgeIcons.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ const isLimit = computedAsync(async () => {
3131
}, false);
3232
3333
const showDocumentBadge = computed(() => props.type == TypeOfUrl.Document);
34-
const showLimitBadge = computed(() => props.listType == TypeOfList.Today && isLimit.value == true);
34+
const showLimitBadge = computed(
35+
() =>
36+
(props.listType == TypeOfList.Today || props.listType == TypeOfList.Dashboard) &&
37+
isLimit.value == true,
38+
);
3539
</script>
3640

3741
<style scoped>

src/components/Dashboad.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<div class="settings-item">
3+
<label class="setting-header"> {{ t('dashboard.message') }} </label>
4+
<p class="description">{{ t('timeChartDescription.message') }}</p>
5+
</div>
6+
<div class="chart chartByHours">
7+
<TimeIntervalChart />
8+
</div>
9+
<div class="chart mt-20">
10+
<TabList :type="TypeOfList.Dashboard" :showAllStats="false" />
11+
</div>
12+
</template>
13+
14+
<script lang="ts">
15+
export default {
16+
name: 'Dashboard',
17+
};
18+
</script>
19+
20+
<script lang="ts" setup>
21+
import { useI18n } from 'vue-i18n';
22+
import TimeIntervalChart from './TimeIntervalChart.vue';
23+
import TabList from '../components/TabList.vue';
24+
import { TypeOfList } from '../utils/enums';
25+
26+
const { t } = useI18n();
27+
</script>
28+
29+
<style scoped>
30+
.chart {
31+
margin: 20px;
32+
width: 80%;
33+
}
34+
.chartByHours {
35+
height: 350px;
36+
}
37+
</style>

src/components/TabItemHeader.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const emit = defineEmits<{
4343
}>();
4444
4545
const title = computed(() => {
46-
if (props.listType == TypeOfList.Today) return t('today.message');
46+
if (props.listType == TypeOfList.Today || props.listType == TypeOfList.Dashboard)
47+
return t('today.message');
4748
if (props.listType == TypeOfList.All) {
4849
let countOfActiveDays =
4950
props.countOfActiveDays > 1 ? `(${props.countOfActiveDays} ${t('days.message')})` : '';

src/components/TabList.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
</div>
99
<div v-else>
1010
<OverallStatistics v-if="isShowOverallStats" :data="dataForOvarallStats" />
11-
<DonutChart :time="timeForChart" :labels="sitesForChart" />
11+
<DonutChart
12+
:time="timeForChart"
13+
:labels="sitesForChart"
14+
v-if="type != TypeOfList.Dashboard"
15+
/>
1216
<TabItemHeader
1317
:listType="type"
1418
:summaryTime="summaryTime"
@@ -86,7 +90,8 @@ function showAllWebSites() {
8690
8791
async function loadList(sortingBy: SortingBy) {
8892
let tabSummary = null;
89-
if (props.type == TypeOfList.Today) tabSummary = await useTodayTabListSummary(sortingBy);
93+
if (props.type == TypeOfList.Today || props.type == TypeOfList.Dashboard)
94+
tabSummary = await useTodayTabListSummary(sortingBy);
9095
if (props.type == TypeOfList.All) {
9196
tabSummary = await useAllTabListSummary(sortingBy);
9297
@@ -127,13 +132,13 @@ async function sorting(sortingBy: SortingBy) {
127132
function getItem(tab: Tab): CurrentTabItem {
128133
return {
129134
summaryTime:
130-
props.type == TypeOfList.Today
135+
props.type == TypeOfList.Today || props.type == TypeOfList.Dashboard
131136
? tab.days.find(day => day.date === todayLocalDate())!.summary
132137
: tab.summaryTime,
133138
favicon: tab.favicon,
134139
url: tab.url,
135140
sessions:
136-
props.type == TypeOfList.Today
141+
props.type == TypeOfList.Today || props.type == TypeOfList.Dashboard
137142
? tab.days.find(day => day.date === todayLocalDate())!.counter
138143
: tab.counter,
139144
};

src/components/TimeIntervalChart.vue

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
<template>
2-
<div class="settings-item">
3-
<label class="setting-header"> {{ t('timeChart.message') }} </label>
4-
<p class="description">{{ t('timeChartDescription.message') }}</p>
5-
</div>
6-
<div class="chart">
7-
<Bar :data="data" :options="options" v-if="isLoaded" />
8-
</div>
2+
<Bar :data="data" :options="options" v-if="isLoaded" />
93
</template>
104

115
<script lang="ts">
@@ -16,7 +10,6 @@ export default {
1610

1711
<script lang="ts" setup>
1812
import { Bar } from 'vue-chartjs';
19-
import { useI18n } from 'vue-i18n';
2013
import {
2114
Chart as ChartJS,
2215
Title,
@@ -33,8 +26,6 @@ import { TimeInterval } from '../entity/time-interval';
3326
import { todayLocalDate } from '../utils/date';
3427
import { convertHoursToTime, convertStringTimeIntervalToSeconds } from '../utils/converter';
3528
36-
const { t } = useI18n();
37-
3829
type DataForChart = {
3930
summary: number;
4031
hour: number;
@@ -187,12 +178,3 @@ async function buildChart() {
187178
188179
onMounted(async () => await buildChart());
189180
</script>
190-
191-
<style scoped>
192-
.chart {
193-
height: 350px;
194-
margin: auto;
195-
width: 80%;
196-
margin: 20px;
197-
}
198-
</style>

0 commit comments

Comments
 (0)