215 lines
6.6 KiB
Plaintext
215 lines
6.6 KiB
Plaintext
<release-details>
|
|
<div class="details">
|
|
<h2>{state.release.title}</h2>
|
|
<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>
|
|
|
|
<p if="{this.props.Type === 'master'}">{state.release.year}</p>
|
|
|
|
<a if="{this.props.Type !== 'artist' && state.release.artists?.[0]}" href={"#/release-details/artist/" + state.release.artists[0].id}>{state.release.artists[0].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'}">
|
|
<b if="{this.props.Type === 'master' && state.release.profile}">Track list</b>
|
|
<div if="{this.props.Type === 'master' && !state.release.profile}">
|
|
<h4>{state.release.message}</h4>
|
|
</div>
|
|
<ul>
|
|
<li each="{track in state.release.tracklist}">
|
|
{track.position} - {track.title} - {track.duration}
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="genres">
|
|
<span class="genre-badge" each="{genre in state.release.genres}">{genre}</span>
|
|
</div>
|
|
</div>
|
|
<div if="{this.props.Type === 'artist'}">
|
|
<h3>{state.release.name}</h3>
|
|
<h4>Biographie</h4>
|
|
{state.release.profile}
|
|
<strong if="{!state.release.profile || state.release.profile.trim() === ''}">Pas de profil</strong>
|
|
</div>
|
|
<!-- Liste des extra-artists avec liens -->
|
|
<div class="credits" if="{this.props.Type === 'release'}">
|
|
<b>Crédits :</b>
|
|
<select onchange="{goToArtist}">
|
|
<option disabled selected>-- Sélectionnez un artiste --</option>
|
|
<option each="{artist in state.resource.extraartists}" value={"#/release-details/artist/" + artist.id}>
|
|
{artist.name} - {artist.role}
|
|
</option>
|
|
</select>
|
|
</div>
|
|
<a if={this.props.Type === "release"} href={"#/release-details/master/" + state.release.master_id}><button>master</button></a>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
export default {
|
|
props: ["Type","Id"],
|
|
|
|
state: {
|
|
release: [],
|
|
resource: []
|
|
},
|
|
|
|
previousId: null,
|
|
previousType: "",
|
|
|
|
async onMounted() {
|
|
await this.loadData()
|
|
},
|
|
|
|
async onBeforeUpdate() {
|
|
if (this.props.Id !== this.previousId || this.props.Type !== this.previousType) {
|
|
await this.loadData()
|
|
}
|
|
},
|
|
|
|
async loadData() {
|
|
this.previousId = this.props.Id
|
|
this.previousType = this.props.Type
|
|
|
|
if (this.props.Type === "release") {
|
|
this.state.release = await window.getReleaseDetails(this.props.Id)
|
|
const response = await fetch(this.state.release.resource_url)
|
|
this.state.resource = await response.json()
|
|
} else if (this.props.Type === "master") {
|
|
this.state.release = await window.getMasterDetails(this.props.Id)
|
|
} else if (this.props.Type === "artist") {
|
|
this.state.release = await window.getArtistDetails(this.props.Id)
|
|
}
|
|
this.update()
|
|
},
|
|
|
|
goToArtist(e) {
|
|
const url = e.target.value;
|
|
if (url) window.location.hash = url;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.container {
|
|
display: flex;
|
|
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);
|
|
}
|
|
|
|
.cover {
|
|
width: 250px;
|
|
height: 350px;
|
|
aspect-ratio: 1 / 1; /* carré ou ajuste selon besoin */
|
|
object-fit: cover;
|
|
border-radius: 8px;
|
|
image-rendering: crisp-edges;
|
|
}
|
|
|
|
.details-right {
|
|
flex: 1;
|
|
min-width: 300px;
|
|
}
|
|
|
|
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 {
|
|
display: inline-block;
|
|
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;
|
|
}
|
|
.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;
|
|
}
|
|
|
|
</style>
|
|
</release-details> |