diff --git a/src/ui/App.css b/src/ui/App.css index d8eddae..89f71a9 100644 --- a/src/ui/App.css +++ b/src/ui/App.css @@ -35,12 +35,29 @@ select:focus { .TopButton { height: 60%; margin: 0px 10px; + + color: #c5c5c5; + transition: color 0.1s ease-in-out; +} + +.TopButton span { + display: inline-block; + line-height: normal; + border-bottom: 1px solid #c5c5c5; +} + +.TopButton img { filter: invert(95%) sepia(0%) saturate(18%) hue-rotate(153deg) brightness(88%) contrast(81%); transition: filter 0.1s ease-in-out; } .TopButton:hover { + color: #fff; + cursor: pointer; +} + +.TopButton:hover img { filter: invert(100%) sepia(0%) saturate(18%) hue-rotate(153deg) brightness(100%) contrast(100%); cursor: pointer; } diff --git a/src/ui/App.tsx b/src/ui/App.tsx index f2e034f..cfdd529 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -7,9 +7,10 @@ import { getTheme, loadTheme } from '../utils/themes' import { convertFileSrc, invoke } from '@tauri-apps/api/tauri' import { dataDir } from '@tauri-apps/api/path' import { Main } from './Main' +import { Mods } from './Mods' interface IState { - moddingOpen: boolean + page: string bgFile: string } @@ -21,7 +22,7 @@ class App extends React.Component, IState> { super(props) this.state = { - moddingOpen: false, + page: 'main', bgFile: DEFAULT_BG, } } @@ -85,6 +86,13 @@ class App extends React.Component, IState> { ) } } + + window.addEventListener('changePage', (e) => { + this.setState({ + // @ts-expect-error - TS doesn't like our custom event + page: e.detail, + }) + }) } render() { @@ -99,11 +107,14 @@ class App extends React.Component, IState> { : {} } > - {this.state.moddingOpen ? null : ( - <> -
- - )} + {(() => { + switch (this.state.page) { + case 'modding': + return + default: + return
+ } + })()} ) } diff --git a/src/ui/Debug.tsx b/src/ui/Debug.tsx index 74960bb..7b712d2 100644 --- a/src/ui/Debug.tsx +++ b/src/ui/Debug.tsx @@ -44,7 +44,7 @@ class Debug extends React.Component { render() { return (
- + diff --git a/src/ui/Main.tsx b/src/ui/Main.tsx index 8990ae1..13109ec 100644 --- a/src/ui/Main.tsx +++ b/src/ui/Main.tsx @@ -20,6 +20,11 @@ import { appWindow } from '@tauri-apps/api/window' import { unpatchGame } from '../utils/metadata' import DownloadHandler from '../utils/download' +// Graphics +import cogBtn from '../resources/icons/cog.svg' +import downBtn from '../resources/icons/download.svg' +import wrenchBtn from '../resources/icons/wrench.svg' + interface IProps { downloadHandler: DownloadHandler } @@ -45,8 +50,6 @@ export class Main extends React.Component { moddingOpen: false, } - invoke('list_submissions') - listen('lang_error', (payload) => { console.log(payload) }) @@ -111,14 +114,36 @@ export class Main extends React.Component { render() { return ( <> - { - this.setState({ optionsOpen: !this.state.optionsOpen }) - }} - downFunc={() => this.setState({ downloadsOpen: !this.state.downloadsOpen })} - gameFunc={() => this.setState({ gameDownloadsOpen: !this.state.gameDownloadsOpen })} - modFunc={() => this.setState({ moddingOpen: !this.state.moddingOpen })} - /> + +
this.setState({ optionsOpen: !this.state.optionsOpen })} + className="TopButton" + > + settings +
+
this.setState({ downloadsOpen: !this.state.downloadsOpen })} + > + downloads +
+
{ + // Create and dispatch a custom "openMods" event + const event = new CustomEvent('changePage', { detail: 'modding' }) + window.dispatchEvent(event) + }} + className="TopButton" + > + mods +
+ {/*
this.setState({ gameDownloadsOpen: !this.state.gameDownloadsOpen })}> + game +
*/} +
diff --git a/src/ui/Mods.tsx b/src/ui/Mods.tsx new file mode 100644 index 0000000..b6bad0f --- /dev/null +++ b/src/ui/Mods.tsx @@ -0,0 +1,29 @@ +import React from 'react' +import DownloadHandler from '../utils/download' +import TopBar from './components/TopBar' + +interface IProps { + downloadHandler: DownloadHandler +} + +interface IState { + isDownloading: boolean +} + +export class Mods extends React.Component { + constructor(props: IProps) { + super(props) + } + + async componentDidMount() { + return + } + + render() { + return ( + <> + + + ) + } +} diff --git a/src/ui/components/TopBar.tsx b/src/ui/components/TopBar.tsx index 8b2f55e..b51927f 100644 --- a/src/ui/components/TopBar.tsx +++ b/src/ui/components/TopBar.tsx @@ -3,8 +3,6 @@ import { app } from '@tauri-apps/api' import { appWindow } from '@tauri-apps/api/window' 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 Tr from '../../utils/language' @@ -12,10 +10,7 @@ import './TopBar.css' import { getConfig, setConfigOption } from '../../utils/configuration' interface IProps { - optFunc: () => void - downFunc: () => void - gameFunc: () => void - modFunc: () => void + children?: React.ReactNode[] } interface IState { @@ -111,18 +106,7 @@ export default class TopBar extends React.Component {
minimize
-
- settings -
-
- downloads -
-
- MODS -
- {/*
- game -
*/} + {this.props.children}
)