|
1 |
| -import React from 'react' |
| 1 | +import React, { useContext } from 'react' |
2 | 2 | import { useTranslation } from 'react-i18next'
|
3 | 3 | import ToggleSwitch from 'frontend/components/UI/ToggleSwitch'
|
4 | 4 | import useSetting from 'frontend/hooks/useSetting'
|
5 | 5 | import libraryState from 'frontend/state/libraryState'
|
| 6 | +import ContextProvider from 'frontend/state/ContextProvider' |
6 | 7 |
|
7 | 8 | export default function EnableSteamIntegration() {
|
8 | 9 | const { t } = useTranslation()
|
9 | 10 | const [enabled, setEnabled] = useSetting('enableSteamIntegration', false)
|
| 11 | + const { showDialogModal } = useContext(ContextProvider) |
10 | 12 |
|
11 | 13 | const handleChange = () => {
|
12 | 14 | const newValue = !enabled
|
13 |
| - setEnabled(newValue) |
14 | 15 | 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 | + }) |
16 | 58 | } else {
|
| 59 | + setEnabled(false) |
17 | 60 | if (libraryState.category === 'steam') {
|
18 | 61 | libraryState.category = 'all'
|
19 | 62 | }
|
|
0 commit comments