Skip to main content

max / makenotwork

6.8 KB · 163 lines History Blame Raw
1 {% extends "base.html" %}
2 {% import "_sheet.html" as sheet %}
3 {% import "_island.html" as island %}
4
5 {% block title %}{{ item.title }} - Library - Makenotwork{% endblock %}
6
7 {% block head %}
8 <meta name="robots" content="noindex">
9 {% call sheet::sheet("media-player.css") %}{% endcall %}
10 {% endblock %}
11
12 {% block content %}
13 {% include "partials/site_header.html" %}
14
15 <article class="media-container">
16 <p class="library-back">
17 <a href="/i/{{ item.id }}">&larr; Store page</a> &middot;
18 <a href="/library">Your library</a>
19 </p>
20
21 <header class="author-header">
22 <div class="author-avatar">{{ creator_avatar_initials }}</div>
23 <div class="author-info">
24 <div class="author-name"><a href="/u/{{ creator_username }}">{% if let Some(name) = creator_display_name %}{{ name }}{% else %}{{ creator_username }}{% endif %}</a></div>
25 <div class="media-meta">{{ item.release_date }}{% match item.content %}{% when crate::types::ItemContent::Audio with { duration, .. } %}{% if let Some(dur) = duration %} | {{ dur }}{% endif %}{% when _ %}{% endmatch %}</div>
26 </div>
27 </header>
28
29 <h1 class="media-title">{{ item.title }}</h1>
30
31 {% if let Some(project_title) = project_title %}
32 <p class="media-series">
33 <a href="/p/{{ project_slug }}">{{ project_title }}</a>{% match item.content %}{% when crate::types::ItemContent::Audio with { episode_number, .. } %}{% if let Some(episode) = episode_number %} | Episode {{ episode }}{% endif %}{% when _ %}{% endmatch %}
34 </p>
35 {% endif %}
36
37 <div class="cover-art">
38 {% match item.content %}
39 {% when crate::types::ItemContent::Audio with { cover_url, .. } %}
40 {% if let Some(url) = cover_url %}
41 <img src="{{ url }}" alt="{{ item.title }} cover art">
42 {% endif %}
43 {% when _ %}
44 {% endmatch %}
45 </div>
46
47 <div class="media-player">
48 <audio id="media-a" preload="metadata">
49 {% if let Some(audio_url) = audio_url %}
50 <source src="{{ audio_url }}" type="audio/mpeg">
51 {% endif %}
52 </audio>
53 <audio id="media-b" preload="metadata"></audio>
54
55 <div class="player-controls">
56 <button class="play-button" id="play-btn" aria-label="Play">
57 <svg id="play-icon" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
58 <path d="M8 5v14l11-7z"/>
59 </svg>
60 <svg id="pause-icon" class="media-icon-hidden" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
61 <path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>
62 </svg>
63 </button>
64 <div class="progress-container">
65 <div class="progress-bar" id="progress-bar">
66 <div class="progress-fill" id="progress-fill"></div>
67 </div>
68 <div class="time-display">
69 <span id="current-time">0:00</span>
70 <span id="duration">0:00</span>
71 </div>
72 </div>
73 </div>
74
75 <div class="insertion-label" id="insertion-label"></div>
76 <button class="skip-insertion" id="skip-btn" type="button">Skip &#8250;</button>
77
78 <div class="player-secondary">
79 <div class="speed-control">
80 <span>Speed:</span>
81 <button class="speed-button" data-speed="0.5">0.5x</button>
82 <button class="speed-button is-selected" data-speed="1">1x</button>
83 <button class="speed-button" data-speed="1.5">1.5x</button>
84 <button class="speed-button" data-speed="2">2x</button>
85 </div>
86 <div class="volume-control">
87 <span class="volume-icon">
88 <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
89 <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>
90 </svg>
91 </span>
92 <input type="range" class="volume-slider" id="volume-slider" min="0" max="100" value="75" />
93 </div>
94 </div>
95 </div>
96
97 {% if !chapters.is_empty() %}
98 <div class="chapters">
99 <h3>Chapters</h3>
100 <ul class="chapter-list">
101 {% for chapter in chapters %}
102 <li class="chapter-item" data-time="{{ chapter.start_seconds }}">
103 <span class="chapter-title">{{ chapter.title }}</span>
104 <span class="chapter-time">{{ chapter.timestamp }}</span>
105 </li>
106 {% endfor %}
107 </ul>
108 </div>
109 {% endif %}
110
111 {% if !item.description.is_empty() %}
112 <div class="media-description">
113 <p>{{ item.description }}</p>
114 </div>
115 {% endif %}
116
117 {% if !versions.is_empty() %}
118 <section class="library-downloads raised">
119 <h3>Source files</h3>
120 {% for version in versions %}
121 {% if version.has_file %}
122 <div class="download-row">
123 <span class="download-version">v{{ version.number }}</span>
124 {% if let Some(label) = version.label %}
125 <span class="download-label">{{ label }}</span>
126 {% else %}
127 <span class="download-label download-label--empty">{% match version.file_name %}{% when Some with (name) %}{{ name }}{% when None %}Download{% endmatch %}</span>
128 {% endif %}
129 <span class="download-size">{{ version.size }}</span>
130 <button class="btn-secondary btn-download-compact"
131 data-action="downloadVersion" data-arg="{{ version.id }}">Download</button>
132 </div>
133 {% endif %}
134 {% endfor %}
135 </section>
136 {% endif %}
137 </article>
138
139 {% include "partials/discussion_section.html" %}
140
141 <footer class="media-player-footer">
142 {% if is_owner %}
143 <a href="/dashboard/item/{{ item.id }}">Edit</a> &middot;
144 {% endif %}
145 <a href="/i/{{ item.id }}">Store page</a> &middot;
146 <a href="/library">Your library</a>
147 </footer>
148 {% endblock %}
149
150 {% block scripts %}
151 <mnw-media-player>
152 <script id="media-player-data" type="application/json">
153 {
154 "segments": {{ segments_json|safe }},
155 "mediaType": "audio",
156 "itemId": "{{ item.id }}"
157 }
158 </script>
159 </mnw-media-player>
160 {% call island::island("media-player") %}{% endcall %}
161 <script src="/static/page-library-audio.js?v=0623" defer></script>
162 {% endblock %}
163