summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/boards/components/modal/empty_state.vue
blob: cd4512f320f2657ed89dde4f5e7b6f09ccd66dc6 (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
<script>
/* eslint-disable vue/no-v-html */
import { GlButton } from '@gitlab/ui';
import { __, sprintf } from '~/locale';
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';

export default {
  components: {
    GlButton,
  },
  mixins: [modalMixin],
  props: {
    newIssuePath: {
      type: String,
      required: true,
    },
    emptyStateSvg: {
      type: String,
      required: true,
    },
  },
  data() {
    return ModalStore.store;
  },
  computed: {
    contents() {
      const obj = {
        title: __("You haven't added any issues to your project yet"),
        content: __(
          'An issue can be a bug, a todo or a feature request that needs to be discussed in a project. Besides, issues are searchable and filterable.',
        ),
      };

      if (this.activeTab === 'selected') {
        obj.title = __("You haven't selected any issues yet");
        obj.content = sprintf(
          __(
            'Go back to %{startTag}Open issues%{endTag} and select some issues to add to your board.',
          ),
          { startTag: '<strong>', endTag: '</strong>' },
        );
      }

      return obj;
    },
  },
};
</script>

<template>
  <section class="empty-state d-flex mt-0 h-100">
    <div class="row w-100 my-auto mx-0">
      <div class="col-12 col-md-6 order-md-last">
        <aside class="svg-content d-none d-md-block"><img :src="emptyStateSvg" /></aside>
      </div>
      <div class="col-12 col-md-6 order-md-first">
        <div class="text-content">
          <h4>{{ contents.title }}</h4>
          <p v-html="contents.content"></p>
          <gl-button
            v-if="activeTab === 'all'"
            :href="newIssuePath"
            category="secondary"
            variant="success"
          >
            {{ __('New issue') }}
          </gl-button>
          <gl-button
            v-if="activeTab === 'selected'"
            category="primary"
            variant="default"
            @click="changeTab('all')"
          >
            {{ __('Open issues') }}
          </gl-button>
        </div>
      </div>
    </div>
  </section>
</template>