$text: #222222;
$button-background: #00000010;
$input-highlight: #bbcdff;
+$logo-key-colour: #f9a76b;
.get("/api/search", { params: { term: this.searchTerm } })
.then(function(response) {
parent.searchResults = [];
- response.data.forEach(function(result) {
- parent.searchResults.push(
- new SearchResult(
- result.title,
- result.lastModified,
- result.titleHighlights,
- result.contentHighlights
- )
- );
- });
+ if (response.data.length == 0) {
+ parent.searchFailedIcon = "search";
+ parent.searchFailedMessage = "No Results";
+ parent.searchFailed = true;
+ } else {
+ response.data.forEach(function(result) {
+ parent.searchResults.push(
+ new SearchResult(
+ result.title,
+ result.lastModified,
+ result.titleHighlights,
+ result.contentHighlights
+ )
+ );
+ });
+ }
})
.catch(function(error) {
if (!error.handled) {
<template>
- <div class="container d-flex flex-column align-items-center h-100">
+ <div class="container d-flex flex-column h-100">
<!-- Search Modal -->
<b-modal id="search-modal" centered hide-footer hide-header>
<div class="d-flex flex-column align-items-center">
></NavBar>
<!-- Login -->
- <Login v-if="currentView == views.login"></Login>
+ <Login v-if="currentView == views.login" class="flex-grow-1"></Login>
<!-- Home -->
<div
v-if="currentView == views.home"
class="
home-view
+ align-self-center
d-flex
flex-column
justify-content-center
</div>
<!-- Search Results -->
- <div v-if="currentView == views.search" class="w-100 pt-5">
+ <div v-if="currentView == views.search" class="w-100 pt-5 flex-grow-1">
<!-- Searching -->
- <div v-if="searchResults == null">
- <loading-indicator
- loading-message="Searching..."
- failure-message="Search failed 😞"
+ <div
+ v-if="searchResults == null || searchResults.length == 0"
+ class="h-100 d-flex flex-column justify-content-center"
+ >
+ <LoadingIndicator
:failed="searchFailed"
+ :failedBootstrapIcon="searchFailedIcon"
+ :failedMessage="searchFailedMessage"
/>
</div>
- <!-- No Results -->
- <div v-else-if="searchResults.length == 0">
- <p class="text-center">No Results</p>
- </div>
-
<!-- Search Results Loaded -->
<div v-else>
<div v-for="result in searchResults" :key="result.title" class="mb-5">
<template>
<div>
- <p v-if="!failed" class="text-center">{{ loadingMessage }}</p>
- <p v-else class="text-center">{{ failureMessage }}</p>
+ <div v-if="showLoader && !failed" class="loader"></div>
+ <div v-else-if="failed" class="d-flex flex-column align-items-center">
+ <b-icon class="failed-icon mb-3" :icon="failedBootstrapIcon"></b-icon>
+ <p>{{ failedMessage }}</p>
+ </div>
</div>
</template>
+<style lang="scss" scoped>
+@import "../colours";
+
+.failed-icon {
+ color: $logo-key-colour;
+ font-size: 60px;
+}
+
+.loader,
+.loader:before,
+.loader:after {
+ background: $logo-key-colour;
+ -webkit-animation: load1 1s infinite ease-in-out;
+ animation: load1 1s infinite ease-in-out;
+ width: 1em;
+ height: 4em;
+}
+.loader {
+ color: $logo-key-colour;
+ text-indent: -9999em;
+ margin: 33% auto;
+ position: relative;
+ font-size: 11px;
+ -webkit-transform: translateZ(0);
+ -ms-transform: translateZ(0);
+ transform: translateZ(0);
+ -webkit-animation-delay: -0.16s;
+ animation-delay: -0.16s;
+}
+.loader:before,
+.loader:after {
+ position: absolute;
+ top: 0;
+ content: "";
+}
+.loader:before {
+ left: -1.5em;
+ -webkit-animation-delay: -0.32s;
+ animation-delay: -0.32s;
+}
+.loader:after {
+ left: 1.5em;
+}
+@-webkit-keyframes load1 {
+ 0%,
+ 80%,
+ 100% {
+ box-shadow: 0 0;
+ height: 4em;
+ }
+ 40% {
+ box-shadow: 0 -2em;
+ height: 5em;
+ }
+}
+@keyframes load1 {
+ 0%,
+ 80%,
+ 100% {
+ box-shadow: 0 0;
+ height: 4em;
+ }
+ 40% {
+ box-shadow: 0 -2em;
+ height: 5em;
+ }
+}
+</style>
+
<script>
export default {
props: {
- loadingMessage: { type: String, default: "Loading..." },
- failureMessage: { type: String, default: "Loading failed 😞" },
- failed: Boolean,
+ showLoader: { type: Boolean, default: true },
+ failed: { type: Boolean },
+ failedBootstrapIcon: { type: String, default: "cloud-slash" },
+ failedMessage: { type: String, default: "Loading Failed" },
},
};
</script>
flex-column
justify-content-center
align-items-center
- flex-grow-1
"
>
<!-- Logo -->
<template>
<!-- Note -->
- <div class="w-100">
+ <div class="w-100 h-100">
<!-- Loading -->
- <div v-if="currentNote == null">
- <loading-indicator
- v-if="currentNote == null"
- :failure-message="noteLoadFailedMessage"
+ <div
+ v-if="currentNote == null"
+ class="h-100 d-flex flex-column justify-content-center"
+ >
+ <LoadingIndicator
:failed="noteLoadFailed"
+ :failedBootstrapIcon="noteLoadFailedIcon"
+ :failedMessage="noteLoadFailedMessage"
/>
</div>
titleInput: null,
initialContent: null,
noteLoadFailed: false,
- noteLoadFailedMessage: "Loading failed 😞",
+ noteLoadFailedIcon: null,
+ noteLoadFailedMessage: "Failed to load Note",
viewerOptions: { plugins: [codeSyntaxHighlight] },
editorOptions: { plugins: [codeSyntaxHighlight] },
};
typeof error.response !== "undefined" &&
error.response.status == 404
) {
- parent.noteLoadFailedMessage = "Note not found 😞";
+ parent.noteLoadFailedIcon = "file-earmark-x";
+ parent.noteLoadFailedMessage = "Note not found";
parent.noteLoadFailed = true;
} else {
EventBus.$emit("unhandledServerError");
<template>
<div>
<!-- Loading -->
- <div v-if="notes == null">
- <LoadingIndicator loadingMessage="" :failed="loadingFailed" />
+ <div v-if="notes == null" class="h-100 d-flex flex-column justify-content-center">
+ <LoadingIndicator
+ :showLoader="false"
+ :failed="loadingFailed"
+ failedMessage="Failed to load Recently Modified"
+ />
</div>
<!-- Notes Loaded -->
// Search Result Data
searchFailed: false,
+ searchFailedMessage: "Failed to load Search Results",
+ searchFailedIcon: null,
searchTerm: null,
searchResults: null,
};