Initial dev export (exclude uploads/runtime)
This commit is contained in:
239
plugins/artists/views/site/show.php
Normal file
239
plugins/artists/views/site/show.php
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
use Core\Services\Settings;
|
||||
|
||||
$pageTitle = $title ?? 'Artist';
|
||||
$artist = $artist ?? null;
|
||||
$proUrl = Settings::get('fontawesome_pro_url', '');
|
||||
$faUrl = $proUrl !== '' ? $proUrl : Settings::get('fontawesome_url', '');
|
||||
$hasPro = $proUrl !== '';
|
||||
$hasIcons = $faUrl !== '';
|
||||
$artistReleases = is_array($artist_releases ?? null) ? $artist_releases : [];
|
||||
$socialLinks = [];
|
||||
if ($artist && !empty($artist['social_links'])) {
|
||||
$decoded = json_decode((string)$artist['social_links'], true);
|
||||
if (is_array($decoded)) {
|
||||
$socialLinks = $decoded;
|
||||
}
|
||||
}
|
||||
$iconMap = [
|
||||
'website' => ['label' => 'Website', 'icon' => 'fa-duotone fa-globe-pointer'],
|
||||
'instagram' => ['label' => 'Instagram', 'icon' => 'fa-brands fa-instagram'],
|
||||
'soundcloud' => ['label' => 'SoundCloud', 'icon' => 'fa-brands fa-soundcloud'],
|
||||
'spotify' => ['label' => 'Spotify', 'icon' => 'fa-brands fa-spotify'],
|
||||
'youtube' => ['label' => 'YouTube', 'icon' => 'fa-brands fa-youtube'],
|
||||
'tiktok' => ['label' => 'TikTok', 'icon' => 'fa-brands fa-tiktok'],
|
||||
'bandcamp' => ['label' => 'Bandcamp', 'icon' => 'fa-brands fa-bandcamp'],
|
||||
'beatport' => ['label' => 'Beatport', 'icon' => 'fa-solid fa-music'],
|
||||
'facebook' => ['label' => 'Facebook', 'icon' => 'fa-brands fa-facebook'],
|
||||
'x' => ['label' => 'X', 'icon' => 'fa-brands fa-x-twitter'],
|
||||
];
|
||||
function ac_normalize_url(string $value): string {
|
||||
if ($value === '') {
|
||||
return '';
|
||||
}
|
||||
if (preg_match('~^(https?://)~i', $value)) {
|
||||
return $value;
|
||||
}
|
||||
return 'https://' . $value;
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<section class="card" style="display:grid; gap:16px;">
|
||||
<div class="badge">Artist</div>
|
||||
<?php if (!$artist): ?>
|
||||
<h1 style="margin:0; font-size:28px;">Artist not found</h1>
|
||||
<p style="color:var(--muted);">This profile is unavailable.</p>
|
||||
<?php else: ?>
|
||||
<div style="display:grid; gap:18px;">
|
||||
<div style="display:flex; align-items:center; gap:20px;">
|
||||
<div style="width:160px; height:160px; border-radius:24px; overflow:hidden; background:rgba(255,255,255,0.06); display:grid; place-items:center;">
|
||||
<?php if (!empty($artist['avatar_url'])): ?>
|
||||
<img src="<?= htmlspecialchars((string)$artist['avatar_url'], ENT_QUOTES, 'UTF-8') ?>" alt="" style="width:100%; height:100%; object-fit:cover;">
|
||||
<?php else: ?>
|
||||
<span style="font-size:12px; color:var(--muted); letter-spacing:0.2em;">AC</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div>
|
||||
<div class="badge">Profile</div>
|
||||
<h1 style="margin:6px 0 0; font-size:34px;"><?= htmlspecialchars((string)$artist['name'], ENT_QUOTES, 'UTF-8') ?></h1>
|
||||
<?php if (!empty($artist['country'])): ?>
|
||||
<?php
|
||||
$code = strtolower((string)$artist['country']);
|
||||
if ($code === 'uk') { $code = 'gb'; }
|
||||
?>
|
||||
<div style="margin-top:8px; color:var(--muted); font-size:13px;">
|
||||
<span class="fi fi-<?= htmlspecialchars($code, ENT_QUOTES, 'UTF-8') ?>"></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($artist['bio'])): ?>
|
||||
<div style="color:var(--muted); line-height:1.7;">
|
||||
<?= nl2br(htmlspecialchars((string)$artist['bio'], ENT_QUOTES, 'UTF-8')) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($artist['credits'])): ?>
|
||||
<div style="padding:14px; border-radius:18px; border:1px solid rgba(255,255,255,0.08); background: rgba(0,0,0,0.25);">
|
||||
<div class="badge">Credits</div>
|
||||
<div style="margin-top:8px; color:var(--muted); line-height:1.7;">
|
||||
<?= nl2br(htmlspecialchars((string)$artist['credits'], ENT_QUOTES, 'UTF-8')) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($socialLinks): ?>
|
||||
<div style="display:flex; flex-wrap:wrap; gap:10px;">
|
||||
<?php foreach ($socialLinks as $key => $url): ?>
|
||||
<?php
|
||||
$meta = $iconMap[$key] ?? ['label' => ucfirst($key), 'icon' => 'fa-solid fa-link'];
|
||||
$label = $meta['label'];
|
||||
$icon = $meta['icon'];
|
||||
$normalized = ac_normalize_url((string)$url);
|
||||
$safeUrl = htmlspecialchars($normalized, ENT_QUOTES, 'UTF-8');
|
||||
?>
|
||||
<?php if ($hasIcons && $icon !== ''): ?>
|
||||
<a class="pill social-icon" href="<?= $safeUrl ?>" target="_blank" rel="noopener" aria-label="<?= htmlspecialchars($label, ENT_QUOTES, 'UTF-8') ?>">
|
||||
<i class="<?= htmlspecialchars($icon, ENT_QUOTES, 'UTF-8') ?>"></i>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="pill" href="<?= $safeUrl ?>" target="_blank" rel="noopener">
|
||||
<?= htmlspecialchars($label, ENT_QUOTES, 'UTF-8') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($artistReleases): ?>
|
||||
<div class="artist-release-panel">
|
||||
<div class="artist-release-panel-head">
|
||||
<div class="badge">Latest Releases</div>
|
||||
<a href="/releases?artist=<?= urlencode((string)($artist['name'] ?? '')) ?>" class="badge artist-view-all-link">View all</a>
|
||||
</div>
|
||||
<div class="artist-release-grid">
|
||||
<?php foreach ($artistReleases as $release): ?>
|
||||
<a class="artist-release-card" href="/release?slug=<?= htmlspecialchars((string)($release['slug'] ?? ''), ENT_QUOTES, 'UTF-8') ?>">
|
||||
<div class="artist-release-cover">
|
||||
<?php if (!empty($release['cover_url'])): ?>
|
||||
<img src="<?= htmlspecialchars((string)$release['cover_url'], ENT_QUOTES, 'UTF-8') ?>" alt="">
|
||||
<?php else: ?>
|
||||
<span>AC</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="artist-release-meta">
|
||||
<div class="artist-release-title"><?= htmlspecialchars((string)($release['title'] ?? ''), ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php if (!empty($release['release_date'])): ?>
|
||||
<div class="artist-release-date"><?= htmlspecialchars((string)$release['release_date'], ENT_QUOTES, 'UTF-8') ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.social-icon {
|
||||
color: var(--text);
|
||||
}
|
||||
.social-icon i {
|
||||
font-size: 14px;
|
||||
}
|
||||
.artist-release-panel {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
margin-top: 6px;
|
||||
padding: 14px;
|
||||
border-radius: 18px;
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
background: rgba(0,0,0,0.24);
|
||||
}
|
||||
.artist-release-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
}
|
||||
.artist-view-all-link {
|
||||
text-decoration: none;
|
||||
color: rgba(255,255,255,0.72);
|
||||
transition: color .18s ease;
|
||||
}
|
||||
.artist-view-all-link:hover {
|
||||
color: #ffffff;
|
||||
}
|
||||
.artist-release-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
.artist-release-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255,255,255,0.08);
|
||||
background: rgba(0,0,0,0.22);
|
||||
padding: 8px;
|
||||
transition: transform .18s ease, border-color .18s ease, background .18s ease;
|
||||
}
|
||||
.artist-release-card:hover {
|
||||
transform: translateY(-2px);
|
||||
border-color: rgba(255,255,255,0.18);
|
||||
background: rgba(0,0,0,0.28);
|
||||
}
|
||||
.artist-release-cover {
|
||||
width: 58px;
|
||||
height: 58px;
|
||||
flex: 0 0 58px;
|
||||
border-radius: 9px;
|
||||
overflow: hidden;
|
||||
background: rgba(255,255,255,0.06);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
letter-spacing: .14em;
|
||||
}
|
||||
.artist-release-cover img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.artist-release-title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.artist-release-date {
|
||||
margin-top: 4px;
|
||||
font-size: 10px;
|
||||
color: var(--muted);
|
||||
}
|
||||
.artist-release-meta {
|
||||
min-width: 0;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.artist-release-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 520px) {
|
||||
.artist-release-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.artist-release-card {
|
||||
padding: 7px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
require __DIR__ . '/../../../../views/site/layout.php';
|
||||
Reference in New Issue
Block a user