forked from Stigmatoz/web-activity-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBadgeIcons.vue
More file actions
58 lines (51 loc) · 1.33 KB
/
BadgeIcons.vue
File metadata and controls
58 lines (51 loc) · 1.33 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
<template>
<div class="d-inline-block">
<span v-if="showDocumentBadge" class="badge-document">{{ t('document.message') }}</span>
<span v-if="showLimitBadge" class="badge-block">{{ t('limit.message') }}</span>
</div>
</template>
<script lang="ts">
export default {
name: 'BadgeIcons',
};
</script>
<script lang="ts" setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { TypeOfList, TypeOfUrl } from '../utils/enums';
import { isDomainInLimits } from '../functions/limit-list';
import { computedAsync } from '@vueuse/core';
const { t } = useI18n();
const props = defineProps<{
url: string;
type: TypeOfUrl;
listType: TypeOfList;
}>();
const isLimit = computedAsync(async () => {
return await isDomainInLimits(props.url);
}, false);
const showDocumentBadge = computed(() => props.type == TypeOfUrl.Document);
const showLimitBadge = computed(
() =>
(props.listType == TypeOfList.Today || props.listType == TypeOfList.Dashboard) &&
isLimit.value == true,
);
</script>
<style scoped>
span.badge-document {
border-radius: 6px;
background-color: #0043ff9e;
padding: 3px 7px;
font-size: 11px;
color: white;
font-weight: 600;
}
span.badge-block {
border-radius: 6px;
background-color: #ff0000c0;
padding: 3px 7px;
font-size: 11px;
color: white;
font-weight: 600;
}
</style>