-
-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add info about clear cache and reset before clicking buttons
- Loading branch information
Showing
5 changed files
with
140 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,7 +211,7 @@ a { | |
margin: 0; | ||
} | ||
|
||
.eosSettings { | ||
.advancedSetting { | ||
text-align: start; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters