Skip to content

Commit c1abfc5

Browse files
committed
Completely block website with just one button
1 parent 1aa1223 commit c1abfc5

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

src/components/ListWithTime.vue

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
/>
1111
<Favicon :type="TypeOfUrl.WebSite" :favicon="getFavicon(limit.domain)" />
1212
<span>{{ limit.domain }}</span>
13-
<p class="time-value">{{ t('limit.message') }} : {{ getTime(limit.time) }}</p>
13+
<div>
14+
<p class="time-value d-inline-block" v-if="!completelyBlocked(limit.time)">
15+
{{ t('limit.message') }} : {{ getTime(limit.time) }}
16+
</p>
17+
<p class="blocked" v-if="completelyBlocked(limit.time)">
18+
{{ t('completelyBlocked.message') }}
19+
</p>
20+
</div>
1421
</div>
1522
</li>
1623
</ul>
@@ -31,6 +38,18 @@
3138
@click="isEdit ? editItem() : addToList()"
3239
/>
3340
</div>
41+
<div class="mt-10" v-if="showCompletelyBlockValue">
42+
<label class="block-checkbox">
43+
<input
44+
type="checkbox"
45+
class="filled-in"
46+
id="viewTimeInBadge"
47+
v-model="isCheckedCompletelyBlocked"
48+
@change="completelyBlock"
49+
/>
50+
<span>{{ t('completelyBlocked.description') }}</span>
51+
</label>
52+
</div>
3453
</template>
3554

3655
<script lang="ts">
@@ -73,6 +92,15 @@ const time = ref<Time>({
7392
});
7493
const newWebsiteForList = ref<string>();
7594
const storageParam = ref<StorageParams>();
95+
const isCheckedCompletelyBlocked = computed(
96+
() => time.value != undefined && time.value.hours == 0 && time.value.minutes == 0,
97+
);
98+
const showCompletelyBlockValue = computed(
99+
() =>
100+
props.type == ListWithTime.Limits &&
101+
newWebsiteForList.value != undefined &&
102+
newWebsiteForList.value != '',
103+
);
76104
77105
onMounted(async () => {
78106
switch (props.type) {
@@ -112,6 +140,15 @@ function addToList() {
112140
}
113141
}
114142
143+
function completelyBlock() {
144+
time.value.hours = 0;
145+
time.value.minutes = 0;
146+
}
147+
148+
function completelyBlocked(time: number) {
149+
return props.type == ListWithTime.Limits && time == 0;
150+
}
151+
115152
function getTime(time: number) {
116153
const timeObj = convertSecondsToHHMM(time);
117154
return `${timeObj.hours}:${timeObj.minutes < 10 ? '0' + timeObj.minutes : timeObj.minutes}`;
@@ -171,4 +208,11 @@ async function save(value: any) {
171208
width: 120px;
172209
margin: 0 15px;
173210
}
211+
.blocked {
212+
display: inline-block;
213+
font-size: 13px;
214+
color: gray;
215+
margin-left: 55px;
216+
margin-top: 5px;
217+
}
174218
</style>

0 commit comments

Comments
 (0)