Skip to content

Commit a2b64d2

Browse files
committed
feat(RootNavigation): fill active icons
Signed-off-by: Grigory Vodyanov <[email protected]>
1 parent 4ed7bd8 commit a2b64d2

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

src/components/AppNavigation/GroupNavigationItem.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
<AppNavigationItem
1515
:key="group.key"
1616
:to="group.router"
17-
:name="group.name">
17+
:name="group.name"
18+
@click="$emit('updateRouteState', `group:${group.id}`)">
1819
<template #icon>
19-
<IconContact :size="20" />
20+
<IconContactFilled v-if="routeState === `group:${group.id}`" :size="20" />
21+
<IconContact v-else :size="20" />
2022
</template>
2123
<template #actions>
2224
<ActionButton
@@ -87,6 +89,7 @@ import {
8789
} from '@nextcloud/vue'
8890
import download from 'downloadjs'
8991
import moment from 'moment'
92+
import IconContactFilled from 'vue-material-design-icons/AccountMultiple.vue'
9093
import IconContact from 'vue-material-design-icons/AccountMultipleOutline.vue'
9194
import IconEmail from 'vue-material-design-icons/EmailOutline.vue'
9295
import IconRename from 'vue-material-design-icons/FolderEditOutline.vue'
@@ -111,13 +114,18 @@ export default {
111114
IconRename,
112115
IconDelete,
113116
IconLoading,
117+
IconContactFilled,
114118
},
115119
116120
props: {
117121
group: {
118122
type: Object,
119123
required: true,
120124
},
125+
routeState: {
126+
type: String,
127+
required: true,
128+
},
121129
},
122130
123131
data() {

src/components/AppNavigation/RootNavigation.vue

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
:to="{
2525
name: 'group',
2626
params: { selectedGroup: GROUP_ALL_CONTACTS },
27-
}">
27+
}"
28+
@click="updateRouteState('all')">
2829
<template #icon>
29-
<IconContact :size="20" />
30+
<IconContactFilled v-if="routeState === 'all'" :size="20" />
31+
<IconContact v-else :size="20" />
3032
</template>
3133
<template #counter>
3234
<NcCounterBubble
@@ -44,7 +46,8 @@
4446
name: 'chart',
4547
params: { selectedChart: GROUP_ALL_CONTACTS },
4648
}"
47-
icon="icon-category-monitoring" />
49+
icon="icon-category-monitoring"
50+
@click="updateRouteState('orgchart')" />
4851

4952
<!-- Not grouped group -->
5053
<AppNavigationItem
@@ -54,9 +57,11 @@
5457
:to="{
5558
name: 'group',
5659
params: { selectedGroup: GROUP_NO_GROUP_CONTACTS },
57-
}">
60+
}"
61+
@click="updateRouteState('notgrouped')">
5862
<template #icon>
59-
<IconUser :size="20" />
63+
<IconUserFilled v-if="routeState === 'notgrouped'" :size="20" />
64+
<IconUser v-else :size="20" />
6065
</template>
6166
<template #counter>
6267
<NcCounterBubble
@@ -73,7 +78,8 @@
7378
:to="{
7479
name: 'group',
7580
params: { selectedGroup: GROUP_RECENTLY_CONTACTED },
76-
}">
81+
}"
82+
@click="updateRouteState('recentlycontacted')">
7783
<template #icon>
7884
<IconRecentlyContacted :size="20" />
7985
</template>
@@ -113,7 +119,9 @@
113119
<GroupNavigationItem
114120
v-for="group in ellipsisGroupsMenu"
115121
:key="group.key"
116-
:group="group" />
122+
:route-state="routeState"
123+
:group="group"
124+
@update-route-state="updateRouteState" />
117125

118126
<template v-if="isCirclesEnabled">
119127
<!-- Toggle groups ellipsis -->
@@ -198,6 +206,8 @@ import {
198206
} from '@nextcloud/vue'
199207
import { mapStores } from 'pinia'
200208
import naturalCompare from 'string-natural-compare'
209+
import IconUserFilled from 'vue-material-design-icons/Account.vue'
210+
import IconContactFilled from 'vue-material-design-icons/AccountMultiple.vue'
201211
import IconContact from 'vue-material-design-icons/AccountMultipleOutline.vue'
202212
import IconUser from 'vue-material-design-icons/AccountOutline.vue'
203213
import IconError from 'vue-material-design-icons/AlertCircleOutline.vue'
@@ -230,7 +240,9 @@ export default {
230240
ContactsSettings,
231241
GroupNavigationItem,
232242
IconContact,
243+
IconContactFilled,
233244
IconUser,
245+
IconUserFilled,
234246
IconAdd,
235247
IconError,
236248
IconLoading,
@@ -243,12 +255,7 @@ export default {
243255
props: {
244256
loading: {
245257
type: Boolean,
246-
default: true,
247-
},
248-
249-
contactsList: {
250-
type: Array,
251-
required: true,
258+
default: false,
252259
},
253260
},
254261
@@ -278,6 +285,8 @@ export default {
278285
collapsedCircles: true,
279286
280287
showSettings: false,
288+
289+
routeState: 'all',
281290
}
282291
},
283292
@@ -493,6 +502,10 @@ export default {
493502
showContactsSettings() {
494503
this.showSettings = true
495504
},
505+
506+
updateRouteState(state) {
507+
this.routeState = state
508+
},
496509
},
497510
}
498511
</script>

0 commit comments

Comments
 (0)