forked from Stigmatoz/web-activity-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDashboad.vue
More file actions
93 lines (85 loc) · 2.09 KB
/
Dashboad.vue
File metadata and controls
93 lines (85 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<template>
<div class="settings-item">
<label class="title"> {{ t('dashboard.message') }} </label>
</div>
<div class="chart chartByHours">
<div class="mt-10 mb-20">
<button
:class="['chart-btn', chart == TypeOfChart.Horly ? 'active' : '']"
@click="openChart(TypeOfChart.Horly)"
>
<img class="ml-5" src="../assets/icons/by-hours.svg" height="22" />
{{ t('byHours.message') }}
</button>
<button
:class="['ml-10', 'chart-btn', chart == TypeOfChart.Interval ? 'active' : '']"
@click="openChart(TypeOfChart.Interval)"
>
<img class="ml-5" src="../assets/icons/by-intervals.svg" height="22" />
{{ t('intervals.message') }}
</button>
</div>
<HourlyChart v-if="chart == TypeOfChart.Horly" />
<TimeIntervalChart v-if="chart == TypeOfChart.Interval" />
</div>
<div class="tab-items">
<TabList :type="TypeOfList.Dashboard" :showAllStats="false" v-if="chart == TypeOfChart.Horly" />
</div>
</template>
<script lang="ts">
export default {
name: 'Dashboard',
};
</script>
<script lang="ts" setup>
import { useI18n } from 'vue-i18n';
import TimeIntervalChart from './TimeIntervalChart.vue';
import HourlyChart from './HourlyChart.vue';
import TabList from '../components/TabList.vue';
import { TypeOfList } from '../utils/enums';
import { onMounted, ref } from 'vue';
const { t } = useI18n();
const chart = ref<TypeOfChart>();
enum TypeOfChart {
Horly,
Interval,
}
onMounted(() => {
chart.value = TypeOfChart.Horly;
});
function openChart(type: TypeOfChart) {
chart.value = type;
}
</script>
<style scoped>
.chart {
margin: 20px 0;
width: 80%;
}
.tab-items {
width: 80%;
margin-top: 100px;
}
.chartByHours {
height: 390px;
}
.chart-btn {
background-color: rgb(192, 192, 192);
color: #fff;
border-radius: 3px;
height: 36px;
line-height: 35px;
padding: 0 20px;
border: 0;
font-size: 14px;
font-weight: 500;
cursor: pointer;
min-width: 80px;
text-align: center;
width: 200px;
}
.chart-btn.active {
background-color: #428bff !important;
color: white;
}
</style>