Initial introduction of TeamCollectionAdapter based collection render

This commit is contained in:
Andrew Bastin
2021-05-06 12:06:19 -04:00
parent fdf96b0b63
commit 84f8048e0a

View File

@@ -147,7 +147,8 @@
import { fb } from "~/helpers/fb" import { fb } from "~/helpers/fb"
import { getSettingSubject } from "~/newstore/settings" import { getSettingSubject } from "~/newstore/settings"
import gql from "graphql-tag" import gql from "graphql-tag"
import team_utils from "~/helpers/teams/utils" import * as team_utils from "~/helpers/teams/utils"
import TeamCollectionAdapter from "~/helpers/teams/TeamCollectionAdapter"
export default { export default {
props: { props: {
@@ -177,11 +178,13 @@ export default {
selectedTeam: undefined, selectedTeam: undefined,
}, },
teamCollections: {}, teamCollections: {},
teamCollectionAdapter: new TeamCollectionAdapter(null),
} }
}, },
subscriptions() { subscriptions() {
return { return {
SYNC_COLLECTIONS: getSettingSubject("syncCollections"), SYNC_COLLECTIONS: getSettingSubject("syncCollections"),
teamCollectionsNew: this.teamCollectionAdapter.collections$,
} }
}, },
apollo: { apollo: {
@@ -290,6 +293,9 @@ export default {
"collectionsType.type": function emitstuff() { "collectionsType.type": function emitstuff() {
this.$emit("update-collection", this.$data.collectionsType.type) this.$emit("update-collection", this.$data.collectionsType.type)
}, },
"collectionsType.selectedTeam": function (value) {
if (value?.id) this.teamCollectionAdapter.changeTeamID(value.id)
},
}, },
computed: { computed: {
showTeamCollections() { showTeamCollections() {
@@ -313,7 +319,7 @@ export default {
this.collectionsType.selectedTeam && this.collectionsType.selectedTeam &&
this.collectionsType.selectedTeam.id in this.teamCollections this.collectionsType.selectedTeam.id in this.teamCollections
) { ) {
collections = this.teamCollections[this.collectionsType.selectedTeam.id] collections = this.teamCollectionsNew
} else { } else {
collections = [] collections = []
} }