Skip to content

Commit 2f28824

Browse files
authored
Feature/fixs rework (#325)
* fix: change color line result * fix: service worker _redirect * refacto: update alerte * feat: update i18n * lint * event update * fix: register * old alert * fix: config pwa * fix: env dist * fix: footer * fix: tests
1 parent 6ca57cb commit 2f28824

25 files changed

Lines changed: 300 additions & 135 deletions

File tree

.env.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ VUE_APP_FIREBASE_MESSAGING_SENDER_ID=YOUR_FIREBASE_MESSAGING_SENDER_ID
99
VUE_APP_FIREBASE_APP_ID=YOUR_FIREBASE_APP_ID
1010
VUE_APP_FIREBASE_MEASUREMENT_ID=YOUR_FIREBASE_MEASUREMENT_ID
1111

12-
VUE_APP_LIST_MAPS_JSON_URL=https://maps.geoguess.games/maps.json
12+
VUE_APP_LIST_MAPS_JSON_URL=https://maps.geoguess.games/maps.json
13+
#VUE_APP_PUBLIC_PATH="/path"

netlify.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
VUE_APP_FIREBASE_MEASUREMENT_ID = "YOUR_FIREBASE_MEASUREMENT_ID"
1515

1616
[[plugins]]
17-
package = "@netlify/plugin-functions-install-core"
17+
package = "@netlify/plugin-functions-install-core"
18+
19+
[[redirects]]
20+
from = "/*"
21+
to = "/index.html"
22+
status = 200

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"@turf/helpers": "^6.1.4",
1919
"axios": "^0.21.4",
2020
"axios-cache-adapter": "^2.7.3",
21-
"core-js": "^2.6.12",
2221
"firebase": "^8.10.0",
2322
"gmap-vue": "^1.5.0",
2423
"i18n-iso-countries": "^6.8.0",

public/_redirects

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</head>
4545
<body>
4646
<noscript>
47-
<strong>We're sorry but geoguess-master doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
47+
<strong>We're sorry but GeoGuess doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
4848
</noscript>
4949
<div id="app"></div>
5050
<div role="alert" id="alert-update" class="v-alert v-sheet theme--dark elevation-3 v-alert--prominent info d-none">

src/App.vue

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,70 @@
11
<template>
22
<v-app>
33
<router-view />
4+
<v-alert
5+
v-model="updateAvailable"
6+
id="alertUpdate"
7+
dark
8+
type="info"
9+
elevation="3"
10+
prominent
11+
dismissible
12+
>
13+
<v-row align="center">
14+
<v-col class="grow">
15+
{{$t('AlertUpdate.label')}}
16+
</v-col>
17+
<v-col class="shrink">
18+
<v-btn @click="refreshApp">{{$t('AlertUpdate.btn')}}</v-btn>
19+
</v-col>
20+
</v-row>
21+
</v-alert>
422
</v-app>
523
</template>
624

725
<script>
826
export default {
927
name: 'App',
10-
data: () => ({
11-
//
12-
}),
28+
data() {
29+
return {
30+
refreshing: false,
31+
registration: null,
32+
updateAvailable: false
33+
};
34+
},
35+
created() {
36+
// Listen for our custom event from the SW registration
37+
document.addEventListener('swUpdated', this.setUpdate, { once: true });
38+
39+
navigator.serviceWorker.addEventListener('controllerchange', () => {
40+
// Prevent multiple refreshes
41+
if (this.refreshing) return;
42+
this.refreshing = true;
43+
44+
window.location.reload();
45+
});
46+
},
47+
methods:{
48+
setUpdate(event) {
49+
this.registration = event.detail;
50+
this.updateAvailable = true;
51+
},
52+
53+
refreshApp() {
54+
this.updateAvailable = false;
55+
if (!this.registration || !this.registration.waiting)
56+
return;
57+
this.registration.waiting.postMessage({ type: 'SKIP_WAITING' });
58+
},
59+
}
1360
};
1461
</script>
62+
63+
<style lang="scss" scoped>
64+
#alertUpdate{
65+
position: fixed;
66+
bottom: 2%;
67+
right: 5%;
68+
width: 90%;
69+
}
70+
</style>

src/components/Maps.vue

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -100,37 +100,23 @@
100100
v-if="!printMapFull"
101101
ref="refNotepad"
102102
/>
103-
<div class="container-map_controls_guess">
104-
<button
105-
v-if="
106-
!isNextButtonVisible &&
107-
!isSummaryButtonVisible &&
108-
($viewport.width > 450 || isMakeGuessButtonClicked)
109-
"
110-
id="reset-button"
111-
:disabled="isGuessButtonClicked || (!!this.room && !isReady)"
112-
@click="resetLocation"
113-
>
114-
{{ $t('Maps.reset') }}
115-
</button>
116-
<button
117-
v-if="
118-
!isNextButtonVisible &&
119-
!isSummaryButtonVisible &&
120-
($viewport.width > 450 || isMakeGuessButtonClicked)
121-
"
122-
id="guess-button"
123-
:disabled="
124-
randomLatLng == null ||
125-
selectedPos == null ||
126-
isGuessButtonClicked ||
127-
(!!this.room && !isReady)
128-
"
129-
@click="selectLocation"
130-
>
131-
{{ $t('Maps.guess') }}
132-
</button>
133-
</div>
103+
<button
104+
v-if="
105+
!isNextButtonVisible &&
106+
!isSummaryButtonVisible &&
107+
($viewport.width > 450 || isMakeGuessButtonClicked)
108+
"
109+
id="guess-button"
110+
:disabled="
111+
randomLatLng == null ||
112+
selectedPos == null ||
113+
isGuessButtonClicked ||
114+
(!!this.room && !isReady)
115+
"
116+
@click="selectLocation"
117+
>
118+
{{ $t('Maps.guess') }}
119+
</button>
134120
<button
135121
v-if="isNextButtonVisible"
136122
id="next-button"
@@ -688,7 +674,8 @@ export default {
688674
#reset-button,
689675
#play-again-button {
690676
border: none;
691-
border-radius: 5px;
677+
border-bottom-right-radius: 5px;
678+
border-bottom-left-radius: 5px;
692679
opacity: 0.8;
693680
color: white;
694681
font-size: 16px;
@@ -698,10 +685,6 @@ export default {
698685
z-index: 999;
699686
}
700687
701-
#make-guess-button,
702-
#guess-button {
703-
width: 75%;
704-
}
705688
706689
#reset-button {
707690
overflow: hidden;
@@ -798,13 +781,7 @@ button.w-50 {
798781
bottom: 0;
799782
width: 100%;
800783
}
801-
#guess-button {
802-
width: 75%;
803-
}
804784
805-
#reset-button {
806-
width: 25%;
807-
}
808785
809786
#hide-map-button {
810787
position: absolute;

src/components/dialogroom/card/CardRoomSettings.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,15 @@
144144
/>
145145

146146
<v-autocomplete
147+
v-if="optionsArea.length > 0"
147148
:label="$t('CardRoomSettings.selectAreas')"
148149
:value="gameSettings.areaParams"
150+
:items="optionsArea"
149151
@input="
150152
(areaParams) =>
151153
setGameSettings({ areaParams })
152154
"
153-
:items="optionsArea"
154-
></v-autocomplete>
155+
/>
155156
</v-list-group>
156157
</div>
157158
<div>

src/components/history/gameResult/HistoryMapArea.vue

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858

5959
<script>
6060
import FlagIcon from '@/components/shared/FlagIcon';
61+
import { STROKE_COLORS } from '../../../constants';
6162
export default {
6263
name: 'HistoryMapArea',
6364
components: {
@@ -66,14 +67,7 @@ export default {
6667
props: ['item', 'isCountry'],
6768
data() {
6869
return {
69-
strokeColors: [
70-
'#F44336',
71-
'#76FF03',
72-
'#FFEB3B',
73-
'#FF4081',
74-
'#18FFFF',
75-
'#18FFFF',
76-
],
70+
strokeColors: STROKE_COLORS,
7771
};
7872
},
7973
};

0 commit comments

Comments
 (0)