mirror of
https://github.com/LucasVbr/own-workspace.git
synced 2026-05-13 17:21:58 +00:00
Merge pull request #7 from LucasVbr/master
Add 50 Lo-fi musics and translate #btn-newword
This commit is contained in:
+48
-28
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div id="btn-newword">
|
||||
<button @click="getNewWordEveryday" id="fetch" class="btn">
|
||||
Générer un mot
|
||||
Generate a word
|
||||
</button>
|
||||
</div>
|
||||
<hr>
|
||||
@@ -30,9 +30,9 @@
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
Total todo: {{this.nbItemsFinished}}
|
||||
Total todo: {{ this.nbItemsFinished }}
|
||||
<br>
|
||||
Total sessions: {{this.$store.getters.nbSessions}}
|
||||
Total sessions: {{ this.$store.getters.nbSessions }}
|
||||
<div class="center">
|
||||
<button class="btn" id="see-words" @click="displayWord = true">
|
||||
English word
|
||||
@@ -46,17 +46,17 @@
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "Stats",
|
||||
name: 'Stats',
|
||||
data() {
|
||||
return {
|
||||
date: "",
|
||||
time: "",
|
||||
date: '',
|
||||
time: '',
|
||||
word: {
|
||||
word: "",
|
||||
definition: "",
|
||||
word: '',
|
||||
definition: '',
|
||||
},
|
||||
displayWord: true,
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
generateDateOfTheDay() {
|
||||
@@ -69,9 +69,28 @@ export default {
|
||||
}, 1000);
|
||||
},
|
||||
prettyPrintDate(date, day, month) {
|
||||
const days = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"];
|
||||
const days = [
|
||||
'Dimanche',
|
||||
'Lundi',
|
||||
'Mardi',
|
||||
'Mercredi',
|
||||
'Jeudi',
|
||||
'Vendredi',
|
||||
'Samedi'];
|
||||
const dayOfTheWeek = days[date.getDay()];
|
||||
const months = ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"];
|
||||
const months = [
|
||||
'janvier',
|
||||
'février',
|
||||
'mars',
|
||||
'avril',
|
||||
'mai',
|
||||
'juin',
|
||||
'juillet',
|
||||
'août',
|
||||
'septembre',
|
||||
'octobre',
|
||||
'novembre',
|
||||
'décembre'];
|
||||
return `${dayOfTheWeek}, ${day} ${months[month - 1]}`;
|
||||
},
|
||||
getCurrentTime() {
|
||||
@@ -84,28 +103,28 @@ export default {
|
||||
}, 1000);
|
||||
},
|
||||
prettyPrintTime(hours, minutes) {
|
||||
return `${hours < 10 ? "0" + hours : hours}:${minutes < 10 ? "0" + minutes : minutes}`;
|
||||
return `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ?
|
||||
'0' + minutes :
|
||||
minutes}`;
|
||||
},
|
||||
getNewWordEveryday() {
|
||||
document.getElementById("fetch").disabled = true;
|
||||
document.getElementById('fetch').disabled = true;
|
||||
// fetch a new english word everyday
|
||||
fetch("https://random-word-api.herokuapp.com/word?number=1")
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
fetch('https://random-word-api.herokuapp.com/word?number=1').
|
||||
then(response => response.json()).
|
||||
then(data => {
|
||||
// uppercase first letter of data[0]
|
||||
const word = data[0];
|
||||
this.getDefinition(word);
|
||||
})
|
||||
});
|
||||
},
|
||||
getDefinition(word) {
|
||||
const url = 'https://api.dictionaryapi.dev/api/v2/entries/en/' + word;
|
||||
return fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
return fetch(url).then(response => response.json()).then(data => {
|
||||
if (data.length > 0) {
|
||||
document.getElementById("fetch").disabled = false;
|
||||
document.getElementById('fetch').disabled = false;
|
||||
const wordUppercased = word.charAt(0).toUpperCase() + word.slice(1);
|
||||
this.word.word = wordUppercased + " : ";
|
||||
this.word.word = wordUppercased + ' : ';
|
||||
this.word.definition = data[0].meanings[0].definitions[0].definition;
|
||||
} else {
|
||||
// get another word if the word is not found
|
||||
@@ -114,7 +133,7 @@ export default {
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.generateDateOfTheDay();
|
||||
@@ -130,16 +149,16 @@ export default {
|
||||
},
|
||||
colorSelected() {
|
||||
return this.$store.getters.colorSelected;
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
colorSelected: function(color) {
|
||||
if (this.displayWord) {
|
||||
document.getElementById("word").style.color = color;
|
||||
document.getElementById('word').style.color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -200,6 +219,7 @@ export default {
|
||||
#see-words {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
/* ********** */
|
||||
/* RESPONSIVE */
|
||||
/* ********** */
|
||||
|
||||
+52
-1
@@ -5,7 +5,58 @@
|
||||
"7NOSDKb0HlU",
|
||||
"-5KAN9_CzSA",
|
||||
"jfKfPfyJRdk",
|
||||
"GDQnA1LVCWA"
|
||||
|
||||
"GDQnA1LVCWA",
|
||||
"-pzxY5DtZIQ",
|
||||
"Mu3BfD6wmPg",
|
||||
"guhAfOxt5gg",
|
||||
"XoX6zS5-jOY",
|
||||
"doxeMNXYFqk",
|
||||
"kHI9hnC-pnI",
|
||||
"RY89j1qdKvo",
|
||||
"pIOZVb97dSk",
|
||||
"eEXEEuSLjEo",
|
||||
"Bksv9OEj1j8",
|
||||
"nXKDQflDgTo",
|
||||
"gl5DYoxkI20",
|
||||
"Lsr7bJk4zAY",
|
||||
"wVgj3o9k7eY",
|
||||
"YqcN2xmPngc",
|
||||
"-0o37zLDsWo",
|
||||
"0h6a07yVacY",
|
||||
"l9QSIDvbVos",
|
||||
"iH7bdQxXlJI",
|
||||
"T_QWejmgwGg",
|
||||
"yumRWK7XuR4",
|
||||
"4X_uoKF2Wvo",
|
||||
"ozS8auVro70",
|
||||
"uP2X50NrKHQ",
|
||||
"1sPZhg-30ao",
|
||||
"q4V5cvQWWeY",
|
||||
"mjoXkcdGPTM",
|
||||
"XyN-LascAL0",
|
||||
"nV8eAWmVEk4",
|
||||
"yBOv-4ndFGw",
|
||||
"XcUoDrI2BwU",
|
||||
"8NRAOg1c2l0",
|
||||
"XGn4_-ylcaI",
|
||||
"IauSZrpfgLI",
|
||||
"iunocgt3c3E",
|
||||
"J7w58QcrSDc",
|
||||
"4722D_KdAa0",
|
||||
"Fd-2C-ue0h4",
|
||||
"Yu8-JBPhNr8",
|
||||
"zEOnXL9Jo0A",
|
||||
"rRKZ9XAXDKg",
|
||||
"Vjzs4M0wAV0",
|
||||
"4uCNdTiB4Us",
|
||||
"EwREEj3UZT8",
|
||||
"uVem4rbFVrE",
|
||||
"ArqZ1dnXpYs",
|
||||
"UPMgJeYsOLo",
|
||||
"SNq9pPG-Qn0",
|
||||
"BYyPga-3g3k",
|
||||
"h2Hl1uNwDz4"
|
||||
],
|
||||
"easterEggs": [
|
||||
"VDgaKWRuhRU",
|
||||
|
||||
Reference in New Issue
Block a user