Don't load local card info by default, add user page, theme loading

This commit is contained in:
2024-09-05 00:59:51 -04:00
parent 20d7f62f33
commit 0a8091e843
11 changed files with 104 additions and 18 deletions

View File

@@ -65,8 +65,9 @@ pub fn Layout<'a, G: Html>(
spawn_local_scoped(cx, async move {
let global_state = Reactor::<G>::from_cx(cx).get_global_state::<AppStateRx>(cx);
let local_card_user_pref = (*global_state.user_pref.local_card_data.get()).clone();
let card_table_loaded = (*global_state.constants.is_loaded.get()).clone();
if !card_table_loaded {
if local_card_user_pref && !card_table_loaded {
let client = reqwest::Client::new();
let response = client
.get(get_api_path(CARD_INFO).as_str())
@@ -88,12 +89,12 @@ pub fn Layout<'a, G: Html>(
// Modals
section(class = "flex-2") {
(match (*global_state.constants.card_table.get()).clone() {
Some(card_table) => { view!{ cx,
p { "DONE" }
} },
None => { view!{ cx, p { "Loading cards" } } },
})
// (match (*global_state.constants.card_table.get()).clone() {
// Some(card_table) => { view!{ cx,
// p { "DONE" }
// } },
// None => { view!{ cx, p { "Loading cards" } } },
// })
(match *global_state.modals_open.login.get() {
OpenState::Open => {
@@ -141,12 +142,10 @@ pub fn Layout<'a, G: Html>(
main(style = "my-8") {
(match content_state {
ContentState::None => view!{ cx, },
ContentState::Tournaments => view!{ cx, },
ContentState::Inventory => view!{ cx,
// Body header
div (class = "container mx-auto px-6 py-3") {
nav (class = "sm:flex sm:justify-center sm:items-center mt-4 hidden") {
nav (class = "sm:flex sm:justify-center sm:items-center mt-4") {
div (class = "flex flex-col sm:flex-row"){
a(href = "inventory",
class = "mt-3 text-gray-600 hover:underline sm:mx-3 sm:mt-0"
@@ -163,6 +162,7 @@ pub fn Layout<'a, G: Html>(
}
}
},
_ => view!{ cx, },
})
}
}