Files
SAE_riot/components/release-details.riot

192 lines
5.4 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>
2025-04-02 21:48:33 +02:00
<!-- Liste des extra-artists avec liens -->
2025-04-02 22:08:48 +02:00
<div class="credits" if="{this.props.Type === 'release'}">
2025-04-02 21:48:33 +02:00
<b>Crédits :</b>
<ul>
2025-04-02 22:13:20 +02:00
<li each="{artist in state.resource.extraartists}">
2025-04-02 21:52:38 +02:00
<a href={"#/release-details/artist/" + artist.id } target="_blank">{artist.name} - {artist.role}</a>
2025-04-02 22:13:20 +02:00
{console.log(state.resource)}
2025-04-02 21:48:33 +02:00
</li>
</ul>
</div>
2025-03-28 13:53:35 +01:00
</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: [],
2025-04-02 21:48:33 +02:00
resource: []
2025-03-28 13:53:35 +01:00
},
async onMounted() {
2025-03-31 13:15:47 +02:00
const id = this.props.Id
if(this.props.Type === "release"){
2025-04-02 21:54:43 +02:00
this.state.release = await window.getReleaseDetails(id);
2025-04-02 21:48:33 +02:00
// Récupérer les extra-artists depuis leur URL
2025-04-02 21:58:37 +02:00
const response = await fetch(this.state.release.resource_url);
2025-04-02 22:11:08 +02:00
this.state.resource = await response.json();
2025-03-31 13:15:47 +02:00
}
2025-04-02 21:54:43 +02:00
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
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:51:16 +02:00
width: 250px;
height: 350px;
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:52:22 +02:00
image-rendering: crisp-edges;
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
}
2025-04-02 22:08:48 +02:00
.credits {
margin-top: 1.5rem;
padding-top: 1rem;
border-top: 1px solid #ddd;
}
.credits b {
font-size: 1.2rem;
color: #1976d2;
}
.credits ul {
list-style: none;
padding: 0;
margin: 0.5rem 0 0;
}
.credits li {
font-size: 0.95rem;
margin-bottom: 0.4rem;
}
.credits a {
color: #1976d2;
text-decoration: none;
font-weight: bold;
}
.credits a:hover {
text-decoration: underline;
}
2025-03-28 13:53:35 +01:00
</style>
</release-details>