diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index b53862d..14548e2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -19,6 +19,7 @@ fn main() { disconnect, run_program, run_jar, + open_in_browser, req_get, get_bg_file, downloader::download_file, @@ -65,6 +66,15 @@ fn run_jar(path: String, execute_in: String) { }; } +#[tauri::command] +fn open_in_browser(url: String) { + // Open the URL in the default browser. + match open::that(url) { + Ok(_) => (), + Err(e) => println!("Failed to open URL: {}", e), + }; +} + #[tauri::command] async fn req_get(url: String) -> String { // Send a GET request to the specified URL. diff --git a/src/resources/icons/discord.svg b/src/resources/icons/discord.svg new file mode 100644 index 0000000..d017d35 --- /dev/null +++ b/src/resources/icons/discord.svg @@ -0,0 +1,10 @@ + +Created with Fabric.js 1.7.22 + + + + + + + + \ No newline at end of file diff --git a/src/resources/icons/github.svg b/src/resources/icons/github.svg new file mode 100644 index 0000000..fdd907f --- /dev/null +++ b/src/resources/icons/github.svg @@ -0,0 +1,10 @@ + +Created with Fabric.js 1.7.22 + + + + + + + + \ No newline at end of file diff --git a/src/ui/App.css b/src/ui/App.css index fc57d7d..6991c08 100644 --- a/src/ui/App.css +++ b/src/ui/App.css @@ -1,6 +1,8 @@ +html, body { user-select: none; height: 100vh; + overflow: hidden; } #root, .App { diff --git a/src/ui/App.tsx b/src/ui/App.tsx index 6772234..cccb4be 100644 --- a/src/ui/App.tsx +++ b/src/ui/App.tsx @@ -13,6 +13,7 @@ import MiniDialog from './components/MiniDialog' import DownloadList from './components/common/DownloadList' import Downloads from './components/menu/Downloads' import NewsSection from './components/news/NewsSection' +import RightBar from './components/RightBar' interface IProps { [key: string]: never; @@ -52,6 +53,8 @@ class App extends React.Component { downFunc={() => this.setState({ downloadsOpen: !this.state.downloadsOpen })} /> + + { diff --git a/src/ui/components/RightBar.css b/src/ui/components/RightBar.css new file mode 100644 index 0000000..5940b4c --- /dev/null +++ b/src/ui/components/RightBar.css @@ -0,0 +1,27 @@ +.RightBar { + position: absolute; + + display:flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; + + height: 100vh; + width: 6%; + left: 94%; + + background-color: rgba(77, 77, 77, 0.6); +} + +.BarImg:hover { + cursor: pointer; +} + +.RightBarInner > div { + margin: 30px 0; +} + +.RightBar img { + height: 40px; + filter: invert(100%) sepia(0%) saturate(11%) hue-rotate(227deg) brightness(103%) contrast(105%); +} \ No newline at end of file diff --git a/src/ui/components/RightBar.tsx b/src/ui/components/RightBar.tsx new file mode 100644 index 0000000..1c95b03 --- /dev/null +++ b/src/ui/components/RightBar.tsx @@ -0,0 +1,31 @@ +import { invoke } from '@tauri-apps/api' +import React from 'react' + +import Discord from '../../resources/icons/discord.svg' +import Github from '../../resources/icons/github.svg' + +import './RightBar.css' + +const DISCORD = 'https://discord.gg/T5vZU6UyeG' +const GITHUB = 'https://github.com/Grasscutters/Grasscutter' + +export default class RightBar extends React.Component { + openInBrowser(url: string) { + invoke('open_in_browser', { url }) + } + + render() { + return ( + + + this.openInBrowser(DISCORD)}> + + + this.openInBrowser(GITHUB)}> + + + + + ) + } +} \ No newline at end of file