Skip to content

Commit b57c6ce

Browse files
committed
feat: add Steam integration requirements dialog and update types for message handling
1 parent d2d1cac commit b57c6ce

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

public/locales/en/translation.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,21 @@
11301130
"logging": "Logging In...",
11311131
"processing": "Processing files, please wait"
11321132
},
1133+
"steam": {
1134+
"integration": {
1135+
"requirements": {
1136+
"part1": "To ensure this integration works properly and HyperPlay can access your games, you must have",
1137+
"part2": "Steam installed",
1138+
"part3": "and be",
1139+
"part4": "Logged into",
1140+
"part5": "your account.",
1141+
"part6": "Additionally, your profile and game details should be set to ",
1142+
"part7": "Public",
1143+
"part8": "Steam > Profile > Edit Profile > Privacy Settings",
1144+
"title": "Steam Integration Requirements"
1145+
}
1146+
}
1147+
},
11331148
"Steam Installation": "",
11341149
"steam-install": {
11351150
"compatibility-layer-not-available": "Compatibility layer not available. Please install one from \"Settings > Wine Manager\" first.",

src/frontend/screens/Settings/components/EnableSteamIntegration.tsx

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,62 @@
1-
import React from 'react'
1+
import React, { useContext } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import ToggleSwitch from 'frontend/components/UI/ToggleSwitch'
44
import useSetting from 'frontend/hooks/useSetting'
55
import libraryState from 'frontend/state/libraryState'
6+
import ContextProvider from 'frontend/state/ContextProvider'
67

78
export default function EnableSteamIntegration() {
89
const { t } = useTranslation()
910
const [enabled, setEnabled] = useSetting('enableSteamIntegration', false)
11+
const { showDialogModal } = useContext(ContextProvider)
1012

1113
const handleChange = () => {
1214
const newValue = !enabled
13-
setEnabled(newValue)
1415
if (newValue) {
15-
window.api.refreshLibrary('steam')
16+
showDialogModal({
17+
title: t(
18+
'steam.integration.requirements.title',
19+
'Steam Integration Requirements'
20+
),
21+
message: (
22+
<span>
23+
{t(
24+
'steam.integration.requirements.part1',
25+
'To ensure this integration works properly and HyperPlay can access your games, you must have'
26+
)}{' '}
27+
<b>
28+
{t('steam.integration.requirements.part2', 'Steam installed')}
29+
</b>{' '}
30+
{t('steam.integration.requirements.part3', 'and be')}{' '}
31+
<b>{t('steam.integration.requirements.part4', 'Logged into')}</b>{' '}
32+
{t('steam.integration.requirements.part5', 'your account.')}{' '}
33+
{t(
34+
'steam.integration.requirements.part6',
35+
'Additionally, your profile and game details should be set to '
36+
)}
37+
<b>{t('steam.integration.requirements.part7', 'Public')}</b> (
38+
<b>
39+
{t(
40+
'steam.integration.requirements.part8',
41+
'Steam > Profile > Edit Profile > Privacy Settings'
42+
)}
43+
</b>
44+
)
45+
</span>
46+
),
47+
buttons: [
48+
{
49+
text: t('box.ok', 'OK'),
50+
onClick: () => {
51+
setEnabled(true)
52+
window.api.refreshLibrary('steam')
53+
}
54+
}
55+
],
56+
type: 'MESSAGE'
57+
})
1658
} else {
59+
setEnabled(false)
1760
if (libraryState.category === 'steam') {
1861
libraryState.category = 'all'
1962
}

src/frontend/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export interface ContextType {
7575
export type DialogModalOptions = {
7676
showDialog?: boolean
7777
title?: string
78-
message?: string
78+
message?: string | React.ReactNode
7979
buttons?: Array<ButtonOptions>
8080
type?: DialogType
8181
onClose?: () => void

0 commit comments

Comments
 (0)