2020-06-01 02:08:21 -04:00
|
|
|
import Vue from 'vue';
|
2021-09-09 11:09:24 -04:00
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
2020-06-01 02:08:21 -04:00
|
|
|
import store from '~/mr_notes/stores';
|
|
|
|
|
|
|
|
export const initReviewBar = () => {
|
|
|
|
const el = document.getElementById('js-review-bar');
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
|
|
|
store,
|
2021-09-09 11:09:24 -04:00
|
|
|
components: {
|
|
|
|
ReviewBar: () => import('./components/review_bar.vue'),
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapGetters('batchComments', ['draftsCount']),
|
|
|
|
},
|
2020-06-01 02:08:21 -04:00
|
|
|
mounted() {
|
|
|
|
this.fetchDrafts();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions('batchComments', ['fetchDrafts']),
|
|
|
|
},
|
|
|
|
render(createElement) {
|
2021-09-09 11:09:24 -04:00
|
|
|
if (this.draftsCount === 0) return null;
|
|
|
|
|
|
|
|
return createElement('review-bar');
|
2020-06-01 02:08:21 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|