aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreal <eal@waifu.club>2017-09-10 20:46:42 +0300
committereal <eal@waifu.club>2017-09-10 20:46:42 +0300
commit5e6ffc0e45abba5e7519457b21bd63ae9ba008f8 (patch)
tree0932e9de7055c34cb82fa949759516c9dd265ace
parent9c7eb1de3c58b3ddc78548f814f7130d7d9aa99c (diff)
Make user finder more pleasant.
-rw-r--r--src/components/user_finder/user_finder.js12
-rw-r--r--src/components/user_finder/user_finder.vue20
-rw-r--r--static/font/css/animation.css7
3 files changed, 35 insertions, 4 deletions
diff --git a/src/components/user_finder/user_finder.js b/src/components/user_finder/user_finder.js
index 03205382..abd40d51 100644
--- a/src/components/user_finder/user_finder.js
+++ b/src/components/user_finder/user_finder.js
@@ -1,20 +1,30 @@
const UserFinder = {
data: () => ({
username: undefined,
- hidden: true
+ hidden: true,
+ error: false,
+ loading: false
}),
methods: {
findUser (username) {
+ this.loading = true
this.$store.state.api.backendInteractor.externalProfile(username)
.then((user) => {
+ this.loading = false
+ this.hidden = true
if (!user.error) {
this.$store.commit('addNewUsers', [user])
this.$router.push({name: 'user-profile', params: {id: user.id}})
+ } else {
+ this.error = true
}
})
},
toggleHidden () {
this.hidden = !this.hidden
+ },
+ dismissError () {
+ this.error = false
}
}
}
diff --git a/src/components/user_finder/user_finder.vue b/src/components/user_finder/user_finder.vue
index c23d8ee0..2ca476fa 100644
--- a/src/components/user_finder/user_finder.vue
+++ b/src/components/user_finder/user_finder.vue
@@ -1,8 +1,15 @@
<template>
- <a href="#" v-if="hidden"><i class="icon-user-plus user-finder-icon" @click.prevent="toggleHidden"/></a>
- <span v-else>
- <input class="user-finder-input base03-border" @keyup.enter="findUser(username)" v-model="username" placeholder="Find user" id="user-finder-input" type="text"/>
+ <span>
+ <span class="finder-error base05" v-if="error">
+ <i class="icon-cancel user-finder-icon" @click="dismissError"/>
+ Error fetching user
+ </span>
+ <i class="icon-spin4 user-finder-icon animate-spin-slow" v-if="loading" />
+ <a href="#" v-if="hidden"><i class="icon-user-plus user-finder-icon" @click.prevent="toggleHidden"/></a>
+ <span v-else>
+ <input class="user-finder-input base03-border" @keyup.enter="findUser(username)" v-model="username" placeholder="Find user" id="user-finder-input" type="text"/>
<i class="icon-cancel user-finder-icon" @click="toggleHidden"/>
+ </span>
</span>
</template>
@@ -20,4 +27,11 @@
border-radius: 5px;
padding: 0.1em 0.2em 0.2em 0.2em;
}
+
+ .finder-error {
+ background-color: rgba(255, 48, 16, 0.65);
+ margin: 0.35em;
+ border-radius: 5px;
+ padding: 0.25em;
+ }
</style>
diff --git a/static/font/css/animation.css b/static/font/css/animation.css
index ac5a9562..c8cfc252 100644
--- a/static/font/css/animation.css
+++ b/static/font/css/animation.css
@@ -8,6 +8,13 @@
animation: spin 2s infinite linear;
display: inline-block;
}
+.animate-spin-slow {
+ -moz-animation: spin 4s infinite linear;
+ -o-animation: spin 4s infinite linear;
+ -webkit-animation: spin 4s infinite linear;
+ animation: spin 4s infinite linear;
+ display: inline-block;
+}
@-moz-keyframes spin {
0% {
-moz-transform: rotate(0deg);