From ff65b8b02809f061fba815d871b7720055436939 Mon Sep 17 00:00:00 2001 From: familyfriendlymikey Date: Mon, 5 Sep 2022 21:04:45 -0400 Subject: [PATCH] fix buttons --- app/components/app-link.imba | 35 ++++++++++++++++++++++++++--------- app/components/app-links.imba | 11 ----------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/app/components/app-link.imba b/app/components/app-link.imba index 3079700..5d34cac 100644 --- a/app/components/app-link.imba +++ b/app/components/app-link.imba @@ -1,5 +1,16 @@ tag app-link + def handle_delete link + return unless window.confirm "Do you really want to delete {link..display_name}?" + api.delete_link link + + def handle_pin link + api.pin_link link + + def handle_edit + return unless state.sorted_links.length > 0 + refs.edit.open api.selected_link + def render - css d:flex fl:1 + css d:flex fl:3 css w:20px h:20px mr:10px rd:3px @@ -30,25 +41,31 @@ tag app-link ")" <.link-right> - css d:flex fld:row jc:space-between ai:center + css fl:1 d:flex fld:row jc:space-between ai:center + css .buttons-disabled .link-button visibility:hidden css .selected .link-button visibility:visible <.link-buttons .buttons-disabled=!config.data.enable_buttons> - css d:flex fld:row jc:start ai:center pr:25px gap:5px + css d:flex fld:row jc:start ai:center gap:5px + css .link-button visibility:hidden rd:3px c:$button-c fs:15px cursor:pointer px:3px + if index is state.link_selection_index + css .link-button visibility:visible + css .link-button svg w:15px - <.link-button@click.prevent.stop=handle_click_edit(link)> + <.link-button@click.prevent.stop=handle_edit(link)> - <.link-button@click.prevent.stop=handle_click_delete(link)> + <.link-button@click.prevent.stop=handle_delete(link)> - <.link-button - @click.prevent.stop=handle_click_pin(link) - [visibility:visible c:$button-dim-c]=(link.is_pinned and (index isnt state.link_selection_index or not config.data.enable_buttons)) - > + <.link-button @click.prevent.stop=handle_pin(link)> + if link.is_pinned + css visibility:visible c:$button-dim-c + + <.frequency> link.frequency css fs:15px ml:7px diff --git a/app/components/app-links.imba b/app/components/app-links.imba index 7d884fd..99031f2 100644 --- a/app/components/app-links.imba +++ b/app/components/app-links.imba @@ -1,16 +1,5 @@ tag app-links - def handle_click_delete link - return unless window.confirm "Do you really want to delete {link..display_name}?" - handle_delete link - - def handle_click_pin link - api.pin_link link - - def handle_edit - return unless state.sorted_links.length > 0 - refs.edit.open api.selected_link - get tips let result = []