1+ <script setup>
2+ import Button from " @/components/ui/Button.vue"
3+ import Input from " @/components/ui/Input.vue"
4+ import Popover from " @/components/ui/Popover.vue"
5+
6+ const props = defineProps ({
7+ hash: {
8+ type: String ,
9+ required: true ,
10+ },
11+ color: {
12+ type: String ,
13+ default: " primary"
14+ },
15+ })
16+
17+ const alias = computed (() => {
18+ const { $getDisplayName } = useNuxtApp ()
19+
20+ return $getDisplayName (' addresses' , props .hash )
21+ })
22+ </script >
23+
24+ <template >
25+ <Popover :open =" isMessageTypePopoverOpen" @on-close =" onMessageTypePopoverClose" width =" 250" >
26+ <Button @click =" handleOpenMessageTypePopover" type =" secondary" size =" mini" >
27+ <Icon name =" plus-circle" size =" 12" color =" tertiary" />
28+ <Text color =" secondary" >Message Type</Text >
29+
30+ <template v-if =" Object .keys (filters .message_type ).find ((f ) => filters .message_type [f ])" >
31+ <div :class =" $style.vertical_divider" />
32+
33+ <Text size =" 12" weight =" 600" color =" primary" >
34+ {{
35+ Object.keys(filters.message_type).filter((f) => filters.message_type[f]).length < 3
36+ ? Object.keys(filters.message_type)
37+ .filter((f) => filters.message_type[f])
38+ .map((f) => f.replace("Msg", ""))
39+ .join(", ")
40+ : `${Object.keys(filters.message_type)
41+ .filter((f) => filters.message_type[f])[0]
42+ .replace("Msg", "")} and ${
43+ Object.keys(filters.message_type).filter((f) => filters.message_type[f]).length - 1
44+ } more`
45+ }}
46+ </Text >
47+
48+ <Icon @click.stop =" resetFilters('message_type', true)" name =" close-circle" size =" 12" color =" secondary" />
49+ </template >
50+ </Button >
51+
52+ <template #content >
53+ <Flex direction =" column" gap =" 12" >
54+ <Text size =" 12" weight =" 500" color =" secondary" >Filter by Message Type</Text >
55+
56+ <Input v-model =" searchTerm" size =" small" placeholder =" Search" autofocus />
57+
58+ <Flex direction =" column" gap =" 8" :class =" $style.message_types_list" >
59+ <template
60+ v-if ="
61+ Object .keys (filters .message_type ).filter ((t ) =>
62+ t .toLowerCase ().includes (searchTerm .trim ().toLowerCase ()),
63+ ).length
64+ "
65+ >
66+ <Checkbox
67+ v-for =" msg_type in Object.keys(filters.message_type).filter((t) =>
68+ t.toLowerCase().includes(searchTerm.trim().toLowerCase()),
69+ )"
70+ v-model =" filters.message_type[msg_type]"
71+ >
72+ <Text size =" 12" weight =" 500" color =" primary" >{{ msg_type.replace("Msg", "") }}</Text >
73+ </Checkbox >
74+ </template >
75+ <Flex v-else direction =" column" gap =" 8" >
76+ <Text size =" 12" weight =" 500" color =" tertiary" >Nothing was found</Text >
77+ </Flex >
78+ </Flex >
79+
80+ <Button @click =" handleApplyMessageTypeFilters" type =" secondary" size =" mini" wide >Apply</Button >
81+ </Flex >
82+ </template >
83+ </Popover >
84+ </template >
0 commit comments