WIP: feat(collection_viewer): Implement collection viewer
This commit is contained in:
parent
cc27ab5b6d
commit
ebb8ce329c
35
Cargo.lock
generated
35
Cargo.lock
generated
|
@ -426,6 +426,7 @@ dependencies = [
|
||||||
"gloo-net 0.6.0",
|
"gloo-net 0.6.0",
|
||||||
"leptos",
|
"leptos",
|
||||||
"log",
|
"log",
|
||||||
|
"rexie",
|
||||||
"serde",
|
"serde",
|
||||||
"serde-wasm-bindgen",
|
"serde-wasm-bindgen",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1055,6 +1056,20 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "idb"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3afe8830d5802f769dc0be20a87f9f116798c896650cb6266eb5c19a3c109eed"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"num-traits",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
"tokio",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ident_case"
|
name = "ident_case"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
|
@ -1386,6 +1401,15 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_cpus"
|
name = "num_cpus"
|
||||||
version = "1.16.0"
|
version = "1.16.0"
|
||||||
|
@ -1722,6 +1746,17 @@ version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rexie"
|
||||||
|
version = "0.6.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "887466cfa8a12c08ee4b174998135cea8ff0fd84858627cd793e56535a045bc9"
|
||||||
|
dependencies = [
|
||||||
|
"idb",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rstml"
|
name = "rstml"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
|
|
|
@ -27,6 +27,7 @@ futures-util = "0.3.31"
|
||||||
gloo = { version = "0.11.0", features = ["futures"] }
|
gloo = { version = "0.11.0", features = ["futures"] }
|
||||||
gloo-net = { version = "0.6.0" }
|
gloo-net = { version = "0.6.0" }
|
||||||
web-sys = { version = "0.3.77", features = ["FileSystemWritableFileStream", "WorkerGlobalScope"] }
|
web-sys = { version = "0.3.77", features = ["FileSystemWritableFileStream", "WorkerGlobalScope"] }
|
||||||
|
rexie = "0.6.2"
|
||||||
|
|
||||||
[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dev-dependencies]
|
[target.'cfg(all(any(target_arch = "wasm32", target_arch = "wasm64"), target_os = "unknown"))'.dev-dependencies]
|
||||||
wasm-bindgen-test = "0.3.50"
|
wasm-bindgen-test = "0.3.50"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link data-trunk rel="rust" data-type="worker" data-bin="database_worker" data-weak-refs data-loader-shim />
|
<link data-trunk rel="rust" data-type="worker" data-bin="database_worker" data-weak-refs data-loader-shim />
|
||||||
<link data-trunk rel="rust" data-bin="draft-manager" data-weak-refs />
|
<link data-trunk rel="rust" data-bin="collection_viewer" data-weak-refs />
|
||||||
</head>
|
</head>
|
||||||
<body></boy>
|
<body></boy>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -14,33 +14,20 @@
|
||||||
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with yugioh-binder. If not, see <https://www.gnu.org/licenses/>.
|
// along with yugioh-binder. If not, see <https://www.gnu.org/licenses/>.
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use draft_manager::card_database::CardDatabase;
|
|
||||||
use leptos::prelude::*;
|
use leptos::prelude::*;
|
||||||
use wasm_bindgen_futures::spawn_local;
|
use rexie::{ObjectStore, Rexie};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
wasm_logger::init(wasm_logger::Config::default());
|
wasm_logger::init(wasm_logger::Config::default());
|
||||||
|
|
||||||
log::debug!("Startin app database");
|
let rexie = Rexie::builder("collections").version(1).add_object_store(
|
||||||
let db = CardDatabase::new();
|
ObjectStore::new("collection")
|
||||||
log::debug!("Database initialized");
|
.key_path("id")
|
||||||
|
.auto_increment(true),
|
||||||
|
);
|
||||||
|
|
||||||
leptos::mount::mount_to_body(|| view! { <App /> });
|
leptos::mount::mount_to_body(|| view! { <App /> });
|
||||||
|
|
||||||
spawn_local(async move {
|
|
||||||
let db = db;
|
|
||||||
|
|
||||||
log::info!("Running loop!");
|
|
||||||
db.send_message();
|
|
||||||
|
|
||||||
// We create a loop so that listeners can be held for forever.
|
|
||||||
loop {
|
|
||||||
gloo::timers::future::sleep(Duration::from_secs(3600)).await;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
Loading…
Reference in a new issue