debian-mirror-gitlab/app/assets/javascripts/ide/components/activity_bar.vue

93 lines
2.7 KiB
Vue
Raw Normal View History

2018-10-15 14:42:47 +05:30
<script>
2021-01-03 14:25:43 +05:30
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { mapActions, mapState } from 'vuex';
import { BV_HIDE_TOOLTIP } from '~/lib/utils/constants';
2020-03-13 15:44:24 +05:30
import { leftSidebarViews } from '../constants';
2018-10-15 14:42:47 +05:30
export default {
components: {
2020-11-24 15:15:51 +05:30
GlIcon,
2018-10-15 14:42:47 +05:30
},
directives: {
2021-01-03 14:25:43 +05:30
GlTooltip: GlTooltipDirective,
2018-10-15 14:42:47 +05:30
},
computed: {
2021-03-11 19:13:27 +05:30
...mapState(['currentActivityView', 'stagedFiles']),
2018-10-15 14:42:47 +05:30
},
methods: {
...mapActions(['updateActivityBarView']),
2018-11-08 19:23:39 +05:30
changedActivityView(e, view) {
e.currentTarget.blur();
this.updateActivityBarView(view);
2021-03-11 19:13:27 +05:30
this.$root.$emit(BV_HIDE_TOOLTIP);
2018-11-08 19:23:39 +05:30
},
2018-10-15 14:42:47 +05:30
},
2020-03-13 15:44:24 +05:30
leftSidebarViews,
2018-10-15 14:42:47 +05:30
};
</script>
<template>
2021-01-03 14:25:43 +05:30
<nav class="ide-activity-bar" data-testid="left-sidebar">
2018-10-15 14:42:47 +05:30
<ul class="list-unstyled">
<li>
<button
2021-01-03 14:25:43 +05:30
v-gl-tooltip.right.viewport
2018-10-15 14:42:47 +05:30
:class="{
2020-03-13 15:44:24 +05:30
active: currentActivityView === $options.leftSidebarViews.edit.name,
2018-10-15 14:42:47 +05:30
}"
:title="s__('IDE|Edit')"
:aria-label="s__('IDE|Edit')"
2018-11-08 19:23:39 +05:30
data-container="body"
data-placement="right"
2020-11-24 15:15:51 +05:30
data-qa-selector="edit_mode_tab"
2018-11-08 19:23:39 +05:30
type="button"
class="ide-sidebar-link js-ide-edit-mode"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.edit.name)"
2018-10-15 14:42:47 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon name="code" />
2018-10-15 14:42:47 +05:30
</button>
</li>
<li>
<button
2021-01-03 14:25:43 +05:30
v-gl-tooltip.right.viewport
2018-10-15 14:42:47 +05:30
:class="{
2020-03-13 15:44:24 +05:30
active: currentActivityView === $options.leftSidebarViews.review.name,
2018-10-15 14:42:47 +05:30
}"
:title="s__('IDE|Review')"
:aria-label="s__('IDE|Review')"
2018-11-08 19:23:39 +05:30
data-container="body"
data-placement="right"
type="button"
class="ide-sidebar-link js-ide-review-mode"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.review.name)"
2018-10-15 14:42:47 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon name="file-modified" />
2018-10-15 14:42:47 +05:30
</button>
</li>
2020-06-23 00:09:42 +05:30
<li>
2018-10-15 14:42:47 +05:30
<button
2021-01-03 14:25:43 +05:30
v-gl-tooltip.right.viewport
2018-10-15 14:42:47 +05:30
:class="{
2020-03-13 15:44:24 +05:30
active: currentActivityView === $options.leftSidebarViews.commit.name,
2018-10-15 14:42:47 +05:30
}"
:title="s__('IDE|Commit')"
:aria-label="s__('IDE|Commit')"
2018-11-08 19:23:39 +05:30
data-container="body"
data-placement="right"
2020-11-24 15:15:51 +05:30
data-qa-selector="commit_mode_tab"
2018-11-08 19:23:39 +05:30
type="button"
2020-11-24 15:15:51 +05:30
class="ide-sidebar-link js-ide-commit-mode"
2020-03-13 15:44:24 +05:30
@click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)"
2018-10-15 14:42:47 +05:30
>
2020-11-24 15:15:51 +05:30
<gl-icon name="commit" />
2021-03-11 19:13:27 +05:30
<div v-if="stagedFiles.length > 0" class="ide-commit-badge badge badge-pill">
{{ stagedFiles.length }}
</div>
2018-10-15 14:42:47 +05:30
</button>
</li>
</ul>
</nav>
</template>