From b6b8dd7dbf713c11a42aa19411203813bcd8c88c Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sun, 13 Dec 2020 11:43:03 +0100 Subject: [PATCH 1/7] copy invite and tests --- .github/workflows/tests.yaml | 10 ++++++++++ frontend/src/i18n/en.json | 2 +- frontend/src/i18n/it.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..c683393 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,10 @@ +name: Test Pull requests +on: + pull_request: +jobs: + test_build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build the Unified Docker image + run: docker build . --file Dockerfile diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index 7527a13..5670df6 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -52,7 +52,7 @@ "pick_a_card": "FLIP A CARD", "to_defend_from": "TO DEFEND YOURSELF FROM", "submit": "Submit", - "copy": "Copy", + "copy": "Copy invite", "chat": { "chat": "Chat", "joined": "{0} joined the lobby", diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json index 2361cfe..9161c0d 100644 --- a/frontend/src/i18n/it.json +++ b/frontend/src/i18n/it.json @@ -52,7 +52,7 @@ "pick_a_card": "ESTRAI UNA CARTA", "to_defend_from": "PER DIFENDERTI DA", "submit": "Invia", - "copy": "Copia", + "copy": "Copia invito", "chat": { "chat": "Chat", "joined": "{0} è entrato nella stanza", From 08287b48180797773e6e352f6cdce2837ab1a8c7 Mon Sep 17 00:00:00 2001 From: Alberto Xamin Date: Sun, 13 Dec 2020 12:29:28 +0100 Subject: [PATCH 2/7] chat improvements --- backend/__init__.py | 9 +++++---- frontend/src/components/Chat.vue | 22 ++++++++++++++++++---- frontend/src/components/Player.vue | 15 +++++++++++---- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/backend/__init__.py b/backend/__init__.py index 2bb0999..a2e267a 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -173,13 +173,14 @@ def chat_message(sid, msg): elif '/cancelgame' in msg and ses.game.started: ses.game.reset() elif '/gameinfo' in msg: - sio.emit('chat_message', room=sid, data=f'info: {ses.game.__dict__}') + sio.emit('chat_message', room=sid, data={'color': f'#black','text':f'info: {ses.game.__dict__}'}) elif '/meinfo' in msg: - sio.emit('chat_message', room=sid, data=f'info: {ses.__dict__}') + sio.emit('chat_message', room=sid, data={'color': f'#black','text':f'info: {ses.__dict__}'}) else: - sio.emit('chat_message', room=sid, data=f'{msg} COMMAND NOT FOUND') + sio.emit('chat_message', room=sid, data={'color': f'#black','text':f'{msg} COMMAND NOT FOUND'}) else: - sio.emit('chat_message', room=ses.game.name, data=f'[{ses.name}]: {msg}') + color = sid.encode('utf-8').hex()[-3:] + sio.emit('chat_message', room=ses.game.name, data={'color': f'#{color}','text':f'[{ses.name}]: {msg}'}) @sio.event def start_game(sid): diff --git a/frontend/src/components/Chat.vue b/frontend/src/components/Chat.vue index 67c992b..967cb59 100644 --- a/frontend/src/components/Chat.vue +++ b/frontend/src/components/Chat.vue @@ -2,7 +2,7 @@

{{$t("chat.chat")}}

-

{{msg}}

+

{{msg.text}}

.

@@ -21,10 +21,11 @@ export default { }), sockets: { chat_message(msg) { - if (msg.indexOf('_') === 0) { + console.log(msg) + if ((typeof msg === "string") && msg.indexOf('_') === 0) { let params = msg.split('|') let type = params.shift().substring(1) - this.messages.push(this.$t(`chat.${type}`, params)) + this.messages.push({text:this.$t(`chat.${type}`, params)}) }else { this.messages.push(msg) } @@ -45,8 +46,8 @@ export default { \ No newline at end of file diff --git a/frontend/src/components/Player.vue b/frontend/src/components/Player.vue index 10eeeb7..fb2cb50 100644 --- a/frontend/src/components/Player.vue +++ b/frontend/src/components/Player.vue @@ -20,8 +20,8 @@

{{desc}}

-
- {{$t('hand')}} +
+ {{$t('hand')}} Date: Sun, 13 Dec 2020 15:21:07 +0100 Subject: [PATCH 3/7] ui enhancements --- frontend/src/components/Deck.vue | 6 +++++- frontend/src/components/Lobby.vue | 16 +++++++++++----- frontend/src/components/Player.vue | 2 +- frontend/src/components/TinyHand.vue | 24 +++++++++++++++++++++--- frontend/src/i18n/en.json | 1 + frontend/src/i18n/it.json | 1 + frontend/src/router/index.js | 2 +- 7 files changed, 41 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/Deck.vue b/frontend/src/components/Deck.vue index 9ce7062..649cb1a 100644 --- a/frontend/src/components/Deck.vue +++ b/frontend/src/components/Deck.vue @@ -8,7 +8,7 @@
- + @@ -93,6 +93,10 @@ export default { animation-duration: 0.8s; animation-name: slidein; } +.last-scrap:hover { + opacity: 0.8; + transform: translateY(-10px); +} @keyframes slidein { from { transform: translate(-100px, 10px) scale(1.3) rotate(-10deg); diff --git a/frontend/src/components/Lobby.vue b/frontend/src/components/Lobby.vue index 6a46426..f548abb 100644 --- a/frontend/src/components/Lobby.vue +++ b/frontend/src/components/Lobby.vue @@ -1,7 +1,10 @@