projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dd10eb9
)
UserBio: a few fixes, but still doesn't work as expected
author
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 1 May 2020 23:17:43 +0000
(
01:17
+0200)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Fri, 1 May 2020 23:17:43 +0000
(
01:17
+0200)
client/src/components/UserBio.vue
patch
|
blob
|
blame
|
history
client/src/views/Game.vue
patch
|
blob
|
blame
|
history
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
server/models/User.js
patch
|
blob
|
blame
|
history
server/routes/users.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/components/UserBio.vue
b/client/src/components/UserBio.vue
index
c954f3d
..
181c7df
100644
(file)
--- a/
client/src/components/UserBio.vue
+++ b/
client/src/components/UserBio.vue
@@
-6,11
+6,10
@@
div
data-checkbox="modalBio"
)
.card
data-checkbox="modalBio"
)
.card
- div(v-if="st.user.id
==
id")
+ div(v-if="st.user.id
> 0 && st.user.id == u
id")
h3.section(@click="modeEdit = !modeEdit") Click to edit
textarea(
h3.section(@click="modeEdit = !modeEdit") Click to edit
textarea(
- v-if="userBio !== undefined"
- v-show="modeEdit"
+ v-if="userBio !== undefined && modeEdit"
v-model="userBio"
)
button#submitBtn(@click="sendBio()") Submit
v-model="userBio"
)
button#submitBtn(@click="sendBio()") Submit
@@
-20,7
+19,11
@@
div
@click="modeEdit = !modeEdit"
)
#dialog.text-center {{ st.tr[infoMsg] }}
@click="modeEdit = !modeEdit"
)
#dialog.text-center {{ st.tr[infoMsg] }}
- span.clickable(@click="showBio()") {{ name }}
+ span(
+ :class="{ clickable: !!uname }"
+ @click="showBio()"
+ )
+ | {{ uname || "@nonymous" }}
</template>
<script>
</template>
<script>
@@
-29,7
+32,7
@@
import { ajax } from "@/utils/ajax";
import { processModalClick } from "@/utils/modalClick.js";
export default {
name: "my-user-bio",
import { processModalClick } from "@/utils/modalClick.js";
export default {
name: "my-user-bio",
- props: ["
id", "
name"],
+ props: ["
uid", "u
name"],
data: function() {
return {
st: store.state,
data: function() {
return {
st: store.state,
@@
-44,6
+47,9
@@
export default {
},
methods: {
showBio: function() {
},
methods: {
showBio: function() {
+ if (!this.uname)
+ // Anonymous users have no bio:
+ return;
this.infoMsg = "";
document.getElementById("modalBio").checked = true;
if (this.userBio === undefined) {
this.infoMsg = "";
document.getElementById("modalBio").checked = true;
if (this.userBio === undefined) {
@@
-51,7
+57,7
@@
export default {
"/userbio",
"GET",
{
"/userbio",
"GET",
{
- data: { id: this.id },
+ data: { id: this.
u
id },
success: (res) => {
this.userBio = res.bio;
}
success: (res) => {
this.userBio = res.bio;
}
@@
-77,7
+83,7
@@
export default {
<style lang="sass" scoped>
[type="checkbox"].modal+div .card
<style lang="sass" scoped>
[type="checkbox"].modal+div .card
- max-width:
768
px
+ max-width:
570
px
max-height: 100%
#submitBtn
max-height: 100%
#submitBtn
diff --git
a/client/src/views/Game.vue
b/client/src/views/Game.vue
index
ffb7564
..
171dc6c
100644
(file)
--- a/
client/src/views/Game.vue
+++ b/
client/src/views/Game.vue
@@
-120,8
+120,11
@@
main
img(src="/images/icons/rematch.svg")
#playersInfo
div(v-if="isLargeScreen()")
img(src="/images/icons/rematch.svg")
#playersInfo
div(v-if="isLargeScreen()")
- span.name(:class="{connected: isConnected(0)}")
- | {{ game.players[0].name || "@nonymous" }}
+ UserBio.user-bio(
+ :class="{connected: isConnected(0)}"
+ :uid="game.players[0].id"
+ :uname="game.players[0].name"
+ )
span.time(
v-if="game.score=='*'"
:class="{yourturn: !!vr && vr.turn == 'w'}"
span.time(
v-if="game.score=='*'"
:class="{yourturn: !!vr && vr.turn == 'w'}"
@@
-131,8
+134,11
@@
main
span.time-right(v-if="!!virtualClocks[0][1]")
| {{ virtualClocks[0][1] }}
span.split-names -
span.time-right(v-if="!!virtualClocks[0][1]")
| {{ virtualClocks[0][1] }}
span.split-names -
- span.name(:class="{connected: isConnected(1)}")
- | {{ game.players[1].name || "@nonymous" }}
+ UserBio.user-bio(
+ :class="{connected: isConnected(1)}"
+ :uid="game.players[1].id"
+ :uname="game.players[1].name"
+ )
span.time(
v-if="game.score=='*'"
:class="{yourturn: !!vr && vr.turn == 'b'}"
span.time(
v-if="game.score=='*'"
:class="{yourturn: !!vr && vr.turn == 'b'}"
@@
-142,11
+148,17
@@
main
span.time-right(v-if="!!virtualClocks[1][1]")
| {{ virtualClocks[1][1] }}
div(v-else)
span.time-right(v-if="!!virtualClocks[1][1]")
| {{ virtualClocks[1][1] }}
div(v-else)
- span.name(:class="{connected: isConnected(0)}")
- | {{ game.players[0].name || "@nonymous" }}
+ UserBio.user-bio(
+ :class="{connected: isConnected(0)}"
+ :uid="game.players[0].id"
+ :uname="game.players[0].name"
+ )
span.split-names -
span.split-names -
- span.name(:class="{connected: isConnected(1)}")
- | {{ game.players[1].name || "@nonymous" }}
+ UserBio.user-bio(
+ :class="{connected: isConnected(1)}"
+ :uid="game.players[1].id"
+ :uname="game.players[1].name"
+ )
div(v-if="game.score=='*'")
span.time(:class="{yourturn: !!vr && vr.turn == 'w'}")
span.time-left {{ virtualClocks[0][0] }}
div(v-if="game.score=='*'")
span.time(:class="{yourturn: !!vr && vr.turn == 'w'}")
span.time-left {{ virtualClocks[0][0] }}
@@
-168,6
+180,7
@@
main
<script>
import BaseGame from "@/components/BaseGame.vue";
<script>
import BaseGame from "@/components/BaseGame.vue";
+import UserBio from "@/components/UserBio.vue";
import Chat from "@/components/Chat.vue";
import { store } from "@/store";
import { GameStorage } from "@/utils/gameStorage";
import Chat from "@/components/Chat.vue";
import { store } from "@/store";
import { GameStorage } from "@/utils/gameStorage";
@@
-188,7
+201,8
@@
export default {
name: "my-game",
components: {
BaseGame,
name: "my-game",
components: {
BaseGame,
- Chat
+ Chat,
+ UserBio
},
data: function() {
return {
},
data: function() {
return {
@@
-1678,6
+1692,13
@@
button
#aboveBoard
text-align: center
#aboveBoard
text-align: center
+.user-bio
+ display: inline
+ font-size: 1.5rem
+ @media screen and (max-width: 767px)
+ font-size: 1.2rem
+ padding: 0 3px
+
.variant-cadence
padding-right: 10px
.variant-cadence
padding-right: 10px
@@
-1697,12
+1718,6
@@
span.separator
padding: 0
width: 10px
padding: 0
width: 10px
-span.name
- font-size: 1.5rem
- @media screen and (max-width: 767px)
- font-size: 1.2rem
- padding: 0 3px
-
span.time
font-size: 2rem
@media screen and (max-width: 767px)
span.time
font-size: 2rem
@media screen and (max-width: 767px)
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
48af22e
..
a98b4c0
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-113,7
+113,7
@@
main
v-for="sid in Object.keys(people)"
v-if="!!people[sid].name"
)
v-for="sid in Object.keys(people)"
v-if="!!people[sid].name"
)
- UserBio
(:id="people[sid].id" :
name="people[sid].name")
+ UserBio
.user-bio(:uid="people[sid].id" :u
name="people[sid].name")
button.player-action(
v-if="isGamer(sid)"
@click="watchGame(sid)"
button.player-action(
v-if="isGamer(sid)"
@click="watchGame(sid)"
@@
-1402,6
+1402,9
@@
button.refuseBtn
#div2, #div3
margin-top: 0
#div2, #div3
margin-top: 0
+.user-bio
+ display: inline
+
tr > td
&.random-0
background-color: #FF5733
tr > td
&.random-0
background-color: #FF5733
diff --git
a/server/models/User.js
b/server/models/User.js
index
8a97d57
..
37df4e6
100644
(file)
--- a/
server/models/User.js
+++ b/
server/models/User.js
@@
-58,7
+58,7
@@
const UserModel = {
});
},
});
},
- getBio: function(id) {
+ getBio: function(id
, cb
) {
db.serialize(function() {
const query =
"SELECT bio " +
db.serialize(function() {
const query =
"SELECT bio " +
diff --git
a/server/routes/users.js
b/server/routes/users.js
index
a9adc16
..
d637e13
100644
(file)
--- a/
server/routes/users.js
+++ b/
server/routes/users.js
@@
-32,7
+32,8
@@
router.post('/register', access.unlogged, access.ajax, (req,res) => {
? "User name or email already in use"
: "User creation failed. Try again";
res.json({errmsg: msg});
? "User name or email already in use"
: "User creation failed. Try again";
res.json({errmsg: msg});
- } else {
+ }
+ else {
const user = {
id: ret.id,
name: name,
const user = {
id: ret.id,
name: name,