Use frontend for making windows instead
This commit is contained in:
3 files changed
+10
-33
No files matched your search
@@ -18,6 +18,7 @@
|
||||
"core:window:allow-start-dragging",
|
||||
"core:window:allow-toggle-maximize",
|
||||
"core:window:allow-request-user-attention",
|
||||
"core:webview:allow-create-webview-window",
|
||||
"fs:default",
|
||||
"dialog:default",
|
||||
"dialog:allow-open",
|
||||
|
||||
@@ -678,31 +678,6 @@ fn remove_stale_executable(app: AppHandle, version: String, executable: String)
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn open_new_window(
|
||||
app: tauri::AppHandle,
|
||||
title: String,
|
||||
name: String,
|
||||
url: String,
|
||||
width: f64,
|
||||
height: f64,
|
||||
) {
|
||||
if let Some(window) = app.get_webview_window(&name) {
|
||||
let _ = window.show();
|
||||
return;
|
||||
};
|
||||
|
||||
tauri::WebviewWindowBuilder::new(
|
||||
&app,
|
||||
name,
|
||||
tauri::WebviewUrl::External(url.parse().unwrap()),
|
||||
)
|
||||
.inner_size(width, height)
|
||||
.title(title)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
#[allow(unused)]
|
||||
@@ -731,7 +706,6 @@ pub fn run() {
|
||||
folder_size,
|
||||
verify_signature,
|
||||
cancel_download,
|
||||
open_new_window,
|
||||
move_game_data,
|
||||
restart_app,
|
||||
open_game_folder,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import '../Installs.css'
|
||||
import { useEffect } from 'react'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { useGlobal } from '@/providers/GlobalProvider'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import { platform } from '@tauri-apps/plugin-os'
|
||||
@@ -10,6 +9,7 @@ import { faWarning } from '@fortawesome/free-solid-svg-icons'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import { ask } from '@tauri-apps/plugin-dialog'
|
||||
import { BaseDirectory, exists } from '@tauri-apps/plugin-fs'
|
||||
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
|
||||
|
||||
export default function Installs () {
|
||||
const {
|
||||
@@ -74,14 +74,15 @@ export default function Installs () {
|
||||
<button
|
||||
className='button btntheme1'
|
||||
onClick={() =>
|
||||
invoke('open_new_window', {
|
||||
new WebviewWindow('berrydashleaderboards', {
|
||||
title: 'Berry Dash Leaderboards',
|
||||
name: 'berrydashleaderboards',
|
||||
url:
|
||||
'https://games.lncvrt.xyz/game/berry-dash/leaderboards?launcher=1&theme=' +
|
||||
theme,
|
||||
width: 800,
|
||||
height: 600
|
||||
height: 600,
|
||||
resizable: false,
|
||||
maximizable: false
|
||||
})
|
||||
}
|
||||
title='View the leaderboards for this game.'
|
||||
@@ -92,12 +93,13 @@ export default function Installs () {
|
||||
<button
|
||||
className='button btntheme1'
|
||||
onClick={() =>
|
||||
invoke('open_new_window', {
|
||||
new WebviewWindow('xpsdashboard', {
|
||||
title: 'XPS Dashboard',
|
||||
name: 'xpsdashboard',
|
||||
url: 'https://xps.lncvrt.xyz/dashboard/',
|
||||
width: 1280,
|
||||
height: 720
|
||||
height: 720,
|
||||
minWidth: 1280,
|
||||
minHeight: 720
|
||||
})
|
||||
}
|
||||
title='Open the GDPS Dashboard!'
|
||||
|
||||
Reference in new issue
Block a user