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
|
<script>
import { s__ } from '~/locale';
import { MAX_FREQUENT_PROJECTS_COUNT } from '../constants';
import FrequentItemsList from './frequent_items_list.vue';
import SearchResults from './search_results.vue';
import NavItem from './nav_item.vue';
export default {
MAX_FREQUENT_PROJECTS_COUNT,
components: {
FrequentItemsList,
SearchResults,
NavItem,
},
props: {
username: {
type: String,
required: true,
},
viewAllLink: {
type: String,
required: true,
},
isSearch: {
type: Boolean,
required: false,
default: false,
},
searchResults: {
type: Array,
required: false,
default: () => [],
},
},
computed: {
storageKey() {
return `${this.username}/frequent-projects`;
},
viewAllProps() {
return {
item: {
link: this.viewAllLink,
title: s__('Navigation|View all your projects'),
icon: 'project',
},
linkClasses: { 'dashboard-shortcuts-projects': true },
};
},
},
i18n: {
title: s__('Navigation|Frequently visited projects'),
searchTitle: s__('Navigation|Projects'),
pristineText: s__('Navigation|Projects you visit often will appear here.'),
noResultsText: s__('Navigation|No project matches found'),
},
};
</script>
<template>
<search-results
v-if="isSearch"
class="gl-border-t-0"
:title="$options.i18n.searchTitle"
:no-results-text="$options.i18n.noResultsText"
:search-results="searchResults"
>
<template #view-all-items>
<nav-item v-bind="viewAllProps" is-subitem />
</template>
</search-results>
<frequent-items-list
v-else
:title="$options.i18n.title"
:storage-key="storageKey"
:max-items="$options.MAX_FREQUENT_PROJECTS_COUNT"
:pristine-text="$options.i18n.pristineText"
>
<template #view-all-items>
<nav-item v-bind="viewAllProps" is-subitem />
</template>
</frequent-items-list>
</template>
|