|
23 | 23 | </label> |
24 | 24 | <br /> |
25 | 25 | <label class="setting-header"> |
26 | | - <input type="checkbox" class="filled-in" id="blockDeferral" /> |
| 26 | + <input |
| 27 | + type="checkbox" |
| 28 | + class="filled-in" |
| 29 | + id="blockDeferral" |
| 30 | + v-model="allowDeferringBlock" |
| 31 | + /> |
27 | 32 | <span>Allow deferring block for 5 minutes</span> |
28 | 33 | <p class="description"> |
29 | 34 | After the site is blocked, you can postpone the blocking for 5 minutes |
30 | 35 | </p> |
31 | 36 | </label> |
32 | 37 | <br /> |
33 | 38 | <label class="setting-header"> |
34 | | - <input type="checkbox" class="filled-in" id="darkMode" /> |
| 39 | + <input type="checkbox" class="filled-in" id="darkMode" v-model="darkMode" /> |
35 | 40 | <span>Dark mode</span> |
| 41 | + <p class="description"></p> |
| 42 | + </label> |
| 43 | + <label class="setting-header d-inline-block" |
| 44 | + >Stop tracking if there is no activity during: |
36 | 45 | </label> |
| 46 | + <div class="d-inline-block ml-10"> |
| 47 | + <select class="option" v-model="intervalInactivity"> |
| 48 | + <option :value="InactivityInterval.Seconds_30">30 seconds</option> |
| 49 | + <option :value="InactivityInterval.Seconds_45">45 seconds</option> |
| 50 | + <option :value="InactivityInterval.Min_1">1 min</option> |
| 51 | + <option :value="InactivityInterval.Min_2">2 min</option> |
| 52 | + <option :value="InactivityInterval.Min_5">5 mins</option> |
| 53 | + <option :value="InactivityInterval.Min_10">10 mins</option> |
| 54 | + <option :value="InactivityInterval.Min_20">20 mins</option> |
| 55 | + <option :value="InactivityInterval.Min_30">30 mins</option> |
| 56 | + </select> |
| 57 | + </div> |
| 58 | + <p class="description">These are any actions with the mouse or keyboard</p> |
37 | 59 | <br /> |
38 | 60 | <!-- <div class="margin-top-10"> |
39 | | - <label class="setting-header">Stop tracking if no activity detected for: </label> |
40 | | - <div class="tooltip"> |
41 | | - <img src="../assets/icons/information.svg" height="18" /> |
42 | | - <span class="tooltiptext">An activity is an action with a mouse or keyboard</span> |
43 | | - </div> |
44 | | - <div class="margin-top-10"> |
45 | | - <select id="intervalInactivity" class="option"> |
46 | | - <option value="30">30 seconds</option> |
47 | | - <option value="45">45 seconds</option> |
48 | | - <option value="60">1 min</option> |
49 | | - <option value="120">2 min</option> |
50 | | - <option value="300">5 mins</option> |
51 | | - <option value="600">10 mins</option> |
52 | | - <option value="1200">20 mins</option> |
53 | | - <option value="1800">30 mins</option> |
54 | | - </select> |
55 | | - </div> |
56 | | - <br /> |
57 | | - <div class="margin-top-10"> |
58 | 61 | <label class="setting-header">Default range for days:</label> |
59 | 62 | </div> |
60 | 63 | <div class="margin-top-10"> |
|
140 | 143 | import { watchEffect, onMounted, ref } from 'vue'; |
141 | 144 | import { StorageParams } from '../storage/storage-params'; |
142 | 145 | import { injecStorage } from '../storage/inject-storage'; |
| 146 | +import { InactivityInterval } from '../storage/storage-params'; |
143 | 147 |
|
144 | 148 | const settingsStorage = injecStorage(); |
145 | 149 |
|
146 | 150 | const viewTimeInBadge = ref<boolean>(); |
| 151 | +const intervalInactivity = ref<InactivityInterval>(); |
| 152 | +const allowDeferringBlock = ref<boolean>(); |
| 153 | +const darkMode = ref<boolean>(); |
147 | 154 |
|
148 | 155 | onMounted(async () => { |
149 | 156 | viewTimeInBadge.value = await settingsStorage.getValue(StorageParams.VIEW_TIME_IN_BADGE); |
| 157 | + intervalInactivity.value = await settingsStorage.getValue(StorageParams.INTERVAL_INACTIVITY); |
| 158 | + darkMode.value = await settingsStorage.getValue(StorageParams.DARK_MODE); |
| 159 | + allowDeferringBlock.value = await settingsStorage.getValue(StorageParams.BLOCK_DEFERRAL); |
150 | 160 | }); |
151 | 161 |
|
152 | 162 | watchEffect(() => save(StorageParams.VIEW_TIME_IN_BADGE, viewTimeInBadge.value)); |
| 163 | +watchEffect(() => save(StorageParams.INTERVAL_INACTIVITY, intervalInactivity.value)); |
| 164 | +watchEffect(() => save(StorageParams.DARK_MODE, darkMode.value)); |
| 165 | +watchEffect(() => save(StorageParams.BLOCK_DEFERRAL, allowDeferringBlock.value)); |
153 | 166 |
|
154 | 167 | function save(storageParam: StorageParams, value: any) { |
155 | 168 | settingsStorage.saveValue(storageParam, value); |
|
0 commit comments