[feat] use heroui + setup persistore + setup toast
todo: fix launchoption problem
This commit is contained in:
13
package.json
13
package.json
@@ -17,6 +17,7 @@
|
|||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@heroui/react": "^2.7.5",
|
||||||
"@icon-park/react": "^1.4.2",
|
"@icon-park/react": "^1.4.2",
|
||||||
"@reactuses/core": "6.0.1",
|
"@reactuses/core": "6.0.1",
|
||||||
"@tauri-apps/api": "2.1.0",
|
"@tauri-apps/api": "2.1.0",
|
||||||
@@ -31,10 +32,12 @@
|
|||||||
"@tauri-apps/plugin-shell": "2.0.1",
|
"@tauri-apps/plugin-shell": "2.0.1",
|
||||||
"@tauri-apps/plugin-store": "^2.2.0",
|
"@tauri-apps/plugin-store": "^2.2.0",
|
||||||
"@types/throttle-debounce": "^5.0.2",
|
"@types/throttle-debounce": "^5.0.2",
|
||||||
"jotai": "^2.12.1",
|
"framer-motion": "^12.5.0",
|
||||||
|
"jotai": "^2.12.2",
|
||||||
"next": "15.2.0",
|
"next": "15.2.0",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
|
"tauri-plugin-valtio": "1.1.1",
|
||||||
"throttle-debounce": "^5.0.2",
|
"throttle-debounce": "^5.0.2",
|
||||||
"zustand": "5.0.1"
|
"zustand": "5.0.1"
|
||||||
},
|
},
|
||||||
@@ -46,12 +49,12 @@
|
|||||||
"@testing-library/react": "^16.2.0",
|
"@testing-library/react": "^16.2.0",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/node": "^22.13.9",
|
"@types/node": "^22.13.10",
|
||||||
"@types/react": "19.0.10",
|
"@types/react": "19.0.10",
|
||||||
"@types/react-dom": "19.0.4",
|
"@types/react-dom": "19.0.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
||||||
"@typescript-eslint/parser": "^8.26.0",
|
"@typescript-eslint/parser": "^8.26.1",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.21",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cssnano": "^7.0.6",
|
"cssnano": "^7.0.6",
|
||||||
|
|||||||
109
src-tauri/Cargo.lock
generated
109
src-tauri/Cargo.lock
generated
@@ -20,6 +20,7 @@ dependencies = [
|
|||||||
"tauri-plugin-process",
|
"tauri-plugin-process",
|
||||||
"tauri-plugin-shell",
|
"tauri-plugin-shell",
|
||||||
"tauri-plugin-store",
|
"tauri-plugin-store",
|
||||||
|
"tauri-plugin-valtio",
|
||||||
"window-vibrancy",
|
"window-vibrancy",
|
||||||
"winreg",
|
"winreg",
|
||||||
]
|
]
|
||||||
@@ -843,6 +844,20 @@ dependencies = [
|
|||||||
"syn 2.0.87",
|
"syn 2.0.87",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dashmap"
|
||||||
|
version = "6.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"crossbeam-utils",
|
||||||
|
"hashbrown 0.14.5",
|
||||||
|
"lock_api",
|
||||||
|
"once_cell",
|
||||||
|
"parking_lot_core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "data-url"
|
name = "data-url"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@@ -1015,6 +1030,12 @@ version = "1.0.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "embed-resource"
|
name = "embed-resource"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
@@ -1211,6 +1232,21 @@ dependencies = [
|
|||||||
"new_debug_unreachable",
|
"new_debug_unreachable",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures"
|
||||||
|
version = "0.3.31"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-executor",
|
||||||
|
"futures-io",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "futures-channel"
|
name = "futures-channel"
|
||||||
version = "0.3.31"
|
version = "0.3.31"
|
||||||
@@ -1218,6 +1254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1285,6 +1322,7 @@ version = "0.3.31"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-io",
|
"futures-io",
|
||||||
"futures-macro",
|
"futures-macro",
|
||||||
@@ -1652,6 +1690,12 @@ version = "0.12.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.14.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.15.0"
|
version = "0.15.0"
|
||||||
@@ -1936,6 +1980,15 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
@@ -4279,6 +4332,19 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-plugin-valtio"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b04f9e001956ca4d4ab9cb57cb4f0d8fb0949ba1a03a13591d2215653b988691"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"tauri",
|
||||||
|
"tauri-plugin",
|
||||||
|
"tauri-store",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-runtime"
|
name = "tauri-runtime"
|
||||||
version = "2.2.0"
|
version = "2.2.0"
|
||||||
@@ -4324,6 +4390,49 @@ dependencies = [
|
|||||||
"wry",
|
"wry",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-store"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb4e7c0776d9f8b54fd4788f4e471ce83b4c6cf62079799830a3735582a51fc4"
|
||||||
|
dependencies = [
|
||||||
|
"dashmap",
|
||||||
|
"futures",
|
||||||
|
"itertools",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"tauri",
|
||||||
|
"tauri-store-macros",
|
||||||
|
"tauri-store-utils",
|
||||||
|
"thiserror 2.0.3",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-store-macros"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fabed02238bc887f75887b315c6a14d9571ab463c1a188cc27ec2f7e917b06c3"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.87",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-store-utils"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b983a259b22d622ce74b957140efa161bd75c6bfd47b7bf621c98dd05b1a2474"
|
||||||
|
dependencies = [
|
||||||
|
"futures",
|
||||||
|
"tauri",
|
||||||
|
"thiserror 2.0.3",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-utils"
|
name = "tauri-utils"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ tauri-plugin-clipboard-manager = "2.0.2"
|
|||||||
tauri-plugin-shell = "2.0.2"
|
tauri-plugin-shell = "2.0.2"
|
||||||
tauri-plugin-http = "2.0.3"
|
tauri-plugin-http = "2.0.3"
|
||||||
tauri-plugin-notification = "2.0.1"
|
tauri-plugin-notification = "2.0.1"
|
||||||
|
tauri-plugin-valtio = "1.1.1"
|
||||||
tauri-plugin-store = "2.1.0"
|
tauri-plugin-store = "2.1.0"
|
||||||
[target.'cfg(windows)'.dependencies] # Windows Only
|
[target.'cfg(windows)'.dependencies] # Windows Only
|
||||||
winreg = "0.52.0"
|
winreg = "0.52.0"
|
||||||
|
|||||||
10
src-tauri/capabilities/valtio.json
Normal file
10
src-tauri/capabilities/valtio.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"identifier": "valtio",
|
||||||
|
"windows": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"permissions": [
|
||||||
|
"valtio:default",
|
||||||
|
"core:event:default"
|
||||||
|
]
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:default","store:allow-set","store:allow-get-store","store:allow-has","store:allow-delete","store:allow-clear","store:allow-values","store:allow-save","store:allow-load","store:allow-reset","store:allow-entries"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]}}
|
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["global-shortcut:default","store:default","store:allow-set","store:allow-get-store","store:allow-has","store:allow-delete","store:allow-clear","store:allow-values","store:allow-save","store:allow-load","store:allow-reset","store:allow-entries"],"platforms":["macOS","windows","linux"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","fs:allow-read-file","fs:allow-write-file","fs:allow-read-dir","fs:allow-copy-file","fs:allow-mkdir","fs:allow-remove","fs:allow-remove","fs:allow-rename","fs:allow-exists","core:window:allow-create","core:window:allow-center","core:window:allow-request-user-attention","core:window:allow-set-resizable","core:window:allow-set-maximizable","core:window:allow-set-minimizable","core:window:allow-set-closable","core:window:allow-set-title","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-set-decorations","core:window:allow-set-always-on-top","core:window:allow-set-content-protected","core:window:allow-set-size","core:window:allow-set-min-size","core:window:allow-set-max-size","core:window:allow-set-position","core:window:allow-set-fullscreen","core:window:allow-set-focus","core:window:allow-set-icon","core:window:allow-set-skip-taskbar","core:window:allow-set-cursor-grab","core:window:allow-set-cursor-visible","core:window:allow-set-cursor-icon","core:window:allow-set-cursor-position","core:window:allow-set-ignore-cursor-events","core:window:allow-start-dragging","core:webview:allow-print","shell:allow-execute","shell:allow-open","dialog:allow-open","dialog:allow-save","dialog:allow-message","dialog:allow-ask","dialog:allow-confirm","http:default","notification:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-register-all","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","os:allow-platform","os:allow-version","os:allow-os-type","os:allow-family","os:allow-arch","os:allow-exe-extension","os:allow-locale","os:allow-hostname","process:allow-restart","process:allow-exit","clipboard-manager:allow-read-text","clipboard-manager:allow-write-text","core:app:allow-app-show","core:app:allow-app-hide","process:default","fs:default","dialog:default","os:default","clipboard-manager:default"]},"valtio":{"identifier":"valtio","description":"","local":true,"windows":["*"],"permissions":["valtio:default","core:event:default"]}}
|
||||||
@@ -5598,6 +5598,211 @@
|
|||||||
"description": "Denies the values command without any pre-configured scope.",
|
"description": "Denies the values command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "store:deny-values"
|
"const": "store:deny-values"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Default permissions for tauri-plugin-valtio.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the clear_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-clear-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_default_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-default-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_ids command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-ids"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_state command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-state"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the load command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-load"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the patch command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_all_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-all-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_some command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-some"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_some_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-some-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_store_options command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-store-options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unload command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-unload"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the clear_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-clear-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_default_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-default-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_ids command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-ids"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_state command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-state"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the load command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-load"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the patch command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_all_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-all-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_some command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-some"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_some_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-some-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_store_options command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-store-options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unload command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-unload"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5598,6 +5598,211 @@
|
|||||||
"description": "Denies the values command without any pre-configured scope.",
|
"description": "Denies the values command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "store:deny-values"
|
"const": "store:deny-values"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Default permissions for tauri-plugin-valtio.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the clear_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-clear-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_default_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-default-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_ids command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-ids"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_state command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-state"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the load command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-load"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the patch command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_all_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-all-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_some command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-some"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_some_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-some-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_store_options command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-store-options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unload command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-unload"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the clear_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-clear-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_default_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-default-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_ids command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-ids"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_state command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-state"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the load command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-load"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the patch command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_all_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-all-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_some command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-some"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_some_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-some-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_store_options command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-store-options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unload command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-unload"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ fn on_button_clicked() -> String {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.plugin(tauri_plugin_valtio::init())
|
||||||
.plugin(tauri_plugin_store::Builder::new().build())
|
.plugin(tauri_plugin_store::Builder::new().build())
|
||||||
.plugin(tauri_plugin_notification::init())
|
.plugin(tauri_plugin_notification::init())
|
||||||
.plugin(tauri_plugin_http::init())
|
.plugin(tauri_plugin_http::init())
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import Header from "@/components/window/Header"
|
import Header from "@/components/window/Header"
|
||||||
import Nav from "@/components/window/Nav"
|
import Nav from "@/components/window/Nav"
|
||||||
import SideBar from "@/components/window/SideBar"
|
import SideBar from "@/components/window/SideBar"
|
||||||
import clsx from "clsx"
|
import { cn } from "@heroui/react"
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
// import { platform } from "@tauri-apps/plugin-os"
|
||||||
|
|
||||||
export default function BaseLayout({
|
export default function BaseLayout({
|
||||||
@@ -11,7 +11,7 @@ export default function BaseLayout({
|
|||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full h-full bg-transparent">
|
<div className="w-full h-full p-0 m-0 bg-transparent">
|
||||||
{/* bg-[#f1f0f2] */}
|
{/* bg-[#f1f0f2] */}
|
||||||
<Nav />
|
<Nav />
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ export default function BaseLayout({
|
|||||||
<SideBar />
|
<SideBar />
|
||||||
|
|
||||||
<main
|
<main
|
||||||
className={clsx(
|
className={cn(
|
||||||
"flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden",
|
"flex flex-col h-full pb-5 pr-5 ml-20 overflow-hidden",
|
||||||
// platform() === "windows" ? "ml-20" : "ml-[4.25rem]"
|
// platform() === "windows" ? "ml-20" : "ml-[4.25rem]"
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import useAppStore from "@/store/app"
|
import { appStore } from "@/store/app"
|
||||||
|
import { useSnapshot } from "valtio"
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const app = useAppStore()
|
const app = useSnapshot(appStore.state)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
|
<div className="flex flex-col gap-3 items-start pt-2 pb-1">
|
||||||
<p>版本号:{app.version}</p>
|
<p>版本号:{app.version}</p>
|
||||||
<p>是否有更新:{app.hasUpdate ? "有" : "无"}</p>
|
<p>是否有更新:{app.hasUpdate ? "有" : "无"}</p>
|
||||||
<p>初始化:{app.inited ? "是" : "否"}</p>
|
<p>初始化:{app.inited ? "是" : "否"}</p>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
UploadOne,
|
UploadOne,
|
||||||
Videocamera,
|
Videocamera,
|
||||||
} from "@icon-park/react"
|
} from "@icon-park/react"
|
||||||
import clsx from "clsx"
|
import { cn } from "@heroui/react"
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
// import { platform } from "@tauri-apps/plugin-os"
|
||||||
|
|
||||||
@@ -30,21 +30,21 @@ export default function PreferenceLayout({
|
|||||||
<CardIcon
|
<CardIcon
|
||||||
type="menu"
|
type="menu"
|
||||||
onClick={() => router.push("/preference/general")}
|
onClick={() => router.push("/preference/general")}
|
||||||
className={clsx(pathname === "/preference/general" && "bg-black/5")}
|
className={cn(pathname === "/preference/general" && "bg-black/5")}
|
||||||
>
|
>
|
||||||
<SettingConfig /> 通用
|
<SettingConfig /> 通用
|
||||||
</CardIcon>
|
</CardIcon>
|
||||||
<CardIcon
|
<CardIcon
|
||||||
type="menu"
|
type="menu"
|
||||||
onClick={() => router.push("/preference/path")}
|
onClick={() => router.push("/preference/path")}
|
||||||
className={clsx(pathname === "/preference/path" && "bg-black/5")}
|
className={cn(pathname === "/preference/path" && "bg-black/5")}
|
||||||
>
|
>
|
||||||
<AssemblyLine /> 路径
|
<AssemblyLine /> 路径
|
||||||
</CardIcon>
|
</CardIcon>
|
||||||
<CardIcon
|
<CardIcon
|
||||||
type="menu"
|
type="menu"
|
||||||
onClick={() => router.push("/preference/replay")}
|
onClick={() => router.push("/preference/replay")}
|
||||||
className={clsx(pathname === "/preference/replay" && "bg-black/5")}
|
className={cn(pathname === "/preference/replay" && "bg-black/5")}
|
||||||
>
|
>
|
||||||
<Videocamera /> 录像
|
<Videocamera /> 录像
|
||||||
</CardIcon>
|
</CardIcon>
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import "@/styles/globals.css"
|
|
||||||
import type { AppProps } from "next/app"
|
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
|
||||||
return <Component {...pageProps} />
|
|
||||||
}
|
|
||||||
|
|
||||||
export default MyApp
|
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
export const metadata = {
|
"use client"
|
||||||
title: "CS工具箱",
|
// export const metadata = {
|
||||||
description: "Generated by Next.js",
|
// title: "CS工具箱",
|
||||||
icons: ["/favicon.ico"],
|
// description: "Generated by Next.js",
|
||||||
}
|
// icons: ["/favicon.ico"],
|
||||||
|
// }
|
||||||
|
|
||||||
import "./globals.css"
|
import "./globals.css"
|
||||||
|
import Providers from "./providers"
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
children,
|
children,
|
||||||
@@ -13,7 +15,9 @@ export default function RootLayout({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body>{children}</body>
|
<body>
|
||||||
|
<Providers>{children}</Providers>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/app/providers.tsx
Normal file
12
src/app/providers.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
"use client"
|
||||||
|
import { HeroUIProvider } from "@heroui/react"
|
||||||
|
import { ToastProvider } from "@heroui/toast"
|
||||||
|
|
||||||
|
export default function Providers({ children }: { children: React.ReactNode }) {
|
||||||
|
return (
|
||||||
|
<HeroUIProvider className="h-full bg-transparent">
|
||||||
|
<ToastProvider toastOffset={10} placement="top-center" />
|
||||||
|
{children}
|
||||||
|
</HeroUIProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,11 +1,17 @@
|
|||||||
import useToolStore from "@/store/tool"
|
import { toolStore, setLaunchOption, setLaunchIndex } from "@/store/tool"
|
||||||
import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
||||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
||||||
import { ToolButton } from "../window/ToolButton"
|
import { ToolButton } from "../window/ToolButton"
|
||||||
|
import { useSnapshot } from "valtio"
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
|
|
||||||
const LaunchOption = () => {
|
const LaunchOption = () => {
|
||||||
const { launchOptions, setLaunchOption, launchIndex, setLaunchIndex } =
|
toolStore.start()
|
||||||
useToolStore()
|
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
|
||||||
|
const [currentLaunchOption, setCurrentLaunchOption] = useState(launchOptions[0])
|
||||||
|
useEffect(() => {
|
||||||
|
setCurrentLaunchOption(launchOptions[launchIndex] || '')
|
||||||
|
}, [launchIndex])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
@@ -30,10 +36,11 @@ const LaunchOption = () => {
|
|||||||
<CardBody>
|
<CardBody>
|
||||||
<textarea
|
<textarea
|
||||||
placeholder="请输入启动选项"
|
placeholder="请输入启动选项"
|
||||||
value={launchOptions[launchIndex]}
|
value={currentLaunchOption}
|
||||||
onChange={(e) => setLaunchOption(e.target.value, launchIndex)}
|
onChange={(e) => launchIndex !== -1 && setLaunchOption(e.target.value, launchIndex)}
|
||||||
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
|
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
|
||||||
/>
|
/>
|
||||||
|
<p>{launchIndex}</p>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import {
|
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "@/components/window/Card"
|
||||||
Card,
|
import { appStore } from "@/store/app"
|
||||||
CardBody,
|
|
||||||
CardHeader,
|
|
||||||
CardIcon,
|
|
||||||
CardTool,
|
|
||||||
} from "@/components/window/Card"
|
|
||||||
import useAppStore from "@/store/app"
|
|
||||||
import { Refresh, VolumeNotice } from "@icon-park/react"
|
import { Refresh, VolumeNotice } from "@icon-park/react"
|
||||||
import { ToolButton } from "../window/ToolButton"
|
import { ToolButton } from "../window/ToolButton"
|
||||||
|
import { useSnapshot } from "valtio"
|
||||||
|
|
||||||
const Notice = () => {
|
const Notice = () => {
|
||||||
const app = useAppStore()
|
appStore.start()
|
||||||
|
const app = useSnapshot(appStore.state)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@@ -24,9 +21,7 @@ const Notice = () => {
|
|||||||
</ToolButton>
|
</ToolButton>
|
||||||
</CardTool>
|
</CardTool>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardBody>
|
<CardBody>{app.notice || "不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl"}</CardBody>
|
||||||
{app.notice || "不会真的有人要更新CSGO工具箱吧,不会吧不会吧 xswl"}
|
|
||||||
</CardBody>
|
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import clsx from "clsx"
|
import { cn } from "@heroui/react"
|
||||||
import type { ReactNode } from "react"
|
import type { ReactNode } from "react"
|
||||||
|
|
||||||
interface CardProps {
|
interface CardProps {
|
||||||
@@ -28,7 +28,7 @@ const CardHeader = ({ children }: CardProps) => {
|
|||||||
const CardIcon = ({ children, type, className, ...rest }: CardProps) => {
|
const CardIcon = ({ children, type, className, ...rest }: CardProps) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={cn(
|
||||||
"flex gap-1.5 items-center font-semibold",
|
"flex gap-1.5 items-center font-semibold",
|
||||||
type === "menu" &&
|
type === "menu" &&
|
||||||
"transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95",
|
"transition cursor-pointer hover:bg-black/5 px-2 py-1 rounded-md active:scale-95",
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { Close, Minus, RocketOne, Square } from "@icon-park/react"
|
import { resetAppStore } from "@/store/app"
|
||||||
|
import { resetToolStore } from "@/store/tool"
|
||||||
|
import { addToast } from "@heroui/react"
|
||||||
|
import { Close, Minus, Refresh, RocketOne, Square } from "@icon-park/react"
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window"
|
import { getCurrentWindow } from "@tauri-apps/api/window"
|
||||||
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
// import { platform } from "@tauri-apps/plugin-os"
|
||||||
@@ -35,16 +38,26 @@ const Nav = () => {
|
|||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav
|
<nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
|
||||||
className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4"
|
|
||||||
data-tauri-drag-region
|
|
||||||
>
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
|
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
pathname !== "/prepare" ? router.push("/prepare") : router.back()
|
resetAppStore()
|
||||||
}
|
resetToolStore()
|
||||||
|
addToast({
|
||||||
|
title: "重置成功",
|
||||||
|
description: "已重置所有设置,请重新启动程序",
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Refresh size={16} />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||||
|
onClick={() => (pathname !== "/prepare" ? router.push("/prepare") : router.back())}
|
||||||
>
|
>
|
||||||
<RocketOne size={16} />
|
<RocketOne size={16} />
|
||||||
</button>
|
</button>
|
||||||
@@ -53,21 +66,21 @@ const Nav = () => {
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
|
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||||
onClick={minimize}
|
onClick={minimize}
|
||||||
>
|
>
|
||||||
<Minus size={16} />
|
<Minus size={16} />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
|
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||||
onClick={toggleMaximize}
|
onClick={toggleMaximize}
|
||||||
>
|
>
|
||||||
<Square size={16} />
|
<Square size={16} />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
|
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||||
onClick={close}
|
onClick={close}
|
||||||
>
|
>
|
||||||
<Close size={16} />
|
<Close size={16} />
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import {
|
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
|
||||||
Home,
|
import { Button, cn } from "@heroui/react"
|
||||||
MonitorOne,
|
|
||||||
Movie,
|
|
||||||
Setting,
|
|
||||||
Terminal,
|
|
||||||
Toolkit,
|
|
||||||
} from "@icon-park/react"
|
|
||||||
import clsx from "clsx"
|
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
import type { ReactNode } from "react"
|
import type { ReactNode } from "react"
|
||||||
|
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
// import { platform } from "@tauri-apps/plugin-os"
|
||||||
import useAppStore from "@/store/app"
|
import { appStore, setVersion } from "@/store/app"
|
||||||
|
import { useSnapshot } from "valtio"
|
||||||
|
|
||||||
interface SideButtonProps {
|
interface SideButtonProps {
|
||||||
route: string
|
route: string
|
||||||
@@ -33,18 +27,18 @@ const SideButton = ({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => router.push(route || "/")}
|
onClick={() => router.push(route || "/")}
|
||||||
className={clsx(
|
className={cn(
|
||||||
className,
|
className,
|
||||||
"p-2.5 hover:bg-black/5 rounded-lg transition relative",
|
"p-2.5 hover:bg-black/5 rounded-lg transition relative",
|
||||||
path.startsWith(route) && "bg-black/5",
|
path.startsWith(route) && "bg-black/5"
|
||||||
)}
|
)}
|
||||||
{...rest}
|
{...rest}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={cn(
|
||||||
path.startsWith(route) && "opacity-100",
|
path.startsWith(route) && "opacity-100",
|
||||||
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2",
|
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2"
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
@@ -57,10 +51,10 @@ const Avatar = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={() => router.push("/users")}
|
onKeyUp={() => router.push("/users")}
|
||||||
className={clsx(
|
className={cn(
|
||||||
"w-12 h-12 bg-gray-700 rounded-full shadow-2xl cursor-pointer transition active:scale-95 shadow-purple-800",
|
"w-12 h-12 bg-gray-700 rounded-full shadow-2xl cursor-pointer transition active:scale-95 shadow-purple-800",
|
||||||
path.startsWith("/users") && "shadow-sm",
|
path.startsWith("/users") && "shadow-sm"
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<img src="favicon.ico" alt="avatar" draggable={false} />
|
<img src="favicon.ico" alt="avatar" draggable={false} />
|
||||||
@@ -69,12 +63,13 @@ const Avatar = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SideBar = () => {
|
const SideBar = () => {
|
||||||
const { version, setVersion } = useAppStore()
|
appStore.start()
|
||||||
|
const { version } = useSnapshot(appStore.state)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={cn(
|
||||||
"absolute left-0 flex flex-col h-full select-none w-20 py-7",
|
"absolute left-0 flex flex-col h-full select-none w-20 pt-7 pb-5"
|
||||||
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
|
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
|
||||||
)}
|
)}
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
@@ -107,12 +102,11 @@ const SideBar = () => {
|
|||||||
</SideButton>
|
</SideButton>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div
|
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
|
||||||
className="mx-auto text-sm text-center text-zinc-500"
|
|
||||||
data-tauri-drag-region
|
|
||||||
>
|
|
||||||
<p>版本号</p>
|
<p>版本号</p>
|
||||||
<p onClick={() => setVersion("x.y.z")}>{version}</p>
|
<Button variant="light" size="sm" className="mt-0.5 text-zinc-600" onPress={() => setVersion("x.y.z")}>
|
||||||
|
{version}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
105
src/store/app.ts
105
src/store/app.ts
@@ -1,80 +1,33 @@
|
|||||||
import { Store } from "@tauri-apps/plugin-store"
|
import { store } from 'tauri-plugin-valtio';
|
||||||
// import { create } from "zustand"
|
import { DEFAULT_STORE_CONFIG } from '.';
|
||||||
// import { createJSONStorage, persist } from "zustand/middleware"
|
|
||||||
|
|
||||||
// interface AppState {
|
// Usage:
|
||||||
// version: string
|
// import {appStore} from "@/store/app"
|
||||||
// hasUpdate: boolean
|
// import { useSnapshot } from "valtio"
|
||||||
// inited: boolean
|
// const app = useSnapshot(appStore.state)
|
||||||
// notice: string
|
// { app.version }
|
||||||
// useMirror: boolean
|
// () => appStore.setVersion("0.0.1")
|
||||||
// }
|
|
||||||
|
|
||||||
// interface AppAction {
|
const defaultValue = {
|
||||||
// setVersion: (version: string) => void
|
version: "0.0.1",
|
||||||
// setHasUpdate: (hasUpdate: boolean) => void
|
hasUpdate: false,
|
||||||
// setInited: (hasInit: boolean) => void
|
inited: false,
|
||||||
// setNotice: (notice: string) => void
|
notice: "",
|
||||||
// setUseMirror: (useMirror: boolean) => void
|
useMirror: true
|
||||||
// }
|
|
||||||
|
|
||||||
const STORE_NAME = "app"
|
|
||||||
// 节流设置
|
|
||||||
export const THROTTLE_TIME = 300
|
|
||||||
export const THROTTLE_TIME_STORE = 2000
|
|
||||||
export const THROTTLE_LEADING = true
|
|
||||||
export const THROTTLE_TRAILING = true
|
|
||||||
// const { /* store, */ storage } = await tauriStore(STORE_NAME)
|
|
||||||
|
|
||||||
// const useAppStore = create<AppState & AppAction>()(
|
|
||||||
// persist(
|
|
||||||
// (set /* , get */) => ({
|
|
||||||
// version: "0.0.1",
|
|
||||||
// hasUpdate: false,
|
|
||||||
// inited: false,
|
|
||||||
// notice: "Man! What can I say?",
|
|
||||||
// useMirror: true,
|
|
||||||
// setVersion: (version: string) => set(() => ({ version: version })),
|
|
||||||
// setHasUpdate: (hasUpdate: boolean) =>
|
|
||||||
// set(() => ({ hasUpdate: hasUpdate })),
|
|
||||||
// setInited: (inited: boolean) => set(() => ({ inited: inited })),
|
|
||||||
// setNotice: (notice: string) => set(() => ({ notice: notice })),
|
|
||||||
// setUseMirror: (useMirror: boolean) =>
|
|
||||||
// set(() => ({ useMirror: useMirror })),
|
|
||||||
// }),
|
|
||||||
// {
|
|
||||||
// name: STORE_NAME, // name of item in the storage (must be unique)
|
|
||||||
// storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// )
|
|
||||||
|
|
||||||
const useAppStore = async (): Promise<any> => {
|
|
||||||
let store = await Store.get(`${STORE_NAME || "store"}.settings.json`);
|
|
||||||
if (!store) {
|
|
||||||
store = await Store.load(`${STORE_NAME || "store"}.settings.json`, {
|
|
||||||
autoSave: THROTTLE_TIME_STORE,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 生成随机字符串,每1s打印
|
|
||||||
const randomString = Math.random().toString(36).substring(2, 15)
|
|
||||||
setInterval(() => {
|
|
||||||
console.log("app store", randomString)
|
|
||||||
}, 1000)
|
|
||||||
|
|
||||||
return {
|
|
||||||
version: async () => (await store.get<string>("version")) || "0.0.1",
|
|
||||||
hasUpdate: async () => (await store.get<boolean>("hasUpdate")) || false,
|
|
||||||
inited: async () => (await store.get<boolean>("inited")) || false,
|
|
||||||
notice: async () => (await store.get<string>("notice")) || "",
|
|
||||||
useMirror: async () => (await store.get<boolean>("useMirror")) || true,
|
|
||||||
setVersion: async (version: string) => await store.set("version", version),
|
|
||||||
setHasUpdate: async (hasUpdate: boolean) => await store.set("hasUpdate", hasUpdate),
|
|
||||||
setInited: async (inited: boolean) => await store.set("inited", inited),
|
|
||||||
setNotice: async (notice: string) => await store.set("notice", notice),
|
|
||||||
setUseMirror: async (useMirror: boolean) => await store.set("useMirror", useMirror),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default useAppStore
|
export const appStore = store('app', { ...defaultValue }, DEFAULT_STORE_CONFIG);
|
||||||
|
|
||||||
|
export const setVersion = (version: string) => { appStore.state.version = version }
|
||||||
|
export const setHasUpdate = (hasUpdate: boolean) => { appStore.state.hasUpdate = hasUpdate }
|
||||||
|
export const setInited = (inited: boolean) => { appStore.state.inited = inited }
|
||||||
|
export const setNotice = (notice: string) => { appStore.state.notice = notice }
|
||||||
|
export const setUseMirror = (useMirror: boolean) => { appStore.state.useMirror = useMirror }
|
||||||
|
|
||||||
|
export const resetAppStore = () => {
|
||||||
|
setVersion(defaultValue.version)
|
||||||
|
setHasUpdate(defaultValue.hasUpdate)
|
||||||
|
setInited(defaultValue.inited)
|
||||||
|
setNotice(defaultValue.notice)
|
||||||
|
setUseMirror(defaultValue.useMirror)
|
||||||
|
}
|
||||||
6
src/store/index.ts
Normal file
6
src/store/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const DEFAULT_STORE_CONFIG = {
|
||||||
|
saveOnChange: true,
|
||||||
|
saveOnExit: true,
|
||||||
|
saveStrategy: 'debounce' as const,
|
||||||
|
saveInterval: 3000,
|
||||||
|
};
|
||||||
@@ -1,60 +1,37 @@
|
|||||||
import type { SteamUser } from "@/types/steam"
|
import type { SteamUser } from "@/types/steam"
|
||||||
import { tauriStore } from "@/utils/old"
|
import { store } from 'tauri-plugin-valtio';
|
||||||
import { create } from "zustand"
|
import { DEFAULT_STORE_CONFIG } from '.';
|
||||||
import { createJSONStorage, persist } from "zustand/middleware"
|
|
||||||
|
|
||||||
const mock_user: SteamUser = {
|
const defaultValue = {
|
||||||
steamID64: "76561198052315353",
|
dir: "C:\\Program Files (x86)\\Steam",
|
||||||
steamID32: "STEAM_0:0:46157676",
|
csDir: "",
|
||||||
accountName: "wrr",
|
users: [{
|
||||||
personaName: "wrr",
|
steamID64: "76561198052315353",
|
||||||
recent: 0,
|
steamID32: "STEAM_0:0:46157676",
|
||||||
avatar: "",
|
accountName: "wrr",
|
||||||
// "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/0d/0d1d4b9e1a9e8b2b3d4d0a7e1b3d6b1e3f8f4f7.jpg",
|
personaName: "wrr",
|
||||||
|
recent: 0,
|
||||||
|
avatar: ""
|
||||||
|
}] as SteamUser[],
|
||||||
|
isDirValid: false,
|
||||||
|
isCsDirValid: false
|
||||||
|
}
|
||||||
|
export const steamStore = store('steam', {...defaultValue}, DEFAULT_STORE_CONFIG);
|
||||||
|
|
||||||
|
export const setDir = (dir: string) => { steamStore.state.dir = dir }
|
||||||
|
export const setCsDir = (dir: string) => { steamStore.state.csDir = dir }
|
||||||
|
export const setUsers = (users: SteamUser[]) => { steamStore.state.users = users }
|
||||||
|
export const setIsDirValid = (valid: boolean) => { steamStore.state.isDirValid = valid }
|
||||||
|
export const setIsCsDirValid = (valid: boolean) => { steamStore.state.isCsDirValid = valid }
|
||||||
|
|
||||||
|
export const currentUser = () => {
|
||||||
|
return steamStore.state.users[0] || defaultValue.users[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SteamState {
|
export const resetSteamStore = () => {
|
||||||
dir: string
|
setDir(defaultValue.dir)
|
||||||
csDir: string
|
setCsDir(defaultValue.csDir)
|
||||||
users: SteamUser[]
|
setUsers(defaultValue.users)
|
||||||
isDirValid: boolean
|
setIsDirValid(defaultValue.isDirValid)
|
||||||
isCsDirValid: boolean
|
setIsCsDirValid(defaultValue.isCsDirValid)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SteamAction {
|
|
||||||
setDir: (dir: string) => void
|
|
||||||
setCsDir: (dir: string) => void
|
|
||||||
setUsers: (users: SteamUser[]) => void
|
|
||||||
setIsDirValid: (valid: boolean) => void
|
|
||||||
setIsCsDirValid: (valid: boolean) => void
|
|
||||||
currentUser: () => SteamUser
|
|
||||||
}
|
|
||||||
|
|
||||||
const STORE_NAME = "steam"
|
|
||||||
const { /* store, */ storage } = await tauriStore(STORE_NAME)
|
|
||||||
|
|
||||||
const useSteamStore = create<SteamState & SteamAction>()(
|
|
||||||
persist(
|
|
||||||
(set, get) => ({
|
|
||||||
dir: "C:\\Program Files (x86)\\Steam",
|
|
||||||
csDir: "",
|
|
||||||
users: [mock_user] as SteamUser[],
|
|
||||||
isDirValid: false,
|
|
||||||
isCsDirValid: false,
|
|
||||||
setDir: (dir: string) => set(() => ({ dir: dir })),
|
|
||||||
setCsDir: (dir: string) => set(() => ({ csDir: dir })),
|
|
||||||
setUsers: (users: SteamUser[]) => set(() => ({ users: users })),
|
|
||||||
setIsDirValid: (valid: boolean) => set(() => ({ isDirValid: valid })),
|
|
||||||
setIsCsDirValid: (valid: boolean) => set(() => ({ isCsDirValid: valid })),
|
|
||||||
currentUser: () => {
|
|
||||||
return get().users[0] || mock_user
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
name: STORE_NAME, // name of item in the storage (must be unique)
|
|
||||||
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export default useSteamStore
|
|
||||||
@@ -1,51 +1,36 @@
|
|||||||
import { tauriStore } from "@/utils/old"
|
import { store } from 'tauri-plugin-valtio';
|
||||||
import { create } from "zustand"
|
import { DEFAULT_STORE_CONFIG } from '.';
|
||||||
import { createJSONStorage, persist } from "zustand/middleware"
|
|
||||||
|
|
||||||
interface ToolState {
|
const defaultValue = {
|
||||||
launchOptions: string[]
|
launchOptions: [] as string[],
|
||||||
launchIndex: number
|
launchIndex: 0,
|
||||||
powerPlan: number
|
powerPlan: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ToolAction {
|
export const toolStore = store('tool', { ...defaultValue }, DEFAULT_STORE_CONFIG);
|
||||||
setLaunchOption: (option: string, index: number) => void
|
|
||||||
setLaunchOptions: (options: string[]) => void
|
export const setLaunchOption = (option: string, index: number) => {
|
||||||
setLaunchIndex: (index: number) => void
|
toolStore.state.launchOptions = [
|
||||||
setPowerPlan: (index: number) => void
|
...toolStore.state.launchOptions.slice(0, index),
|
||||||
|
option,
|
||||||
|
...toolStore.state.launchOptions.slice(index + 1)
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
const STORE_NAME = "tool"
|
export const setLaunchOptions = (options: string[]) => {
|
||||||
const { /* store, */ storage } = await tauriStore(STORE_NAME)
|
toolStore.state.launchOptions = options
|
||||||
|
}
|
||||||
|
|
||||||
const useToolStore = create<ToolState & ToolAction>()(
|
export const setLaunchIndex = (index: number) => {
|
||||||
persist(
|
toolStore.state.launchIndex = index
|
||||||
(set /* , get */) => ({
|
}
|
||||||
launchOptions: [
|
|
||||||
"-high -refresh 120 -novid -nojoy -tickrate 128 +cl_cmdrate 128 +cl_updaterate 128 +exec auto.cfg +test",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
],
|
|
||||||
launchIndex: 0,
|
|
||||||
powerPlan: 0,
|
|
||||||
setLaunchOption: (option: string, index: number) =>
|
|
||||||
set((state) => ({
|
|
||||||
launchOptions: [
|
|
||||||
...state.launchOptions.slice(0, index),
|
|
||||||
option,
|
|
||||||
...state.launchOptions.slice(index + 1),
|
|
||||||
],
|
|
||||||
})),
|
|
||||||
setLaunchOptions: (options: string[]) =>
|
|
||||||
set(() => ({ launchOptions: options })),
|
|
||||||
setLaunchIndex: (index: number) => set(() => ({ launchIndex: index })),
|
|
||||||
setPowerPlan: (index: number) => set(() => ({ powerPlan: index })),
|
|
||||||
}),
|
|
||||||
{
|
|
||||||
name: STORE_NAME, // name of item in the storage (must be unique)
|
|
||||||
storage: createJSONStorage(() => storage), // (optional) by default the 'localStorage' is used
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export default useToolStore
|
export const setPowerPlan = (plan: number) => {
|
||||||
|
toolStore.state.powerPlan = plan
|
||||||
|
}
|
||||||
|
|
||||||
|
export const resetToolStore = () => {
|
||||||
|
toolStore.state.launchOptions = defaultValue.launchOptions
|
||||||
|
toolStore.state.launchIndex = defaultValue.launchIndex
|
||||||
|
toolStore.state.powerPlan = defaultValue.powerPlan
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
|
const { heroui } = require("@heroui/react");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
content: ["./src/**/*.{js,jsx,ts,tsx}"],
|
content: [
|
||||||
|
"./src/**/*.{js,jsx,ts,tsx}",
|
||||||
|
"./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}"
|
||||||
|
],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {},
|
extend: {},
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: [],
|
||||||
|
darkMode: "class",
|
||||||
|
plugins: [heroui()],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user