From 8798b29b7c67a4d530bf23c5a7f7fa4e1aca7c93 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 9 May 2022 16:26:13 -0700 Subject: [PATCH] downloads button --- src/ui/App.tsx | 12 ++++++++++-- src/ui/components/TopBar.tsx | 4 ++++ src/ui/components/common/Checkbox.tsx | 6 ++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 4919b47..ba1ef67 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -4,7 +4,7 @@ import './App.css' import './custom.css' // Config -import { getConfig } from '../utils/configuration' +import { getConfig, saveConfig } from '../utils/configuration' // Major Components import Topbar from './components/TopBar' @@ -20,13 +20,21 @@ async function playGame() { await invoke('run_program', { path: config.game_path }) } +async function toggleGrasscutter() { + const config = await getConfig() + + config.toggle_grasscutter = !config.toggle_grasscutter + + await saveConfig(config) +} + function App() { return (
- +
diff --git a/src/ui/components/TopBar.tsx b/src/ui/components/TopBar.tsx index 1009b91..88cf1c3 100644 --- a/src/ui/components/TopBar.tsx +++ b/src/ui/components/TopBar.tsx @@ -4,6 +4,7 @@ import './TopBar.css' import closeIcon from '../../resources/icons/close.svg' import minIcon from '../../resources/icons/min.svg' import cogBtn from '../../resources/icons/cog.svg' +import downBtn from '../../resources/icons/download.svg' import { app } from '@tauri-apps/api' interface IProps { @@ -47,6 +48,9 @@ export default class TopBar extends React.Component {
settings
+
+ downloads +
) diff --git a/src/ui/components/common/Checkbox.tsx b/src/ui/components/common/Checkbox.tsx index 1a5bc3e..df4d415 100644 --- a/src/ui/components/common/Checkbox.tsx +++ b/src/ui/components/common/Checkbox.tsx @@ -1,7 +1,8 @@ import React from 'react' interface IProps { - label: string + label: string, + onChange: () => void, } interface IState { @@ -13,12 +14,13 @@ export default class Checkbox extends React.Component { super(props) this.state = { - checked: false, + checked: false } } handleChange = () => { this.setState({ checked: !this.state.checked }) + this.props.onChange() } render() {