Files
SAE_riot/components/release-details.riot

149 lines
4.2 KiB
Plaintext
Raw Normal View History

2025-03-28 13:53:35 +01:00
<release-details>
<div class="details">
<h2>{state.release.title}</h2>
2025-03-31 13:15:47 +02:00
<p if="{this.props.Type === 'release'}">{state.release.formats?.[0]?.name}-{state.release.year}</p>
<p if="{this.props.Type === 'release'}">{state.release.community?.rating?.average}({state.release.community?.rating?.count}vote)</p>
2025-03-28 13:53:35 +01:00
2025-03-31 13:15:47 +02:00
<p if="{this.props.Type === 'master'}">{state.release.year}</p>
<p if="{this.props.Type === 'master'}">{state.release.name}</p>
<div class="container">
<img class="cover" if="{this.props.Type === 'master'}" src="{state.release.image?.[0]?.resource_url}" alt="{state.release.title}" />
<img class="cover" if="{this.props.Type !== 'master'}" src="{state.release.thumb}" alt="{state.release.title}" />
<div class="details-right" if="{this.props.Type !== 'artist'}">
2025-03-28 13:53:35 +01:00
<b>Track list</b>
<ul>
<li each="{track in state.release.tracklist}">
{track.position} - {track.title} - {track.duration}
</li>
</ul>
<div class="genres">
2025-03-31 13:15:47 +02:00
<span class="genre-badge" each="{genre in state.release.genres}">{genre}</span>
2025-03-28 13:53:35 +01:00
</div>
</div>
2025-03-31 13:15:47 +02:00
<div if="{this.props.Type === 'artist'}">
2025-03-28 13:53:35 +01:00
{state.release.profile}
</div>
</div>
</div>
<script>
export default {
2025-03-31 13:15:47 +02:00
props: ["Type","Id"],
2025-03-28 13:53:35 +01:00
state: {
release: [],
},
async onMounted() {
2025-03-31 13:15:47 +02:00
const id = this.props.Id
console.log(this.props.Id)
console.log(this.props.Type)
if(this.props.Type === "release"){
this.state.release = await window.getReleaseDetails(id)
}
else if (this.props.Type === "master"){
this.state.release = await window.getMasterDetails(id)
}
else{
this.state.release = await window.getArtistDetails(id)
}
2025-03-28 13:53:35 +01:00
console.log("resultat", this.state.release)
this.update()
}
}
</script>
<style>
2025-03-31 13:15:47 +02:00
.container {
2025-03-28 13:53:35 +01:00
display: flex;
2025-03-31 13:15:47 +02:00
flex-wrap: wrap;
gap: 2rem;
max-width: 1000px;
margin: 2rem auto;
padding: 1.5rem;
background: #fff;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
2025-03-28 13:53:35 +01:00
}
2025-03-31 13:15:47 +02:00
.cover {
2025-04-02 20:47:21 +02:00
width: 300px;
height: 100px;
2025-03-31 13:15:47 +02:00
aspect-ratio: 1 / 1; /* carré ou ajuste selon besoin */
object-fit: cover;
border-radius: 8px;
2025-04-02 20:41:53 +02:00
image-rendering: high-quality;
2025-03-28 13:53:35 +01:00
}
2025-03-31 13:15:47 +02:00
.details-right {
flex: 1;
min-width: 300px;
2025-03-28 13:53:35 +01:00
}
2025-03-31 13:15:47 +02:00
h2 {
font-size: 2rem;
margin-bottom: 1rem;
color: #1976d2;
}
p {
margin: 0.75rem 0;
line-height: 1.6;
font-size: 1rem;
}
.format {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
margin: 1rem 0;
}
.format span {
background: #e3f2fd;
padding: 0.3rem 0.7rem;
border-radius: 5px;
font-size: 0.9rem;
color: #1976d2;
}
.tracklist {
margin-top: 1.5rem;
}
.tracklist h3 {
font-size: 1.3rem;
margin-bottom: 0.5rem;
}
.tracklist ul {
list-style: none;
padding-left: 1rem;
margin: 0;
}
.tracklist li {
margin-bottom: 0.4rem;
font-size: 0.95rem;
}
.genres {
margin-top: 1.5rem;
}
.genre-badge {
2025-03-28 13:53:35 +01:00
display: inline-block;
2025-03-31 13:15:47 +02:00
background-color: #e0e0e0;
color: #333;
padding: 0.4rem 0.8rem;
border-radius: 20px;
font-size: 0.85rem;
margin-right: 0.5rem;
margin-bottom: 0.3rem;
2025-03-28 13:53:35 +01:00
}
</style>
</release-details>