feat: added storing if the preview popup was already shown this session
This commit is contained in:
parent
21a3b81044
commit
2c6c529cc6
|
@ -131,6 +131,7 @@ dependencies = [
|
|||
"futures-channel",
|
||||
"gloo 0.10.0",
|
||||
"gloo-net 0.4.0",
|
||||
"gloo-storage 0.3.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
|
|
|
@ -21,4 +21,5 @@ wasm-bindgen = "0.2.87"
|
|||
wasm-bindgen-futures = "0.4"
|
||||
web-sys = { version = "0.3.64", features = ["HtmlInputElement", "HtmlDocument"] }
|
||||
gloo = "0.10.0"
|
||||
gloo-net = "0.4.0"
|
||||
gloo-net = "0.4.0"
|
||||
gloo-storage = "0.3.0"
|
22
src/main.rs
22
src/main.rs
|
@ -2,10 +2,10 @@ mod backend;
|
|||
mod content;
|
||||
mod topbar;
|
||||
|
||||
use anyhow::Result;
|
||||
use backend::Session;
|
||||
use content::{about::About, error, home::Home};
|
||||
use gloo::dialogs::alert;
|
||||
use gloo_storage::{SessionStorage, Storage};
|
||||
use std::ops::Deref;
|
||||
use topbar::TopBar;
|
||||
use yew::prelude::*;
|
||||
|
@ -70,8 +70,22 @@ fn App() -> Html {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
if option_env!("NC_BETA_BUILD").is_some() {
|
||||
alert("This is a beta preview!\nThe UI and the backend are subjects to change. Data persistence can't be guaranteed.");
|
||||
}
|
||||
preview_alert();
|
||||
yew::Renderer::<App>::new().render();
|
||||
}
|
||||
|
||||
fn preview_alert() {
|
||||
if option_env!("NC_BETA_BUILD").is_none() {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Ok(value) = SessionStorage::get::<bool>("nc-preview-alert-shown") {
|
||||
if value {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SessionStorage::set("nc-preview-alert-shown", true).expect("Failed to set session storage!");
|
||||
|
||||
alert("This is a beta preview!\nThe UI and the backend are subjects to change. Data persistence can't be guaranteed.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue