|
| 1 | +--- |
| 2 | +import { |
| 3 | + alphaPreRelease, |
| 4 | + betaPreRelease, |
| 5 | +} from "../assets/data/audacityReleases"; |
| 6 | +import SplitDownloadButton from "../components/button/SplitDownloadButton.jsx"; |
| 7 | +import FeaturedVideo from "../components/video/FeaturedVideo"; |
| 8 | +import AlphaDetails from "../components/next/AlphaDetails.astro"; |
| 9 | +import BetaDetails from "../components/next/BetaDetails.astro"; |
| 10 | +import BaseLayout from "../layouts/BaseLayout.astro"; |
| 11 | +import "../styles/icons.css"; |
| 12 | +
|
| 13 | +const pageTitle = "Audacity ® | Pre-release downloads"; |
| 14 | +const pageDescription = |
| 15 | + "Test upcoming Audacity builds for Windows, macOS, and Linux."; |
| 16 | +
|
| 17 | +const releaseConfigurations = [ |
| 18 | + { |
| 19 | + entry: betaPreRelease, |
| 20 | + Details: BetaDetails, |
| 21 | + }, |
| 22 | + { |
| 23 | + entry: alphaPreRelease, |
| 24 | + Details: AlphaDetails, |
| 25 | + }, |
| 26 | +]; |
| 27 | +
|
| 28 | +const activeConfig = |
| 29 | + releaseConfigurations.find(({ entry }) => entry.isActive) ?? null; |
| 30 | +
|
| 31 | +const activeRelease = activeConfig?.entry ?? null; |
| 32 | +const DetailsComponent = activeConfig?.Details ?? null; |
| 33 | +const releaseDownloads = activeRelease?.downloads ?? null; |
| 34 | +const releaseVersion = releaseDownloads?.version ?? ""; |
| 35 | +const windowsDownloads = releaseDownloads?.win ?? []; |
| 36 | +const macDownloads = releaseDownloads?.mac ?? []; |
| 37 | +const linuxDownloads = releaseDownloads?.lin ?? []; |
| 38 | +const isAlphaRelease = activeRelease?.id === "alpha"; |
| 39 | +
|
| 40 | +const downloadSections = activeRelease |
| 41 | + ? [ |
| 42 | + { |
| 43 | + id: "windows", |
| 44 | + title: `${releaseVersion} for Windows`, |
| 45 | + os: "Windows", |
| 46 | + entries: windowsDownloads, |
| 47 | + }, |
| 48 | + { |
| 49 | + id: "mac", |
| 50 | + title: `${releaseVersion} for macOS`, |
| 51 | + os: "macOS", |
| 52 | + entries: macDownloads, |
| 53 | + }, |
| 54 | + { |
| 55 | + id: "linux", |
| 56 | + title: `${releaseVersion} for Linux`, |
| 57 | + os: "Linux", |
| 58 | + entries: linuxDownloads, |
| 59 | + }, |
| 60 | + ].filter((section) => section.entries.length > 0) |
| 61 | + : []; |
| 62 | +--- |
| 63 | + |
| 64 | +<BaseLayout |
| 65 | + title={pageTitle} |
| 66 | + description={pageDescription} |
| 67 | + showPromoBanner={false} |
| 68 | +> |
| 69 | + <main id="main" class="max-w-screen-xl mx-auto text-gray-700"> |
| 70 | + <div class="grid grid-cols-12 pt-8 pb-32 gap-y-12"> |
| 71 | + <section class="col-start-2 col-span-10 sm:col-start-2 sm:col-span-5"> |
| 72 | + { |
| 73 | + activeRelease ? ( |
| 74 | + <> |
| 75 | + <h1>{releaseVersion}</h1> |
| 76 | + {DetailsComponent && <DetailsComponent />} |
| 77 | + {isAlphaRelease && ( |
| 78 | + <FeaturedVideo |
| 79 | + client:load |
| 80 | + placeholderImage="https://i.ytimg.com/vi/QYM3TWf_G38/maxresdefault.jpg" |
| 81 | + imageAltText="Video: How we made Audacity 4" |
| 82 | + videoURL="https://www.youtube-nocookie.com/embed/QYM3TWf_G38?autoplay=1" |
| 83 | + title="Video: How we made Audacity 4" |
| 84 | + label="Watch a behind-the-scenes video on the making of Audacity 4" |
| 85 | + class="mt-8" |
| 86 | + /> |
| 87 | + )} |
| 88 | + </> |
| 89 | + ) : ( |
| 90 | + <div class="border border-yellow-300 bg-yellow-50 text-yellow-900 rounded-md p-6"> |
| 91 | + <h1 class="text-3xl font-semibold text-yellow-900"> |
| 92 | + Pre-release downloads are currently unavailable. |
| 93 | + </h1> |
| 94 | + <p class="mt-4"> |
| 95 | + Check back soon or download the latest stable version of Audacity. |
| 96 | + </p> |
| 97 | + <a |
| 98 | + class="hyperlink inline-flex items-center gap-1 mt-4" |
| 99 | + href="/download" |
| 100 | + > |
| 101 | + Browse stable downloads |
| 102 | + <span class="align-middle icon icon-share text-blue-600" /> |
| 103 | + </a> |
| 104 | + </div> |
| 105 | + ) |
| 106 | + } |
| 107 | + </section> |
| 108 | + <aside |
| 109 | + class="row-start-2 sm:row-start-1 col-start-2 col-span-10 sm:col-start-8 sm:col-span-4" |
| 110 | + > |
| 111 | + <h2 class="text-sm uppercase font-normal">Download links</h2> |
| 112 | + { |
| 113 | + activeRelease ? ( |
| 114 | + downloadSections.length > 0 ? ( |
| 115 | + <div class="flex flex-col gap-6 mt-2"> |
| 116 | + {downloadSections.map((section) => ( |
| 117 | + <div class="border border-bg-200 rounded-md p-6"> |
| 118 | + <h3 class="additional-resource-heading"> |
| 119 | + {section.title} |
| 120 | + </h3> |
| 121 | + <div class="mt-2"> |
| 122 | + <SplitDownloadButton |
| 123 | + OS={section.os} |
| 124 | + releaseData={section.entries} |
| 125 | + client:load |
| 126 | + /> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + ))} |
| 130 | + </div> |
| 131 | + ) : ( |
| 132 | + <div class="mt-4 p-4 border border-gray-200 rounded-md bg-gray-50"> |
| 133 | + <p class="text-sm text-gray-700"> |
| 134 | + Download packages for this pre-release are not available right now. |
| 135 | + </p> |
| 136 | + <a |
| 137 | + class="hyperlink text-sm inline-flex items-center gap-1 mt-3" |
| 138 | + href="/download" |
| 139 | + > |
| 140 | + Browse stable downloads |
| 141 | + <span class="align-middle icon icon-share text-blue-600" /> |
| 142 | + </a> |
| 143 | + </div> |
| 144 | + ) |
| 145 | + ) : ( |
| 146 | + <div class="mt-4 p-4 border border-gray-200 rounded-md bg-gray-50"> |
| 147 | + <p class="text-sm text-gray-700"> |
| 148 | + Pre-release downloads are currently unavailable. |
| 149 | + </p> |
| 150 | + <p class="text-sm text-gray-700 mt-1"> |
| 151 | + You can still download the latest stable version of Audacity. |
| 152 | + </p> |
| 153 | + <a |
| 154 | + class="hyperlink text-sm inline-flex items-center gap-1 mt-3" |
| 155 | + href="/download" |
| 156 | + > |
| 157 | + Browse stable downloads |
| 158 | + <span class="align-middle icon icon-share text-blue-600" /> |
| 159 | + </a> |
| 160 | + </div> |
| 161 | + ) |
| 162 | + } |
| 163 | + </aside> |
| 164 | + </div> |
| 165 | + </main> |
| 166 | +</BaseLayout> |
0 commit comments