quasiment fini

This commit is contained in:
2025-03-31 13:15:47 +02:00
parent b5bed05929
commit eabc11d2cc
7 changed files with 374 additions and 202 deletions

View File

@@ -40,10 +40,10 @@
<div class="results-grid">
<div class="card" each="{item in searchs.items}">
<!-- Afficher l'étoile avec la musique immédiatement -->
<a if={authUser} onclick={() => item.isFavorite ? this.removeFavoris(item.id) : this.addFavoris(item.id)}>
<a if={authUser && this.searchs.type !== "artist"} onclick={() => item.isFavorite ? this.removeFavoris(item.id) : this.addFavoris(item.id)}>
<button><i class={item.isFavorite ? "fa-solid fa-star" : "fa-regular fa-star"}></i></button>
</a>
<a href={ "#/release-details/" + item.id}>
<a href={ "#/release-details/" + item.type + "/" + item.id}>
{item.title}
<img src="{item.cover_image}" alt="cover" />
<div if="{item.type !=='artist' } ">
@@ -51,13 +51,14 @@
<footer>{item.community.want}<i class="fa-solid fa-check"></i> {item.community.have}<i class="fa-regular fa-heart"></i></footer>
</div>
</a>
<a if={this.searchs.type === "release"} href={"#/release-details/master/" + item.master_id}><button>master</button></a>
</div>
</div>
</div>
</route>
<route path="#/release-details/:id">
<release-details releaseid={route.params.id}></release-details>
<route path="#/release-details/:type/:id">
<release-details Type={route.params.type} Id={route.params.id}></release-details>
</route>
<route path="#/favoris">
<favorites></favorites>
@@ -80,7 +81,8 @@
searchs: {
items: [],
pagination: [],
type: null,
type: "release",
query: ""
},
async search(e, page = 1) {
@@ -88,7 +90,6 @@
const type = e?.target?.type?.value || this.searchs.type;
const query = e?.target?.query?.value || this.searchs.query;
if (!query) return;
const result = await window.discogsearch(query, type, page);
console.log(result);
@@ -119,6 +120,8 @@
this.authUser = user;
this.update();
});
this.search(null, 1);
this.update();
},
addFavoris(id) {
@@ -153,81 +156,84 @@
max-width: 1200px;
margin: auto;
}
form {
display: flex;
gap: 10px;
margin-bottom: 20px;
}
.results-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 15px;
}
.card {
border: 1px solid #ccc;
padding: 10px;
text-align: center;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
footer {
justify-content: space-between;
align-items: center;
}
img {
width: 100%;
height: auto;
border-radius: 4px;
margin-bottom: 10px;
}
h4 {
font-size: 1rem;
margin: 5px 0;
}
a {
text-decoration: none;
color: #007bff;
}
nav {
display: flex;
justify-content: space-around;
background: #1976d2;
padding: 1rem;
}
button {
color: white;
background-color: #2196f3;
border: none;
font-weight: bold;
cursor: pointer;
padding: 0.5em 1em;
border-radius: 5px;
margin: 0.5em;
transition: background-color 0.3s ease;
flex-wrap: wrap;
}
button:hover {
background-color: #1769aa;
text-decoration: none;
form select,
form input {
padding: 0.6rem;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 1rem;
}
nav {
form button {
background-color: #1976d2;
padding: 1rem;
color: white;
padding: 0.6rem 1.2rem;
border: none;
border-radius: 6px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s;
}
form button:hover {
background-color: #125aa3;
}
.results-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 1rem;
padding: 1rem;
}
.card {
background: white;
border-radius: 10px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
padding: 1rem;
text-align: center;
transition: transform 0.2s ease;
}
.card:hover {
transform: translateY(-4px);
}
.card img {
width: 100%;
border-radius: 6px;
margin-bottom: 0.5rem;
}
.card h4 {
font-size: 1.1rem;
margin: 0.5rem 0;
}
footer {
display: flex;
justify-content: space-between;
align-items: center;
justify-content: space-around;
font-size: 0.9rem;
color: #666;
margin-top: 0.5rem;
}
.card a i.fa-star {
color: #fbc02d;
font-size: 1.3rem;
transition: transform 0.2s ease;
}
.card a i.fa-star:hover {
transform: scale(1.2);
}
.pagination {
@@ -237,11 +243,35 @@
gap: 1rem;
margin-bottom: 2rem;
}
.pagination button {
background-color: #1976d2;
color: white;
padding: 0.5rem 1rem;
border: none;
border-radius: 6px;
cursor: pointer;
transition: background-color 0.3s;
}
.pagination button:hover {
background-color: #125aa3;
}
nav {
background-color: #1976d2;
padding: 1rem;
color: white;
display: flex;
justify-content: space-between;
align-items: center;
}
nav a {
margin: 0 10px;
color: white;
text-decoration: none;
}
</style>
</app>