Skip to content

Commit 41d7669

Browse files
committed
adds apple silicon download url to apple warning
1 parent fcbc640 commit 41d7669

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

i18n/react-intl/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"raspberryPi32AssetTooltip": "This is the only 32-bit platform that is supported with Processing 4.",
8080
"raspberryPi64AssetTooltip": "Not a ton of people are 64-bit with their RPi devices yet, but releases are happening.",
8181
"publishedOn": "Published on",
82-
"macOsIntelWarning": "Got an M1 or M2 CPU? Download the Apple Silicon version below instead.",
82+
"macOsIntelWarning": "Got an M1 or M2 CPU? Download the <a href='{0}'>Apple Silicon</a> version instead.",
8383
"otherVersions": "Need another version?",
8484
"olderVersions": "Looking for older versions?",
8585
"githubEarlierReleases": "Head over to GitHub for <a href='https://github.com/processing/processing4/releases'>earlier releases of Processing 4</a>.",

i18n/react-intl/es.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"raspberryPi32AssetTooltip": "Esta es la única plataforma de 32-bit compatible con Processing 4.",
8080
"raspberryPi64AssetTooltip": "Aún no muchas personas usan 64-bit con sus dispositivos RPi, pero hay avances en progreso.",
8181
"publishedOn": "Publicado en",
82-
"macOsIntelWarning": "¿Usas macOS con CPU M1 o M2? Descarga entonces la versión de Apple Silicon abajo.",
82+
"macOsIntelWarning": "¿Usas macOS con CPU M1 o M2? Descarga entonces la versión <a href='{0}'>Apple Silicon</a>.",
8383
"otherVersions": "¿Necesitas otra versión?",
8484
"olderVersions": "¿Buscas versiones anteriores?",
8585
"githubEarlierReleases": "En GitHub encontrarás <a href='https://github.com/processing/processing4/releases'>versiones anteriores de Processing 4</a>.",

src/styles/templates/download.module.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
align-items: center;
1919
flex-basis: var(--col8);
2020

21-
margin: var(--vertical-margin-medium) 0;
21+
margin: var(--vertical-margin-large) 0;
2222
}
2323

2424
a.mainDownloadButton {
@@ -61,7 +61,7 @@ a.mainDownloadButton {
6161
& > p {
6262
font-size: var(--text-large);
6363
line-height: 1.5;
64-
font-weight: 500;
64+
font-weight: 700;
6565
color: var(--download-inactive);
6666
margin-bottom: 0;
6767
}
@@ -213,7 +213,6 @@ a.mainDownloadButton {
213213
.infoTooltipContainer {
214214
display: inline-block;
215215
position: relative;
216-
/* z-index: 1; */
217216

218217
& > button {
219218
display: inline-flex;

src/templates/download.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { memo, useEffect, useRef, useState } from 'react';
1+
import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
22
import { navigate, graphql } from 'gatsby';
33
import { useIntl } from 'react-intl';
44
import classnames from 'classnames';
@@ -129,6 +129,13 @@ const MainDownloadSection = memo(({ release, onAfterDownload }) => {
129129
const intl = useIntl();
130130
const detectedAsset = useMachineOS(release.assetsByOs, release.publishedAt);
131131

132+
const appleSiliconAsset = useMemo(() => {
133+
for (let asset of release.assets) {
134+
if (asset.bit === 'Apple Silicon') return asset;
135+
}
136+
return null;
137+
}, [release]);
138+
132139
return (
133140
<div className={classnames(grid.container, grid.grid)}>
134141
<div className={classnames(grid.col, css.mainDownloadButtonContainer)}>
@@ -143,7 +150,7 @@ const MainDownloadSection = memo(({ release, onAfterDownload }) => {
143150
</a>
144151

145152
{detectedAsset.asset && (
146-
<div className={css.osDetails}>
153+
<div>
147154
<p className={css.osBit}>
148155
{detectedAsset.asset.os}
149156
{detectedAsset.asset.bit && (
@@ -165,11 +172,19 @@ const MainDownloadSection = memo(({ release, onAfterDownload }) => {
165172
/>
166173
</div>
167174
)}
168-
{detectedAsset.asset && detectedAsset.asset.name.includes('macos-x64') && (
169-
<div>
170-
<p>{intl.formatMessage({ id: 'macOsIntelWarning' })}</p>
171-
</div>
172-
)}
175+
{detectedAsset.asset &&
176+
detectedAsset.asset.name.includes('macos-x64') &&
177+
appleSiliconAsset && (
178+
<div>
179+
<p
180+
dangerouslySetInnerHTML={{
181+
__html: intl
182+
.formatMessage({ id: 'macOsIntelWarning' })
183+
.replace('{0}', appleSiliconAsset.url)
184+
}}
185+
/>
186+
</div>
187+
)}
173188
</div>
174189
</div>
175190
);

0 commit comments

Comments
 (0)