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

15419 sdv config mod #111

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
12 changes: 12 additions & 0 deletions game-stardewvalley/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.3.0] - 2024-04-25

- Improved detection of mod configuration files
- Added ability to maintain all mod configuration files in one mod (toggleable option) - this will maintain configuration between mod updates and re-installs.
- Added "Sync Configuration Files" button to mods page tool bar to manually sync configuration files with the configuration mod (if enabled)
- Added settings page option to enable/disable the configuration mod.
38 changes: 30 additions & 8 deletions game-stardewvalley/Settings.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 45 additions & 12 deletions game-stardewvalley/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,35 @@ import React from 'react';
import { ControlLabel, FormGroup, HelpBlock, Panel } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { useSelector, useStore } from 'react-redux';
import { Toggle } from 'vortex-api';
import { Toggle, More, selectors, types } from 'vortex-api';
import { setRecommendations } from './actions';
import { GAME_ID } from './common';

function Settings() {
const useRecommendations = useSelector((state: any) =>
state.settings['SDV']?.useRecommendations);
interface IBaseProps {
onMergeConfigToggle: (profileId: string, enabled: boolean) => Promise<void>;
}

interface IConnectedProps {
profileId: string;
}

function Settings(props: IBaseProps) {
const { onMergeConfigToggle } = props;
const sdvSettings = useSelector((state: any) => state.settings['SDV']);
const { useRecommendations, mergeConfigs } = sdvSettings;
const store = useStore();
const { profileId } = useSelector(mapStateToProps);

const setUseRecommendations = React.useCallback((enabled: boolean) => {
store.dispatch(setRecommendations(enabled));
}, []);

const { t } = useTranslation();

const setMergeConfigSetting = React.useCallback((enabled: boolean) => {
onMergeConfigToggle(profileId, enabled);
}, [onMergeConfigToggle, profileId]);

const { t } = useTranslation();
const mergeEnabled = mergeConfigs?.[profileId];
return (
<form>
<FormGroup controlId='default-enable'>
Expand All @@ -26,20 +40,39 @@ function Settings() {
<Toggle
checked={useRecommendations}
onToggle={setUseRecommendations}
disabled={true}
>
{t('Use recommendations from the mod manifests')}
<More id='sdv_use_recommendations' name='SDV Use Recommendations'>
{t('If checked, when you install a mod for Stardew Valley you may get '
+ 'suggestions for installing further mods, required or recommended by it.'
+ 'This information could be wrong or incomplete so please carefully '
+ 'consider before accepting them.')}
</More>
</Toggle>
<Toggle checked={mergeEnabled} onToggle={setMergeConfigSetting}>
{t('Manage SDV mod configuration files')}
<More id='sdv_mod_configuration' name='SDV Mod Configuration'>
{t('Vortex by default is configured to attempt to pull-in newly created files (mod configuration json files for example) '
+ 'created externally (by the game itself or tools) into their respective mod folders.\n\n'
+ 'Unfortunately the configuration files are lost during mod updates when using this method.\n\n'
+ 'Toggling this functionality creates a separate mod configuration "override" folder where all of your mod configuration files '
+ 'will be stored. This allows you to manage your mod configuration files on their own, regardless of mod updates. '
)}
</More>
</Toggle>
<HelpBlock>
{t('If checked, when you install a mod for Stardew Valley you may get '
+ 'suggestions for installing further mods, required or recommended by it.'
+ 'This information could be wrong or incomplete so please carefully '
+ 'consider before accepting them.')}
</HelpBlock>
</Panel.Body>
</Panel>
</FormGroup>
</form>
);
}

function mapStateToProps(state: types.IState): IConnectedProps {
const profileId = selectors.lastActiveProfileForGame(state, GAME_ID);
return {
profileId,
}
}

export default Settings;
Loading