You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.0 KiB

2 years ago
tag app-link
2 years ago
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
2 years ago
def render
2 years ago
<self
@pointerover=api.set_link_selection_index(index)
2 years ago
@click=api.handle_click_link
.selected=(index is state.link_selection_index)
2 years ago
>
2 years ago
css d:flex fld:row jc:space-between ai:center
2 years ago
px:16px py:11px rd:5px cursor:pointer c:$text-c
if link.is_bang
2 years ago
css c:$bang-color
2 years ago
2 years ago
<.link-left>
2 years ago
css d:flex fl:3
2 years ago
<img.link-icon src=link.icon>
2 years ago
css w:20px h:20px mr:10px rd:3px
2 years ago
<.display-name> link.display_name
2 years ago
css tt:capitalize fs:20px overflow-wrap:anywhere
2 years ago
if link.display_name isnt link.name and config.data.enable_effective_names
2 years ago
<.name>
2 years ago
css d:flex ja:center c:$effective-name-c ml:10px fs:14px
css .parens fs:10px c:$effective-name-parens-c
2 years ago
2 years ago
<span.parens> "("
<span> link.name
2 years ago
<span.parens> ")"
2 years ago
2 years ago
<.link-right>
2 years ago
css fl:1 d:flex fld:row jc:space-between ai:center
2 years ago
css .buttons-disabled .link-button visibility:hidden
css .selected .link-button visibility:visible
2 years ago
2 years ago
<.link-buttons .buttons-disabled=!config.data.enable_buttons>
2 years ago
css d:flex fld:row jc:start ai:center gap:5px
2 years ago
css .link-button visibility:hidden rd:3px c:$button-c fs:15px cursor:pointer px:3px
2 years ago
if index is state.link_selection_index
css .link-button visibility:visible
2 years ago
css .link-button svg w:15px
2 years ago
2 years ago
<.link-button@click.prevent.stop=handle_edit(link)>
2 years ago
<svg src='../assets/edit-2.svg'>
2 years ago
2 years ago
<.link-button@click.prevent.stop=handle_delete(link)>
2 years ago
<svg src='../assets/trash.svg'>
2 years ago
2 years ago
<.link-button @click.prevent.stop=handle_pin(link)>
if link.is_pinned
css visibility:visible c:$button-dim-c
<svg src='../assets/star.svg'>
2 years ago
<.frequency> link.frequency
2 years ago
css fs:15px ml:7px