diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 99e338e..7155a32 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -11,6 +11,8 @@ import ServerLaunchSection from './components/ServerLaunchSection' import ProgressBar from './components/common/ProgressBar' import MainProgressBar from './components/common/MainProgressBar' import Options from './components/menu/Options' +import MiniDialog from './components/MiniDialog' +import DownloadList from './components/common/DownloadList' interface IProps { [key: string]: never; @@ -19,6 +21,7 @@ interface IProps { interface IState { isDownloading: boolean; optionsOpen: boolean; + miniDownloadsOpen: boolean; } const downloadHandler = new DownloadHandler() @@ -41,7 +44,8 @@ class App extends React.Component { super(props) this.state = { isDownloading: false, - optionsOpen: false + optionsOpen: false, + miniDownloadsOpen: false, } } @@ -52,9 +56,20 @@ class App extends React.Component { optFunc={() => { this.setState({ optionsOpen: !this.state.optionsOpen }) }} - downFunc={() => null} + downFunc={() => { + this.setState({ miniDownloadsOpen: !this.state.miniDownloadsOpen }) + console.log(this.state.miniDownloadsOpen) + }} /> + { + // Mini downloads section + this.state.miniDownloadsOpen ? + + + : null + } + { this.state.optionsOpen ? this.setState({ optionsOpen: !this.state.optionsOpen })}/> : null } diff --git a/src/ui/components/MiniDialog.css b/src/ui/components/MiniDialog.css new file mode 100644 index 0000000..215303b --- /dev/null +++ b/src/ui/components/MiniDialog.css @@ -0,0 +1,18 @@ +.MiniDialog { + position: fixed; + z-index: 99; + + /* Temp positions */ + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + + /* Len and width */ + height: 30%; + width: 30%; + + background: #fff; + padding: 20px; + border-radius: 10px; +} + diff --git a/src/ui/components/MiniDialog.tsx b/src/ui/components/MiniDialog.tsx new file mode 100644 index 0000000..3a1c7f4 --- /dev/null +++ b/src/ui/components/MiniDialog.tsx @@ -0,0 +1,21 @@ +import React from 'react' + +import './MiniDialog.css' + +interface IProps { + children: React.ReactNode[] | React.ReactNode; +} + +export default class MiniDialog extends React.Component { + constructor(props: IProps) { + super(props) + } + + render() { + return ( +
+ {this.props.children} +
+ ) + } +} \ No newline at end of file diff --git a/src/ui/components/TopBar.tsx b/src/ui/components/TopBar.tsx index d3d76af..b0d3fd1 100644 --- a/src/ui/components/TopBar.tsx +++ b/src/ui/components/TopBar.tsx @@ -1,11 +1,12 @@ import React from 'react' +import { app } from '@tauri-apps/api' import { appWindow } from '@tauri-apps/api/window' -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' + +import './TopBar.css' interface IProps { optFunc: () => void; @@ -13,7 +14,7 @@ interface IProps { } interface IState { - version: string + version: string; } export default class TopBar extends React.Component { constructor(props: IProps) { @@ -49,7 +50,7 @@ export default class TopBar extends React.Component {
settings
-
+
downloads
diff --git a/src/ui/components/common/DownloadList.css b/src/ui/components/common/DownloadList.css new file mode 100644 index 0000000..e69de29 diff --git a/src/ui/components/common/DownloadList.tsx b/src/ui/components/common/DownloadList.tsx new file mode 100644 index 0000000..f57847b --- /dev/null +++ b/src/ui/components/common/DownloadList.tsx @@ -0,0 +1,29 @@ +import React from 'react' +import DownloadHandler from '../../../utils/download' +import DownloadSection from './DownloadSection' + +import './DownloadList.css' + +interface IProps { + downloadManager: DownloadHandler; +} + +export default class DownloadList extends React.Component { + constructor(props: IProps) { + super(props) + } + + render() { + return ( +
+ { + this.props.downloadManager.getDownloads().map((download) => { + return ( + + ) + }) + } +
+ ) + } +} \ No newline at end of file diff --git a/src/ui/components/common/DownloadSection.css b/src/ui/components/common/DownloadSection.css new file mode 100644 index 0000000..e69de29 diff --git a/src/ui/components/common/DownloadSection.tsx b/src/ui/components/common/DownloadSection.tsx new file mode 100644 index 0000000..bb41027 --- /dev/null +++ b/src/ui/components/common/DownloadSection.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import DownloadHandler from '../../../utils/download' +import ProgressBar from './ProgressBar' + +import './DownloadSection.css' + +interface IProps { + downloadManager: DownloadHandler; + downloadName: string; +} + +export default class MiniDialog extends React.Component { + constructor(props: IProps) { + super(props) + } + + render() { + return ( +
+ {this.props.downloadName} +
+ +
+
+ ) + } +} \ No newline at end of file diff --git a/src/ui/components/common/ProgressBar.css b/src/ui/components/common/ProgressBar.css index a942c6b..2706597 100644 --- a/src/ui/components/common/ProgressBar.css +++ b/src/ui/components/common/ProgressBar.css @@ -13,6 +13,8 @@ width: 80%; background-color: #fff; color: #fff; + + border: 1px solid #ccc; } .InnerProgress { diff --git a/src/utils/download.ts b/src/utils/download.ts index 46111be..3cd1c9d 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -36,6 +36,10 @@ export default class DownloadHandler { this.downloads[index].status = 'finished' }) } + + getDownloads() { + return this.downloads + } addDownload(url: string, path: string) { // Begin download from rust backend