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

39 lines
924 B
Rust

use yew::prelude::*;
use yew_side_effect::title::Title;
pub mod assignments;
pub mod tokens;
#[derive(Properties, PartialEq, Eq)]
pub struct SettingsProps {
pub token: Option<String>,
pub admin: bool,
}
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>
if ctx.props().admin {
<section>
<assignments::Assignments token={ctx.props().token.as_ref().unwrap().to_owned()} />
</section>
}
</>
}
}
}