|
10 | 10 | /> |
11 | 11 | <Favicon :type="TypeOfUrl.WebSite" :favicon="getFavicon(limit.domain)" /> |
12 | 12 | <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> |
14 | 21 | </div> |
15 | 22 | </li> |
16 | 23 | </ul> |
|
31 | 38 | @click="isEdit ? editItem() : addToList()" |
32 | 39 | /> |
33 | 40 | </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> |
34 | 53 | </template> |
35 | 54 |
|
36 | 55 | <script lang="ts"> |
@@ -73,6 +92,15 @@ const time = ref<Time>({ |
73 | 92 | }); |
74 | 93 | const newWebsiteForList = ref<string>(); |
75 | 94 | 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 | +); |
76 | 104 |
|
77 | 105 | onMounted(async () => { |
78 | 106 | switch (props.type) { |
@@ -112,6 +140,15 @@ function addToList() { |
112 | 140 | } |
113 | 141 | } |
114 | 142 |
|
| 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 | +
|
115 | 152 | function getTime(time: number) { |
116 | 153 | const timeObj = convertSecondsToHHMM(time); |
117 | 154 | return `${timeObj.hours}:${timeObj.minutes < 10 ? '0' + timeObj.minutes : timeObj.minutes}`; |
@@ -171,4 +208,11 @@ async function save(value: any) { |
171 | 208 | width: 120px; |
172 | 209 | margin: 0 15px; |
173 | 210 | } |
| 211 | +.blocked { |
| 212 | + display: inline-block; |
| 213 | + font-size: 13px; |
| 214 | + color: gray; |
| 215 | + margin-left: 55px; |
| 216 | + margin-top: 5px; |
| 217 | +} |
174 | 218 | </style> |
0 commit comments