mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 08:34:43 +01:00
fix commands and stylign
This commit is contained in:
@@ -10,9 +10,12 @@ mod proxy;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.invoke_handler(tauri::generate_handler![downloader::download_file])
|
.invoke_handler(tauri::generate_handler![
|
||||||
.invoke_handler(tauri::generate_handler![run_program])
|
connect,
|
||||||
.invoke_handler(tauri::generate_handler![connect, disconnect])
|
disconnect,
|
||||||
|
run_program,
|
||||||
|
downloader::download_file
|
||||||
|
])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,14 +58,15 @@ class App extends React.Component<IProps, IState> {
|
|||||||
}}
|
}}
|
||||||
downFunc={() => {
|
downFunc={() => {
|
||||||
this.setState({ miniDownloadsOpen: !this.state.miniDownloadsOpen })
|
this.setState({ miniDownloadsOpen: !this.state.miniDownloadsOpen })
|
||||||
console.log(this.state.miniDownloadsOpen)
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{
|
{
|
||||||
// Mini downloads section
|
// Mini downloads section
|
||||||
this.state.miniDownloadsOpen ?
|
this.state.miniDownloadsOpen ?
|
||||||
<MiniDialog>
|
<MiniDialog closeFn={() => {
|
||||||
|
this.setState({ miniDownloadsOpen: false })
|
||||||
|
}}>
|
||||||
<DownloadList downloadManager={downloadHandler} />
|
<DownloadList downloadManager={downloadHandler} />
|
||||||
</MiniDialog> : null
|
</MiniDialog> : null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,3 +16,19 @@
|
|||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.MiniDialogTop {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MiniDialogTop img {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.MiniDialogTop:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
|
import Close from '../../resources/icons/close.svg'
|
||||||
import './MiniDialog.css'
|
import './MiniDialog.css'
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
children: React.ReactNode[] | React.ReactNode;
|
children: React.ReactNode[] | React.ReactNode;
|
||||||
|
closeFn: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class MiniDialog extends React.Component<IProps, never> {
|
export default class MiniDialog extends React.Component<IProps, never> {
|
||||||
@@ -14,7 +16,13 @@ export default class MiniDialog extends React.Component<IProps, never> {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="MiniDialog">
|
<div className="MiniDialog">
|
||||||
{this.props.children}
|
<div className="MiniDialogTop" onClick={this.props.closeFn}>
|
||||||
|
<div></div>
|
||||||
|
<img src={Close} className="MiniDialogClose" />
|
||||||
|
</div>
|
||||||
|
<div className="MiniDialogInner">
|
||||||
|
{this.props.children}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
height: 20px;
|
height: 20px;
|
||||||
width: 80%;
|
width: 80%;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #fff;
|
color: #c5c5c5;
|
||||||
|
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
@@ -23,5 +23,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ProgressText {
|
.ProgressText {
|
||||||
color: #fff;
|
color: #c5c5c5;
|
||||||
}
|
}
|
||||||
@@ -42,9 +42,8 @@ export default class DownloadHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addDownload(url: string, path: string) {
|
addDownload(url: string, path: string) {
|
||||||
// Begin download from rust backend
|
// Begin download from rust backend, don't add if the download addition fails
|
||||||
invoke('download_file', { url, path })
|
invoke('download_file', { url, path })
|
||||||
|
|
||||||
const obj = {
|
const obj = {
|
||||||
path,
|
path,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user