mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 08:04:52 +01:00
QoL changes & code formatting
This commit is contained in:
@@ -20,4 +20,4 @@ root.render(
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
import reportWebVitals from './utils/reportWebVitals'
|
||||
reportWebVitals()
|
||||
reportWebVitals(console.log)
|
||||
@@ -72,8 +72,6 @@ export default class DirInput extends React.Component<IProps, IState> {
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Array.isArray(path)) path = path[0]
|
||||
if (!path) return
|
||||
|
||||
@@ -6,7 +6,6 @@ import './Options.css'
|
||||
import { setConfigOption, getConfig, getConfigOption } from '../../../utils/configuration'
|
||||
import Checkbox from '../common/Checkbox'
|
||||
import Divider from './Divider'
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
|
||||
interface IProps {
|
||||
closeFn: () => void;
|
||||
@@ -81,8 +80,8 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
})
|
||||
}
|
||||
|
||||
setCustomBackground() {
|
||||
setConfigOption('customBackground', this.state.bg_url_or_path)
|
||||
setCustomBackground(value: string) {
|
||||
setConfigOption('customBackground', value)
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -132,7 +131,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
<Tr text="options.background" />
|
||||
</div>
|
||||
<div className='OptionValue'>
|
||||
<DirInput onChange={this.setCustomBackground} readonly={false} value={this.state?.bg_url_or_path} extensions={['png', 'jpg', 'jpeg']} />
|
||||
<DirInput onChange={this.setCustomBackground} value={this.state?.bg_url_or_path} extensions={['png', 'jpg', 'jpeg']} readonly={false} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -40,11 +40,10 @@ export interface Configuration {
|
||||
}
|
||||
|
||||
export async function setConfigOption(key: string, value: any): Promise<void> {
|
||||
const config = await getConfig()
|
||||
|
||||
Object.assign(config, { [key]: value })
|
||||
const config: any = await getConfig()
|
||||
config[key] = value
|
||||
|
||||
await saveConfig(config)
|
||||
await saveConfig(<Configuration> config)
|
||||
}
|
||||
|
||||
export async function getConfigOption(key: string): Promise<any> {
|
||||
|
||||
Reference in New Issue
Block a user