From d731dc34d7d3000e13ba23778bc506a765810295 Mon Sep 17 00:00:00 2001 From: familyfriendlymikey Date: Sun, 28 Aug 2022 12:34:01 -0400 Subject: [PATCH] disable stuff if loading --- app/client.imba | 62 ++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/app/client.imba b/app/client.imba index 09927f8..5cacd33 100644 --- a/app/client.imba +++ b/app/client.imba @@ -269,6 +269,7 @@ tag app window.location.href = link.url def handle_return + return if editing_link if bang or state.scored_links.length < 1 return handle_bang! let link = state.scored_links[selection_index] @@ -335,16 +336,20 @@ tag app handle_edit state.scored_links[selection_index] def handle_shift_return - if editing_link - try - await update_link editing_link, state.query - editing_link = no - state.query = '' - sort_links! - catch e - err "updating link", e - else - handle_add! + def go + if editing_link + try + await update_link editing_link, state.query + editing_link = no + state.query = '' + sort_links! + catch e + err "updating link", e + else + handle_add! + loading = yes + await go! + loading = no def handle_esc editing_link = no @@ -427,7 +432,14 @@ tag app Date!.toString!.split(" ").slice(0, 4).join(" ") def render - + + css .disabled * + @important c:gray4 cursor:default user-select:none pointer-events:none + + css .disabled $main-input + @important bg:gray4/10 bc:gray4 + + css body d:flex fld:column jc:flex-start ai:center @@ -484,9 +496,6 @@ tag app css .tip-content pt:2px fs:14px c:purple3 - css .disabled - c:gray4 cursor:default user-select:none - css .links d:flex fld:column jc:flex-start fl:1 w:100% ofy:auto pt:15px @@ -559,7 +568,7 @@ tag app @click=(settings_active = no) > "BACK" <.settings-container> - + "IMPORT" <.settings-button - .disabled=loading @click.if(!loading)=handle_click_export > "EXPORT" <.settings-container> <.settings-button - .disabled=loading @click.if(!loading)=handle_click_github > "TUTORIAL" <.settings-button - .disabled=loading @click.if(!loading)=handle_click_github > "GITHUB" <.settings-container> @@ -600,7 +606,6 @@ tag app config.enable_effective_names ? "DISABLE EFFECTIVE NAMES" : "ENABLE EFFECTIVE NAMES" <.settings-container> <.settings-button - .disabled=loading @click.if(!loading)=handle_toggle_light_theme > config.enable_dark_theme ? "DISABLE DARK THEME" : "ENABLE DARK THEME" @@ -638,17 +643,16 @@ tag app