GUI initial commit

This commit is contained in:
venashial
2022-02-21 21:01:45 -08:00
parent a9ddc6b75f
commit 9016785f88
41 changed files with 5428 additions and 45 deletions

View File

@@ -0,0 +1,24 @@
[package]
name = "theseus_gui"
version = "0.1.0"
default-run = "theseus_gui"
edition = "2021"
rust-version = "1.57"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.0.0-rc.3", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.0-rc.3", features = ["api-all"] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]

View File

@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,89 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use tauri::api::shell;
use tauri::{
CustomMenuItem, Manager, Menu, MenuEntry, MenuItem, Submenu, WindowBuilder, WindowUrl,
};
fn main() {
let ctx = tauri::generate_context!();
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![])
.create_window("main", WindowUrl::default(), |win, webview| {
let win = win
.title("Modrinth")
.resizable(true)
.decorations(true)
.always_on_top(false)
.inner_size(800.0, 550.0)
.min_inner_size(400.0, 200.0)
.skip_taskbar(false)
.fullscreen(false);
return (win, webview);
})
.menu(Menu::with_items([
#[cfg(target_os = "macos")]
MenuEntry::Submenu(Submenu::new(
&ctx.package_info().name,
Menu::with_items([
MenuItem::About(ctx.package_info().name.clone()).into(),
MenuItem::Separator.into(),
MenuItem::Services.into(),
MenuItem::Separator.into(),
MenuItem::Hide.into(),
MenuItem::HideOthers.into(),
MenuItem::ShowAll.into(),
MenuItem::Separator.into(),
MenuItem::Quit.into(),
]),
)),
MenuEntry::Submenu(Submenu::new(
"File",
Menu::with_items([MenuItem::CloseWindow.into()]),
)),
MenuEntry::Submenu(Submenu::new(
"Edit",
Menu::with_items([
MenuItem::Undo.into(),
MenuItem::Redo.into(),
MenuItem::Separator.into(),
MenuItem::Cut.into(),
MenuItem::Copy.into(),
MenuItem::Paste.into(),
#[cfg(not(target_os = "macos"))]
MenuItem::Separator.into(),
MenuItem::SelectAll.into(),
]),
)),
MenuEntry::Submenu(Submenu::new(
"View",
Menu::with_items([MenuItem::EnterFullScreen.into()]),
)),
MenuEntry::Submenu(Submenu::new(
"Window",
Menu::with_items([MenuItem::Minimize.into(), MenuItem::Zoom.into()]),
)),
// You should always have a Help menu on macOS because it will automatically
// show a menu search field
MenuEntry::Submenu(Submenu::new(
"Help",
Menu::with_items([CustomMenuItem::new("Learn More", "Learn More").into()]),
)),
]))
.on_menu_event(|event| {
let event_name = event.menu_item_id();
match event_name {
"Learn More" => {
let url = "https://github.com/probablykasper/tauri-template".to_string();
shell::open(&event.window().shell_scope(), url, None).unwrap();
}
_ => {}
}
})
.run(ctx)
.expect("error while running tauri application");
}

View File

@@ -0,0 +1,63 @@
{
"package": {
"productName": "Modrinth"
},
"build": {
"distDir": "../build",
"devPath": "http://localhost:3000",
"beforeDevCommand": "pnpm dev:web",
"beforeBuildCommand": "pnpm run build:web"
},
"tauri": {
"bundle": {
"active": true,
"targets": [
"dmg",
"deb",
"appimage",
"msi"
],
"identifier": "com.modrinth.theseus",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "Game",
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"providerShortName": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"all": true
},
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
}
}
}