do not show account details if there are no accounts
This commit is contained in:
parent
9e37ddc955
commit
36e35768c1
@ -40,9 +40,13 @@ impl Component for Accounts {
|
|||||||
fn view(&self, ctx: &Context<Self>) -> Html {
|
fn view(&self, ctx: &Context<Self>) -> Html {
|
||||||
html! {
|
html! {
|
||||||
<>
|
<>
|
||||||
|
if ctx.props().account_nrs.is_empty() {
|
||||||
|
<h2>{"No accounts"}</h2>
|
||||||
|
} else {
|
||||||
<ul class={classes!("accounts")}>
|
<ul class={classes!("accounts")}>
|
||||||
{ for ctx.props().account_nrs.iter().map(|e| self.account_entry(e, &ctx.props().selected_nr, ctx)) }
|
{ for ctx.props().account_nrs.iter().map(|e| self.account_entry(e, &ctx.props().selected_nr, ctx)) }
|
||||||
</ul>
|
</ul>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,9 @@ impl Component for Main {
|
|||||||
</h1>
|
</h1>
|
||||||
<div class={classes!("inner-content")}>
|
<div class={classes!("inner-content")}>
|
||||||
<Accounts account_nrs={self.account_nrs.clone()} selected_nr={self.selected_nr.clone()} />
|
<Accounts account_nrs={self.account_nrs.clone()} selected_nr={self.selected_nr.clone()} />
|
||||||
|
if !self.account_nrs.is_empty() {
|
||||||
<Account balance={self.selected_balance} owner={self.selected_owner.clone()} nr={self.selected_nr.clone()} account_nrs={self.account_nrs.clone()} />
|
<Account balance={self.selected_balance} owner={self.selected_owner.clone()} nr={self.selected_nr.clone()} account_nrs={self.account_nrs.clone()} />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</>
|
</>
|
||||||
|
Loading…
Reference in New Issue
Block a user