|
3 | 3 | <UIBanner :title="pageInfo['title_' + $i18n.locale]" :description="pageInfo['description_' + $i18n.locale]" />
|
4 | 4 | <div class="container flex flex-col-reverse lg:flex-row justify-between py-6">
|
5 | 5 | <ElementsDropdown :items="categories" :active="activeCat" @setActive="setActiveCat" class="min-w-xs" />
|
6 |
| - <ElementsControlInput v-model="searchString" :placeholder="$t('search') + ' ' + activeCatTitle" |
7 |
| - class="search-bar mb-8 lg:mb-0 rounded-full flex-grow w-full lg:w-auto" /> |
| 6 | + <ElementsControlInput v-model="searchString" :placeholder="$t('search')" |
| 7 | + class="search-bar mb-8 lg:mb-0 rounded-full flex-grow w-full lg:w-auto rtl:mr-8 ltr:ml-8" /> |
8 | 8 | </div>
|
9 | 9 | <ListsAppSpotlight v-if="spotlightApps.length && !searchString" :title="$t('spotlightApp')"
|
10 | 10 | :content="orderBy(spotlightApps, 'published_at', -1)[0]" class="mt-10" />
|
11 | 11 | <ListsAppGrid v-if="popularApps.length && !searchString" :title="$t('popularApps')" :contentList="popularApps"
|
12 | 12 | :count="3" class="mt-10" />
|
13 | 13 | <ListsAppAll v-if="allApps.length" :title="searchString ? $t('searchResults') + ' ' + searchString : $t('allApps')"
|
14 |
| - :contentList="filterBy(allApps, searchString, 'name_en', 'description_en', 'name_ar', 'description_ar')" |
| 14 | + :contentList="filterBy(allApps, searchString, 'name_en', 'name_ar')" |
15 | 15 | class="my-10" />
|
16 | 16 | </div>
|
17 | 17 | </template>
|
|
31 | 31 | return this.$store.getters.getPages.find((page) => page.page_id == 'apps')
|
32 | 32 | },
|
33 | 33 | allApps() {
|
34 |
| - let list = this.$store.state.apps.list |
35 |
| - if (this.active != 'all') { |
36 |
| - let filteredList = list.filter((item) => { |
37 |
| - return item.category.name == this.active |
38 |
| - }) |
39 |
| - return filteredList |
40 |
| - } else { |
41 |
| - return list |
42 |
| - } |
| 34 | + return this.$store.state.apps.list |
43 | 35 | },
|
44 | 36 | popularApps() {
|
45 |
| - let list = this.$store.state.apps.popular |
46 |
| - if (this.active != 'all') { |
47 |
| - let filteredList = list.filter((item) => { |
48 |
| - return item.category.name == this.active |
49 |
| - }) |
50 |
| - return filteredList |
51 |
| - } else { |
52 |
| - return list |
53 |
| - } |
| 37 | + return this.$store.state.apps.popular |
54 | 38 | },
|
55 | 39 | spotlightApps() {
|
56 |
| - let list = this.$store.state.apps.spotlight |
57 |
| - if (this.active != 'all') { |
58 |
| - let filteredList = list.filter((item) => { |
59 |
| - return item.category.name == this.active |
60 |
| - }) |
61 |
| - return filteredList |
62 |
| - } else { |
63 |
| - return list |
64 |
| - } |
65 |
| - }, |
66 |
| - publishers() { |
67 |
| - return this.$store.state.apps.publishers |
| 40 | + return this.$store.state.apps.spotlight |
68 | 41 | },
|
69 | 42 | categories() {
|
70 | 43 | return this.$store.state.apps.categories
|
71 | 44 | },
|
72 | 45 | activeCat() {
|
73 |
| - let hash = this.$route.hash.replace('#', '') |
74 |
| - let cat = this.categories.find((cat) => { |
75 |
| - return cat.name == hash |
76 |
| - }) |
77 |
| - if (cat && hash != '#all') { |
78 |
| - this.active = hash |
79 |
| - this.activeCatTitle = cat['title_' + this.$i18n.locale] |
80 |
| - } else { |
81 |
| - this.active = 'all' |
82 |
| - this.activeCatTitle = this.$t('all') |
83 |
| - } |
84 | 46 | return this.active
|
85 | 47 | }
|
86 | 48 | },
|
87 | 49 | async fetch() {
|
88 | 50 | let list = this.$store.state.apps.list
|
89 | 51 | let categories = this.$store.state.apps.categories
|
90 |
| - let publishers = this.$store.state.apps.publishers |
91 | 52 | if (list.length < 1) {
|
92 | 53 | await this.$store.dispatch("apps/fetch")
|
93 | 54 | }
|
94 | 55 | if (categories.length < 1) {
|
95 | 56 | await this.$store.dispatch('apps/fetchCategories')
|
96 | 57 | }
|
97 |
| - if (publishers.length < 1) { |
98 |
| - await this.$store.dispatch('apps/fetchPublishers') |
99 |
| - } |
100 | 58 | },
|
101 | 59 | methods: {
|
102 |
| - setActiveCat(value, title) { |
103 |
| - this.active = value |
104 |
| - this.activeCatTitle = title |
105 |
| - if (value == 'all') { |
106 |
| - this.$router.push('') |
107 |
| - } else { |
108 |
| - this.$router.push('#' + value) |
| 60 | + setActiveCat(value) { |
| 61 | + if (value != 'all') { |
| 62 | + let path = this.localePath('/apps/category/' + value) |
| 63 | + this.$router.push(path) |
109 | 64 | }
|
110 | 65 | }
|
111 | 66 | }
|
|
0 commit comments