Improvements
This commit is contained in:
1 file changed
+19
-3
@@ -66,6 +66,21 @@ export default function GameDownloadsPage () {
|
||||
a.click()
|
||||
}
|
||||
|
||||
const replaceName = (id: string) => {
|
||||
return id
|
||||
.replace('windows-x86', 'Windows x86')
|
||||
.replace('windows-x64', 'Windows x64')
|
||||
.replace('windows-arm64', 'Windows ARM64')
|
||||
.replace('macos-x64', 'MacOS x64')
|
||||
.replace('macos-arm64', 'MacOS ARM64')
|
||||
.replace('macos-universal', 'MacOS Universal')
|
||||
.replace('linux-x86', 'Linux x86')
|
||||
.replace('linux-x64', 'Linux x64')
|
||||
.replace('linux-ARM64', 'Linux ARM64')
|
||||
.replace('android', 'Android')
|
||||
.replace('ios', 'iOS')
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='box'>
|
||||
<HomeButton refLink={backButtonRef} />
|
||||
@@ -87,15 +102,16 @@ export default function GameDownloadsPage () {
|
||||
{Object.entries(v.downloads).map(([key, value]) => (
|
||||
<button
|
||||
key={v.game + '-' + v.id + '-' + key}
|
||||
onClick={async () => {
|
||||
onClick={async e => {
|
||||
e.currentTarget.disabled = true
|
||||
const result = await axios.get(
|
||||
`/api/launcher/download?downloadId=${value}&versionId=${v.id}`
|
||||
)
|
||||
downloadFile(result.data.data.url)
|
||||
e.currentTarget.disabled = false
|
||||
}}
|
||||
>
|
||||
{key.charAt(0).toUpperCase() +
|
||||
key.slice(1).replace('-', ' ')}
|
||||
{replaceName(key)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user