2023-04-23 21:23:45 +05:30
|
|
|
import Vue from 'vue';
|
2023-05-27 22:25:52 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2023-04-23 21:23:45 +05:30
|
|
|
|
|
|
|
import ProfileTabs from './components/profile_tabs.vue';
|
2023-05-27 22:25:52 +05:30
|
|
|
import UserAchievements from './components/user_achievements.vue';
|
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
2023-04-23 21:23:45 +05:30
|
|
|
|
|
|
|
export const initProfileTabs = () => {
|
|
|
|
const el = document.getElementById('js-profile-tabs');
|
|
|
|
|
|
|
|
if (!el) return false;
|
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
const { followees, followers, userCalendarPath, utcOffset } = el.dataset;
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
return new Vue({
|
|
|
|
el,
|
2023-05-27 22:25:52 +05:30
|
|
|
provide: {
|
|
|
|
followees: parseInt(followers, 10),
|
|
|
|
followers: parseInt(followees, 10),
|
|
|
|
userCalendarPath,
|
|
|
|
utcOffset,
|
|
|
|
},
|
2023-04-23 21:23:45 +05:30
|
|
|
render(createElement) {
|
|
|
|
return createElement(ProfileTabs);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
2023-05-27 22:25:52 +05:30
|
|
|
|
|
|
|
export const initUserAchievements = () => {
|
|
|
|
const el = document.getElementById('js-user-achievements');
|
|
|
|
|
|
|
|
if (!el) return false;
|
|
|
|
|
|
|
|
const { rootUrl, userId } = el.dataset;
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
name: 'UserAchievements',
|
|
|
|
provide: { rootUrl, userId: parseInt(userId, 10) },
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(UserAchievements);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|