${albumName}
diff --git a/Astro/src/main/resources/static/js/generator/menus.js b/Astro/src/main/resources/static/js/generator/menus.js
index 392acf6..6a03900 100644
--- a/Astro/src/main/resources/static/js/generator/menus.js
+++ b/Astro/src/main/resources/static/js/generator/menus.js
@@ -59,7 +59,7 @@ document.addEventListener("DOMContentLoaded", function () {
setTimeout(() => {
notificationItem.remove();
}, 500); // Tempo do fade
- }, 5000); // Tempo antes de iniciar o fade
+ }, 3000); // Tempo antes de iniciar o fade
}
// Criação da sidebar
const sidebar = document.createElement("div");
@@ -71,7 +71,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Adicionando itens à lista
navList.appendChild(
createMenuItem(
- '
publicHome',
+ '
public',
"Home",
"home"
)
@@ -86,7 +86,7 @@ document.addEventListener("DOMContentLoaded", function () {
navList.appendChild(document.createElement("hr")); // Separator
navList.appendChild(
createMenuItem(
- '
folderBiblioteca',
+ '
folder',
"Biblioteca",
null,
true,
@@ -109,28 +109,30 @@ document.addEventListener("DOMContentLoaded", function () {
)
);
+ // Exit section
// Exit section
const exitContainer = document.createElement("div");
exitContainer.classList.add("exit-container");
const exitItem = createMenuItem(
- '
exit_to_appSair',
+ '
exit_to_app',
"Sair",
- "/",
- true, // Define como um botão
+ true,
() => {
- // Aqui você pode adicionar a lógica de logout se necessário
- window.location.href = "/"; // Redireciona para a página inicial
+ console.log("Saindo"); // Imprime mensagem no console
+ logout(); // Chama a função de logout
}
);
+ exitContainer.addEventListener("click", () => logout())
+
// Adiciona a classe logoutBtn ao botão
- exitItem.firstChild.classList.add("logoutBtn");
+ exitItem.firstChild.id = "logoutBtn";
exitContainer.appendChild(exitItem);
navList.appendChild(exitContainer);
// Montagem da lista e sidebar
sidebar.appendChild(navList);
- document.body.appendChild(sidebar);
+ document.body.prepend(sidebar);
});
diff --git a/Astro/src/main/resources/static/js/generator/navbar.js b/Astro/src/main/resources/static/js/generator/navbar.js
new file mode 100644
index 0000000..44f13fa
--- /dev/null
+++ b/Astro/src/main/resources/static/js/generator/navbar.js
@@ -0,0 +1,149 @@
+/**
+ * Função para criar a barra de navegação do Astro
+ * @ohthias
+ */
+
+const createNavigationBar = () => {
+ const nav = document.createElement("nav");
+ nav.className = "navigation-bar";
+
+ const sideLeft = document.createElement("div");
+ sideLeft.className = "side-left";
+
+ const hamburgerIcon = document.createElement("i");
+ hamburgerIcon.className = "material-icons hamburger";
+ hamburgerIcon.textContent = "menu";
+
+ const logoLink = document.createElement("a");
+ logoLink.href = "/home";
+ logoLink.className = "nav-logo bebas-neue-regular";
+ logoLink.textContent = "Astro";
+
+ sideLeft.appendChild(hamburgerIcon);
+ sideLeft.appendChild(logoLink);
+
+ // Obtém o caminho da URL atual
+ const currentPage = window.location.pathname.split("/").pop().split(".")[0]; // Ex: 'playlist' ou 'album'
+
+ // Verifica se a página atual é playlist ou álbum
+ if (currentPage === "playlist" || currentPage === "album") {
+ const navMenu = document.createElement("section");
+ navMenu.className = "nav-menu";
+ navMenu.id = "controllerNav";
+ navMenu.style.display = "none";
+
+ const controllerButtons = document.createElement("div");
+ controllerButtons.className = "controller-buttons";
+
+ const playButton = document.createElement("button");
+ playButton.id = "playButton";
+ playButton.className = "controller-button";
+ playButton.setAttribute("aria-label", "Play");
+
+ const playIcon = document.createElement("span");
+ playIcon.className = "material-symbols-outlined";
+ playIcon.textContent = "play_arrow";
+
+ playButton.appendChild(playIcon);
+
+ const favoriteButton = document.createElement("button");
+ favoriteButton.id = "favoriteButton";
+ favoriteButton.className = "controller-button";
+ favoriteButton.setAttribute("aria-label", "Favorite");
+
+ const favoriteIcon = document.createElement("span");
+ favoriteIcon.className = "material-symbols-outlined";
+ favoriteIcon.textContent = "favorite";
+
+ favoriteButton.appendChild(favoriteIcon);
+
+ controllerButtons.appendChild(playButton);
+ controllerButtons.appendChild(favoriteButton);
+ navMenu.appendChild(controllerButtons);
+
+ sideLeft.appendChild(navMenu);
+ }
+
+ const sideRight = document.createElement("div");
+ sideRight.className = "side-right";
+
+ const premiumLink = document.createElement("a");
+ premiumLink.href = "/plano";
+ premiumLink.className = "btn-shine montserrat-bold";
+ premiumLink.innerHTML = "Seja
premium";
+
+ const userLink = document.createElement("a");
+ userLink.href = "/user";
+ userLink.className = "btn-user";
+
+ const userImage = document.createElement("img");
+ userImage.src = "/images/placeholder.png";
+ userImage.alt = "placeholder";
+ userImage.className = "user-perfil";
+
+ userLink.appendChild(userImage);
+ sideRight.appendChild(premiumLink);
+ sideRight.appendChild(userLink);
+
+ nav.appendChild(sideLeft);
+ nav.appendChild(sideRight);
+
+ // Menu do hamburger
+ const overlayMenu = document.createElement("div");
+ overlayMenu.className = "overlay-menu";
+ overlayMenu.style.display = "none";
+
+ // Botão de fechar
+ const closeButton = document.createElement("button");
+ closeButton.className = "close-button";
+ closeButton.innerHTML = "×"; // Símbolo de fechar
+ closeButton.setAttribute("aria-label", "Fechar menu");
+
+ const menuItems = [
+ { name: "Home", icon: "home", link: "/home" },
+ { name: "Busca", icon: "search", link: "/busca" },
+ { name: "Sair", icon: "logout", link: "/" },
+ ];
+
+ menuItems.forEach((item) => {
+ const menuItem = document.createElement("a");
+ menuItem.href = item.link;
+
+ const itemIcon = document.createElement("span");
+ itemIcon.className = "material-icons";
+ itemIcon.textContent = item.icon;
+
+ menuItem.appendChild(itemIcon);
+ menuItem.appendChild(document.createTextNode(item.name));
+ menuItem.className = "menu-item montserrat-bold";
+
+ if (item.name === "Sair") {
+ menuItem.classList.add("logoutBtn");
+ }
+
+ overlayMenu.appendChild(menuItem);
+ });
+
+ overlayMenu.appendChild(closeButton); // Adiciona o botão de fechar
+ document.body.appendChild(nav);
+ document.body.appendChild(overlayMenu);
+
+ // Evento para mostrar/ocultar o menu
+ hamburgerIcon.addEventListener("click", () => {
+ overlayMenu.style.display = "flex"; // Torna o menu visível
+ setTimeout(() => {
+ overlayMenu.classList.add("visible"); // Adiciona a classe de visibilidade após a exibição
+ }, 10); // Delay para permitir a aplicação da transição
+ });
+
+ // Evento para fechar o menu
+ closeButton.addEventListener("click", () => {
+ overlayMenu.classList.remove("visible");
+ setTimeout(() => {
+ overlayMenu.style.display = "none";
+ }, 300);
+ });
+};
+
+// Chamar a função para gerar a barra de navegação
+createNavigationBar();
diff --git a/Astro/src/main/resources/static/js/generator/player.js b/Astro/src/main/resources/static/js/generator/player.js
index 0895950..f68d1c5 100644
--- a/Astro/src/main/resources/static/js/generator/player.js
+++ b/Astro/src/main/resources/static/js/generator/player.js
@@ -1,121 +1,147 @@
-document.addEventListener("DOMContentLoaded", function () {
- // Criação da estrutura do player
- const containerPlayer = document.createElement("div");
- containerPlayer.classList.add("container_player");
-
- const player = document.createElement("div");
- player.classList.add("player");
-
- // Seção esquerda do player
- const sideLeft = document.createElement("div");
- sideLeft.classList.add("side-left");
-
- const playerImage = document.createElement("div");
- playerImage.classList.add("player_image");
- const imgSong = document.createElement("img");
- imgSong.id = "imgSong";
- imgSong.src = "https://fakeimg.pl/210x210/e9e9e9/e9e9e9";
- imgSong.alt = "Song_Image";
- playerImage.appendChild(imgSong);
-
- const playerInfoMusic = document.createElement("div");
- playerInfoMusic.classList.add("player_infoMusic");
- const musicName = document.createElement("span");
- musicName.id = "musicName";
- musicName.classList.add("montserrat-bold");
- musicName.textContent = "Título da Música";
- const artistName = document.createElement("span");
- artistName.id = "artistName";
- artistName.classList.add("montserrat-regular");
- artistName.textContent = "Artista";
- playerInfoMusic.appendChild(musicName);
- playerInfoMusic.appendChild(artistName);
-
- sideLeft.appendChild(playerImage);
- sideLeft.appendChild(playerInfoMusic);
-
- // Seção dos controles do usuário
- const userPrefers = document.createElement("div");
- userPrefers.classList.add("user-prefers");
-
- const heartMusic = document.createElement("button");
- heartMusic.id = "heartMusic";
- heartMusic.innerHTML = '
favorite';
-
- const prevButton = document.createElement("button");
- prevButton.id = "prevButton";
- prevButton.innerHTML = '
skip_previous';
-
- const playPauseButton = document.createElement("button");
- playPauseButton.id = "playPauseButton";
- playPauseButton.innerHTML = '
play_arrow';
-
- const nextButton = document.createElement("button");
- nextButton.id = "nextButton";
- nextButton.innerHTML = '
skip_next';
-
- const randomPlayerMusic = document.createElement("button");
- randomPlayerMusic.id = "randomPlayerMusic";
- randomPlayerMusic.innerHTML = '
shuffle';
-
- userPrefers.appendChild(heartMusic);
- userPrefers.appendChild(prevButton);
- userPrefers.appendChild(playPauseButton);
- userPrefers.appendChild(nextButton);
- userPrefers.appendChild(randomPlayerMusic);
-
- // Audio player
- const audioPlayer = document.createElement("audio");
- audioPlayer.id = "player";
- audioPlayer.src = "";
-
- // Barra de progresso e tempo
- const timecodePlayer = document.createElement("div");
- timecodePlayer.classList.add("timecode_player");
-
- const currentTime = document.createElement("span");
- currentTime.id = "currentTime";
- currentTime.classList.add("montserrat-medium");
- currentTime.textContent = "0:00";
-
- const progressBar = document.createElement("div");
- progressBar.classList.add("progress-bar");
- progressBar.id = "progressBar";
- progressBar.style.cursor = "pointer";
- const progress = document.createElement("div");
- progress.classList.add("progress");
- progressBar.appendChild(progress);
-
- const duration = document.createElement("span");
- duration.id = "duration";
- duration.classList.add("montserrat-medium");
- duration.textContent = "0:00";
-
- timecodePlayer.appendChild(currentTime);
- timecodePlayer.appendChild(progressBar);
- timecodePlayer.appendChild(duration);
-
- // Controle de volume
- const volumeControl = document.createElement("div");
- volumeControl.classList.add("volume-control");
- const volumeSlider = document.createElement("input");
- volumeSlider.type = "range";
- volumeSlider.id = "volumeSlider";
- volumeSlider.min = "0";
- volumeSlider.max = "1";
- volumeSlider.step = "0.01";
- volumeSlider.value = "1";
- volumeControl.appendChild(volumeSlider);
-
- // Montagem da estrutura do player
- player.appendChild(sideLeft);
- player.appendChild(userPrefers);
- player.appendChild(audioPlayer);
- player.appendChild(timecodePlayer);
- player.appendChild(volumeControl);
-
- containerPlayer.appendChild(player);
-
- // Adiciona a estrutura na página
- document.body.appendChild(containerPlayer);
-});
+// Criação da estrutura HTML usando JavaScript
+const containerPlayer = document.createElement("div");
+containerPlayer.className = "container_player";
+
+const player = document.createElement("div");
+player.className = "player";
+
+const sideLeft = document.createElement("div");
+sideLeft.className = "side-left";
+
+const playerImage = document.createElement("div");
+playerImage.className = "player_image";
+
+const imgSong = document.createElement("img");
+imgSong.id = "imgSong";
+imgSong.src = "https://fakeimg.pl/210x210/e9e9e9/e9e9e9";
+imgSong.alt = "Song_Image";
+playerImage.appendChild(imgSong);
+
+const playerInfoMusic = document.createElement("div");
+playerInfoMusic.className = "player_infoMusic";
+
+const musicName = document.createElement("span");
+musicName.id = "musicName";
+musicName.className = "montserrat-bold";
+musicName.textContent = "Título da Música";
+
+const artistName = document.createElement("span");
+artistName.id = "artistName";
+artistName.className = "montserrat-regular";
+artistName.textContent = "Artista";
+
+playerInfoMusic.appendChild(musicName);
+playerInfoMusic.appendChild(artistName);
+sideLeft.appendChild(playerImage);
+sideLeft.appendChild(playerInfoMusic);
+player.appendChild(sideLeft);
+
+// Controles de usuário
+const userPrefers = document.createElement("div");
+userPrefers.className = "user-prefers";
+
+const heartMusicButton = document.createElement("button");
+heartMusicButton.id = "heartMusic";
+const heartIcon = document.createElement("span");
+heartIcon.className = "material-symbols-outlined heart";
+heartIcon.textContent = "favorite";
+heartMusicButton.appendChild(heartIcon);
+
+const prevButton = document.createElement("button");
+prevButton.id = "prevButton";
+const prevIcon = document.createElement("span");
+prevIcon.className = "material-symbols-outlined skip_previous";
+prevIcon.textContent = "skip_previous";
+prevButton.appendChild(prevIcon);
+
+const playPauseButton = document.createElement("button");
+playPauseButton.id = "playPauseButton";
+const playIcon = document.createElement("span");
+playIcon.className = "material-symbols-outlined play_arrow";
+playIcon.textContent = "play_arrow";
+playPauseButton.appendChild(playIcon);
+
+const nextButton = document.createElement("button");
+nextButton.id = "nextButton";
+const nextIcon = document.createElement("span");
+nextIcon.className = "material-symbols-outlined skip_next";
+nextIcon.textContent = "skip_next";
+nextButton.appendChild(nextIcon);
+
+const randomPlayerMusicButton = document.createElement("button");
+randomPlayerMusicButton.id = "randomPlayerMusic";
+const shuffleIcon = document.createElement("span");
+shuffleIcon.className = "material-symbols-outlined shuffle";
+shuffleIcon.textContent = "shuffle";
+randomPlayerMusicButton.appendChild(shuffleIcon);
+
+userPrefers.appendChild(heartMusicButton);
+userPrefers.appendChild(prevButton);
+userPrefers.appendChild(playPauseButton);
+userPrefers.appendChild(nextButton);
+userPrefers.appendChild(randomPlayerMusicButton);
+player.appendChild(userPrefers);
+
+// Player de áudio
+const audioPlayer = document.createElement("audio");
+audioPlayer.id = "player";
+audioPlayer.src = "";
+player.appendChild(audioPlayer);
+
+// Barra de progresso e tempo
+const timecodePlayer = document.createElement("div");
+timecodePlayer.className = "timecode_player";
+
+const currentTime = document.createElement("span");
+currentTime.id = "currentTime";
+currentTime.className = "montserrat-medium";
+currentTime.textContent = "0:00";
+
+const progressBar = document.createElement("div");
+progressBar.className = "progress-bar";
+progressBar.id = "progressBar";
+progressBar.style.cursor = "pointer";
+
+const progress = document.createElement("div");
+progress.className = "progress";
+progressBar.appendChild(progress);
+
+const duration = document.createElement("span");
+duration.id = "duration";
+duration.className = "montserrat-medium";
+duration.textContent = "0:00";
+
+timecodePlayer.appendChild(currentTime);
+timecodePlayer.appendChild(progressBar);
+timecodePlayer.appendChild(duration);
+player.appendChild(timecodePlayer);
+
+// Controle de volume
+const volumeControl = document.createElement("div");
+volumeControl.className = "volume-control";
+
+const volumeIcon = document.createElement("span");
+volumeIcon.className = "material-symbols-outlined volume_up";
+volumeIcon.textContent = "volume_up";
+
+const volumeToolkit = document.createElement("div");
+volumeToolkit.className = "volume-toolkit";
+
+const volumeSlider = document.createElement("input");
+volumeSlider.type = "range";
+volumeSlider.id = "volumeSlider";
+volumeSlider.min = "0";
+volumeSlider.max = "1";
+volumeSlider.step = "0.01";
+volumeSlider.value = "1";
+
+volumeToolkit.appendChild(volumeSlider);
+volumeControl.appendChild(volumeIcon);
+volumeControl.appendChild(volumeToolkit);
+player.appendChild(volumeControl);
+
+// Adiciona o player ao container
+containerPlayer.appendChild(player);
+
+// Adiciona o container ao body (ou outro elemento desejado)
+document.body.appendChild(containerPlayer);
diff --git a/Astro/src/main/resources/static/js/home.js b/Astro/src/main/resources/static/js/home.js
index d35b12b..db1cf80 100644
--- a/Astro/src/main/resources/static/js/home.js
+++ b/Astro/src/main/resources/static/js/home.js
@@ -2,15 +2,13 @@ const getTokenFromLocalStorage = () => {
return localStorage.getItem('authToken'); // Obtém o token do localStorage
}
-// Função para decodificar o token JWT
const parseJwt = (token) => {
try {
const base64Url = token.split('.')[1]; // Obtém o payload (a segunda parte do token)
- const base64 = decodeURIComponent(atob(base64Url).split('').map(function(c) {
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
- }).join(''));
+ const base64 = atob(base64Url); // Decodifica o Base64
+ const jsonPayload = decodeURIComponent(escape(base64)); // Corrige problemas de codificação
- return JSON.parse(base64); // Retorna o payload como um objeto JavaScript
+ return JSON.parse(jsonPayload); // Retorna o payload como um objeto JavaScript
} catch (error) {
console.error("Erro ao decodificar o token JWT", error);
return null;
@@ -27,18 +25,20 @@ document.addEventListener("DOMContentLoaded", function () {
if (decodedToken) {
// Obtém o nome de usuário do token decodificado (supondo que esteja no campo 'sub')
+
const userName = decodedToken.sub || "Nome não disponível";
const userEmail = decodedToken.email || "Email não disponível";
const userCreationDate = decodedToken.iat ? new Date(decodedToken.iat * 1000).toLocaleDateString() : "Data de criação não disponível";
// Exibindo as informações no HTML
document.getElementById("userNameAcess").innerHTML = userName;
- document.getElementById("userEmail").innerHTML = userEmail;
- document.getElementById("userCreationDate").innerHTML = userCreationDate;
+ document.querySelector("input#userNameAcess").value = userName;
+ document.getElementById("userEmail").value = userEmail;
+
} else {
console.error("Falha ao decodificar o token.");
}
} else {
console.error("Token não encontrado no localStorage.");
}
-});
\ No newline at end of file
+});
diff --git a/Astro/src/main/resources/static/js/playlist.js b/Astro/src/main/resources/static/js/playlist.js
index 6ad3d11..6823ae2 100644
--- a/Astro/src/main/resources/static/js/playlist.js
+++ b/Astro/src/main/resources/static/js/playlist.js
@@ -73,13 +73,10 @@ const displayPlaylistData = (playlistData) => {
playlistImage.alt = playlistData.name;
playlistImage.classList.add("album-image");
- const playlistTitleNav = document.getElementById("albumTitleNav");
- playlistTitleNav.textContent = playlistData.name;
- const playlistTitle = document.getElementById("albumTitleElement");
- playlistTitle.textContent = playlistData.name;
+ document.getElementById("playlistName").innerHTML = playlistData.name
const playlistOwner = document.getElementById("albumArtistElement");
- playlistOwner.textContent = playlistData.owner.display_name;
- playlistOwner.href = `user.html?username=${playlistData.name}`;
+ playlistOwner.innerHTML = playlistData.owner.display_name
+ playlistOwner.href = `user?id=${playlistData.id}`;
// Criar a lista de faixas
const trackList = document.createElement("ul");
@@ -132,7 +129,7 @@ const displayPlaylistData = (playlistData) => {
const trackArtists = document.createElement("a");
trackArtists.classList.add("montserrat-regular");
- trackArtists.href = `artist.html?id=${track.artists[0].id}`;
+ trackArtists.href = `/artist?id=${track.artists[0].id}`;
let artistNames = track.artists[0].name;
if (track.artists.length > 1) {
for (let i = 1; i < track.artists.length; i++) {
diff --git a/Astro/src/main/resources/static/js/search/search.js b/Astro/src/main/resources/static/js/search/search.js
index 950338d..363da8d 100644
--- a/Astro/src/main/resources/static/js/search/search.js
+++ b/Astro/src/main/resources/static/js/search/search.js
@@ -1,82 +1,98 @@
const searchArtists = async (query) => {
- try {
- const response = await fetch(`/api/spotify/search?query=${encodeURIComponent(query)}`);
- if (!response.ok) {
- throw new Error("Network response was not ok");
- }
- const data = await response.json();
- exibirResultados(data);
- } catch (error) {
- console.error("Erro ao buscar dados da API Spotify", error);
+ try {
+ const response = await fetch(
+ `/api/spotify/search?query=${encodeURIComponent(query)}`
+ );
+ if (!response.ok) {
+ throw new Error("Network response was not ok");
}
- };
+ const data = await response.json();
+ exibirResultados(data);
+ } catch (error) {
+ console.error("Erro ao buscar dados da API Spotify", error);
+ }
+};
- const exibirResultados = (data) => {
- const listaArtistas = document.getElementById("lista-artistas");
- const listaMusicas = document.getElementById("lista-musicas");
- const listaPlaylists = document.getElementById("lista-playlists");
+const exibirResultados = (data) => {
+ const listaArtistas = document.getElementById("lista-artistas");
+ const listaMusicas = document.getElementById("lista-musicas");
+ const listaPlaylists = document.getElementById("lista-playlists");
- listaArtistas.innerHTML = ""; // Limpa a lista de artistas
- listaMusicas.innerHTML = ""; // Limpa a lista de músicas
- listaPlaylists.innerHTML = ""; // Limpa a lista de playlists
+ listaArtistas.innerHTML = ""; // Limpa a lista de artistas
+ listaMusicas.innerHTML = ""; // Limpa a lista de músicas
+ listaPlaylists.innerHTML = ""; // Limpa a lista de playlists
- // Exibir artistas
- if (data.artists && data.artists.items.length > 0) {
- data.artists.items.forEach(artista => {
- const item = document.createElement('a');
- item.href = `./artist?id=${artista.id}`
- item.classList.add("track-item")
- const imagemUrl = artista.images.length > 0 ? artista.images[0].url : 'https://via.placeholder.com/50';
- item.innerHTML = `
+ // Exibir artistas
+ if (data.artists && data.artists.items.length > 0) {
+ data.artists.items.forEach((artista) => {
+ const item = document.createElement("a");
+ item.href = `./artist?id=${artista.id}`;
+ item.classList.add("track-item");
+ const imagemUrl =
+ artista.images.length > 0
+ ? artista.images[0].url
+ : "https://via.placeholder.com/50";
+ item.innerHTML = `
${artista.name}
`;
- listaArtistas.appendChild(item);
- });
- }
+ listaArtistas.appendChild(item);
+ });
+ }
- // Exibir músicas
- if (data.tracks && data.tracks.items.length > 0) {
- data.tracks.items.forEach(musica => {
- const item = document.createElement('div');
- item.classList.add("track-item")
- const imagemUrl = musica.album.images.length > 0 ? musica.album.images[0].url : 'https://via.placeholder.com/50';
- item.innerHTML = `
-
-
-
${musica.name}
-
${musica.name}
-
- `;
- listaMusicas.appendChild(item);
- });
- }
+ // Exibir músicas
+ if (data.tracks && data.tracks.items.length > 0) {
+ data.tracks.items.forEach((musica) => {
+ const item = document.createElement("div");
+ item.classList.add("track-item");
+ const imagemUrl =
+ musica.album.images.length > 0
+ ? musica.album.images[0].url
+ : "https://via.placeholder.com/50";
- // Exibir playlists
- if (data.playlists && data.playlists.items.length > 0) {
- data.playlists.items.forEach(playlist => {
- const item = document.createElement('a');
- item.href = `/playlist?id=${playlist.id}`
- item.classList.add("track-item")
- const imagemUrl = playlist.images.length > 0 ? playlist.images[0].url : 'https://via.placeholder.com/50';
- item.innerHTML = `
+ // Mapear os nomes dos artistas
+ const artistas = musica.artists.map((artista) => artista.name).join(", ");
+
+ item.innerHTML = `
+
+
+
${musica.name}
+
${artistas}
+
+ `;
+ listaMusicas.appendChild(item);
+ });
+ }
+
+ // Exibir playlists
+ if (data.playlists && data.playlists.items.length > 0) {
+ data.playlists.items.forEach((playlist) => {
+ const item = document.createElement("a");
+ item.href = `/playlist?id=${playlist.id}`;
+ item.classList.add("track-item");
+ const imagemUrl =
+ playlist.images.length > 0
+ ? playlist.images[0].url
+ : "https://via.placeholder.com/50";
+ item.innerHTML = `
${playlist.name}
Criado por: ${playlist.owner.display_name}
`;
- listaPlaylists.appendChild(item);
- });
- }
- };
+ listaPlaylists.appendChild(item);
+ });
+ }
+};
- // Listener para a barra de busca
- document.querySelector('#search').addEventListener('input', (event) => {
- const query = event.target.value;
- if (query.length > 2) { // Apenas busca se o tamanho for maior que 2
- searchArtists(query);
- }
- });
\ No newline at end of file
+// Listener para a barra de busca
+document.querySelector("#search").addEventListener("input", (event) => {
+ const query = event.target.value;
+ if (query.length > 2) {
+ // Apenas busca se o tamanho for maior que 2
+ searchArtists(query);
+ }
+});
diff --git a/Astro/src/main/resources/static/js/swipe.js b/Astro/src/main/resources/static/js/swipe.js
index 424b0a5..0c461a6 100644
--- a/Astro/src/main/resources/static/js/swipe.js
+++ b/Astro/src/main/resources/static/js/swipe.js
@@ -3,12 +3,34 @@ document.addEventListener("DOMContentLoaded", function () {
swipers.forEach((swiperContainer) => {
const swiper = new Swiper(swiperContainer, {
- slidesPerView: 7,
+ slidesPerView: 7, // Valor padrão para telas maiores
spaceBetween: 10,
navigation: {
nextEl: swiperContainer.querySelector(".swiper-button-next"),
prevEl: swiperContainer.querySelector(".swiper-button-prev"),
},
+ breakpoints: {
+ 320: {
+ slidesPerView: 2, // Para telas muito pequenas
+ spaceBetween: 10,
+ },
+ 420: {
+ slidesPerView: 3, // Para telas pequenas
+ spaceBetween: 10,
+ },
+ 550: {
+ slidesPerView: 4, // Para tablets
+ spaceBetween: 10,
+ },
+ 1024: {
+ slidesPerView: 6, // Para laptops
+ spaceBetween: 10,
+ },
+ 1440: {
+ slidesPerView: 7, // Para telas grandes
+ spaceBetween: 10,
+ },
+ },
});
});
-});
\ No newline at end of file
+});
diff --git a/Astro/src/main/resources/static/js/theme.js b/Astro/src/main/resources/static/js/theme.js
new file mode 100644
index 0000000..55fd200
--- /dev/null
+++ b/Astro/src/main/resources/static/js/theme.js
@@ -0,0 +1,7 @@
+document.addEventListener("DOMContentLoaded", () => {
+ const rootElement = document.documentElement;
+ const theme = localStorage.getItem("theme"); // Obtendo o tema armazenado
+ if (theme) {
+ rootElement.classList.add(theme); // Adicionando a classe com o tema armazenado
+ }
+});
\ No newline at end of file
diff --git a/Astro/src/main/resources/static/js/token.js b/Astro/src/main/resources/static/js/token.js
index 491e794..58b637c 100644
--- a/Astro/src/main/resources/static/js/token.js
+++ b/Astro/src/main/resources/static/js/token.js
@@ -26,9 +26,9 @@ document.addEventListener('DOMContentLoaded', addTokenToLinks);
// Função para logout (chamada pelo botão de logout)
function logout() {
+ window.confirm("Você realmente quer sair?")
localStorage.removeItem('authToken'); // Remove o token do armazenamento local
+ localStorage.removeItem('theme')
+ localStorage.removeItem('driveInitialized')
window.location.href = '/login'; // Redireciona para a página de login
-}
-
-// Adiciona o evento de logout ao botão de logout
-document.getElementById('logoutBtn').addEventListener('click', logout);
+}
\ No newline at end of file
diff --git a/Astro/src/main/resources/static/js/userInfo.js b/Astro/src/main/resources/static/js/userInfo.js
new file mode 100644
index 0000000..2a46f5b
--- /dev/null
+++ b/Astro/src/main/resources/static/js/userInfo.js
@@ -0,0 +1,27 @@
+const rootElement = document.documentElement;
+
+document.getElementById("defaultTheme").addEventListener("click", () => {
+ changeTheme();
+});
+
+document.getElementById("lightMode").addEventListener("click", () => {
+ changeTheme("light");
+});
+
+document.getElementById("darkMode").addEventListener("click", () => {
+ changeTheme("dark");
+});
+
+document.getElementById("oceanMode").addEventListener("click", () => {
+ changeTheme("ocean");
+});
+
+document.getElementById("fireMode").addEventListener("click", () => {
+ changeTheme("fire");
+});
+
+function changeTheme(themeClass) {
+ rootElement.className = ""; // Remove all previous classes
+ rootElement.classList.add(themeClass); // Add the new theme class
+ localStorage.setItem("theme", themeClass)
+}
diff --git a/Astro/src/main/resources/templates/404.html b/Astro/src/main/resources/templates/404.html
index 4fe1f16..c799e26 100644
--- a/Astro/src/main/resources/templates/404.html
+++ b/Astro/src/main/resources/templates/404.html
@@ -1,13 +1,13 @@
-
+
Erro
-
-
-
-
+
+
+
+
diff --git a/Astro/src/main/resources/templates/album.html b/Astro/src/main/resources/templates/album.html
index fd1437b..537b2a5 100644
--- a/Astro/src/main/resources/templates/album.html
+++ b/Astro/src/main/resources/templates/album.html
@@ -50,106 +50,6 @@
-
-
-
-
-
-
-
-
-
-
- Título da Música
- Artista
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
diff --git a/Astro/src/main/resources/templates/artist.html b/Astro/src/main/resources/templates/artist.html
index afe0b00..c125236 100644
--- a/Astro/src/main/resources/templates/artist.html
+++ b/Astro/src/main/resources/templates/artist.html
@@ -1,12 +1,13 @@
-
+
Astro
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
- Título da Música
- Artista
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -186,12 +108,15 @@
Estrelas similares
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/Astro/src/main/resources/templates/busca.html b/Astro/src/main/resources/templates/busca.html
index 2f3c362..ede29fe 100644
--- a/Astro/src/main/resources/templates/busca.html
+++ b/Astro/src/main/resources/templates/busca.html
@@ -1,5 +1,5 @@
-
+
@@ -39,97 +39,18 @@
href="https://unpkg.com/swiper/swiper-bundle.min.css"
/>
-
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
- Título da Música
- Artista
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
search
@@ -157,9 +78,12 @@
Playlists
-
-
+
+
+
+
+
diff --git a/Astro/src/main/resources/templates/error.html b/Astro/src/main/resources/templates/error.html
index d2bacfe..873470b 100644
--- a/Astro/src/main/resources/templates/error.html
+++ b/Astro/src/main/resources/templates/error.html
@@ -1,12 +1,13 @@
-
+