forked from Stigmatoz/web-activity-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWelcome.vue
More file actions
145 lines (132 loc) · 3.24 KB
/
Welcome.vue
File metadata and controls
145 lines (132 loc) · 3.24 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
<div class="main">
<template v-if="step == WelcomeStep.InitialView">
<div class="initial-block">
<p class="header">{{ t('welcome.message') }}</p>
<img class="img" src="../assets/initial.jpg" height="250" />
<p class="description" v-html="t('welcome.description')"></p>
<div class="next-btn">
<button @click="nextStep()">{{ t('next.message') }}</button>
</div>
</div>
</template>
<template v-if="step == WelcomeStep.Tutorial">
<div class="steps">
<p class="header">{{ t('getStarted.message') }}</p>
<p class="description">{{ t('welcomeStart.message') }}</p>
<p class="step">1. {{ t('pinIcon.message') }}</p>
<p class="description">
{{ t('pinIconPart1.message') }}
<img src="../assets/icons/extension.svg" height="25" /> {{ t('pinIconPart2.message') }}
<img src="../assets/icons/pin.svg" height="25" />
</p>
<img class="img" src="../assets/pin-tutorial.png" height="250" />
<p class="step">2. {{ t('browse.message') }}</p>
<p class="description">
{{ t('browse.description') }}
<img src="../assets/icons/icon.png" height="35" />
</p>
<p class="step">3. {{ t('seeData.message') }}</p>
<p class="description mt-20">
{{ t('seeData.description') }}
</p>
<div class="btn-block">
<button class="close" @click="close()">{{ t('close.message') }}</button>
<button @click="openDashboard()">{{ t('useExtension.message') }}</button>
</div>
</div>
</template>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import Browser from 'webextension-polyfill';
const { t } = useI18n();
enum WelcomeStep {
InitialView,
Tutorial,
}
const step = ref<WelcomeStep>();
onMounted(() => {
step.value = WelcomeStep.InitialView;
});
function nextStep() {
step.value = WelcomeStep.Tutorial;
}
async function close() {
const currentTab = await Browser.tabs.getCurrent();
await Browser.tabs.remove(currentTab.id!);
}
async function openDashboard() {
const url = Browser.runtime.getURL('src/dashboard.html?tab=dashboard');
const tab = await Browser.tabs.query({ currentWindow: true, active: true });
Browser.tabs.update(tab[0].id, { url: url });
}
</script>
<style scoped>
.main {
margin: auto;
text-align: center;
width: 60%;
height: 100%;
}
.initial-block {
margin-top: 20%;
}
.header {
font-size: 26px;
font-weight: 700;
}
.img {
margin: 20px 0;
}
.description {
font-size: 18px;
}
.description span {
font-weight: 600;
}
.description img {
margin: 0 10px;
}
.steps {
margin-top: 50px;
}
.steps .step {
text-align: left;
font-size: 24px;
font-weight: 700;
}
.steps .step {
margin: 30px;
}
.steps .description {
margin: 20px;
}
.next-btn {
margin-top: 40px;
}
button.close {
background: #c5c5c5;
color: rgb(0, 0, 0);
}
button {
display: inline-block;
background: #428bff;
color: #fff;
border-radius: 5px;
height: 36px;
line-height: 35px;
padding: 0 10px;
border: 0;
font-size: 14px;
cursor: pointer;
text-align: center;
width: 200px;
margin: 0 10px;
}
.btn-block {
margin: 25px;
}
</style>