A music player that connects to your cloud/distributed storage.

feat: home page links + version upgrade on all pages

+98 -67
+8
src/_components/diffuse/status.vto
··· 1 + <span id="status"> 2 + <a href="/latest/" title="Upgrade to latest" class="animate-spin"> 3 + <i class="ph-bold ph-spinner"></i> 4 + </a> 5 + <a href="/chronicle/" title="Browse versions of Diffuse"> 6 + <i class="ph-fill ph-star-four"></i> 7 + </a> 8 + </span>
+4 -2
src/_includes/layouts/facets.vto
··· 12 12 13 13 scripts: 14 14 - facets/common/ppr.js 15 + - common/pages/version-upgrade.js 15 16 --- 16 17 17 18 <style> ··· 22 23 23 24 <header style="overflow: hidden"> 24 25 <div style="min-width: var(--container-md)"> 25 - <div> 26 - <a class="diffuse-logo" href="./" style="display: inline-block;"> 26 + <div class="diffuse-logo-container"> 27 + <a href="./" style="display: inline-block;"> 27 28 {{ await comp.diffuse.logo() }} 28 29 </a> 30 + {{ await comp.diffuse.status() }} 29 31 </div> 30 32 <p class="construct dither-mask" style="margin-top: 0; max-width: none;"> 31 33 Facets
+45
src/common/pages/version-upgrade.js
··· 1 + // Version upgrade (only works with `diffuse-artifacts` deployments) 2 + if (document.location.hostname.endsWith("diffuse.sh")) { 3 + document.querySelectorAll("#status").forEach(async (status) => { 4 + const versionOrCid = 5 + document.location.pathname.slice(1).split("/")[0]?.toLowerCase() ?? ""; 6 + const usesCid = versionOrCid.startsWith("bafy"); 7 + const { default: artifacts } = await import( 8 + `${document.location.origin}/artifacts.json`, 9 + { with: { type: "json" } } 10 + ); 11 + 12 + // Latest is located at the end 13 + const lastArtifact = Object.values(artifacts).reverse()[0]; 14 + 15 + // Check if using latest 16 + const isLatest = usesCid 17 + ? versionOrCid === lastArtifact.cid 18 + : versionOrCid === lastArtifact.version; 19 + 20 + // Remove loading animation 21 + status.querySelectorAll(".ph-spinner").forEach((icon) => { 22 + icon.parentElement?.classList.add("hidden"); 23 + 24 + setTimeout(() => { 25 + icon.parentElement?.classList.remove("animate-spin"); 26 + icon.classList.remove("ph-spinner"); 27 + icon.classList.add("ph-arrow-fat-lines-up"); 28 + }, 500); 29 + }); 30 + 31 + // If using CID, append `/hash/` to href 32 + status.querySelectorAll(`[href="/latest/"]`).forEach((a) => { 33 + if (usesCid) a.setAttribute("href", "/latest/hash/"); 34 + if (!isLatest) { 35 + setTimeout(() => { 36 + a.classList.remove("hidden"); 37 + }, 750); 38 + } 39 + }); 40 + }); 41 + } else { 42 + document.querySelectorAll("#status").forEach((status) => { 43 + status.remove(); 44 + }); 45 + }
-46
src/index.js
··· 59 59 } 60 60 61 61 addDemoBtn?.addEventListener("click", addSampleContent); 62 - 63 - // Version upgrade (only works with `diffuse-artifacts` deployments) 64 - if (document.location.hostname.endsWith("diffuse.sh")) { 65 - document.querySelectorAll("#status").forEach(async (status) => { 66 - const versionOrCid = 67 - document.location.pathname.slice(1).split("/")[0]?.toLowerCase() ?? ""; 68 - const usesCid = versionOrCid.startsWith("bafy"); 69 - const { default: artifacts } = await import( 70 - `${document.location.origin}/artifacts.json`, 71 - { with: { type: "json" } } 72 - ); 73 - 74 - // Latest is located at the end 75 - const lastArtifact = Object.values(artifacts).reverse()[0]; 76 - 77 - // Check if using latest 78 - const isLatest = usesCid 79 - ? versionOrCid === lastArtifact.cid 80 - : versionOrCid === lastArtifact.version; 81 - 82 - // Remove loading animation 83 - status.querySelectorAll(".ph-spinner").forEach((icon) => { 84 - icon.parentElement?.classList.add("hidden"); 85 - 86 - setTimeout(() => { 87 - icon.parentElement?.classList.remove("animate-spin"); 88 - icon.classList.remove("ph-spinner"); 89 - icon.classList.add("ph-arrow-fat-lines-up"); 90 - }, 500); 91 - }); 92 - 93 - // If using CID, append `/hash/` to href 94 - status.querySelectorAll(`[href="/latest/"]`).forEach((a) => { 95 - if (usesCid) a.setAttribute("href", "/latest/hash/"); 96 - if (!isLatest) { 97 - setTimeout(() => { 98 - a.classList.remove("hidden"); 99 - }, 750); 100 - } 101 - }); 102 - }); 103 - } else { 104 - document.querySelectorAll("#status").forEach((status) => { 105 - status.remove(); 106 - }); 107 - }
+36 -16
src/index.vto
··· 9 9 10 10 scripts: 11 11 - index.js 12 + - common/pages/version-upgrade.js 12 13 13 14 # ELEMENTS 14 15 ··· 203 204 A bundle of tracks. 204 205 url: "definitions/output/trackBundle.json" 205 206 207 + # LINKS 208 + 209 + links: 210 + - title: "Bluesky" 211 + url: "https://bsky.app/profile/tokono.ma" 212 + desc: "Follow Diffuse updates." 213 + - title: "Discord" 214 + url: "https://discord.gg/KUnhstJV" 215 + desc: "Chat with us in the U&A Discord #diffuse channel." 216 + - title: "Github" 217 + url: "https://github.com/icidasset/diffuse" 218 + desc: "Source code." 219 + - title: "Tangled" 220 + url: "https://tangled.org/tokono.ma/diffuse" 221 + desc: "Source code." 222 + 206 223 --- 207 224 208 225 <header> 209 226 <div> 210 - <h1 class="diffuse-logo"> 227 + <h1 hidden>Diffuse</h1> 228 + <div class="diffuse-logo-container"> 211 229 {{ await comp.diffuse.logo() }} 212 - <span id="status"> 213 - <a href="/latest/" title="Upgrade to latest" class="animate-spin"> 214 - <i class="ph-bold ph-spinner"></i> 215 - </a> 216 - <a href="/chronicle/" title="Browse versions of Diffuse"> 217 - <i class="ph-fill ph-star-four"></i> 218 - </a> 219 - </span> 220 - </h1> 230 + {{ await comp.diffuse.status() }} 231 + </div> 221 232 <p class="construct dither-mask"> 222 233 Your audio<br />your data<br />your rules 223 234 </p> ··· 235 246 <li><a href="#agency">Agency</a></li> 236 247 <li><a href="#elements">Elements</a></li> 237 248 <li><a href="#definitions">Definitions</a></li> 249 + <li><a href="#links">Links</a></li> 238 250 </ul> 239 251 <p> 240 252 <small>Built by <a href="https://tokono.ma">tokono.ma</a></small> ··· 457 469 </div> 458 470 </section> 459 471 460 - <!-- DEFINITIONS --> 461 - <section> 462 - <h2 id="definitions">Definitions</h2> 472 + <!-- DEFINITIONS + LINKS --> 473 + <div class="columns"> 474 + <section> 475 + <h2 id="definitions">Definitions</h2> 463 476 464 - <p>All of the elements here are built with these data definitions in mind. That said, you can mix elements that use different definitions; you just have to put a transformer between them in order to translate between them, if needed.</p> 477 + <p>All of the elements here are built with these data definitions in mind. That said, you can mix elements that use different definitions; you just have to put a transformer between them in order to translate between them, if needed.</p> 465 478 466 - {{ await comp.list({ items: definitions }) }} 467 - </section> 479 + {{ await comp.list({ items: definitions }) }} 480 + </section> 481 + 482 + <section> 483 + <h2 id="links">Links</h2> 484 + 485 + {{ await comp.list({ items: links }) }} 486 + </section> 487 + </div> 468 488 </main>
+1 -1
src/styles/diffuse/page.css
··· 503 503 * Logo 504 504 */ 505 505 506 - .diffuse-logo { 506 + .diffuse-logo-container { 507 507 align-items: center; 508 508 display: flex; 509 509 font-size: var(--fs-lg);
+4 -2
src/themes/index.vto
··· 10 10 11 11 scripts: 12 12 - themes/index.js 13 + - common/pages/version-upgrade.js 13 14 14 15 # THEMES 15 16 ··· 27 28 28 29 <header> 29 30 <div> 30 - <div> 31 - <a class="diffuse-logo" href="./" style="display: inline-block;"> 31 + <div class="diffuse-logo-container"> 32 + <a href="./" style="display: inline-block;"> 32 33 {{ await comp.diffuse.logo() }} 33 34 </a> 35 + {{ await comp.diffuse.status() }} 34 36 </div> 35 37 36 38 <p class="construct dither-mask" style="margin-top: 0">