QoL changes & code formatting

This commit is contained in:
KingRainbow44
2022-06-01 17:28:48 -04:00
parent 2d2cf82751
commit 174a990c40
8 changed files with 20 additions and 23 deletions

View File

@@ -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)

View File

@@ -72,8 +72,6 @@ export default class DirInput extends React.Component<IProps, IState> {
]
})
}
if (Array.isArray(path)) path = path[0]
if (!path) return

View File

@@ -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>

View File

@@ -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> {