Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UX] Add info about what Reset Heroic and Clear Heroic Cache do #3431

Merged
merged 2 commits into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,28 @@
"wineversion": "Wine Version"
},
"settings": {
"advanced": {
"clearCache": {
"help1": "This action will clear the following caches:",
"help10": "Heroic configuration",
"help2": "Third-party game info (scores, steam compatibility, howlongtobeat, pcgamingwiki, applegamingwiki)",
"help3": "Legendary library info (list of games, install dialog info, game info)",
"help4": "GOG library info (list of games, install dialog info, api info -i.e: requirements-)",
"help5": "Amazon library info (list of games, install dialog info)",
"help6": "This will NOT delete:",
"help7": "Store login",
"help8": "Installed games",
"help9": "Games settings"
},
"details": "Details",
"resetHeroic": {
"help": "This will remove all Settings and Caching but won't remove your Installed games or your Epic credentials. Portable versions (AppImage, WinPortable, ...) of heroic needs to be restarted manually afterwards."
},
"title": {
"clearCache": "Clear Cache",
"resetHeroic": "Reset Heroic"
}
},
"battlEyeRuntime": {
"installing": "Installing BattlEye Runtime...",
"name": "BattlEye AntiCheat Runtime"
Expand Down
81 changes: 81 additions & 0 deletions src/frontend/screens/Settings/components/ClearCache.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { InfoBox } from 'frontend/components/UI'
import ContextProvider from 'frontend/state/ContextProvider'
import { CleaningServicesOutlined } from '@mui/icons-material'

const ClearCache = () => {
const { refreshLibrary } = useContext(ContextProvider)
const { t } = useTranslation()

async function clearHeroicCache() {
const storage: Storage = window.localStorage
storage.removeItem('updates')
window.api.clearCache(true)
return refreshLibrary({ runInBackground: true })
}

return (
<>
<h3 className="settingSubheader">
{t('settings.advanced.title.clearCache', 'Clear Cache')}
</h3>
<InfoBox text={t('settings.advanced.details', 'Details')}>
{t(
'settings.advanced.clearCache.help1',
'This action will clear the following caches:'
)}
<ul>
<li>
{t(
'settings.advanced.clearCache.help2',
'Third-party game info (scores, steam compatibility, howlongtobeat, pcgamingwiki, applegamingwiki)'
)}
</li>
<li>
{t(
'settings.advanced.clearCache.help3',
'Legendary library info (list of games, install dialog info, game info)'
)}
</li>
<li>
{t(
'settings.advanced.clearCache.help4',
'GOG library info (list of games, install dialog info, api info -i.e: requirements-)'
)}
</li>
<li>
{t(
'settings.advanced.clearCache.help5',
'Amazon library info (list of games, install dialog info)'
)}
</li>
</ul>
{t('settings.advanced.clearCache.help6', 'This will NOT delete:')}
<ul>
<li>{t('settings.advanced.clearCache.help7', 'Store login')}</li>
<li>{t('settings.advanced.clearCache.help8', 'Installed games')}</li>
<li>{t('settings.advanced.clearCache.help9', 'Games settings')}</li>
<li>
{t('settings.advanced.clearCache.help10', 'Heroic configuration')}
</li>
</ul>
CommandMC marked this conversation as resolved.
Show resolved Hide resolved
</InfoBox>
<button
className="button is-footer is-danger"
onClick={async () => clearHeroicCache()}
>
<div className="button-icontext-flex">
<div className="button-icon-flex">
<CleaningServicesOutlined />
</div>
<span className="button-icon-text">
{t('settings.clear-cache', 'Clear Heroic Cache')}
</span>
</div>
</button>
</>
)
}

export default ClearCache
36 changes: 36 additions & 0 deletions src/frontend/screens/Settings/components/ResetHeroic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { InfoBox } from 'frontend/components/UI'
import ContextProvider from 'frontend/state/ContextProvider'
import { DeleteOutline } from '@mui/icons-material'

const ResetHeroic = () => {
const { showResetDialog } = useContext(ContextProvider)
const { t } = useTranslation()

return (
<>
<h3 className="settingSubheader">
{t('settings.advanced.title.resetHeroic', 'Reset Heroic')}
</h3>
<InfoBox text={t('settings.advanced.details', 'Details')}>
{t(
'settings.advanced.resetHeroic.help',
"This will remove all Settings and Caching but won't remove your Installed games or your Epic credentials. Portable versions (AppImage, WinPortable, ...) of heroic needs to be restarted manually afterwards."
)}
</InfoBox>
<button className="button is-footer is-danger" onClick={showResetDialog}>
<div className="button-icontext-flex">
<div className="button-icon-flex">
<DeleteOutline />
</div>
<span className="button-icon-text">
{t('settings.reset-heroic', 'Reset Heroic')}
</span>
</div>
</button>
</>
)
}

export default ResetHeroic
2 changes: 2 additions & 0 deletions src/frontend/screens/Settings/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ export { default as WineVersionSelector } from './WineVersionSelector'
export { default as WrappersTable } from './WrappersTable'
export { default as EnableDXVKFpsLimit } from './EnableDXVKFpsLimit'
export { default as PlaytimeSync } from './PlaytimeSync'
export { default as ClearCache } from './ClearCache'
export { default as ResetHeroic } from './ResetHeroic'
2 changes: 1 addition & 1 deletion src/frontend/screens/Settings/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ a {
margin: 0;
}

.eosSettings {
.advancedSetting {
text-align: start;
}

Expand Down
61 changes: 20 additions & 41 deletions src/frontend/screens/Settings/sections/AdvancedSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useContext, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
CleaningServicesOutlined,
ContentCopyOutlined,
DeleteOutline,
CachedOutlined,
Expand All @@ -19,12 +18,14 @@ import {
AltGOGdlBin,
AltLegendaryBin,
AltNileBin,
ClearCache,
DisableLogs,
DownloadNoHTTPS,
ExperimentalFeatures
ExperimentalFeatures,
ResetHeroic
} from '../../components'

export default function AdvancedSettings() {
export default function AdvancedSetting() {
const { config } = useContext(SettingsContext)

const [isCopiedToClipboard, setCopiedToClipboard] = useState(false)
Expand All @@ -40,8 +41,7 @@ export default function AdvancedSettings() {
useState(false)
const eosOverlayAppName = '98bc04bc842e4906993fd6d6644ffb8d'

const { libraryStatus, platform, refreshLibrary, showResetDialog } =
useContext(ContextProvider)
const { libraryStatus, platform } = useContext(ContextProvider)
const { t } = useTranslation()
const isWindows = platform === 'win32'

Expand Down Expand Up @@ -161,13 +161,6 @@ export default function AdvancedSettings() {
setEosOverlayCheckingForUpdates(false)
}

async function clearHeroicCache() {
const storage: Storage = window.localStorage
storage.removeItem('updates')
window.api.clearCache(true)
return refreshLibrary({ runInBackground: true })
}

return (
<div>
<h3 className="settingSubheader">{t('settings.navbar.advanced')}</h3>
Expand All @@ -184,7 +177,7 @@ export default function AdvancedSettings() {

<hr />

<div className="eosSettings">
<div className="advancedSetting">
<h3>EOS Overlay</h3>
<div>{getMainEosText()}</div>
<br />
Expand Down Expand Up @@ -295,11 +288,24 @@ export default function AdvancedSettings() {
</button>
)}
</div>
<br />
<hr />
</div>

<div className="advancedSetting">
<ExperimentalFeatures />
<hr />
</div>

<div className="advancedSetting">
<ClearCache />
<hr />
</div>

<div className="advancedSetting">
<ResetHeroic />
<hr />
</div>

<div className="footerFlex">
<button
className={classNames('button', 'is-footer', {
Expand All @@ -326,33 +332,6 @@ export default function AdvancedSettings() {
</span>
</div>
</button>
<button
className="button is-footer is-danger"
onClick={async () => clearHeroicCache()}
>
<div className="button-icontext-flex">
<div className="button-icon-flex">
<CleaningServicesOutlined />
</div>
<span className="button-icon-text">
{t('settings.clear-cache', 'Clear Heroic Cache')}
</span>
</div>
</button>

<button
className="button is-footer is-danger"
onClick={showResetDialog}
>
<div className="button-icontext-flex">
<div className="button-icon-flex">
<DeleteOutline />
</div>
<span className="button-icon-text">
{t('settings.reset-heroic', 'Reset Heroic')}
</span>
</div>
</button>
</div>
</div>
)
Expand Down