Skip to content

Commit fcbc640

Browse files
committed
layout re-design progress
1 parent c4eb0cd commit fcbc640

File tree

7 files changed

+388
-120
lines changed

7 files changed

+388
-120
lines changed

i18n/react-intl/en.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@
7272
"booksIntro": "Processing books cover topics from programming basics to visualization. Browse this page to find the right books for you.",
7373
"readMore": "Read more",
7474
"downloadIntro": "Processing is open source and is available for macOS, Windows, and Linux. Projects created with Processing are also cross-platform, and can be used on macOS, Windows, Android, Raspberry Pi, and many other Linux platforms.",
75+
"windowsIntelAssetTooltip": "Tested on Windows 10. Untested on Windows 11 but should work.",
76+
"macOsIntelAssetTooltip": "Compatible with macOS 10.15.7 (Catalina), 11 (Big Sur), and 12 (Monterey)",
77+
"macOsSiliconAssetTooltip": "Compatible with <a href='https://support.apple.com/en-us/HT211814'>M1 and M2 processors</a>. Tested on macOS 12 (Monterey)",
78+
"linuxIntelAssetTooltip": "Tested on Ubuntu 22.04.",
79+
"raspberryPi32AssetTooltip": "This is the only 32-bit platform that is supported with Processing 4.",
80+
"raspberryPi64AssetTooltip": "Not a ton of people are 64-bit with their RPi devices yet, but releases are happening.",
81+
"publishedOn": "Published on",
82+
"macOsIntelWarning": "Got an M1 or M2 CPU? Download the Apple Silicon version below instead.",
83+
"otherVersions": "Need another version?",
7584
"olderVersions": "Looking for older versions?",
7685
"githubEarlierReleases": "Head over to GitHub for <a href='https://github.com/processing/processing4/releases'>earlier releases of Processing 4</a>.",
7786
"downloadChanges": "The <a href='https://github.com/processing/processing4/blob/main/build/shared/revisions.md'>list of revisions</a> covers the differences between releases in detail.",

i18n/react-intl/es.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@
7272
"booksIntro": "Los libros sobre Processing cubren temas desde los principios básicos de programación a la visualización. Navega esta pagina para encontrar un libro adecuado para ti.",
7373
"readMore": "Leer más",
7474
"downloadIntro": "Processing es código abierto y está disponible para macOS, Windows, y Linux. Proyectos creados con Processing también multiplataforma, y pueden ser ejecutados en macOS, Windows, Android, Raspberry Pi, y muchas plataformas Linux.",
75+
"windowsIntelAssetTooltip": "Testeado en Windows 10. No testeado en Windows 11, pero debería funcionar.",
76+
"macOsIntelAssetTooltip": "Compatible con macOS 10.15.7 (Catalina), 11 (Big Sur), y 12 (Monterey)",
77+
"macOsSiliconAssetTooltip": "Compatible con <a href='https://support.apple.com/en-us/HT211814'>procesadores M1 and M2</a>. Testeado en macOS 12 (Monterey)",
78+
"linuxIntelAssetTooltip": "Testeado en Ubuntu 22.04.",
79+
"raspberryPi32AssetTooltip": "Esta es la única plataforma de 32-bit compatible con Processing 4.",
80+
"raspberryPi64AssetTooltip": "Aún no muchas personas usan 64-bit con sus dispositivos RPi, pero hay avances en progreso.",
81+
"publishedOn": "Publicado en",
82+
"macOsIntelWarning": "¿Usas macOS con CPU M1 o M2? Descarga entonces la versión de Apple Silicon abajo.",
83+
"otherVersions": "¿Necesitas otra versión?",
7584
"olderVersions": "¿Buscas versiones anteriores?",
7685
"githubEarlierReleases": "En GitHub encontrarás <a href='https://github.com/processing/processing4/releases'>versiones anteriores de Processing 4</a>.",
7786
"downloadChanges": "La <a href='https://github.com/processing/processing4/blob/main/build/shared/revisions.md'>lista de revisiones</a> cubre las diferencias entre versiones a detalle.",

src/hooks/download.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { useCallback, useEffect, useMemo, useState } from 'react';
2+
import { useIntl } from 'react-intl';
23

34
const getOS = (name) => {
45
if (name.includes('windows') || name.includes('.exe')) return 'Windows';
6+
else if (name.includes('linux-arm')) return 'Raspberry Pi';
57
else if (name.includes('linux')) return 'Linux';
6-
else if (name.includes('macos')) return 'MacOS';
8+
else if (name.includes('macos')) return 'macOS';
79
else return 'Unknown';
810
};
911

@@ -12,8 +14,21 @@ const getBit = (name) => {
1214
else if (name.includes('windows64')) return '64-bit';
1315
else if (name.includes('windows32')) return '32-bit';
1416
else if (name.includes('macos-aarch64')) return 'Apple Silicon';
15-
else if (name.includes('linux-arm32')) return 'Raspberry Pi 32-bit';
16-
else if (name.includes('linux-arm64')) return 'Raspberry Pi 64-bit';
17+
else if (name.includes('linux-arm32')) return '32-bit';
18+
else if (name.includes('linux-arm64')) return '64-bit';
19+
else return null;
20+
};
21+
22+
const getTooltip = (name, intProvider) => {
23+
if (name.includes('windows')) return intProvider('windowsIntelAssetTooltip');
24+
else if (name.includes('macos-aarch64'))
25+
return intProvider('macOsSiliconAssetTooltip');
26+
else if (name.includes('macos')) return intProvider('macOsIntelAssetTooltip');
27+
else if (name.includes('linux-arm32'))
28+
return intProvider('raspberryPi32AssetTooltip');
29+
else if (name.includes('linux-arm64'))
30+
return intProvider('raspberryPi64AssetTooltip');
31+
else if (name.includes('linux')) return intProvider('linuxIntelAssetTooltip');
1732
else return null;
1833
};
1934

@@ -36,6 +51,8 @@ function formatBytes(bytes, decimals = 0) {
3651
@param {Array} releases Array of releases JSON files
3752
**/
3853
export const usePreparedReleases = (releases) => {
54+
const intl = useIntl();
55+
3956
return useMemo(() => {
4057
const prepared = [];
4158

@@ -52,7 +69,7 @@ export const usePreparedReleases = (releases) => {
5269
day: 'numeric'
5370
}),
5471
assets: [],
55-
assetsByOs: { Windows: [], MacOS: [], Linux: [] }
72+
assetsByOs: { Windows: [], macOS: [], Linux: [], 'Raspberry Pi': [] }
5673
};
5774

5875
// Prepare release assets
@@ -63,7 +80,10 @@ export const usePreparedReleases = (releases) => {
6380
os: getOS(asset.name),
6481
bit: getBit(asset.name),
6582
url: asset.downloadUrl,
66-
size: formatBytes(asset.size)
83+
size: formatBytes(asset.size),
84+
tooltipMessage: getTooltip(asset.name, (id) =>
85+
intl.formatMessage({ id })
86+
)
6787
});
6888
}
6989

@@ -85,21 +105,24 @@ export const usePreparedReleases = (releases) => {
85105
}
86106

87107
return prepared;
88-
}, [releases]);
108+
}, [intl, releases]);
89109
};
90110

91111
/**
92112
Hook to detect the OS where the site is mounted.
93113
Will default to Windows if fails to detect other.
94114
**/
95115
export const useMachineOS = (releases) => {
96-
const [selected, setSelected] = useState({ os: '', asset: null });
116+
const [detected, setDetected] = useState({
117+
os: '',
118+
asset: null
119+
});
97120

98121
const selectAsset = useCallback(
99122
(asset) => {
100-
setSelected({ os: asset.os, asset });
123+
setDetected({ os: asset.os, asset });
101124
},
102-
[setSelected]
125+
[setDetected]
103126
);
104127

105128
useEffect(() => {
@@ -113,13 +136,13 @@ export const useMachineOS = (releases) => {
113136
if (userAgent.search('Windows') !== -1) {
114137
selectOS('Windows');
115138
} else if (userAgent.search('Mac') !== -1) {
116-
selectOS('MacOS');
139+
selectOS('macOS');
117140
} else if (userAgent.search('X11') !== -1) {
118141
selectOS('Linux');
119142
} else {
120143
selectOS('Windows');
121144
}
122145
}, [releases, selectAsset]);
123146

124-
return [selected, selectAsset];
147+
return detected;
125148
};

src/images/info-icon.svg

Lines changed: 3 additions & 0 deletions
Loading

src/images/logo-raspberry.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)