feat: added a beta preview alert

This commit is contained in:
antifallobst 2023-10-08 14:22:16 +02:00
parent 039cff2f2a
commit 21a3b81044
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
2 changed files with 11 additions and 9 deletions

View File

@ -14,8 +14,8 @@ COPY Cargo.lock Cargo.toml index.html ./
COPY src ./src
COPY style ./style
# Build for release.
RUN trunk build --release
# Build for preview release.
RUN NC_BETA_BUILD="" trunk build --release
FROM nginx:latest

View File

@ -5,6 +5,7 @@ mod topbar;
use anyhow::Result;
use backend::Session;
use content::{about::About, error, home::Home};
use gloo::dialogs::alert;
use std::ops::Deref;
use topbar::TopBar;
use yew::prelude::*;
@ -47,13 +48,11 @@ fn App() -> Html {
let cloned_state = state.clone();
let callbacks = use_state(move || Callbacks {
sign_in: Callback::from(
move |token: String| {
let mut new_state = cloned_state.deref().clone();
new_state.set_token(token);
cloned_state.set(new_state);
},
),
sign_in: Callback::from(move |token: String| {
let mut new_state = cloned_state.deref().clone();
new_state.set_token(token);
cloned_state.set(new_state);
}),
});
html! {
@ -71,5 +70,8 @@ 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.");
}
yew::Renderer::<App>::new().render();
}