diff --git a/client/src/ui/lib/util.ts b/client/src/ui/lib/util.ts index b12f932..93bfbe8 100644 --- a/client/src/ui/lib/util.ts +++ b/client/src/ui/lib/util.ts @@ -7,6 +7,7 @@ import type { WebSocketServer } from '../../server/server' import type { MapCreation, MapDetail } from '../../server/protocol' import * as MapDir from '../../twmap/mapdir' import { QuadsLayer } from '../../twmap/quadsLayer' +import { clearDialog, showInfo } from './dialog' export type Ctor = new (...args: any[]) => T @@ -14,17 +15,24 @@ export type FormEvent = Event & { currentTarget: EventTarget & T } export type FormInputEvent = FormEvent export async function download(file: string, name: string) { - const resp = await fetch(file) - const data = await resp.blob() - const url = URL.createObjectURL(data) - - const link = document.createElement('a') - link.href = url - link.download = name - - document.body.append(link) - link.click() - link.remove() + const id = showInfo(`Downloading '${name}'…`, 'none') + try { + const resp = await fetch(file) + const data = await resp.blob() + const url = URL.createObjectURL(data) + + const link = document.createElement('a') + link.href = url + link.download = name + + document.body.append(link) + link.click() + link.remove() + showInfo(`Downloaded '${name}'.`) + } + finally { + clearDialog(id) + } } export async function uploadMap(httpRoot: string, name: string, file: Blob) { diff --git a/client/src/ui/routes/lobby.svelte b/client/src/ui/routes/lobby.svelte index 2d26b61..52e72a7 100644 --- a/client/src/ui/routes/lobby.svelte +++ b/client/src/ui/routes/lobby.svelte @@ -270,15 +270,15 @@

Teeworlds Web Editor is a multiplayer map editor for - DDRaceNetwork + DDRaceNetwork , a flavour of - Teeworlds + Teeworlds .

The project is currently in beta, expect some bugs and missing features! Please report your bugs and make suggestions on the - GitHub issues page + GitHub issues page . Have fun!

diff --git a/client/styles/style.scss b/client/styles/style.scss index 32d1929..e685c93 100644 --- a/client/styles/style.scss +++ b/client/styles/style.scss @@ -75,6 +75,7 @@ text-overflow: ellipsis; overflow: hidden; background-color: #f2f2f2; + height: 2rem; outline: 1px solid #aaaaaa; outline-offset: -1px; @@ -760,9 +761,14 @@ nav.hidden .context { flex-direction: row; gap: 1rem; - > :nth-child(3) { + >.channels { flex-grow: 1; } + + .buttons { + display: flex; + gap: 1rem; + } } .graph { @@ -807,14 +813,13 @@ nav.hidden .context { .channels { display: flex; - // gap: .5rem; align-items: center; label { position: relative; display: block; - width: 1.5rem; - height: 1.5rem; + width: 2rem; + height: 2rem; user-select: none; &.red span { @@ -863,7 +868,7 @@ nav.hidden .context { position: absolute; inset: 0; text-align: center; - padding: 0.25rem; + padding: 0.6rem; } } } diff --git a/desktop/Cargo.lock b/desktop/Cargo.lock index 8ed2688..0ddad82 100644 --- a/desktop/Cargo.lock +++ b/desktop/Cargo.lock @@ -873,7 +873,7 @@ checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -936,7 +936,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall 0.3.5", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2065,7 +2065,7 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2272,6 +2272,16 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "open" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" +dependencies = [ + "pathdiff", + "windows-sys 0.42.0", +] + [[package]] name = "opus_headers" version = "0.1.2" @@ -2349,6 +2359,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" version = "2.3.0" @@ -2867,7 +2883,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3218,7 +3234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3482,9 +3498,11 @@ dependencies = [ "ignore", "objc", "once_cell", + "open", "percent-encoding", "rand 0.8.5", "raw-window-handle", + "regex", "semver", "serde", "serde_json", @@ -3539,6 +3557,7 @@ dependencies = [ "png", "proc-macro2", "quote", + "regex", "semver", "serde", "serde_json", @@ -3655,7 +3674,7 @@ dependencies = [ "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -3790,7 +3809,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.4", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -4570,6 +4589,21 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -4585,12 +4619,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.48.5", "windows_aarch64_msvc 0.48.5", "windows_i686_gnu 0.48.5", "windows_i686_msvc 0.48.5", "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.48.5", "windows_x86_64_msvc 0.48.5", ] @@ -4600,6 +4634,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f838de2fe15fe6bac988e74b798f26499a8b21a9d97edec321e79b28d1d7f597" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -4612,6 +4652,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -4624,6 +4670,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -4636,6 +4688,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -4648,12 +4706,24 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -4666,6 +4736,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -4688,7 +4764,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml index cdfb4c0..3356be5 100644 --- a/desktop/Cargo.toml +++ b/desktop/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = { version = "1.4.0", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.4.0", features = [] } +tauri = { version = "1.4.0", features = [ "shell-open", "fs-all"] } twwe-server = { path = "../server" } tokio = "1.32.0" platform-dirs = "0.3.0" diff --git a/desktop/tauri.conf.json b/desktop/tauri.conf.json index 5a4a257..bf0c46f 100644 --- a/desktop/tauri.conf.json +++ b/desktop/tauri.conf.json @@ -11,7 +11,13 @@ }, "tauri": { "allowlist": { - "all": false + "all": false, + "fs": { + "all": true + }, + "shell": { + "open": true + } }, "bundle": { "active": true, @@ -62,4 +68,4 @@ } ] } -} +} \ No newline at end of file