Skip to content

Commit

Permalink
fix(Routing): add proper routing for circles
Browse files Browse the repository at this point in the history
Signed-off-by: Grigory Vodyanov <[email protected]>
  • Loading branch information
GVodyanov committed Jan 16, 2025
1 parent 84abda7 commit a0a80c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/models/circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Vue from 'vue'
import Member from './member'

import { CircleConfigs, MemberLevels } from './constants'
import { CircleConfigs, MemberLevels, ROUTE_CIRCLE } from './constants'

type MemberList = Record<string, Member>

Expand Down Expand Up @@ -303,7 +303,7 @@ export default class Circle {
get router() {
return {
name: 'circle',
params: { selectedCircle: this.id },
params: { selectedCircle: this.id, selectedGroup: ROUTE_CIRCLE },
}
}

Expand Down
11 changes: 10 additions & 1 deletion src/views/Contacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:selected-group="selectedGroup"
:selected-contact="selectedContact">
<div class="import-and-new-contact-buttons">
<SettingsImportContacts v-if="!loadingContacts && isEmptyGroup && !isChartView" />
<SettingsImportContacts v-if="!loadingContacts && isEmptyGroup && !isChartView && !isCirclesView" />
<!-- new-contact-button -->
<Button v-if="!loadingContacts"
type="secondary"
Expand Down Expand Up @@ -146,6 +146,9 @@ export default {
groups() {
return this.$store.getters.getGroups
},
circles() {

Check warning on line 149 in src/views/Contacts.vue

View check run for this annotation

Codecov / codecov/patch

src/views/Contacts.vue#L149

Added line #L149 was not covered by tests
return this.$store.getters.getCircles
},

Check warning on line 151 in src/views/Contacts.vue

View check run for this annotation

Codecov / codecov/patch

src/views/Contacts.vue#L151

Added line #L151 was not covered by tests
orderKey() {
return this.$store.getters.getOrderKey
},
Expand Down Expand Up @@ -193,6 +196,8 @@ export default {
return this.sortedContacts
} else if (this.selectedGroup === GROUP_NO_GROUP_CONTACTS) {
return this.ungroupedContacts.map(contact => this.sortedContacts.find(item => item.key === contact.key))
} else if (this.selectedGroup === ROUTE_CIRCLE) {
return []
}
const group = this.groups.filter(group => group.name === this.selectedGroup)[0]
if (group) {
Expand All @@ -201,6 +206,10 @@ export default {
return []
},

isCirclesView() {

Check warning on line 209 in src/views/Contacts.vue

View check run for this annotation

Codecov / codecov/patch

src/views/Contacts.vue#L209

Added line #L209 was not covered by tests
return this.selectedGroup === ROUTE_CIRCLE
},

Check warning on line 212 in src/views/Contacts.vue

View check run for this annotation

Codecov / codecov/patch

src/views/Contacts.vue#L212

Added line #L212 was not covered by tests
ungroupedContacts() {
return this.sortedContacts.filter(contact => this.contacts[contact.key].groups && this.contacts[contact.key].groups.length === 0)
},
Expand Down

0 comments on commit a0a80c9

Please sign in to comment.