mirror of
https://github.com/LucasVbr/own-workspace.git
synced 2026-05-19 10:53:19 +00:00
@@ -106,9 +106,11 @@ button:disabled {
|
|||||||
#container {
|
#container {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
#todo-container {
|
#todo-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#right-side {
|
#right-side {
|
||||||
margin-right: 32px;
|
margin-right: 32px;
|
||||||
margin-left: 32px;
|
margin-left: 32px;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="btn-newword">
|
<div id="btn-newword">
|
||||||
<button @click="getNewWordEveryday" id="fetch" class="btn">
|
<button @click="getNewWordEveryday" id="fetch" class="btn">
|
||||||
Generate a word
|
📝 Generate a word
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
@@ -26,16 +26,22 @@
|
|||||||
<div id="stats">
|
<div id="stats">
|
||||||
<div class="center" v-if="displayWord">
|
<div class="center" v-if="displayWord">
|
||||||
<button @click="displayWord = false" class="btn">
|
<button @click="displayWord = false" class="btn">
|
||||||
Session stats
|
📊 Session stats
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
Total todo: {{ this.nbItemsFinished }}
|
Total todo: {{ this.nbItemsFinished }}
|
||||||
<br>
|
<br>
|
||||||
Total sessions: {{ this.$store.getters.nbSessions }}
|
Total sessions: {{ this.nbSessions }}
|
||||||
|
<br>
|
||||||
|
<span id="hint">(last + current session)</span>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
|
<button @click="resetStats" class="btn" id="reset-stats" :disabled="resetDone">
|
||||||
|
🔁 Reset last session
|
||||||
|
</button>
|
||||||
|
<br>
|
||||||
<button class="btn" id="see-words" @click="displayWord = true">
|
<button class="btn" id="see-words" @click="displayWord = true">
|
||||||
English word
|
🇬🇧 English word
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -56,6 +62,7 @@ export default {
|
|||||||
definition: '',
|
definition: '',
|
||||||
},
|
},
|
||||||
displayWord: true,
|
displayWord: true,
|
||||||
|
resetDone: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -134,6 +141,10 @@ export default {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
resetStats() {
|
||||||
|
this.resetDone = true;
|
||||||
|
this.$store.commit('resetStats');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.generateDateOfTheDay();
|
this.generateDateOfTheDay();
|
||||||
@@ -141,15 +152,15 @@ export default {
|
|||||||
this.getNewWordEveryday();
|
this.getNewWordEveryday();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
itemsFinished() {
|
|
||||||
return this.$store.getters.itemsFinished;
|
|
||||||
},
|
|
||||||
nbItemsFinished() {
|
nbItemsFinished() {
|
||||||
return this.$store.getters.itemsFinished.length;
|
return parseInt(this.$store.getters.globalState.nbItemsFinished) + this.$store.getters.itemsFinished.length
|
||||||
},
|
},
|
||||||
colorSelected() {
|
colorSelected() {
|
||||||
return this.$store.getters.colorSelected;
|
return this.$store.getters.colorSelected;
|
||||||
},
|
},
|
||||||
|
nbSessions() {
|
||||||
|
return parseInt(this.$store.getters.globalState.nbSessions) + this.$store.getters.nbSessions
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
colorSelected: function(color) {
|
colorSelected: function(color) {
|
||||||
@@ -216,10 +227,19 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#see-words {
|
#hint {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: lighter;
|
||||||
|
}
|
||||||
|
|
||||||
|
#reset-stats {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#see-words {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ********** */
|
/* ********** */
|
||||||
/* RESPONSIVE */
|
/* RESPONSIVE */
|
||||||
/* ********** */
|
/* ********** */
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Stats from "@/components/Infos";
|
import Stats from "@/components/Infos";
|
||||||
|
|
||||||
const MINUTES = 25;
|
const MINUTES = 25;
|
||||||
const RANGE_MINUTES = 5;
|
const RANGE_MINUTES = 5;
|
||||||
const SECONDS = 0;
|
const SECONDS = 0;
|
||||||
@@ -99,7 +100,9 @@ export default {
|
|||||||
}
|
}
|
||||||
this.disableButton("start");
|
this.disableButton("start");
|
||||||
let all = document.querySelectorAll("#presetTime button");
|
let all = document.querySelectorAll("#presetTime button");
|
||||||
for (let el of all) { el.disabled = true; }
|
for (let el of all) {
|
||||||
|
el.disabled = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
pauseSession() {
|
pauseSession() {
|
||||||
this.sessionStarted = false;
|
this.sessionStarted = false;
|
||||||
@@ -122,7 +125,9 @@ export default {
|
|||||||
this.prettyTime();
|
this.prettyTime();
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
let all = document.querySelectorAll("#presetTime button, #start");
|
let all = document.querySelectorAll("#presetTime button, #start");
|
||||||
for (let el of all) { el.disabled = false; }
|
for (let el of all) {
|
||||||
|
el.disabled = false;
|
||||||
|
}
|
||||||
this.disableButton("pause")
|
this.disableButton("pause")
|
||||||
this.unlockArrows()
|
this.unlockArrows()
|
||||||
},
|
},
|
||||||
@@ -136,6 +141,7 @@ export default {
|
|||||||
alert("SESSION TERMINÉE 👏");
|
alert("SESSION TERMINÉE 👏");
|
||||||
this.nbSessionsFinished++;
|
this.nbSessionsFinished++;
|
||||||
this.$store.commit("updateNbSessionsFinished");
|
this.$store.commit("updateNbSessionsFinished");
|
||||||
|
localStorage.setItem("nbSessions", this.$store.getters.nbSessions);
|
||||||
if (this.nbSessionsFinished === 4) {
|
if (this.nbSessionsFinished === 4) {
|
||||||
this.setupPauseTimer(LONG_PAUSE);
|
this.setupPauseTimer(LONG_PAUSE);
|
||||||
this.nbSessionsFinished = 0;
|
this.nbSessionsFinished = 0;
|
||||||
@@ -326,6 +332,7 @@ export default {
|
|||||||
margin: 12px 4px 12px 4px;
|
margin: 12px 4px 12px 4px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** */
|
/* ********** */
|
||||||
/* RESPONSIVE */
|
/* RESPONSIVE */
|
||||||
/* ********** */
|
/* ********** */
|
||||||
@@ -334,9 +341,11 @@ export default {
|
|||||||
#container {
|
#container {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#message {
|
#message {
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pomodoro {
|
.pomodoro {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
@@ -347,6 +356,7 @@ export default {
|
|||||||
#time {
|
#time {
|
||||||
font-size: 38px;
|
font-size: 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#colon {
|
#colon {
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
<div id="settings-container">
|
<div id="settings-container">
|
||||||
<div id="color-palette" class="bubble-container">
|
<div id="color-palette" class="bubble-container">
|
||||||
<div v-for="color in colors" :key="color.id">
|
<div v-for="color in colors" :key="color.id">
|
||||||
<div class="bubble-item" :style="{backgroundColor: color, borderColor: activeColor}" @click="setBackgroundColor($event, color)"></div>
|
<div class="bubble-item" :id="color" :style="{backgroundColor: color, borderColor: activeColor}"
|
||||||
|
@click="setBackgroundColor($event, color)"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -30,6 +31,7 @@ export default {
|
|||||||
event.target.style.borderColor = this.activeColor;
|
event.target.style.borderColor = this.activeColor;
|
||||||
document.body.style.backgroundColor = color;
|
document.body.style.backgroundColor = color;
|
||||||
this.$store.commit("setColorSelected", color);
|
this.$store.commit("setColorSelected", color);
|
||||||
|
localStorage.setItem("themeColor", this.$store.getters.colorSelected)
|
||||||
},
|
},
|
||||||
removeActiveColorFromPalette() {
|
removeActiveColorFromPalette() {
|
||||||
const palette = document.querySelectorAll(".bubble-item");
|
const palette = document.querySelectorAll(".bubble-item");
|
||||||
@@ -38,9 +40,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setFirstColor() {
|
setFirstColor() {
|
||||||
// get first div of color-palette
|
const color = this.$store.getters.globalState.themeColor;
|
||||||
const palette = document.querySelectorAll(".bubble-item");
|
document.getElementById(color).style.borderColor = this.activeColor;
|
||||||
palette[0].style.borderColor = this.activeColor;
|
document.body.style.backgroundColor = color;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -79,6 +81,7 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bubble-item {
|
.bubble-item {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
item: "",
|
item: "",
|
||||||
items: []
|
items: JSON.parse(this.$store.getters.globalState.currentItems)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -47,6 +47,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.sortArrayPinnedElements()
|
this.sortArrayPinnedElements()
|
||||||
this.clearItem()
|
this.clearItem()
|
||||||
|
this.saveCurrentItems()
|
||||||
},
|
},
|
||||||
removeItem(item) {
|
removeItem(item) {
|
||||||
this.items = this.items.filter(e =>
|
this.items = this.items.filter(e =>
|
||||||
@@ -54,6 +55,8 @@ export default {
|
|||||||
)
|
)
|
||||||
this.$store.commit("addItemFinished", item);
|
this.$store.commit("addItemFinished", item);
|
||||||
this.clearItem()
|
this.clearItem()
|
||||||
|
this.saveCurrentItems()
|
||||||
|
localStorage.setItem("nbItemsFinished", this.$store.getters.itemsFinished.length);
|
||||||
},
|
},
|
||||||
clearItem() {
|
clearItem() {
|
||||||
this.item = ""
|
this.item = ""
|
||||||
@@ -69,6 +72,7 @@ export default {
|
|||||||
list.scrollTo({top: 0, behavior: 'smooth'});
|
list.scrollTo({top: 0, behavior: 'smooth'});
|
||||||
}
|
}
|
||||||
this.sortArrayPinnedElements()
|
this.sortArrayPinnedElements()
|
||||||
|
this.saveCurrentItems()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sortArrayPinnedElements() {
|
sortArrayPinnedElements() {
|
||||||
@@ -81,6 +85,9 @@ export default {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
saveCurrentItems() {
|
||||||
|
localStorage.setItem("currentItems", JSON.stringify(this.items));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,6 +221,7 @@ export default {
|
|||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#liste {
|
#liste {
|
||||||
padding-bottom: 8px;
|
padding-bottom: 8px;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default {
|
|||||||
livesId: [],
|
livesId: [],
|
||||||
easterEggs: [],
|
easterEggs: [],
|
||||||
easterEggsSongsId: -1,
|
easterEggsSongsId: -1,
|
||||||
songId: 0,
|
songId: this.$store.getters.globalState.currentSongIndex,
|
||||||
muted: true
|
muted: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -42,11 +42,13 @@ export default {
|
|||||||
},
|
},
|
||||||
nextPlaylist() {
|
nextPlaylist() {
|
||||||
this.songId++ === this.livesId.length - 1 ? this.songId = 0 : this.songId;
|
this.songId++ === this.livesId.length - 1 ? this.songId = 0 : this.songId;
|
||||||
|
localStorage.setItem("currentSongIndex", this.songId);
|
||||||
let id = this.livesId[this.songId];
|
let id = this.livesId[this.songId];
|
||||||
this.loadVideoFromApi(id)
|
this.loadVideoFromApi(id)
|
||||||
},
|
},
|
||||||
prevPlaylist() {
|
prevPlaylist() {
|
||||||
--this.songId === -1 ? this.songId = this.livesId.length - 1 : this.songId;
|
--this.songId === -1 ? this.songId = this.livesId.length - 1 : this.songId;
|
||||||
|
localStorage.setItem("currentSongIndex", this.songId);
|
||||||
let id = this.livesId[this.songId];
|
let id = this.livesId[this.songId];
|
||||||
this.loadVideoFromApi(id)
|
this.loadVideoFromApi(id)
|
||||||
},
|
},
|
||||||
@@ -73,13 +75,17 @@ export default {
|
|||||||
this.muted = !this.muted;
|
this.muted = !this.muted;
|
||||||
},
|
},
|
||||||
loadVideoFromApi(id) {
|
loadVideoFromApi(id) {
|
||||||
|
this.saveLocalStorage(id);
|
||||||
player.loadVideoById(id);
|
player.loadVideoById(id);
|
||||||
},
|
},
|
||||||
|
saveLocalStorage(id) {
|
||||||
|
localStorage.setItem("lastSong", id);
|
||||||
|
},
|
||||||
loadApi() {
|
loadApi() {
|
||||||
window.onYouTubeIframeAPIReady = () => {
|
window.onYouTubeIframeAPIReady = () => {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
player = new window.YT.Player("player", {
|
player = new window.YT.Player("player", {
|
||||||
videoId: "XDh0JcxrbPM",
|
videoId: this.$store.getters.globalState.lastSong,
|
||||||
playerVars: {
|
playerVars: {
|
||||||
'autoplay': 1,
|
'autoplay': 1,
|
||||||
'mute': 1,
|
'mute': 1,
|
||||||
|
|||||||
+16
-1
@@ -8,7 +8,15 @@ export default new Vuex.Store({
|
|||||||
state: {
|
state: {
|
||||||
itemsFinished: [],
|
itemsFinished: [],
|
||||||
colorSelected: "",
|
colorSelected: "",
|
||||||
nbSessions: 0
|
nbSessions: 0,
|
||||||
|
globalState: {
|
||||||
|
currentItems: localStorage.getItem("currentItems") ? localStorage.getItem("currentItems") : JSON.stringify([]),
|
||||||
|
nbItemsFinished: localStorage.getItem("nbItemsFinished") ? localStorage.getItem("nbItemsFinished") : 0,
|
||||||
|
nbSessions: localStorage.getItem("nbSessions") ? localStorage.getItem("nbSessions") : 0,
|
||||||
|
lastSong: localStorage.getItem("lastSong") ? localStorage.getItem("lastSong") : "XDh0JcxrbPM",
|
||||||
|
currentSongIndex: localStorage.getItem("currentSongIndex") ? localStorage.getItem("currentSongIndex") : 0,
|
||||||
|
themeColor: localStorage.getItem("themeColor") ? localStorage.getItem("themeColor") : "#fdde95",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
itemsFinished(state) {
|
itemsFinished(state) {
|
||||||
@@ -19,6 +27,9 @@ export default new Vuex.Store({
|
|||||||
},
|
},
|
||||||
nbSessions(state) {
|
nbSessions(state) {
|
||||||
return state.nbSessions;
|
return state.nbSessions;
|
||||||
|
},
|
||||||
|
globalState(state) {
|
||||||
|
return state.globalState;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
@@ -30,6 +41,10 @@ export default new Vuex.Store({
|
|||||||
},
|
},
|
||||||
updateNbSessionsFinished(state) {
|
updateNbSessionsFinished(state) {
|
||||||
state.nbSessions++;
|
state.nbSessions++;
|
||||||
|
},
|
||||||
|
resetStats(state) {
|
||||||
|
state.globalState.nbItemsFinished = 0;
|
||||||
|
state.globalState.nbSessions = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
Reference in New Issue
Block a user