debian-mirror-gitlab/app/assets/javascripts/ide/components/activity_bar.vue
2021-01-03 14:25:43 +05:30

88 lines
2.5 KiB
Vue

<script>
import { mapActions, mapState } from 'vuex';
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { leftSidebarViews } from '../constants';
export default {
components: {
GlIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
},
computed: {
...mapState(['currentActivityView']),
},
methods: {
...mapActions(['updateActivityBarView']),
changedActivityView(e, view) {
e.currentTarget.blur();
this.updateActivityBarView(view);
this.$root.$emit('bv::hide::tooltip');
},
},
leftSidebarViews,
};
</script>
<template>
<nav class="ide-activity-bar" data-testid="left-sidebar">
<ul class="list-unstyled">
<li>
<button
v-gl-tooltip.right.viewport
:class="{
active: currentActivityView === $options.leftSidebarViews.edit.name,
}"
:title="s__('IDE|Edit')"
:aria-label="s__('IDE|Edit')"
data-container="body"
data-placement="right"
data-qa-selector="edit_mode_tab"
type="button"
class="ide-sidebar-link js-ide-edit-mode"
@click.prevent="changedActivityView($event, $options.leftSidebarViews.edit.name)"
>
<gl-icon name="code" />
</button>
</li>
<li>
<button
v-gl-tooltip.right.viewport
:class="{
active: currentActivityView === $options.leftSidebarViews.review.name,
}"
:title="s__('IDE|Review')"
:aria-label="s__('IDE|Review')"
data-container="body"
data-placement="right"
type="button"
class="ide-sidebar-link js-ide-review-mode"
@click.prevent="changedActivityView($event, $options.leftSidebarViews.review.name)"
>
<gl-icon name="file-modified" />
</button>
</li>
<li>
<button
v-gl-tooltip.right.viewport
:class="{
active: currentActivityView === $options.leftSidebarViews.commit.name,
}"
:title="s__('IDE|Commit')"
:aria-label="s__('IDE|Commit')"
data-container="body"
data-placement="right"
data-qa-selector="commit_mode_tab"
type="button"
class="ide-sidebar-link js-ide-commit-mode"
@click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)"
>
<gl-icon name="commit" />
</button>
</li>
</ul>
</nav>
</template>