summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/ide_context_bar.vue
blob: 79a83b4799466c93bcf6768c5a9dca85d0769a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<script>
import { mapActions, mapGetters, mapState } from 'vuex';
import icon from '~/vue_shared/components/icon.vue';
import panelResizer from '~/vue_shared/components/panel_resizer.vue';
import repoCommitSection from './repo_commit_section.vue';
import ResizablePanel from './resizable_panel.vue';

export default {
  components: {
    repoCommitSection,
    icon,
    panelResizer,
    ResizablePanel,
  },
  props: {
    noChangesStateSvgPath: {
      type: String,
      required: true,
    },
    committedStateSvgPath: {
      type: String,
      required: true,
    },
  },
  computed: {
    ...mapState(['changedFiles', 'rightPanelCollapsed']),
    ...mapGetters(['currentIcon']),
  },
  methods: {
    ...mapActions(['setPanelCollapsedStatus']),
  },
};
</script>

<template>
  <resizable-panel
    :collapsible="true"
    :initial-width="340"
    side="right"
  >
    <div
      class="multi-file-commit-panel-section"
    >
      <header
        class="multi-file-commit-panel-header"
        :class="{
          'is-collapsed': rightPanelCollapsed,
        }"
      >
        <div
          class="multi-file-commit-panel-header-title"
          v-if="!rightPanelCollapsed"
        >
          <div
            v-if="changedFiles.length"
          >
            <icon
              name="list-bulleted"
              :size="18"
            />
            Staged
          </div>
        </div>
        <button
          type="button"
          class="btn btn-transparent multi-file-commit-panel-collapse-btn"
          @click.stop="setPanelCollapsedStatus({
            side: 'right',
            collapsed: !rightPanelCollapsed,
          })"
        >
          <icon
            :name="currentIcon"
            :size="18"
          />
        </button>
      </header>
      <repo-commit-section
        :no-changes-state-svg-path="noChangesStateSvgPath"
        :committed-state-svg-path="committedStateSvgPath"
      />
    </div>
  </resizable-panel>
</template>