Skip to content

Commit 7596cba

Browse files
authored
Merge pull request #47 from jordanopensource/development
Release v1.1.2 of Aman Raqami
2 parents 5a49f58 + b507bb7 commit 7596cba

File tree

6 files changed

+100
-61
lines changed

6 files changed

+100
-61
lines changed

components/Elements/Dropdown.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
}
6767
6868
.dropdown-link {
69-
@apply w-full flex flex-row flex-no-wrap items-center justify-start;
69+
@apply w-full h-full flex flex-row flex-no-wrap items-center justify-start;
7070
}
7171
7272
.dropdown-link:hover>* {
@@ -84,7 +84,6 @@
8484
.dropdown-menu {
8585
@apply absolute z-10 overflow-y-auto py-4 my-4 bg-white;
8686
top: 100%;
87-
left: 40px;
8887
background-clip: padding-box;
8988
}
9089

components/Lists/AppAll.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<div class="grid-list container">
33
<div class="flex flex-row flex-wrap justify-between items-center mb-8">
4-
<h2 v-if="title" class="mb-4 flex-grow">{{ title }}</h2>
5-
<div class="flex flex-row flex-no-wrap justify-start items-center mb-4">
4+
<h2 v-if="title" class="mb-4">{{ title }}</h2>
5+
<div class="flex flex-grow flex-row flex-no-wrap justify-end items-center mb-4">
66
<!-- Sort -->
77
<div class="inline-block relative">
88
<select name="sortMembers" id="sortMembers" v-model="sortValue"

lang/ar.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default {
55
popularApps: 'التطبيقات الأكثر شعبية',
66
allGuides: 'جميع الأدلة الإرشادية',
77
allApps: 'جميع التطبيقات',
8+
apps: 'التطبيقات',
89
all: 'الجميع',
910
content: 'المحتوى',
1011
weeklyRecommendations: 'تطبيقات مقترحة أسبوعياً',
@@ -13,7 +14,8 @@ export default {
1314
allHelpdesks: 'جميع مكاتب المساعدة',
1415
helpdesk: 'مكتب المساعدة',
1516
noResults: 'لا توجد نتائج',
16-
search: 'بحث في',
17+
searchIn: 'بحث في',
18+
search: 'بحث',
1719
searchResults: 'البحث عن:',
1820
stepByStep: 'خطوة بخطوة',
1921
submit: 'إرسال',

lang/en.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default {
55
popularApps: 'Popular Apps',
66
allGuides: 'All Guides',
77
allApps: 'All Apps',
8+
apps: 'Apps',
89
all: 'All',
910
content: 'Content',
1011
weeklyRecommendations: 'Weekly Recommendations',
@@ -13,7 +14,8 @@ export default {
1314
allHelpdesks: 'All Helpdesks',
1415
helpdesk: 'Helpdesk',
1516
noResults: 'No results',
16-
search: 'Search in',
17+
searchIn: 'Search in',
18+
search: 'Search',
1719
searchResults: 'Searching for:',
1820
stepByStep: 'Step-by-step',
1921
submit: 'Submit',

pages/apps/category/_slug.vue

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<template>
2+
<div>
3+
<UIBanner :title="pageInfo['title_' + $i18n.locale]" :description="pageInfo['description_' + $i18n.locale]" />
4+
<div class="container flex flex-col-reverse lg:flex-row justify-between py-6">
5+
<ElementsDropdown :items="categories" :active="activeCat" @setActive="setActiveCat" class="min-w-xs" />
6+
<ElementsControlInput v-model="searchString" :placeholder="$t('searchIn') + ' ' + activeCatTitle"
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+
</div>
9+
<ListsAppAll v-if="allApps.length" :title="searchString ? $t('searchResults') + ' ' + searchString : ''"
10+
:contentList="filterBy(allApps, searchString, 'name_en', 'name_ar')" class="my-10" />
11+
</div>
12+
</template>
13+
<script>
14+
import Vue2Filters from 'vue2-filters';
15+
export default {
16+
mixins: [Vue2Filters.mixin],
17+
data() {
18+
return {
19+
active: '',
20+
activeCatTitle: '',
21+
searchString: ''
22+
}
23+
},
24+
mounted() {
25+
let category = this.$route.params.slug
26+
let categories = this.categories
27+
try {
28+
let activeCat = categories.find((cat) => {
29+
return cat.name == category
30+
})
31+
this.active = activeCat.name
32+
this.activeCatTitle = activeCat['title_' + this.$i18n.locale]
33+
} catch (err) {
34+
return this.$nuxt.error({
35+
statusCode: 404,
36+
message: '404 Page Not Found'
37+
})
38+
}
39+
},
40+
computed: {
41+
pageInfo() {
42+
return this.$store.getters.getPages.find((page) => page.page_id == 'apps')
43+
},
44+
allApps() {
45+
let list = this.$store.state.apps.list
46+
let filteredList = list.filter((item) => {
47+
return item.category.name == this.active
48+
})
49+
return filteredList
50+
},
51+
categories() {
52+
return this.$store.state.apps.categories
53+
},
54+
activeCat() {
55+
return this.active
56+
}
57+
},
58+
async fetch() {
59+
let list = this.$store.state.apps.list
60+
let categories = this.$store.state.apps.categories
61+
if (list.length < 1) {
62+
await this.$store.dispatch("apps/fetch")
63+
}
64+
if (categories.length < 1) {
65+
await this.$store.dispatch('apps/fetchCategories')
66+
}
67+
},
68+
methods: {
69+
setActiveCat(value) {
70+
let path
71+
if (value == 'all') {
72+
path = this.localePath('/apps')
73+
} else {
74+
path = this.localePath('/apps/category/' + value)
75+
}
76+
this.$router.push(path)
77+
}
78+
}
79+
}
80+
81+
</script>

pages/apps/index.vue

+10-55
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<UIBanner :title="pageInfo['title_' + $i18n.locale]" :description="pageInfo['description_' + $i18n.locale]" />
44
<div class="container flex flex-col-reverse lg:flex-row justify-between py-6">
55
<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" />
88
</div>
99
<ListsAppSpotlight v-if="spotlightApps.length && !searchString" :title="$t('spotlightApp')"
1010
:content="orderBy(spotlightApps, 'published_at', -1)[0]" class="mt-10" />
1111
<ListsAppGrid v-if="popularApps.length && !searchString" :title="$t('popularApps')" :contentList="popularApps"
1212
:count="3" class="mt-10" />
1313
<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')"
1515
class="my-10" />
1616
</div>
1717
</template>
@@ -31,81 +31,36 @@
3131
return this.$store.getters.getPages.find((page) => page.page_id == 'apps')
3232
},
3333
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
4335
},
4436
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
5438
},
5539
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
6841
},
6942
categories() {
7043
return this.$store.state.apps.categories
7144
},
7245
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-
}
8446
return this.active
8547
}
8648
},
8749
async fetch() {
8850
let list = this.$store.state.apps.list
8951
let categories = this.$store.state.apps.categories
90-
let publishers = this.$store.state.apps.publishers
9152
if (list.length < 1) {
9253
await this.$store.dispatch("apps/fetch")
9354
}
9455
if (categories.length < 1) {
9556
await this.$store.dispatch('apps/fetchCategories')
9657
}
97-
if (publishers.length < 1) {
98-
await this.$store.dispatch('apps/fetchPublishers')
99-
}
10058
},
10159
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)
10964
}
11065
}
11166
}

0 commit comments

Comments
 (0)