Hide parts of transfer menu when Custom transfer selected

This commit is contained in:
Emilia Allison 2023-10-24 17:18:45 -04:00
parent db345bfbb5
commit a9e5f05fd9
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,9 @@ pub fn TransferMenu() -> Html {
let ct_dispatch = ct_dispatch.clone();
Callback::from(move |e: Event| {
if matches!(ct_dispatch.get().transfer.transfer_region.source_region, Region::Custom(_)) {
return; // Do nothing here!
}
let target: Option<EventTarget> = e.target();
let input = target.and_then(|t| t.dyn_into::<HtmlInputElement>().ok());
if let Some(input) = input {
@ -250,6 +253,8 @@ pub fn TransferMenu() -> Html {
onchange={on_name_change}
value={ct_state.transfer.name.clone()}/>
</div>
// Anything below here is not rendered when a Custom transfer is selected
if !matches!(&ct_state.transfer.transfer_region.source_region, Region::Custom(_)) {
<div>
<label for="src_region"><h3>{"Source Region:"}</h3></label>
<input type="text" name="src_region"
@ -291,6 +296,7 @@ pub fn TransferMenu() -> Html {
onchange={on_volume_change}
value={ct_state.transfer.volume.to_string()}/>
</div>
}
<div id="controls">
<input type="button" name="new_transfer" onclick={new_transfer_button_callback}
value={"New"} />