diff --git a/src/app/[locale]/download/[[...options]]/page.tsx b/src/app/[locale]/download/[[...options]]/page.tsx
index 2ae1065..8672b35 100644
--- a/src/app/[locale]/download/[[...options]]/page.tsx
+++ b/src/app/[locale]/download/[[...options]]/page.tsx
@@ -1,6 +1,5 @@
import get from 'lodash/get'
import Link from 'next/link'
-import { useMemo } from 'react'
import { Button } from '~/components/ui/button'
import { initTranslations } from '~/i18n'
@@ -10,7 +9,9 @@ import {
platformToTarget,
type DistributionType,
type LinuxPackageFormat,
+ PlatformSpec,
} from '~/lib/target'
+import { cn } from '~/lib/utils'
export const runtime = 'edge'
@@ -19,28 +20,18 @@ export default async function DownloadPage({
}: {
params: {
locale: string
- options?: [OS?, CPU?, (DistributionType | LinuxPackageFormat)?]
+ options?: [OS?, PlatformSpec?]
}
}) {
const { t } = await initTranslations(locale, ['common'])
- const [os, cpu, pacakgeFormatOrDistributionType] = options
- console.log(os, cpu, pacakgeFormatOrDistributionType)
+ const [os, spec] = options
+ console.log(os, spec)
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
- const possibleOptions = get(platformToTarget, [os!, cpu!], {})
-
- console.log(
- possibleOptions,
- Object.keys(possibleOptions as object).length,
- typeof possibleOptions,
- pacakgeFormatOrDistributionType,
- )
-
- const shouldShowOptions =
- os === undefined || (cpu === undefined && os !== OS.macos)
return (
-
{t('Operating system')}
+
+ {t('Operating system')}
+
{os === undefined && (
{Object.keys(platformToTarget).map((system) => (
@@ -50,31 +41,16 @@ export default async function DownloadPage({
))}
)}
-
{t('Platform')}
+
+ {t('Platform')}
+
{os !== undefined &&
- cpu === undefined &&
+ spec === undefined &&
Object.keys(platformToTarget[os] ?? {}).map((platform) => (
))}
-
- {shouldShowOptions && (
- <>
-
{t('Options')}
- {pacakgeFormatOrDistributionType === undefined && (
-
- {Object.keys(possibleOptions as object).map((option) => (
-
- ))}
-
- )}
- >
- )}
)
}
diff --git a/src/lib/target.ts b/src/lib/target.ts
index da85a43..8bb8046 100644
--- a/src/lib/target.ts
+++ b/src/lib/target.ts
@@ -38,32 +38,36 @@ export enum DistributionType {
portable = 'portable',
}
+export enum PlatformSpec {
+ X64Setup = 'x64Setup', // setup for windows x64 and macOS Intel
+ X64Portable = 'x64Portable', // portable for windows x64 and Linux x64
+ IA32Setup = 'ia32Setup', // setup for windows x86
+ IA32Portable = 'ia32Portable', // portable for windows x86
+ ARM = 'arm', // setup for windows ARM and macOS Apple silicon
+ X64DEB = 'x64DEB', // deb package for linux x64
+ x64RPM = 'x64RPM', // rpm package for linux x64
+ ARMDEB = 'armDEB', // deb package for linux ARM
+ ARMPortable = 'armPortable', // currently for linux only, windows ARM is always setup
+}
+
export const platformToTarget = {
[OS.windows]: {
- [CPU.x64]: {
- [DistributionType.setup]: Target.win64Setup,
- [DistributionType.portable]: Target.win64,
- },
- [CPU.ia32]: {
- [DistributionType.setup]: Target.win32Setup,
- [DistributionType.portable]: Target.win32,
- },
- [CPU.arm]: Target.winArm,
+ [PlatformSpec.X64Setup]: Target.win64Setup,
+ [PlatformSpec.X64Portable]: Target.win64,
+ [PlatformSpec.IA32Setup]: Target.win32Setup,
+ [PlatformSpec.IA32Portable]: Target.win32,
+ [PlatformSpec.ARM]: Target.winArm,
},
[OS.macos]: {
- [CPU.x64]: Target.macos,
- [CPU.arm]: Target.macosArm,
+ [PlatformSpec.X64Setup]: Target.macos,
+ [PlatformSpec.ARM]: Target.macosArm,
},
[OS.linux]: {
- [CPU.x64]: {
- [LinuxPackageFormat.deb]: Target.linuxDeb,
- [LinuxPackageFormat.rpm]: Target.linuxRpm,
- [DistributionType.portable]: Target.linux,
- },
- [CPU.arm]: {
- [LinuxPackageFormat.deb]: Target.linuxDebArm,
- [DistributionType.portable]: Target.linuxArm,
- },
+ [PlatformSpec.X64DEB]: Target.linuxDeb,
+ [PlatformSpec.x64RPM]: Target.linuxRpm,
+ [PlatformSpec.X64Portable]: Target.linux,
+ [PlatformSpec.ARMDEB]: Target.linuxDebArm,
+ [PlatformSpec.ARMPortable]: Target.linuxArm,
},
}
diff --git a/src/locales/en/common.json b/src/locales/en/common.json
index 720707f..f5e8e29 100644
--- a/src/locales/en/common.json
+++ b/src/locales/en/common.json
@@ -7,18 +7,6 @@
"opencollective": "OpenCollective",
"weibo": "Weibo",
"download": "Download {{version}}",
- "linux-x64": "Linux (x64)",
- "linux-arm": "Linux (ARM)",
- "linux-deb-x64": "Debian / Ubuntu (x64)",
- "linux-deb-arm": "Debian / Ubuntu (ARM)",
- "linux-rpm-x64": "Fedora / CentOS (x64)",
- "macos-x64": "macOS (x64)",
- "macos-arm": "macOS (ARM)",
- "win-ia32": "Windows (x86) Portable",
- "win-ia32-setup": "Windows (x86)",
- "win-x64": "Windows (x64) Portable",
- "win-x64-setup": "Windows (x64)",
- "win-arm": "Windows (ARM)",
"stable-hint": "Stable, for most users",
"beta-hint": "Beta, for new features",
"other-versions": "Check the complete list",
@@ -50,15 +38,5 @@
"Download options": "Download options",
"Operating system": "Operating system",
"Platform": "Platform",
- "Options": "Options",
- "windows": "Windows",
- "linux": "Linux",
- "macos": "macOS",
- "x64": "64 bit",
- "ia32": "32 bit",
- "arm": "ARM",
- "deb": "DEB",
- "rpm": "RPM",
- "setup": "Setup",
- "portable": "Portable"
+ "Options": "Options"
}
diff --git a/src/locales/fr/common.json b/src/locales/fr/common.json
index 2e422cf..a3f06be 100644
--- a/src/locales/fr/common.json
+++ b/src/locales/fr/common.json
@@ -7,18 +7,6 @@
"opencollective": "OpenCollective",
"weibo": "Weibo",
"download": "Téléchargez {{version}}",
- "linux-x64": "Linux (x64)",
- "linux-arm": "Linux (ARM)",
- "linux-deb-x64": "Debian / Ubuntu (x64)",
- "linux-deb-arm": "Debian / Ubuntu (ARM)",
- "linux-rpm-x64": "Fedora / CentOS (x64)",
- "macos-x64": "macOS (x64)",
- "macos-arm": "macOS (ARM)",
- "win-ia32": "Windows (x86) Portable",
- "win-ia32-setup": "Windows (x86)",
- "win-x64": "Windows (x64) Portable",
- "win-x64-setup": "Windows (x64)",
- "win-arm": "Windows (ARM)",
"stable-hint": "Stable, pour la plupart des utilisateurs",
"beta-hint": "Beta, pour les nouvelles fonctionalités",
"telegram-group-link": "https://t.me/joinchat/ENYTx0Cr6B9OxSCRKUzYUw",
@@ -50,15 +38,5 @@
"Download options": "Options de téléchargement",
"Operating system": "Système opérateur",
"Platform": "Plate-forme",
- "Options": "Possibilités",
- "linux": "Linux",
- "macos": "macOS",
- "windows": "Windows",
- "arm": "ARM",
- "ia32": "32 bits",
- "x64": "64 bits",
- "deb": "DEB",
- "portable": "Portable",
- "rpm": "RPM",
- "setup": "Installation"
+ "Options": "Possibilités"
}
diff --git a/src/locales/ja/common.json b/src/locales/ja/common.json
index 9651727..ccbebce 100644
--- a/src/locales/ja/common.json
+++ b/src/locales/ja/common.json
@@ -7,18 +7,6 @@
"opencollective": "OpenCollective",
"weibo": "Weibo",
"download": "{{version}} をダウンロードする",
- "linux-x64": "64 ビット Linux バージョン",
- "linux-arm": "ARM Linux バージョン",
- "linux-deb-x64": "64 ビット Debian / Ubuntu バージョン",
- "linux-deb-arm": "ARM Debian / Ubuntu バージョン",
- "linux-rpm-x64": "64 ビット Fedora / CentOS バージョン",
- "macos-x64": "64 ビット macOS バージョン",
- "macos-arm": "ARM macOS バージョン",
- "win-ia32": "32 ビット Windows バージョン",
- "win-ia32-setup": "32 ビット Windows インストーラ",
- "win-x64": "64 ビット Windows バージョン",
- "win-x64-setup": "64 ビット Windows インストーラ",
- "win-arm": "ARM Windows バージョン",
"stable-hint": "安定版・一般利用の方におすすめ",
"beta-hint": "開発版・新機能が欲しい方におすすめ",
"other-versions": "完全なリストを見る",
@@ -50,15 +38,5 @@
"Download options": "ダウンロードオプション",
"Operating system": "オペレーティング·システム",
"Platform": "プラットフォーム",
- "Options": "オプション",
- "linux": "Linux",
- "macos": "macOS",
- "windows": "Windows",
- "arm": "ARM",
- "ia32": "32ビット",
- "x64": "64ビット",
- "deb": "DEB",
- "portable": "ポータブル",
- "rpm": "RPM",
- "setup": "インストーラ"
+ "Options": "オプション"
}
diff --git a/src/locales/ko/common.json b/src/locales/ko/common.json
index cb4cb35..15566bf 100644
--- a/src/locales/ko/common.json
+++ b/src/locales/ko/common.json
@@ -7,18 +7,6 @@
"opencollective": "OpenCollective",
"weibo": "Weibo",
"download": "{{version}} 다운로드하기",
- "linux-x64": "64비트 리눅스용",
- "linux-arm": "ARM 리눅스용",
- "linux-deb-x64": "64비트 데비안/우분투용",
- "linux-deb-arm": "ARM 데비안/우분투용",
- "linux-rpm-x64": "64비트 페도라/CentOS용",
- "macos-x64": "64비트 macOS용",
- "macos-arm": "ARM macOS용",
- "win-ia32": "32비트 윈도우용 포터블 버전",
- "win-ia32-setup": "32비트 윈도우용",
- "win-x64": "64비트 윈도우용 포터블 버전",
- "win-x64-setup": "64비트 윈도우용",
- "win-arm": "ARM 윈도우용 포터블 버전",
"stable-hint": "일반 사용자용 안정 버전",
"beta-hint": "새로운 기능 맛보기용 베타 버전",
"other-versions": "모든 버전 목록 보기",
@@ -50,15 +38,5 @@
"Download options": "다운로드 옵션",
"Operating system": "운영 체제",
"Platform": "플랫폼",
- "Options": "옵션",
- "linux": "Linux",
- "macos": "macOS",
- "windows": "Windows",
- "arm": "ARM",
- "ia32": "32비트",
- "x64": "64비트",
- "deb": "DEB",
- "portable": "가지고 다닐 수 있는",
- "rpm": "RPM",
- "setup": "윈도우용"
+ "Options": "옵션"
}
diff --git a/src/locales/zh-Hans/common.json b/src/locales/zh-Hans/common.json
index c3a717b..5bb1898 100644
--- a/src/locales/zh-Hans/common.json
+++ b/src/locales/zh-Hans/common.json
@@ -7,18 +7,6 @@
"opencollective": "OpenCollective ",
"weibo": "新浪微博",
"download": "下载 {{version}}",
- "linux-x64": "64 位 Linux 版",
- "linux-arm": "ARM Linux 版",
- "linux-deb-x64": "64 位 Debian / Ubuntu 版",
- "linux-deb-arm": "ARM Debian / Ubuntu 版",
- "linux-rpm-x64": "64 位 Fedora / CentOS 版",
- "macos-x64": "64 位 macOS 版",
- "macos-arm": "ARM macOS 版",
- "win-ia32": "32 位 Windows 版",
- "win-ia32-setup": "32 位 Windows 安装包",
- "win-x64": "64 位 Windows 版",
- "win-x64-setup": "64 位 Windows 安装包",
- "win-arm": "ARM Windows 版",
"stable-hint": "正式版,适合大部分人使用",
"beta-hint": "测试版,包含最新的功能",
"other-versions": "浏览完整列表",
@@ -50,15 +38,5 @@
"Download options": "下载其它平台版本",
"Operating system": "操作系统",
"Platform": "平台",
- "Options": "选项",
- "linux": "Linux",
- "macos": "macOS",
- "windows": "Windows",
- "arm": "ARM",
- "ia32": "32位",
- "x64": "64位",
- "deb": "DEB",
- "portable": "便携版",
- "rpm": "RPM",
- "setup": "安装包"
+ "Options": "选项"
}
diff --git a/src/locales/zh-Hant/common.json b/src/locales/zh-Hant/common.json
index 82015b5..4555e4b 100644
--- a/src/locales/zh-Hant/common.json
+++ b/src/locales/zh-Hant/common.json
@@ -7,18 +7,6 @@
"opencollective": "OpenCollective",
"weibo": "新浪微博",
"download": "下載 {{version}}",
- "linux-x64": "64 位 Linux 版",
- "linux-arm": "ARM Linux 版",
- "linux-deb-x64": "64 位 Debian / Ubuntu 版",
- "linux-deb-arm": "ARM Debian / Ubuntu 版",
- "linux-rpm-x64": "64 位 Fedora / CentOS 版",
- "macos-x64": "64 位 macOS 版",
- "macos-arm": "ARM macOS 版",
- "win-ia32": "32 位 Windows 版",
- "win-ia32-setup": "32 位 Windows 安裝包",
- "win-x64": "64 位 Windows 版",
- "win-x64-setup": "64 位 Windows 安裝包",
- "win-arm": "ARM Windows 版",
"stable-hint": "正式版,適合大部分人使用",
"beta-hint": "測試版,包含最新的功能",
"other-versions": "瀏覽完整列表",
@@ -50,15 +38,5 @@
"Download options": "下載其它平臺版本",
"Operating system": "作業系統",
"Platform": "平台",
- "Options": "選項",
- "linux": "Linux",
- "macos": "macOS",
- "windows": "Windows",
- "arm": "ARM",
- "ia32": "32位",
- "x64": "64位",
- "deb": "DEB",
- "portable": "便攜版",
- "rpm": "RPM",
- "setup": "安裝包"
+ "Options": "選項"
}