From 718482cdddf5d8b44a4a769695bd50ee69de7cb0 Mon Sep 17 00:00:00 2001 From: RemiSaurel Date: Fri, 26 Aug 2022 12:43:32 +0200 Subject: [PATCH 1/2] full refactoring + improve responsive --- src/App.vue | 51 +++----- src/components/Infos.vue | 38 +++--- src/components/Pomodoro.vue | 86 ++++++------- src/components/Settings.vue | 23 ++-- src/components/Socials.vue | 6 +- src/components/ToDoList.vue | 237 +++++++++++++++++------------------ src/components/YtbPlayer.vue | 2 +- src/store/index.js | 3 +- 8 files changed, 214 insertions(+), 232 deletions(-) diff --git a/src/App.vue b/src/App.vue index 8e72fac..356042a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -64,16 +64,6 @@ button:disabled { cursor: not-allowed; } -footer { - display: flex; - justify-content: center; - margin-top: 24px; -} - -footer > div { - margin-right: 16px; -} - #nav-bar { margin-top: 8px; margin-left: 16px; @@ -90,10 +80,6 @@ footer > div { box-shadow: rgba(0, 0, 0) 0px 4px 10px; } -#pomodoro { - width: 100%; -} - #container { display: flex; flex-direction: row; @@ -112,28 +98,27 @@ footer > div { margin-left: 32px; } +/* ********** */ +/* RESPONSIVE */ +/* ********** */ + +@media (max-width: 835px) { + #container{ + flex-direction: column; + } + #todo-container { + width: 100%; + } + #right-side { + margin-right: 32px; + margin-left: 32px; + width: auto; + } +} + @media (max-width: 330px) { #right-side { display: none; } } - -@media (max-width: 675px) { - #todo-container { - width: 100%; - } - #right-side { - width: auto; - margin-top: 16px; - } - - #container { - display: block; - } - #ytb-player { - display: none; - } - -} - diff --git a/src/components/Infos.vue b/src/components/Infos.vue index aaaa43e..e7a9dda 100644 --- a/src/components/Infos.vue +++ b/src/components/Infos.vue @@ -16,7 +16,7 @@
{{ this.word.definition }}
-
+
@@ -26,7 +26,7 @@
@@ -35,7 +35,7 @@ Total sessions: {{this.$store.getters.nbSessions}}
@@ -148,7 +148,6 @@ export default { position: relative; background: #504746; width: 100%; - height: 300px; border-radius: 16px; padding: 16px 24px 18px 24px; color: white; @@ -162,7 +161,6 @@ export default { font-size: 36px; } - #word-definition { margin-top: 16px; } @@ -179,17 +177,14 @@ export default { font-weight: lighter; } -#btn { +#btn-newword { text-align: center; - margin-top: 24px; + margin-top: 16px; } .btn { font-size: 20px; padding: 8px; -} - -#fetch { margin-bottom: 8px; } @@ -205,12 +200,9 @@ export default { #see-words { margin-top: 16px; } - -@media (max-width: 835px) { - #container-infos { - display: none; - } -} +/* ********** */ +/* RESPONSIVE */ +/* ********** */ @media (max-width: 1400px) { #time { @@ -218,4 +210,18 @@ export default { } } +@media (max-width: 835px) { + #container-infos { + width: 50%; + margin-left: 8px; + } +} + + +@media (max-width: 550px) { + #container-infos { + display: none; + } +} + \ No newline at end of file diff --git a/src/components/Pomodoro.vue b/src/components/Pomodoro.vue index d09afbf..82e9f5b 100644 --- a/src/components/Pomodoro.vue +++ b/src/components/Pomodoro.vue @@ -135,7 +135,7 @@ export default { } else { alert("SESSION TERMINร‰E ๐Ÿ‘"); this.nbSessionsFinished++; - this.$store.commit("setNbSessions"); + this.$store.commit("updateNbSessionsFinished"); if (this.nbSessionsFinished === 4) { this.setupPauseTimer(LONG_PAUSE); this.nbSessionsFinished = 0; @@ -199,9 +199,9 @@ export default { this.seconds = "0" + this.seconds; } if (this.isRestingTime) { - document.title = "PAUSE ๐Ÿ‘ " + this.minutes + ":" + this.seconds; + document.title = "๐Ÿ– " + this.minutes + ":" + this.seconds; } else { - document.title = "WORKING ๐Ÿ… " + this.minutes + ":" + this.seconds; + document.title = "๐Ÿ… " + this.minutes + ":" + this.seconds; } } }, @@ -305,27 +305,41 @@ export default { -webkit-transform: rotate(45deg); } -@media (min-width: 635px) { +#message { + font-size: 1.6rem; +} + +.dot { + height: 25px; + width: 25px; + background-color: lightslategrey; + border-radius: 50%; + margin: 12px 4px 12px 4px; + display: inline-block; +} + +.active { + height: 25px; + width: 25px; + background-color: mediumseagreen; + border-radius: 50%; + margin: 12px 4px 12px 4px; + display: inline-block; +} +/* ********** */ +/* RESPONSIVE */ +/* ********** */ + +@media (max-width: 835px) { + #container { + margin-top: 16px; + } #message { font-size: 1.6rem; } - - .dot { - height: 25px; - width: 25px; - background-color: lightslategrey; - border-radius: 50%; - margin: 12px 4px 12px 4px; - display: inline-block; - } - - .active { - height: 25px; - width: 25px; - background-color: mediumseagreen; - border-radius: 50%; - margin: 12px 4px 12px 4px; - display: inline-block; + .pomodoro { + margin-right: 8px; + width: 50%; } } @@ -337,38 +351,12 @@ export default { margin-right: 8px; margin-left: 8px; } - #container { - margin-left: 16px; - margin-right: 16px; - } } -@media (max-width: 835px) { +@media (max-width: 550px) { .pomodoro { - margin-right: 0px; width: 100%; - } - - #message { - font-size: 1.6rem; - } - - .dot { - height: 25px; - width: 25px; - background-color: lightslategrey; - border-radius: 50%; - margin: 12px 4px 12px 4px; - display: inline-block; - } - - .active { - height: 25px; - width: 25px; - background-color: mediumseagreen; - border-radius: 50%; - margin: 12px 4px 12px 4px; - display: inline-block; + margin-right: 0; } } diff --git a/src/components/Settings.vue b/src/components/Settings.vue index f7dca1f..fbae9bd 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -1,8 +1,8 @@ diff --git a/src/store/index.js b/src/store/index.js index 7795e76..bcf28cb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,6 +1,5 @@ // store/index.js - import Vue from "vue"; import Vuex from "vuex"; @@ -29,7 +28,7 @@ export default new Vuex.Store({ setColorSelected(state, color) { state.colorSelected = color; }, - setNbSessions(state) { + updateNbSessionsFinished(state) { state.nbSessions++; } }, From add72e6246bc4e2d917d305cf66bd2adc23bb754 Mon Sep 17 00:00:00 2001 From: RemiSaurel Date: Fri, 26 Aug 2022 13:46:01 +0200 Subject: [PATCH 2/2] new feature: pin elements from todolist --- src/components/ToDoList.vue | 68 +++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/src/components/ToDoList.vue b/src/components/ToDoList.vue index a70fde3..41d0738 100644 --- a/src/components/ToDoList.vue +++ b/src/components/ToDoList.vue @@ -6,13 +6,18 @@ placeholder="Ex: Finir exos maths">
-
-
-
- {{item}} +
+
+
+ {{item.text}}
-
- ๐Ÿ—‘ +
+
+ ๐Ÿ“Œ +
+
+ ๐Ÿ—‘ +
@@ -33,9 +38,14 @@ export default { methods: { addItem(item) { const trimmedItem = item.trim(); - if (trimmedItem.length > 0 && this.items.indexOf(trimmedItem) === -1) { - this.items = [trimmedItem].concat(this.items) + const found = this.items.some(item => item.text === trimmedItem) + if (trimmedItem.length > 0 && !(found)) { + this.items.unshift({ + text: trimmedItem, + isPinned: false + }); } + this.sortArrayPinnedElements() this.clearItem() }, removeItem(item) { @@ -47,6 +57,30 @@ export default { }, clearItem() { this.item = "" + }, + pinItem(item) { + if (item.isPinned) { + item.isPinned = false + this.sortArrayPinnedElements() + } else { + item.isPinned = true + this.$nextTick(() => { + const pinnedElement = document.getElementById(item) + pinnedElement.scrollIntoView({behavior: "smooth"}) + }); + this.sortArrayPinnedElements() + } + }, + sortArrayPinnedElements() { + this.items.sort((a, b) => { + if (a.isPinned && !b.isPinned) { + return -1 + } else if (!a.isPinned && b.isPinned) { + return 1 + } else { + return 0 + } + }) } } } @@ -152,10 +186,22 @@ export default { box-shadow: #79624c 0px 1px 6px 0px; } -#trash { - font-size: 20px; - padding-left: 8px; +.pinned { + box-shadow: inset 0px 0px 0px 3px #fd7e7e; +} + +.pinned:hover { + box-shadow: inset 0px 0px 0px 3px #ea0000; +} + +#emojis { + display: flex; cursor: pointer; + margin-left: 8px; +} + +#emojis > div { + margin-left: 8px; } /* ********** */