mirror of
https://github.com/LucasVbr/own-workspace.git
synced 2026-05-13 17:21:58 +00:00
UI + responsive + playlists
This commit is contained in:
+54
-16
@@ -1,12 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<to-do-list></to-do-list>
|
<div id="container">
|
||||||
<div class="aside">
|
<div id="todo-container">
|
||||||
<div class="ytb" v-show="displayYoutube">
|
<to-do-list></to-do-list>
|
||||||
<iframe width="100%" height="388" src="https://www.youtube-nocookie.com/embed/MCkTebktHVc?autoplay=1&mute=1" title="YouTube video player" frameborder="0"
|
</div>
|
||||||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
<div id="right-side">
|
||||||
id="youtube_video">
|
<div id="pomodoro">
|
||||||
</iframe>
|
<pomodoro></pomodoro>
|
||||||
|
</div>
|
||||||
|
<div id="ytb-player">
|
||||||
|
<ytb-player></ytb-player>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer>Made with <a href="https://github.com/RemiSaurel/todoapp" target="_blank" class="name">💙</a> by <a href="https://www.linkedin.com/in/r%C3%A9mi-saurel/" target="_blank" class="name">Rémi Saurel</a> </footer>
|
<footer>Made with <a href="https://github.com/RemiSaurel/todoapp" target="_blank" class="name">💙</a> by <a href="https://www.linkedin.com/in/r%C3%A9mi-saurel/" target="_blank" class="name">Rémi Saurel</a> </footer>
|
||||||
@@ -15,16 +19,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ToDoList from "@/components/ToDoList";
|
import ToDoList from "@/components/ToDoList";
|
||||||
|
import Pomodoro from "@/components/Pomodoro";
|
||||||
|
import YtbPlayer from "@/components/YtbPlayer";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
ToDoList,
|
ToDoList,
|
||||||
},
|
Pomodoro,
|
||||||
data() {
|
YtbPlayer
|
||||||
return {
|
|
||||||
displayYoutube: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,10 +55,45 @@ footer {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ytb {
|
#container {
|
||||||
margin-left: 32px;
|
display: flex;
|
||||||
margin-right: 32px;
|
flex-direction: row;
|
||||||
margin-top: 16px;
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 380px) {
|
||||||
|
#ytb-player {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 330px) {
|
||||||
|
#ytb-player {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 330px) {
|
||||||
|
#right-side {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 330px) {
|
||||||
|
#right-side {
|
||||||
|
display: flex;
|
||||||
|
width: 50%;
|
||||||
|
flex-direction: column;
|
||||||
|
margin-right: 32px;
|
||||||
|
margin-left: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#todo-container {
|
||||||
|
width: 50%;
|
||||||
|
margin-right: 16px;
|
||||||
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TEXT UNDERLINE */
|
/* TEXT UNDERLINE */
|
||||||
|
|||||||
+81
-10
@@ -15,15 +15,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="time">
|
<div id="time">
|
||||||
<span id="minutes">{{minutes}}</span>
|
<div id="minutes">
|
||||||
|
<div><i @click="this.addMinutes" class="arrow up"></i></div>
|
||||||
|
<span>{{minutes}}</span>
|
||||||
|
<div><i @click="this.substractMinutes" class="arrow down"></i></div>
|
||||||
|
</div>
|
||||||
<span id="colon">:</span>
|
<span id="colon">:</span>
|
||||||
<span id="seconds">{{seconds}}</span>
|
<span id="seconds">{{seconds}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="params">
|
<div id="params">
|
||||||
<div id="presetTime">
|
|
||||||
<button @click="setMinutes(25)">25'</button>
|
|
||||||
<button @click="setMinutes(45)">45'</button>
|
|
||||||
</div>
|
|
||||||
<div id="startStop">
|
<div id="startStop">
|
||||||
<button @click="startSession" id="start">▶️</button>
|
<button @click="startSession" id="start">▶️</button>
|
||||||
<button @click="pauseSession" id="pause" disabled>⏸</button>
|
<button @click="pauseSession" id="pause" disabled>⏸</button>
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const MINUTES = 25;
|
const MINUTES = 25;
|
||||||
|
const RANGE_MINUTES = 5;
|
||||||
const SECONDS = 0;
|
const SECONDS = 0;
|
||||||
const SHORT_PAUSE = 5;
|
const SHORT_PAUSE = 5;
|
||||||
const LONG_PAUSE = 30;
|
const LONG_PAUSE = 30;
|
||||||
@@ -48,16 +49,42 @@ export default {
|
|||||||
sessionStarted: false,
|
sessionStarted: false,
|
||||||
nbSessionsFinished: 0,
|
nbSessionsFinished: 0,
|
||||||
isRestingTime: false,
|
isRestingTime: false,
|
||||||
customTimer: MINUTES
|
customTimer: MINUTES,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setMinutes(value) {
|
lockArrows() {
|
||||||
this.minutes = value.toString();
|
const arrows = document.querySelectorAll(".arrow");
|
||||||
this.customTimer = value;
|
arrows.forEach(arrow => {
|
||||||
|
arrow.style.pointerEvents = "none";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
unlockArrows() {
|
||||||
|
const arrows = document.querySelectorAll(".arrow");
|
||||||
|
arrows.forEach(arrow => {
|
||||||
|
arrow.style.pointerEvents = "auto";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addMinutes() {
|
||||||
|
this.minutes += RANGE_MINUTES;
|
||||||
|
this.handleLimits()
|
||||||
|
this.customTimer = this.minutes;
|
||||||
|
},
|
||||||
|
substractMinutes() {
|
||||||
|
this.minutes -= RANGE_MINUTES;
|
||||||
|
this.handleLimits()
|
||||||
|
this.customTimer = this.minutes;
|
||||||
|
},
|
||||||
|
handleLimits() {
|
||||||
|
if (this.minutes < 10) {
|
||||||
|
this.minutes = 10;
|
||||||
|
} else if (this.minutes > 60) {
|
||||||
|
this.minutes = 60;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
startSession() {
|
startSession() {
|
||||||
if (!this.sessionStarted) {
|
if (!this.sessionStarted) {
|
||||||
|
this.lockArrows()
|
||||||
this.countDownTimer();
|
this.countDownTimer();
|
||||||
this.sessionStarted = true;
|
this.sessionStarted = true;
|
||||||
}
|
}
|
||||||
@@ -92,6 +119,7 @@ export default {
|
|||||||
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()
|
||||||
},
|
},
|
||||||
countDownTimer: function () {
|
countDownTimer: function () {
|
||||||
if (this.minutes === "00" && this.seconds === "00") {
|
if (this.minutes === "00" && this.seconds === "00") {
|
||||||
@@ -165,9 +193,13 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#time {
|
#time {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
font-size: 8vw;
|
font-size: 5vw;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
margin-top: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#startStop > button{
|
#startStop > button{
|
||||||
@@ -190,8 +222,24 @@ export default {
|
|||||||
#seconds {
|
#seconds {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 10vw;
|
width: 10vw;
|
||||||
|
padding-top: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#colon {
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
#minutes {
|
#minutes {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#minutes > div {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#minutes > span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 10vw;
|
width: 10vw;
|
||||||
}
|
}
|
||||||
@@ -238,4 +286,27 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
border: solid black;
|
||||||
|
border-width: 0 6px 6px 0;
|
||||||
|
font-size: 1rem;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow:hover {
|
||||||
|
border: solid mediumseagreen;
|
||||||
|
border-width: 0 6px 6px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.up {
|
||||||
|
transform: rotate(-135deg);
|
||||||
|
-webkit-transform: rotate(-135deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.down {
|
||||||
|
transform: rotate(45deg);
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -16,22 +16,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="pomodoro">
|
|
||||||
<pomodoro></pomodoro>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import Pomodoro from "@/components/Pomodoro";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ToDoList",
|
name: "ToDoList",
|
||||||
components: {
|
|
||||||
Pomodoro
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
item: "",
|
item: "",
|
||||||
@@ -70,7 +62,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-left: 32px;
|
margin-left: 32px;
|
||||||
width: 40%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#todo_input {
|
#todo_input {
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<template>
|
||||||
|
<div id="ytb-container">
|
||||||
|
<div class="ytb" v-show="displayYoutube">
|
||||||
|
<iframe width="100%" height="360" src="https://www.youtube-nocookie.com/embed/MCkTebktHVc?autoplay=1&mute=1" title="YouTube video player" frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
|
||||||
|
id="youtube_video">
|
||||||
|
</iframe>
|
||||||
|
</div>
|
||||||
|
<div class="params">
|
||||||
|
<button @click="prevPlaylist" id="prev">⏮</button>
|
||||||
|
<button @click="nextPlaylist" id="next">⏭</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "YtbPlayer",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
displayYoutube: true,
|
||||||
|
livesId: [],
|
||||||
|
songId: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
readFileAndStore()
|
||||||
|
{
|
||||||
|
let lofi = require("../data/lofi.json");
|
||||||
|
this.livesId = lofi.id;
|
||||||
|
},
|
||||||
|
nextPlaylist()
|
||||||
|
{
|
||||||
|
this.songId++ === this.livesId.length - 1 ? this.songId = 0 : this.songId;
|
||||||
|
let id = this.livesId[this.songId];
|
||||||
|
let ytb = document.getElementById("youtube_video")
|
||||||
|
ytb.src = "https://www.youtube.com/embed/" + id + "?autoplay=1";
|
||||||
|
},
|
||||||
|
prevPlaylist()
|
||||||
|
{
|
||||||
|
--this.songId === -1 ? this.songId = this.livesId.length - 1: this.songId;
|
||||||
|
console.log(this.songId)
|
||||||
|
console.log(this.livesId.length)
|
||||||
|
let id = this.livesId[this.songId];
|
||||||
|
let ytb = document.getElementById("youtube_video")
|
||||||
|
ytb.src = "https://www.youtube.com/embed/" + id + "?autoplay=1";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.readFileAndStore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.ytb {
|
||||||
|
margin-top: 24px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params > * {
|
||||||
|
width: 80px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"id": [
|
||||||
|
"MCkTebktHVc",
|
||||||
|
"7NOSDKb0HlU",
|
||||||
|
"-5KAN9_CzSA",
|
||||||
|
"jfKfPfyJRdk",
|
||||||
|
"SIt21jdTYKk",
|
||||||
|
"XDh0JcxrbPM",
|
||||||
|
"GDQnA1LVCWA"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user