Skip to content

Commit 8d860f4

Browse files
authored
[FIX] Download Action after canceling update from DM (#1146)
* [FIX] Download Action after canceling update from DM * chore: update utils pkg * chore: logs and codecheck * fix: icons and titles --------- Co-authored-by: Flavio F Lima <[email protected]>
1 parent 17c3831 commit 8d860f4

File tree

5 files changed

+56
-85
lines changed

5 files changed

+56
-85
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"@hyperplay/check-disk-space": "^3.5.2",
172172
"@hyperplay/quests-ui": "^0.0.28",
173173
"@hyperplay/ui": "^1.8.9",
174-
"@hyperplay/utils": "^0.3.3",
174+
"@hyperplay/utils": "^0.3.4",
175175
"@mantine/carousel": "^7.12.0",
176176
"@mantine/core": "^7.12.0",
177177
"@mantine/dropzone": "^7.12.0",

public/locales/en/translation.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,6 @@
676676
"retrying": "Retrying"
677677
},
678678
"On first launch Steam will download the necessary files and will take a few minutes to finish and the login screen to appear;": "On first launch Steam will download the necessary files and will take a few minutes to finish and the login screen to appear;",
679-
"Open": "Open",
680679
"options": {
681680
"advanced": {
682681
"key": "Variable Name",
@@ -806,9 +805,13 @@
806805
"finished": "Nothing downloaded",
807806
"queue": "Nothing to download"
808807
},
808+
"launch": "Launch Game",
809809
"pause": "Pause download",
810810
"remove": "Remove from Downloads",
811811
"resume": "Resume download",
812+
"retry-install": "Retry Install",
813+
"retry-update": "Retry Update",
814+
"stop": "Stop Download",
812815
"timeElapsed": "Time Elapsed: {{elapsed}}"
813816
}
814817
},

src/frontend/screens/DownloadManager/components/DownloadManagerItem/index.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import libraryState from 'frontend/state/libraryState'
2727
import { hasStatus } from 'frontend/hooks/hasStatus'
2828
import { Images } from '@hyperplay/ui'
2929
import styles from './index.module.scss'
30-
const { PauseIcon, PlayIcon, XCircle, DownloadIcon } = Images
30+
const { PauseIcon, PlayIcon, XCircle, DownloadIcon, Refresh } = Images
3131

3232
type Props = {
3333
element?: DMQueueElement
@@ -130,6 +130,7 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
130130
const finished = status === 'done'
131131
const canceled = status === 'error' || (status === 'abort' && !current)
132132
const isExtracting = gameProgressStatus === 'extracting'
133+
const isUpdate = type === 'update'
133134
const isPatching = gameProgressStatus === 'patching'
134135

135136
const goToGamePage = (action?: GamePageActions) => {
@@ -144,7 +145,15 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
144145
// using one element for the different states so it doesn't
145146
// lose focus from the button when using a game controller
146147
const handleMainActionClick = async () => {
147-
const action = finished ? 'launch' : 'install'
148+
let action: GamePageActions | undefined = 'launch'
149+
if (!finished) {
150+
if (isUpdate) {
151+
action = 'update'
152+
} else {
153+
action = 'install'
154+
}
155+
}
156+
148157
if (finished || canceled) {
149158
return goToGamePage(action)
150159
}
@@ -174,6 +183,9 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
174183
}
175184

176185
if (canceled) {
186+
if (isUpdate) {
187+
return <Refresh className={styles.downloadIcon} />
188+
}
177189
return <DownloadIcon className={styles.downloadIcon} />
178190
}
179191

@@ -205,11 +217,18 @@ const DownloadManagerItem = observer(({ element, current, state }: Props) => {
205217
const mainIconTitle = () => {
206218
const { status } = element
207219
if (status === 'done' || status === 'error') {
208-
return t('Open')
220+
return t('queue.label.launch', 'Launch Game')
221+
}
222+
223+
if (canceled) {
224+
if (isUpdate) {
225+
return t('queue.label.retry-update', 'Retry Update')
226+
}
227+
return t('queue.label.retry-install', 'Retry Install')
209228
}
210229

211230
return current
212-
? t('button.cancel', 'Cancel')
231+
? t('queue.label.stop', 'Stop Download')
213232
: t('queue.label.remove', 'Remove from Downloads')
214233
}
215234

src/frontend/screens/Game/GamePage/index.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,25 @@ export default observer(function GamePage(): JSX.Element | null {
162162

163163
const hasRun = useRef(false)
164164
useEffect(() => {
165-
if (!action || hasRun.current) return
166-
hasRun.current = true
165+
const mainAction = async () => {
166+
if (!action || hasRun.current) return
167+
hasRun.current = true
167168

168-
if (action === 'install') {
169-
return setShowModal({ game: appName, show: true })
170-
}
171-
if (action === 'launch') {
172-
if (isBrowserGame || gameInfo.is_installed) {
173-
handlePlay()()
174-
} else {
169+
if (action === 'update') {
170+
return updateGame(gameInfo)
171+
}
172+
if (action === 'install') {
175173
return setShowModal({ game: appName, show: true })
176174
}
175+
if (action === 'launch') {
176+
if (isBrowserGame || gameInfo.is_installed) {
177+
handlePlay()()
178+
} else {
179+
return setShowModal({ game: appName, show: true })
180+
}
181+
}
177182
}
183+
mainAction()
178184
}, [action])
179185

180186
// Track the screen view once each time the appName, gameInfo or runner changes

yarn.lock

Lines changed: 13 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@
11581158
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.6.0.tgz#31ab07ca6a06358c5de4d295d4711b675006163f"
11591159
integrity sha512-xyX0X9mc0kyz9plIyryrRbl7ngsA9jz77mCZJsUkLl+ZKs0KWObgaEBoSgQiYWAsSmjz/yjl0F++Got0Mdp4Rw==
11601160

1161-
"@fortawesome/fontawesome-svg-core@^6.1.1", "@fortawesome/fontawesome-svg-core@^6.4.0":
1161+
"@fortawesome/fontawesome-svg-core@^6.1.1":
11621162
version "6.6.0"
11631163
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.6.0.tgz#2a24c32ef92136e98eae2ff334a27145188295ff"
11641164
integrity sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg==
@@ -1172,21 +1172,21 @@
11721172
dependencies:
11731173
"@fortawesome/fontawesome-common-types" "6.6.0"
11741174

1175-
"@fortawesome/free-regular-svg-icons@^6.4.0", "@fortawesome/free-regular-svg-icons@^6.6.0":
1175+
"@fortawesome/free-regular-svg-icons@^6.6.0":
11761176
version "6.6.0"
11771177
resolved "https://registry.yarnpkg.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.6.0.tgz#fc49a947ac8dfd20403c9ea5f37f0919425bdf04"
11781178
integrity sha512-Yv9hDzL4aI73BEwSEh20clrY8q/uLxawaQ98lekBx6t9dQKDHcDzzV1p2YtBGTtolYtNqcWdniOnhzB+JPnQEQ==
11791179
dependencies:
11801180
"@fortawesome/fontawesome-common-types" "6.6.0"
11811181

1182-
"@fortawesome/free-solid-svg-icons@^6.4.0", "@fortawesome/free-solid-svg-icons@^6.6.0":
1182+
"@fortawesome/free-solid-svg-icons@^6.6.0":
11831183
version "6.6.0"
11841184
resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.6.0.tgz#061751ca43be4c4d814f0adbda8f006164ec9f3b"
11851185
integrity sha512-IYv/2skhEDFc2WGUcqvFJkeK39Q+HyPf5GHUrT/l2pKbtgEIv1al1TKd6qStR5OIwQdN1GZP54ci3y4mroJWjA==
11861186
dependencies:
11871187
"@fortawesome/fontawesome-common-types" "6.6.0"
11881188

1189-
"@fortawesome/react-fontawesome@^0.2.0", "@fortawesome/react-fontawesome@^0.2.2":
1189+
"@fortawesome/react-fontawesome@^0.2.2":
11901190
version "0.2.2"
11911191
resolved "https://registry.yarnpkg.com/@fortawesome/react-fontawesome/-/react-fontawesome-0.2.2.tgz#68b058f9132b46c8599875f6a636dad231af78d4"
11921192
integrity sha512-EnkrprPNqI6SXJl//m29hpaNzOp1bruISWaOiRtkMi/xSvHJlzc2j2JAYS7egxt/EbjSNV/k6Xy0AQI6vB2+1g==
@@ -1240,13 +1240,6 @@
12401240
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3"
12411241
integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==
12421242

1243-
"@hyperplay/chains@^0.2.9":
1244-
version "0.2.10"
1245-
resolved "https://registry.yarnpkg.com/@hyperplay/chains/-/chains-0.2.10.tgz#6c9d4e175146d79e4556039db487c182d60c533d"
1246-
integrity sha512-TUe9vJo9jXx23pb5QlGuW6xo6JmXYjqXKJSma//aUPZ99HU8I/lATlyqdXwozPfQ2qGsAYn58FCTo2kbF+J+8w==
1247-
dependencies:
1248-
axios "^1.4.0"
1249-
12501243
"@hyperplay/chains@^0.3.0":
12511244
version "0.3.0"
12521245
resolved "https://registry.yarnpkg.com/@hyperplay/chains/-/chains-0.3.0.tgz#f0cc73e1fde33678328249e40bf0d02bccd14625"
@@ -1358,10 +1351,10 @@
13581351
dependencies:
13591352
bignumber.js "^9.1.2"
13601353

1361-
"@hyperplay/utils@^0.3.1":
1362-
version "0.3.3"
1363-
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.3.3.tgz#9d594a29012ae5a172138878208d6d4edb6412f2"
1364-
integrity sha512-t8XB7oFWJU4S1ULxVBURt9BhpgaZAq5C131Ch5wShxuMTjxxGEhTAAcppsH+VYd7lwtp4se9myzhc6u21rUNgQ==
1354+
"@hyperplay/utils@^0.3.4":
1355+
version "0.3.4"
1356+
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.3.4.tgz#71d4abe910ec8550c865418118eb1c07df3b399d"
1357+
integrity sha512-ndkDnp+iV9BlLCKpbq0XVuuc/ORzaZ+69wFvVvAftdU6mbwbk4EfxAwTOpmXWkLaiGp0MZaybYMa5zYZkxkW5w==
13651358
dependencies:
13661359
bignumber.js "^9.1.2"
13671360

@@ -3000,19 +2993,6 @@
30002993
dependencies:
30012994
defer-to-connect "^2.0.0"
30022995

3003-
"@tabler/icons-react@^2.46.0":
3004-
version "2.47.0"
3005-
resolved "https://registry.yarnpkg.com/@tabler/icons-react/-/icons-react-2.47.0.tgz#b704e7ae98f95be8bd6e938b4b2e84cd20b0cf31"
3006-
integrity sha512-iqly2FvCF/qUbgmvS8E40rVeYY7laltc5GUjRxQj59DuX0x/6CpKHTXt86YlI2whg4czvd/c8Ce8YR08uEku0g==
3007-
dependencies:
3008-
"@tabler/icons" "2.47.0"
3009-
prop-types "^15.7.2"
3010-
3011-
3012-
version "2.47.0"
3013-
resolved "https://registry.yarnpkg.com/@tabler/icons/-/icons-2.47.0.tgz#c41c680d1947e3ab2d60af3febc4132287c60596"
3014-
integrity sha512-4w5evLh+7FUUiA1GucvGj2ReX2TvOjEr4ejXdwL/bsjoSkof6r1gQmzqI+VHrE2CpJpB3al7bCTulOkFa/RcyA==
3015-
30162996
"@tanstack/[email protected]":
30172997
version "5.52.2"
30182998
resolved "https://registry.yarnpkg.com/@tanstack/query-core/-/query-core-5.52.2.tgz#a023864a892fda9858b724d667eb19cd84ce054a"
@@ -3791,7 +3771,7 @@
37913771
resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"
37923772
integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==
37933773

3794-
"@valist/sdk@^2.10.5", "@valist/sdk@^2.9.1":
3774+
"@valist/sdk@^2.10.5":
37953775
version "2.10.5"
37963776
resolved "https://registry.yarnpkg.com/@valist/sdk/-/sdk-2.10.5.tgz#e43cafc101d42097c6191ae2ac0f426b62603520"
37973777
integrity sha512-2m95VJfljJQXaSUfqfVwfHsaVcgynY4yy6wKjIsACYgiKkzck2XqjyAOtLhRESyzvuNvBA/ypj0mP+JxdmCtOw==
@@ -7098,13 +7078,6 @@ eth-rpc-errors@^4.0.2, eth-rpc-errors@^4.0.3:
70987078
dependencies:
70997079
fast-safe-stringify "^2.0.6"
71007080

7101-
ethereum-blockies-base64@^1.0.2:
7102-
version "1.0.2"
7103-
resolved "https://registry.yarnpkg.com/ethereum-blockies-base64/-/ethereum-blockies-base64-1.0.2.tgz#4aebca52142bf4d16a3144e6e2b59303e39ed2b3"
7104-
integrity sha512-Vg2HTm7slcWNKaRhCUl/L3b4KrB8ohQXdd5Pu3OI897EcR6tVRvUqdTwAyx+dnmoDzj8e2bwBLDQ50ByFmcz6w==
7105-
dependencies:
7106-
pnglib "0.0.1"
7107-
71087081
ethereum-cryptography@^2.0.0:
71097082
version "2.2.1"
71107083
resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.2.1.tgz#58f2810f8e020aecb97de8c8c76147600b0b8ccf"
@@ -11324,11 +11297,6 @@ pngjs@^5.0.0:
1132411297
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-5.0.0.tgz#e79dd2b215767fd9c04561c01236df960bce7fbb"
1132511298
integrity sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==
1132611299

11327-
11328-
version "0.0.1"
11329-
resolved "https://registry.yarnpkg.com/pnglib/-/pnglib-0.0.1.tgz#f9ab6f9c688f4a9d579ad8be28878a716e30c096"
11330-
integrity sha512-95ChzOoYLOPIyVmL+Y6X+abKGXUJlvOVLkB1QQkyXl7Uczc6FElUy/x01NS7r2GX6GRezloO/ecCX9h4U9KadA==
11331-
1133211300
pony-cause@^2.1.10:
1133311301
version "2.1.11"
1133411302
resolved "https://registry.yarnpkg.com/pony-cause/-/pony-cause-2.1.11.tgz#d69a20aaccdb3bdb8f74dd59e5c68d8e6772e4bd"
@@ -11478,7 +11446,7 @@ prompts@^2.0.1:
1147811446
kleur "^3.0.3"
1147911447
sisteransi "^1.0.5"
1148011448

11481-
prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1:
11449+
prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.8.1:
1148211450
version "15.8.1"
1148311451
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
1148411452
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
@@ -12755,16 +12723,7 @@ string-length@^4.0.1:
1275512723
char-regex "^1.0.2"
1275612724
strip-ansi "^6.0.0"
1275712725

12758-
"string-width-cjs@npm:string-width@^4.2.0":
12759-
version "4.2.3"
12760-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
12761-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
12762-
dependencies:
12763-
emoji-regex "^8.0.0"
12764-
is-fullwidth-code-point "^3.0.0"
12765-
strip-ansi "^6.0.1"
12766-
12767-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
12726+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1276812727
version "4.2.3"
1276912728
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
1277012729
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -12858,14 +12817,7 @@ stringify-entities@^4.0.0:
1285812817
character-entities-html4 "^2.0.0"
1285912818
character-entities-legacy "^3.0.0"
1286012819

12861-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
12862-
version "6.0.1"
12863-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
12864-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
12865-
dependencies:
12866-
ansi-regex "^5.0.1"
12867-
12868-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
12820+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1286912821
version "6.0.1"
1287012822
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
1287112823
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -14120,7 +14072,7 @@ word-wrap@^1.2.5:
1412014072
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
1412114073
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
1412214074

14123-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
14075+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1412414076
version "7.0.0"
1412514077
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1412614078
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -14138,15 +14090,6 @@ wrap-ansi@^6.2.0:
1413814090
string-width "^4.1.0"
1413914091
strip-ansi "^6.0.0"
1414014092

14141-
wrap-ansi@^7.0.0:
14142-
version "7.0.0"
14143-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
14144-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
14145-
dependencies:
14146-
ansi-styles "^4.0.0"
14147-
string-width "^4.1.0"
14148-
strip-ansi "^6.0.0"
14149-
1415014093
wrap-ansi@^8.1.0:
1415114094
version "8.1.0"
1415214095
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)