Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Commit

Permalink
Add no search results view
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankchhabra committed Sep 22, 2022
1 parent 38f5170 commit 89d5103
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
Binary file added src/assets/no-search-results.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 45 additions & 2 deletions src/views/AppStore/AppStore.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
ref="searchInput"
class="search-input"
type="text"
v-model="appStoreSearchQuery"
placeholder="Search apps"
v-model="appStoreSearchQuery"
@input="onTypeAppStoreSearchQuery"
></b-input>
</div>
</div>
Expand All @@ -37,7 +38,7 @@
</div>
</div>

<div v-if="appStoreSearchQuery" class="app-store-card-columns">
<div v-if="appStoreSearchQuery && appStoreSearchResults.length" class="app-store-card-columns">
<card-widget
v-for="app in appStoreSearchResults"
:key="app.id"
Expand Down Expand Up @@ -81,6 +82,13 @@
</card-widget>
</div>

<div v-else-if="appStoreSearchQuery && !appStoreSearchResults.length && !isTypingAppStoreSearchQuery" class="w-100">
<p class="text-muted">No results found</p>
<transition name="no-search-results-transition" appear>
<img class="no-search-results-image d-block mt-5 mx-auto" src="@/assets/no-search-results.gif" />
</transition>
</div>

<div v-show="!appStoreSearchQuery" class="app-store-card-columns">
<card-widget
v-for="categorizedApps in categorizedAppStore"
Expand Down Expand Up @@ -191,12 +199,15 @@
<script>
import { mapState } from "vuex";
import delay from "@/helpers/delay";
import CardWidget from "@/components/CardWidget";
import UpdateAppsApp from "@/views/AppStore/UpdateAppsApp";
export default {
data() {
return {
isTypingAppStoreSearchQuery: false,
isUpdatingAll: false,
};
},
Expand Down Expand Up @@ -238,6 +249,15 @@ export default {
// update scroll position
this.$store.dispatch("apps/updateAppStoreScrollTop", event.target.scrollTop);
},
onTypeAppStoreSearchQuery: async function() {
this.isTypingAppStoreSearchQuery = true;
const appStoreSearchQuery = this.appStoreSearchQuery;
await delay(500);
const newAppStoreSearchQuery = this.appStoreSearchQuery;
if (newAppStoreSearchQuery === appStoreSearchQuery) {
this.isTypingAppStoreSearchQuery = false;
}
},
updateAll: function() {
this.isUpdatingAll = true;
this.appsWithUpdate
Expand Down Expand Up @@ -294,6 +314,7 @@ export default {
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.search-input-container {
svg.search-input-icon {
transition: transform 0.3s ease;
Expand Down Expand Up @@ -325,6 +346,12 @@ export default {
}
}
.no-search-results-image {
width: 300px;
height: auto;
border-radius: 20px;
}
.umbrel-dev-note {
position: relative;
overflow: visible;
Expand Down Expand Up @@ -357,4 +384,20 @@ export default {
line-height: 25px;
margin: 0;
}
// transitions
.no-search-results-transition-enter-active,
.no-search-results-transition-leave-active {
transition: transform 0.5s ease;
transition-delay: 0.5s;
}
.no-search-results-transition-enter {
transform: rotate(-360deg) scale3d(0, 0, 0);
opacity: 0;
}
.no-search-results-transition-enter-to {
transform: rotate(0deg) scale3d(1, 1, 1);
opacity: 1;
}
</style>

0 comments on commit 89d5103

Please sign in to comment.