tunnel: interface pour page admin sans backend + problème de gestion de la playlist (importé dans 2 script, l'un demande un focntion, l'autre une array et on est là hum...)

This commit is contained in:
2026-07-06 22:32:41 +02:00
parent eaba21e126
commit 874226a140
10 changed files with 1573 additions and 0 deletions
+359
View File
@@ -0,0 +1,359 @@
<template>
<Teleport to="#event .windowContent" defer>
<div class="sectionTitle" v-show="eventPannel">
<p>{{newEventText}} &emsp; &emsp;&emsp;&emsp;&emsp; &rarr; </p>
<button type="button" class="toggleBtn" ref="newEventBtn" @click="toggleNewEvent">
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
<div class="editor" v-show="newEvent">
<div class="inputDiv" id="title">
<p>&emsp; Titre &emsp;&emsp;&emsp; &rarr;</p>
<input type="text" name="eventTitle" v-model="title">
</div>
<div class="inputDiv" id="date">
<p>&emsp; Date &emsp;&emsp;&emsp; &rarr;</p>
<input type="text" name="eventDate" v-model="date">
</div>
<div class="inputDiv" id="time">
<p>&emsp; Heure &emsp;&emsp;&ensp; &rarr;</p>
<input type="text" name="eventTime" v-model="time">
</div>
<div class="inputDiv" id="subtitle">
<p>&emsp; Sous-titre &emsp; &rarr;</p>
<input type="text" name="eventSub" v-model="sub">
</div>
<div class="inputDiv" id="desc">
<p> Description &emsp; &emsp;</p>
<textarea name="eventDesc" rows="8" cols="80" v-model="desc"></textarea>
</div>
<button type="button" name="saveChanges" class="textBtnStyle" @click="saveEvent" :class="{alert: eventAlertActive}">SAUVEGARDER !</button>
</div>
<div class="sectionTitle" v-show="eventPannel">
<p>Éditer les évènements &ensp; &emsp;&emsp;&emsp; &rarr; </p>
<button type="button" class="toggleBtn" ref="oldEventBtn" @click="toggleOldEvent">
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
<div class="content" v-show="oldEvent">
<div class="eventEntry" v-for="item of displayedEvents" ref="item.title">
<p>{{item.title}}</p>
<div class="controls">
<button type="button" name="edit" class="toggleBtn" id="edit" @click='editEvent(item)'>
<svg class="icon" viewBox="0 0 40.19 38.9">
<path d="M8.61,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26,1.41-.94,2.31-.94,1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31-1.41.96-2.31.96-1.67-.32-2.31-.96ZM17.78,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26c.64-.63,1.41-.94,2.31-.94s1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31c-.64.64-1.41.96-2.31.96s-1.67-.32-2.31-.96ZM26.96,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26c.64-.63,1.41-.94,2.31-.94s1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31-1.41.96-2.31.96-1.67-.32-2.31-.96Z"/>
<path d="M34.91,7.2l-1.92-1.92L27.71,0H0v38.9h40.19V12.48l-5.28-5.28ZM32.3,33.62H5.28V5.28h2.61s17.64,0,17.64,0v9.84h9.38v18.5h-2.61Z"/>
</svg>
</button>
<button type="button" name="remove" class="toggleBtn" id="remove" @click='removeEvent(item)'>
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
</div>
</div>
</Teleport>
</template>
<style scoped>
#event .windowContent{
.sectionTitle{
width: 100%;
height: 44px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-style: solid;
border-color: var(--main-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
padding-right: 33px;
padding-left: 33px;
box-sizing: border-box;
p{
font-family: 'velvelyne';
font-weight: bold;
font-size: 16.1px;
color: var(--main-color);
margin: 0;
}
}
.editor{
width: 100%;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
gap: 13.12px;
overflow-y: scroll;
padding-top: 7.77px;
padding-right: 7.77px;
border-style: solid;
border-color: var(--main-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
box-sizing: border-box;
.textBtnStyle{
margin-bottom: 16.1px;
margin-right: 16.1px;
min-height: 33px;
}
.textBtnStyle.alert{
color: var(--back-color);
background-color: var(--main-color);
}
.inputDiv{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
color: var(--main-color);
width: 95%;
margin: 0;
padding: 0;
height: 44px;
input{
width: 60%;
background-color: var(--back-color);
height: 33px;
padding-left: 16.1px;
border-style: solid;
border-color: var(--main-color);
border-radius: 22px;
border-width: thin;
}
p{
font-family: 'velvelyne';
font-weight: normal;
font-size: 16.1px;
color: var(--main-color);
margin: 0;
}
}
#desc.inputDiv{
flex-direction: column;
align-items: flex-end;
height: 161px;
margin-bottom: 7.77px;
textarea{
width: 92%;
align-self: center;
background-color: var(--back-color);
height: 77px;
padding-left: 16.1px;
padding-right: 16.1px;
padding-top: 7.77px;
border-style: solid;
border-color: var(--main-color);
border-radius: 22px;
border-width: thin;
resize: none;
overflow-y: scroll;
}
}
}
.content{
width: 100%;
height: 100%;
position: relative;
background-color: var(--main-color);
overflow-y: scroll;
.eventEntry{
width: 100%;
height: 44px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
border-style: solid;
border-color: var(--back-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
padding-left: 16.1px;
padding-right: 16.1px;
p{
font-family: 'velvelyne';
font-weight: bold;
font-size: 16.1px;
color: var(--back-color);
margin: 0;
}
.controls{
width: auto;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: 7.77px;
.toggleBtn{
transform: rotate(0);
cursor: cell;
}
}
}
}
}
</style>
<script>
import { lolLinkList } from '/src/lolLinks.js'
import { lolEventsList } from '/src/lolEvents.js'
import { loadAudioData } from '/src/data/audioData.js'
import { pannelStatusList } from '../pannelStatus.js'
import { watch } from 'vue'
export default {
name : 'EventEditor',
data() {
return {
newEventText: 'Nouvel Évènement',
eventAlertActive: false,
hideTimer: null,
submitEventText: 'SAUVEGARDER',
newEvent: false,
oldEvent: false,
title: '',
date: '',
time: '',
sub: '',
desc: '',
eventDefault: {
title: 'Exemple de Titre',
date: '13/12/26',
time: '13h12',
sub: 'exemple de sous-titre',
desc: 'exemple de description \nsur plusieurs lignes'
},
editingEvent: null
}
},
computed: {
displayedEvents(){
return lolEventsList
},
eventPannel(){
return pannelStatusList.event;
}
},
methods: {
toggleNewEvent(){
this.newEvent = !this.newEvent;
if (this.newEvent){
this.oldEvent = false;
if(!this.editingEvent){
this.backToDefaultEvent();
}
}
this.$refs.newEventBtn.style.transform = this.newEvent ? 'rotate(0)' : 'rotate(45deg)';
this.$refs.oldEventBtn.style.transform = this.oldEvent ? 'rotate(0)' : 'rotate(45deg)';
},
toggleOldEvent(){
this.oldEvent = !this.oldEvent;
if (this.oldEvent){
this.newEvent = false;
}
this.$refs.newEventBtn.style.transform = this.newEvent ? 'rotate(0)' : 'rotate(45deg)';
this.$refs.oldEventBtn.style.transform = this.oldEvent ? 'rotate(0)' : 'rotate(45deg)';
},
backToDefaultEvent(){
this.title = this.eventDefault.title;
this.date = this.eventDefault.date;
this.time = this.eventDefault.time;
this.sub = this.eventDefault.sub;
this.desc = this.eventDefault.desc;
this.editingEvent = null;
this.newEventText = 'Nouvel Évènement';
},
createListEntry(){
let entry = {
title: this.title,
date: this.date,
time: this.time,
subtitle: this.sub,
desc: this.desc
}
return entry
},
saveEvent(){
let entry = this.createListEntry();
if(this.editingEvent){
Object.assign(this.editingEvent, {
title: this.title,
date: this.date,
time: this.time,
subtitle: this.sub,
desc: this.desc
})
} else {
this.displayedEvents.push(entry);
}
this.toggleOldEvent();
this.backToDefaultEvent();
},
removeEvent(obj){
let index = this.displayedEvents.indexOf(obj);
this.displayedEvents.splice(index, 1);
},
editEvent(obj){
console.log('selected :', obj)
this.editingEvent = obj;
this.title = obj.title;
this.date = obj.date;
this.time = obj.time;
this.sub = obj.subtitle;
this.desc = obj.desc;
this.newEventText = 'Éditer l\'évènement'
this.toggleNewEvent();
},
async eventSaveMsg(){
this.eventAlertActive = true;
this.submitEventText = "Enregistré !";
clearTimeout(this.hideTimer)
this.hideTimer = setTimeout(() => {
this.eventAlertActive = false;
this.submitEventText = 'SAUVEGARDER';
}, 1610)
}
},
mounted(){
watch( () => this.eventPannel, () => {
if(!this.eventPannel){
this.oldEvent = false;
this.newEvent = false;
}
})
console.log("Event editor is fully loaded!");
}
};
</script>
+363
View File
@@ -0,0 +1,363 @@
<template>
<Teleport to="#link .windowContent" defer>
<div class="sectionTitle" v-show="linkPannel">
<p>{{newLinkText}} &emsp; &emsp;&emsp; &ensp; &rarr; </p>
<button type="button" class="toggleBtn" ref="newLinkBtn" @click="toggleNewLink">
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
<div class="editor" v-show="newLink">
<div class="inputDiv" id="title">
<p>&emsp; Titre &emsp;&emsp;&emsp; &rarr;</p>
<input type="text" name="linkTitle" v-model="title">
</div>
<div class="inputDiv" id="desc">
<p> Description &emsp; &emsp;</p>
<textarea name="linkDesc" rows="8" cols="80" v-model="desc"></textarea>
</div>
<div class="inputDiv" id="href">
<p> Lien &emsp; &emsp;</p>
<textarea name="linkDesc" rows="8" cols="80" v-model="href"></textarea>
</div>
<button type="button" name="saveChanges" class="textBtnStyle" @click="saveLink" :class="{alert: linkAlertActive}">SAUVEGARDER !</button>
</div>
<div class="sectionTitle" v-show="linkPannel">
<p>Éditer les liens &emsp; &emsp; &emsp; &rarr; </p>
<button type="button" class="toggleBtn" ref="oldLinkBtn" @click="toggleOldLink">
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
<div class="content" v-show="oldLink">
<div class="linkEntry" v-for="item of displayedLinks" ref="item.title">
<p>{{item.title}}</p>
<div class="controls">
<button type="button" name="edit" class="toggleBtn" id="edit" @click='editLink(item)'>
<svg class="icon" viewBox="0 0 40.19 38.9">
<path d="M8.61,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26,1.41-.94,2.31-.94,1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31-1.41.96-2.31.96-1.67-.32-2.31-.96ZM17.78,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26c.64-.63,1.41-.94,2.31-.94s1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31c-.64.64-1.41.96-2.31.96s-1.67-.32-2.31-.96ZM26.96,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26c.64-.63,1.41-.94,2.31-.94s1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31-1.41.96-2.31.96-1.67-.32-2.31-.96Z"/>
<path d="M34.91,7.2l-1.92-1.92L27.71,0H0v38.9h40.19V12.48l-5.28-5.28ZM32.3,33.62H5.28V5.28h2.61s17.64,0,17.64,0v9.84h9.38v18.5h-2.61Z"/>
</svg>
</button>
<button type="button" name="remove" class="toggleBtn" id="remove" @click='removeLink(item)'>
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
</div>
</div>
</Teleport>
</template>
<style scoped>
#link .windowContent{
.sectionTitle{
width: 100%;
height: 44px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-style: solid;
border-color: var(--main-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
padding-right: 33px;
padding-left: 33px;
box-sizing: border-box;
p{
font-family: 'velvelyne';
font-weight: bold;
font-size: 16.1px;
color: var(--main-color);
margin: 0;
}
}
.editor{
width: 100%;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
gap: 13.12px;
overflow-y: scroll;
padding-top: 7.77px;
padding-right: 7.77px;
border-style: solid;
border-color: var(--main-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
box-sizing: border-box;
.textBtnStyle{
margin-bottom: 16.1px;
margin-right: 16.1px;
min-height: 33px;
}
.textBtnStyle.alert{
color: var(--back-color);
background-color: var(--main-color);
}
.inputDiv{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
color: var(--main-color);
width: 95%;
margin: 0;
padding: 0;
height: 44px;
input{
width: 60%;
background-color: var(--back-color);
height: 33px;
padding-left: 16.1px;
border-style: solid;
border-color: var(--main-color);
border-radius: 22px;
border-width: thin;
}
p{
font-family: 'velvelyne';
font-weight: normal;
font-size: 16.1px;
color: var(--main-color);
margin: 0;
}
}
#desc.inputDiv{
flex-direction: column;
align-items: flex-end;
height: 161px;
margin-bottom: 7.77px;
textarea{
width: 92%;
align-self: center;
background-color: var(--back-color);
height: 77px;
padding-left: 16.1px;
padding-right: 16.1px;
padding-top: 7.77px;
border-style: solid;
border-color: var(--main-color);
border-radius: 22px;
border-width: thin;
resize: none;
overflow-y: scroll;
}
}
#href.inputDiv{
flex-direction: column;
align-items: flex-end;
height: 161px;
margin-bottom: 7.77px;
textarea{
width: 92%;
align-self: center;
background-color: var(--back-color);
height: 77px;
padding-left: 16.1px;
padding-right: 16.1px;
padding-top: 7.77px;
border-style: solid;
border-color: var(--main-color);
border-radius: 22px;
border-width: thin;
resize: none;
overflow-y: scroll;
}
}
}
.content{
width: 100%;
height: 100%;
position: relative;
background-color: var(--main-color);
overflow-y: scroll;
.linkEntry{
width: 100%;
height: 44px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
border-style: solid;
border-color: var(--back-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
padding-left: 16.1px;
padding-right: 16.1px;
p{
font-family: 'velvelyne';
font-weight: bold;
font-size: 16.1px;
color: var(--back-color);
margin: 0;
}
.controls{
width: auto;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: 7.77px;
.toggleBtn{
transform: rotate(0);
cursor: cell;
}
}
}
}
}
</style>
<script>
import { lolLinkList } from '/src/lolLinks.js'
import { pannelStatusList } from '../pannelStatus.js'
import { watch } from 'vue'
export default {
name : 'LinkEditor',
data() {
return {
newLinkText: 'Nouveau Lien',
linkAlertActive: false,
hideTimer: null,
submitLinkText: 'SAUVEGARDER',
newLink: false,
oldLink: false,
title: '',
href: '',
desc: '',
linkDefault: {
title: 'Exemple de Titre',
href: 'https://example.com/',
desc: 'exemple de description'
},
editingLink: null
}
},
computed: {
displayedLinks(){
return lolLinkList
},
linkPannel(){
return pannelStatusList.link;
}
},
methods: {
toggleNewLink(){
this.newLink = !this.newLink;
if (this.newLink){
this.oldLink = false;
if(!this.editingLink){
this.backToDefaultLink();
}
}
this.$refs.newLinkBtn.style.transform = this.newLink ? 'rotate(0)' : 'rotate(45deg)';
this.$refs.oldLinkBtn.style.transform = this.oldLink ? 'rotate(0)' : 'rotate(45deg)';
},
toggleOldLink(){
this.oldLink = !this.oldLink;
if (this.oldLink){
this.newLink = false;
}
this.$refs.newLinkBtn.style.transform = this.newLink ? 'rotate(0)' : 'rotate(45deg)';
this.$refs.oldLinkBtn.style.transform = this.oldLink ? 'rotate(0)' : 'rotate(45deg)';
},
backToDefaultLink(){
this.title = this.linkDefault.title;
this.href = this.linkDefault.href;
this.desc = this.linkDefault.desc;
this.editingLink = null;
this.newLinkText = 'Nouveau Lien';
},
createListEntry(){
let entry = {
title: this.title,
href: this.href,
desc: this.desc
}
return entry
},
saveLink(){
let entry = this.createListEntry();
if(this.editingLink){
Object.assign(this.editingLink, {
title: this.title,
href: this.href,
desc: this.desc
})
} else {
this.displayedLinks.push(entry);
}
this.toggleOldLink();
this.backToDefaultLink();
},
removeLink(obj){
let index = this.displayedLinks.indexOf(obj);
this.displayedLinks.splice(index, 1);
},
editLink(obj){
console.log('selected :', obj)
this.editingLink = obj;
this.title = obj.title;
this.href = obj.href
this.desc = obj.desc;
this.newLinkText = 'Éditer le lien'
this.toggleNewLink();
},
async linkSaveMsg(){
this.linkAlertActive = true;
this.submitLinkText = "Enregistré !";
clearTimeout(this.hideTimer)
this.hideTimer = setTimeout(() => {
this.eventAlertActive = false;
this.submitLinkText = 'SAUVEGARDER';
}, 1610)
}
},
mounted(){
watch( () => this.linkPannel, () => {
if(!this.linkPannel){
this.oldLink = false;
this.newLink = false;
}
})
console.log("Link editor is fully loaded!");
}
};
</script>
+352
View File
@@ -0,0 +1,352 @@
<template>
<Teleport to="#playlist .windowContent" defer>
<div class="sectionTitle" v-show="playlistPannel">
<p>{{newSongText}} &emsp; &emsp; &emsp; &emsp; &emsp; &rarr; </p>
<button type="button" class="toggleBtn" ref="newSongBtn" @click="toggleNewPlaylist">
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
<div class="editor" v-show="newSong">
<div class="inputDiv" id="track">
<p>&emsp; Titre &emsp;&emsp; &emsp; &rarr;</p>
<input type="text" name="songTitle" v-model="track">
</div>
<div class="inputDiv" id="artist">
<p>&emsp; Artiste &emsp;&emsp;&ensp; &rarr;</p>
<input type="text" name="songArtist" v-model="artist">
</div>
<div class="inputDiv" id="src">
<p>&emsp; Fichier MP3 &ensp; &rarr;</p>
<input type="file" name="songFile" ref="audioFile" @change="loadFile">
</div>
<button type="button" name="saveChanges" class="textBtnStyle" @click="savePlaylist" :class="{alert: playlistAlertActive}">SAUVEGARDER !</button>
</div>
<div class="sectionTitle" v-show="playlistPannel">
<p>Modifier la playlist &ensp; &emsp;&emsp;&emsp; &rarr; </p>
<button type="button" class="toggleBtn" ref="currentPlaylistBtn" @click="toggleCurrentPlaylist">
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
<div class="content" v-show="currentPlaylist">
<div class="playlistEntry" v-for="item of displayedPlaylists" ref="item.track">
<p>{{item.track}} {{item.artist}}</p>
<div class="controls">
<button type="button" name="edit" class="toggleBtn" id="edit" @click='editPlaylist(item)'>
<svg class="icon" viewBox="0 0 40.19 38.9">
<path d="M8.61,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26,1.41-.94,2.31-.94,1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31-1.41.96-2.31.96-1.67-.32-2.31-.96ZM17.78,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26c.64-.63,1.41-.94,2.31-.94s1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31c-.64.64-1.41.96-2.31.96s-1.67-.32-2.31-.96ZM26.96,30.26c-.64-.64-.96-1.41-.96-2.31s.32-1.63.96-2.26c.64-.63,1.41-.94,2.31-.94s1.67.31,2.31.94c.64.63.96,1.38.96,2.26s-.32,1.67-.96,2.31-1.41.96-2.31.96-1.67-.32-2.31-.96Z"/>
<path d="M34.91,7.2l-1.92-1.92L27.71,0H0v38.9h40.19V12.48l-5.28-5.28ZM32.3,33.62H5.28V5.28h2.61s17.64,0,17.64,0v9.84h9.38v18.5h-2.61Z"/>
</svg>
</button>
<button type="button" name="remove" class="toggleBtn" id="remove" @click='removePlaylist(item)'>
<svg class="icon" viewBox="0 0 53.73 53.59">
<path d="M26.87,40.16l-13.43,13.43L0,40.16l13.43-13.43L.29,13.43,13.72,0l13.15,13.29L40.01.14l13.43,13.43-13,13.15,13.29,13.29-13.43,13.43-13.43-13.29Z"/>
</svg>
</button>
</div>
</div>
</div>
</Teleport>
</template>
<style scoped>
#playlist .windowContent{
.sectionTitle{
width: 100%;
height: 44px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-style: solid;
border-color: var(--main-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
padding-right: 33px;
padding-left: 33px;
box-sizing: border-box;
p{
font-family: 'velvelyne';
font-weight: bold;
font-size: 16.1px;
color: var(--main-color);
margin: 0;
}
}
.editor{
width: 100%;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
gap: 13.12px;
overflow-y: scroll;
padding-top: 7.77px;
padding-right: 7.77px;
border-style: solid;
border-color: var(--main-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
box-sizing: border-box;
.textBtnStyle{
margin-bottom: 16.1px;
margin-right: 22px;
height: 33px;
}
.textBtnStyle.alert{
color: var(--back-color);
background-color: var(--main-color);
}
.inputDiv{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
color: var(--main-color);
width: 95%;
margin: 0;
padding: 0;
height: 44px;
input{
width: 60%;
background-color: var(--back-color);
height: 33px;
padding-left: 16.1px;
border-style: solid;
border-color: var(--main-color);
border-radius: 22px;
border-width: thin;
}
p{
font-family: 'velvelyne';
font-weight: normal;
font-size: 16.1px;
color: var(--main-color);
margin: 0;
}
}
#src.inputDiv{
input[type=file]::file-selector-button{
font-family: 'karrik';
font-size: 10px;
background-color: var(--back-color);
color: var(--main-color);
padding-left: 0;
margin: 0;
border-width: 0 1.61px 0 0;
height: 100%;
padding-left: 16.1px;
padding-right: 7.77px;
margin-left: -22px;
margin-right: 7.77px;
outline: none;
}
input[type=file]::file-selector-button:hover{
font-family: 'karrik';
font-size: 13.12px;
background-color: var(--main-color);
color: var(--back-color);
padding-left: 0;
margin: 0;
border-width: 0 1.61px 0 0;
height: 100%;
padding-left: 16.1px;
padding-right: 7.77px;
margin-left: -22px;
margin-right: 7.77px;
outline: none;
}
}
}
.content{
width: 100%;
height: 100%;
position: relative;
background-color: var(--main-color);
overflow-y: scroll;
.playlistEntry{
width: 100%;
height: 44px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
border-style: solid;
border-color: var(--back-color);
border-radius: 0;
border-width: 0 0 1.61px 0;
padding-left: 16.1px;
padding-right: 16.1px;
p{
font-family: 'velvelyne';
font-weight: bold;
font-size: 16.1px;
color: var(--back-color);
margin: 0;
}
.controls{
width: auto;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
gap: 7.77px;
.toggleBtn{
transform: rotate(0);
cursor: cell;
}
}
}
}
}
</style>
<script>
import { loadAudioData } from '/src/data/audioData.js'
import { watch } from 'vue'
import { pannelStatusList } from '../pannelStatus.js'
export default {
name : 'PlaylistEditor',
data() {
return {
newSongText: 'Nouveau Son',
playlistAlertActive: false,
hideTimer: null,
submitPlaylistText: 'SAUVEGARDER',
newSong: false,
currentPlaylist: false,
track: '',
artist: '',
src: null,
playlistDefault: {
track: 'exemple',
artist: 'exemple',
src: null
},
editingSong: null,
fileInput: null
}
},
computed: {
displayedPlaylists(){
let list = loadAudioData()
return list
},
playlistPannel(){
return pannelStatusList.playlist;
}
},
methods: {
toggleNewPlaylist(){
this.newSong = !this.newSong;
if (this.newSong){
this.currentPlaylist = false;
if(!this.editingSong){
this.backToDefaultPlaylist();
}
}
this.$refs.newSongBtn.style.transform = this.newSong ? 'rotate(0)' : 'rotate(45deg)';
this.$refs.currentPlaylistBtn.style.transform = this.currentPlaylist ? 'rotate(0)' : 'rotate(45deg)';
},
toggleCurrentPlaylist(){
this.currentPlaylist = !this.currentPlaylist;
if (this.currentPlaylist){
this.newSong = false;
}
this.$refs.newSongBtn.style.transform = this.newSong ? 'rotate(0)' : 'rotate(45deg)';
this.$refs.currentPlaylistBtn.style.transform = this.currentPlaylist ? 'rotate(0)' : 'rotate(45deg)';
},
backToDefaultPlaylist(){
this.track = this.playlistDefault.track;
this.artist = this.playlistDefault.artist;
this.src = this.playlistDefault.src;
this.editingSong = null;
this.newSongText = 'Nouveau Son';
},
createListEntry(){
let entry = {
track: this.track,
artist: this.artist,
src: this.src
}
return entry
},
savePlaylist(){
let entry = this.createListEntry();
if(this.editingSong){
Object.assign(this.editingSong, {
title: this.title,
href: this.href,
desc: this.desc
})
} else {
this.displayedPlaylists.push(entry);
}
this.toggleCurrentPlaylist();
this.backToDefaultPlaylist();
},
removePlaylist(obj){
let index = this.displayedPlaylists.indexOf(obj);
this.displayedPlaylists.splice(index, 1);
},
editPlaylist(obj){
console.log('selected :', obj)
this.editingSong = obj;
this.track = obj.track;
this.artist = obj.artist;
this.src = obj.src;
this.newSongText = 'Éditer les infos'
this.toggleNewPlaylist();
},
async playlistSaveMsg(){
this.playlistAlertActive = true;
this.submitPlaylistText = "Enregistré !";
clearTimeout(this.hideTimer)
this.hideTimer = setTimeout(() => {
this.eventAlertActive = false;
this.submitPlaylistText = 'SAUVEGARDER';
}, 1610)
}
},
mounted(){
this.fileInput = this.$refs.audioFile;
watch( () => this.playlistPannel, () => {
if(!this.playlistPannel){
this.newSong = false;
this.currentPlaylist = false;
}
})
console.log("Playlist editor is fully loaded!");
}
};
</script>