-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: timeline filters [WTEL-4465]
- Loading branch information
Showing
7 changed files
with
124 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 0 additions & 89 deletions
89
...s/contacts/modules/timeline/modules/filters/components/timeline-task-filter-container.vue
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
src/modules/contacts/modules/timeline/modules/filters/components/timeline-task-filter.vue
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
...odules/contacts/modules/timeline/modules/filters/components/timeline-task-type-filter.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<template> | ||
<div class="timeline-task-type-filter"> | ||
<div | ||
v-for="({ icon, selected, set, count }) of filters" | ||
class="timeline-task-filter__filter-wrapper" | ||
> | ||
<wt-checkbox | ||
:selected="selected" | ||
@change="set" | ||
> | ||
<template #label> | ||
<div class="timeline-task-type-filter__label-wrapper"> | ||
<wt-icon :icon="icon" /> | ||
<span class="timeline-task-filter__count"> | ||
({{ count }}) | ||
</span> | ||
</div> | ||
</template> | ||
</wt-checkbox> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import getNamespacedState from '@webitel/ui-sdk/src/store/helpers/getNamespacedState'; | ||
import { computed } from 'vue'; | ||
import { useStore } from 'vuex'; | ||
import { WebitelContactsTimelineEventType } from 'webitel-sdk'; | ||
const props = defineProps({ | ||
namespace: { | ||
type: String, | ||
required: true, | ||
}, | ||
callsCount: { | ||
type: [Number, String], | ||
default: 0, | ||
}, | ||
chatsCount: { | ||
type: [Number, String], | ||
default: 0, | ||
}, | ||
}); | ||
const store = useStore(); | ||
const filterValue = computed(() => getNamespacedState(store.state, props.namespace).type.value); | ||
function setFilter(payload) { | ||
return store.dispatch(`${props.namespace}/SET_FILTER`, payload); | ||
} | ||
function toggleFilterValue(value) { | ||
const newValue = filterValue.value.includes(value) | ||
? filterValue.value.filter((item) => item !== value) | ||
: [...filterValue.value, value]; | ||
return setFilter({ filter: 'type', value: newValue }); | ||
} | ||
const filters = computed(() => [ | ||
{ | ||
icon: 'call', | ||
selected: filterValue.value.includes(WebitelContactsTimelineEventType.Call), | ||
set: () => toggleFilterValue(WebitelContactsTimelineEventType.Call), | ||
count: props.callsCount, | ||
}, | ||
{ | ||
icon: 'chat', | ||
selected: filterValue.value.includes(WebitelContactsTimelineEventType.Chat), | ||
set: () => toggleFilterValue(WebitelContactsTimelineEventType.Chat), | ||
count: props.chatsCount, | ||
}, | ||
]); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.timeline-task-type-filter { | ||
display: flex; | ||
gap: var(--spacing-md); | ||
} | ||
.timeline-task-type-filter__label-wrapper { | ||
display: flex; | ||
align-items: center; | ||
gap: var(--spacing-2xs); | ||
margin-left: var(--spacing-2xs); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters