Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Menteur
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
Menteur
Commits
4463aee3
Unverified
Commit
4463aee3
authored
5 years ago
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: Solve warnings
parent
610dac15
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
61 deletions
+83
-61
App.vue
client/src/App.vue
+39
-35
Card.vue
client/src/components/Card.vue
+35
-18
Hand.vue
client/src/components/Hand.vue
+9
-8
No files found.
client/src/App.vue
View file @
4463aee3
<
template
>
<
template
>
<div
id=
"app"
>
<div
id=
"app"
>
<h2
id=
"header"
>
Salut
{{
name
}}
!
</h2>
<h2
id=
"header"
>
Salut
{{
name
}}
!
</h2>
<Sockets
/>
<Sockets
/>
<div
id=
"game"
>
<div
id=
"game"
>
<Hand
:cards=
"mockCards()"
/>
<Hand
:cards=
"mockCards()"
/>
<label
for=
"messages"
>
Choose a message:
</label>
<label
for=
"messages"
>
Choose a message:
</label>
<select
v-model=
"message"
name=
"message"
id=
"messages"
>
<select
v-model=
"message"
name=
"message"
id=
"messages"
>
<option
value=
"WAITING"
>
J'attends
</option>
<option
value=
"WAITING"
>
J'attends
</option>
...
@@ -17,75 +17,79 @@
...
@@ -17,75 +17,79 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
Vue
from
"vue"
;
import
"es6-promise/auto"
;
// Needed for Promise polyfill
import
VueSocketIO
from
"vue-socket.io"
;
import
Vuex
,
{
mapGetters
,
mapMutations
}
from
"vuex"
;
import
Hand
from
"./components/Hand"
;
import
Sockets
from
"./Sockets"
;
import
{
store
}
from
"./vuex-store"
;
import
{
BootstrapVue
,
IconsPlugin
}
from
"bootstrap-vue"
;
import
"bootstrap/dist/css/bootstrap.css"
;
import
"bootstrap-vue/dist/bootstrap-vue.css"
;
import
Vue
from
'vue'
Vue
.
use
(
Vuex
);
import
'es6-promise/auto'
// Needed for Promise polyfill
Vue
.
use
(
BootstrapVue
);
import
VueSocketIO
from
'vue-socket.io'
Vue
.
use
(
IconsPlugin
);
import
Vuex
,
{
mapGetters
,
mapMutations
}
from
'vuex'
;
import
Hand
from
"./components/Hand"
;
import
Sockets
from
"./Sockets"
;
import
{
store
}
from
'./vuex-store'
Vue
.
use
(
Vuex
);
Vue
.
use
(
new
VueSocketIO
({
Vue
.
use
(
new
VueSocketIO
({
debug
:
true
,
debug
:
true
,
connection
:
'http://localhost:9042'
,
connection
:
"http://localhost:9042"
,
vuex
:
{
vuex
:
{
store
,
store
,
actionPrefix
:
'SOCKET_'
,
actionPrefix
:
"SOCKET_"
,
mutationPrefix
:
'SOCKET_'
mutationPrefix
:
"SOCKET_"
},
},
options
:
{
path
:
"/socket.io/"
}
//Optional options
options
:
{
path
:
"/socket.io/"
}
//Optional options
}));
})
);
export
default
{
export
default
{
name
:
"App"
,
name
:
"App"
,
store
:
store
,
store
:
store
,
components
:
{
components
:
{
Sockets
,
Sockets
,
Hand
Hand
},
},
data
:
function
()
{
data
:
function
()
{
return
{
return
{
message
:
"WAITING"
message
:
"WAITING"
}
};
},
},
computed
:
{
computed
:
{
...
mapGetters
([
'isConnected'
,
'name'
,
'socketMessage'
])
...
mapGetters
([
"isConnected"
,
"name"
,
"socketMessage"
])
},
},
methods
:
{
methods
:
{
sendMessage
:
function
(
message
)
{
sendMessage
:
function
(
message
)
{
console
.
log
(
"User wants to send"
,
message
);
console
.
log
(
"User wants to send"
,
message
);
this
.
$socket
.
emit
(
"message"
,
message
);
this
.
$socket
.
emit
(
"message"
,
message
);
},
},
mockCards
()
{
mockCards
()
{
return
[
return
[
{
"value"
:
"ace"
,
"color"
:
"hearts"
},
{
value
:
"ace"
,
color
:
"hearts"
},
{
"value"
:
"ace"
,
"color"
:
"clubs"
},
{
value
:
"ace"
,
color
:
"clubs"
},
{
"value"
:
"ace"
,
"color"
:
"diamonds"
},
{
value
:
"ace"
,
color
:
"diamonds"
},
{
"value"
:
"ace"
,
"color"
:
"spades"
}
{
value
:
"ace"
,
color
:
"spades"
}
];
];
},
},
...
mapMutations
([
'setName'
]),
...
mapMutations
([
"setName"
])
// ...mapActions(['setNumberToRemoteValue']),
// ...mapActions(['setNumberToRemoteValue']),
}
}
};
};
</
script
>
</
script
>
<
style
>
<
style
>
#app
{
#app
{
font-family
:
Avenir
,
Helvetica
,
Arial
,
sans-serif
;
font-family
:
Avenir
,
Helvetica
,
Arial
,
sans-serif
;
-webkit-font-smoothing
:
antialiased
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
;
-moz-osx-font-smoothing
:
grayscale
;
text-align
:
center
;
text-align
:
center
;
color
:
#2c3e50
;
color
:
#2c3e50
;
margin-top
:
60px
;
margin-top
:
60px
;
}
}
#game
{
#game
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
</
style
>
</
style
>
This diff is collapsed.
Click to expand it.
client/src/components/Card.vue
View file @
4463aee3
<
template
>
<
template
>
<div
class=
"card"
>
<div
class=
"card"
>
<img
class=
"card-pic"
v-bind:src=
"imageSrc()"
>
<div>
<b-card
title=
"Card Title"
img-src=
"https://picsum.photos/600/300/?image=25"
img-alt=
"Image"
img-top
tag=
"article"
style=
"max-width: 20rem;"
class=
"mb-2"
>
<b-card-text>
Some quick example text to build on the card title and make up the
bulk of the card's content.
</b-card-text>
<b-button
href=
"#"
variant=
"primary"
>
Go somewhere
</b-button>
</b-card>
</div>
<img
class=
"card-pic"
v-bind:src=
"imageSrc()"
/>
<p>
{{
text
()
}}
</p>
<p>
{{
text
()
}}
</p>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
name
:
"Card"
,
name
:
"Card"
,
props
:
{
props
:
{
value
:
String
,
value
:
String
,
color
:
String
,
color
:
String
},
},
methods
:
{
methods
:
{
imageSrc
()
{
imageSrc
()
{
return
`/img/
${
this
.
value
}
_of_
${
this
.
color
}
.png`
return
`/img/
${
this
.
value
}
_of_
${
this
.
color
}
.png`
;
},
},
text
:
function
()
{
text
:
function
()
{
console
.
log
(
"Generating text for"
,
this
);
// Translate
// Translate
let
valueText
=
{
let
valueText
=
{
"2"
:
"Deux"
,
"2"
:
"Deux"
,
...
@@ -28,28 +45,28 @@
...
@@ -28,28 +45,28 @@
"8"
:
"Huit"
,
"8"
:
"Huit"
,
"9"
:
"Neuf"
,
"9"
:
"Neuf"
,
"10"
:
"Dix"
,
"10"
:
"Dix"
,
"jack"
:
"Valet"
,
jack
:
"Valet"
,
"queen"
:
"Dame"
,
queen
:
"Dame"
,
"king"
:
"Roi"
,
king
:
"Roi"
,
"ace"
:
"As"
ace
:
"As"
}[
this
.
value
];
}[
this
.
value
];
let
colorText
=
{
let
colorText
=
{
"hearts"
:
"Coeur"
,
hearts
:
"Coeur"
,
"spades"
:
"Pique"
,
spades
:
"Pique"
,
"clubs"
:
"Trèfle"
,
clubs
:
"Trèfle"
,
"diamonds"
:
"Carreau"
diamonds
:
"Carreau"
}[
this
.
color
];
}[
this
.
color
];
// Capitalize
// Capitalize
valueText
=
valueText
.
charAt
(
0
).
toUpperCase
()
+
valueText
.
slice
(
1
);
valueText
=
valueText
.
charAt
(
0
).
toUpperCase
()
+
valueText
.
slice
(
1
);
colorText
=
colorText
.
charAt
(
0
).
toUpperCase
()
+
colorText
.
slice
(
1
);
colorText
=
colorText
.
charAt
(
0
).
toUpperCase
()
+
colorText
.
slice
(
1
);
return
`
${
valueText
}
de
${
colorText
}
`
return
`
${
valueText
}
de
${
colorText
}
`
;
}
}
}
}
}
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.card-pic
{
.card-pic
{
max-width
:
150px
;
max-width
:
150px
;
}
}
</
style
>
</
style
>
This diff is collapsed.
Click to expand it.
client/src/components/Hand.vue
View file @
4463aee3
<
template
>
<
template
>
<div
id=
"hand"
>
<div
id=
"hand"
>
<p>
{{
count
()
}}
cartes.
</p>
<p>
{{
count
()
}}
cartes.
</p>
<Card
v-for=
"card in cards"
<Card
v-for=
"card in cards"
v-bind:key=
"card.value + ' ' + card.color"
v-bind:key=
"card.value + ' ' + card.color"
v-bind:value=
"card.value"
v-bind:value=
"card.value"
v-bind:color=
"card.color"
v-bind:color=
"card.color"
...
@@ -9,25 +10,25 @@
...
@@ -9,25 +10,25 @@
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
Card
from
"./Card"
;
import
Card
from
"./Card"
;
export
default
{
export
default
{
name
:
"Hand"
,
name
:
"Hand"
,
components
:
{
components
:
{
Card
Card
},
},
props
:
{
props
:
{
cards
:
Array
,
cards
:
Array
},
},
methods
:
{
methods
:
{
count
()
{
count
()
{
return
this
.
cards
.
length
;
return
this
.
cards
.
length
;
}
}
}
}
}
};
</
script
>
</
script
>
<
style
scoped
>
<
style
scoped
>
.card-pic
{
.card-pic
{
max-width
:
100px
;
max-width
:
100px
;
}
}
</
style
>
</
style
>
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment