2020-05-13 20:07:47 -04:00
|
|
|
import $ from 'jquery';
|
|
|
|
import Vue from 'vue';
|
2020-10-05 05:08:17 -04:00
|
|
|
import { GlIcon } from '@gitlab/ui';
|
2020-05-13 20:07:47 -04:00
|
|
|
|
|
|
|
export default (ModalStore, boardsStore) => {
|
|
|
|
const issueBoardsContent = document.querySelector('.content-wrapper > .js-focus-mode-board');
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el: document.getElementById('js-toggle-focus-btn'),
|
2020-10-05 05:08:17 -04:00
|
|
|
components: {
|
|
|
|
GlIcon,
|
|
|
|
},
|
2020-05-13 20:07:47 -04:00
|
|
|
data: {
|
|
|
|
modal: ModalStore.store,
|
|
|
|
store: boardsStore.state,
|
|
|
|
isFullscreen: false,
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleFocusMode() {
|
|
|
|
$(this.$refs.toggleFocusModeButton).tooltip('hide');
|
|
|
|
issueBoardsContent.classList.toggle('is-focused');
|
|
|
|
|
|
|
|
this.isFullscreen = !this.isFullscreen;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
template: `
|
|
|
|
<div class="board-extra-actions">
|
|
|
|
<a
|
|
|
|
href="#"
|
2020-07-17 05:09:43 -04:00
|
|
|
class="btn btn-default has-tooltip gl-ml-3 js-focus-mode-btn"
|
2020-05-13 20:07:47 -04:00
|
|
|
data-qa-selector="focus_mode_button"
|
|
|
|
role="button"
|
|
|
|
aria-label="Toggle focus mode"
|
|
|
|
title="Toggle focus mode"
|
|
|
|
ref="toggleFocusModeButton"
|
|
|
|
@click="toggleFocusMode">
|
2020-10-05 05:08:17 -04:00
|
|
|
<gl-icon :name="isFullscreen ? 'minimize' : 'maximize'" />
|
2020-05-13 20:07:47 -04:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
`,
|
|
|
|
});
|
|
|
|
};
|