diff --git a/src/assets/images/backgrounds/team_challenge_bg.png b/src/assets/images/backgrounds/team_challenge_bg.png new file mode 100644 index 0000000000..c4b7674077 Binary files /dev/null and b/src/assets/images/backgrounds/team_challenge_bg.png differ diff --git a/src/graphql/query/portfolioQuery.graphql b/src/graphql/query/portfolioQuery.graphql new file mode 100644 index 0000000000..4302a2ea2f --- /dev/null +++ b/src/graphql/query/portfolioQuery.graphql @@ -0,0 +1,27 @@ +query portfolioQuery { + my { + id + teams ( + limit: 100 + ) { + values { + id + team { + id + name + teamPublicId + } + } + } + } + general { + team_challenge_enable: uiConfigSetting(key: "portfolio_team_challenge_enable") { + key + value + } + challenge_allowed_teams: uiConfigSetting(key: "portfolio_challenge_allowed_teams") { + key + value + } + } +} diff --git a/src/pages/Portfolio/ImpactDashboard/ImpactDashboardPage.vue b/src/pages/Portfolio/ImpactDashboard/ImpactDashboardPage.vue index 703c87eee7..ee616831a3 100644 --- a/src/pages/Portfolio/ImpactDashboard/ImpactDashboardPage.vue +++ b/src/pages/Portfolio/ImpactDashboard/ImpactDashboardPage.vue @@ -6,8 +6,15 @@ -
- +
+ + @@ -27,6 +34,8 @@ import WwwPage from '@/components/WwwFrame/WwwPage'; import TheMyKivaSecondaryMenu from '@/components/WwwFrame/Menus/TheMyKivaSecondaryMenu'; import ThePortfolioTertiaryMenu from '@/components/WwwFrame/Menus/ThePortfolioTertiaryMenu'; import { gql } from '@apollo/client'; +import { readBoolSetting } from '@/util/settingsUtils'; +import portfolioQuery from '@/graphql/query/portfolioQuery.graphql'; import KvGrid from '~/@kiva/kv-components/vue/KvGrid'; import KvPageContainer from '~/@kiva/kv-components/vue/KvPageContainer'; import AccountOverview from './AccountOverview'; @@ -38,6 +47,7 @@ import RecentLoansList from './RecentLoansList'; import YourTeams from './YourTeams'; import EducationModule from './EducationModule'; import YourDonations from './YourDonations'; +import TeamChallenge from './TeamChallenge'; export default { name: 'ImpactDashboardPage', @@ -56,13 +66,22 @@ export default { ThePortfolioTertiaryMenu, WwwPage, YourTeams, - YourDonations + YourDonations, + TeamChallenge, }, data() { return { - post: null + post: null, + showTeamChallenge: false, + teamsChallengeEnable: false, + allowedTeams: [], }; }, + apollo: { + async preFetch(config, client) { + return client.query({ query: portfolioQuery }); + }, + }, methods: { loadEducationPost() { // Donation Education Module Experiment MARS-497 @@ -83,6 +102,18 @@ export default { }); } }, + created() { + const portfolioQueryData = this.apollo.readQuery({ query: portfolioQuery }); + const teamsChallengeEnable = readBoolSetting(portfolioQueryData, 'general.team_challenge_enable.value'); + const userTeams = portfolioQueryData.my?.teams?.values ?? []; + let allowedTeamsSettings = portfolioQueryData.general?.challenge_allowed_teams?.value ?? ''; + allowedTeamsSettings = JSON.parse(allowedTeamsSettings); + this.allowedTeams = userTeams.filter(t => { + return allowedTeamsSettings.includes(t.team.teamPublicId); + }); + + this.showTeamChallenge = teamsChallengeEnable && this.allowedTeams.length > 0; + }, mounted() { this.loadEducationPost(); } diff --git a/src/pages/Portfolio/ImpactDashboard/TeamChallenge.vue b/src/pages/Portfolio/ImpactDashboard/TeamChallenge.vue new file mode 100644 index 0000000000..3e928dfe15 --- /dev/null +++ b/src/pages/Portfolio/ImpactDashboard/TeamChallenge.vue @@ -0,0 +1,106 @@ + + + + +