mentorenwahl/frontend/src/routes/settings/mod.rs

39 lines
924 B
Rust
Raw Normal View History

2022-11-21 18:48:53 +00:00
use yew::prelude::*;
use yew_side_effect::title::Title;
2022-11-23 19:17:14 +00:00
pub mod assignments;
2022-11-21 18:48:53 +00:00
pub mod tokens;
#[derive(Properties, PartialEq, Eq)]
pub struct SettingsProps {
pub token: Option<String>,
2022-11-23 19:17:14 +00:00
pub admin: bool,
2022-11-21 18:48:53 +00:00
}
pub struct Settings;
impl Component for Settings {
type Message = ();
type Properties = SettingsProps;
fn create(_ctx: &Context<Self>) -> Self {
Self
}
fn view(&self, ctx: &Context<Self>) -> Html {
html! {
<>
<Title value="Settings" />
<section>
<tokens::Tokens token={ctx.props().token.as_ref().unwrap().to_owned()} />
</section>
2022-11-23 19:17:14 +00:00
if ctx.props().admin {
<section>
<assignments::Assignments token={ctx.props().token.as_ref().unwrap().to_owned()} />
</section>
}
2022-11-21 18:48:53 +00:00
</>
}
}
}