Skip to content

Commit

Permalink
Help button in download data tab is now, well, a button
Browse files Browse the repository at this point in the history
  • Loading branch information
karpov-sv committed Dec 4, 2023
1 parent ad122b2 commit 412268a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
23 changes: 16 additions & 7 deletions apps/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,25 +504,34 @@ def card_id(pdf):
id='download_json',
variant="outline",
color='indigo',
compact=True,
leftIcon=[DashIconify(icon="mdi:code-json")],
),
dmc.Button(
"VOTable",
id='download_votable',
variant="outline",
color='indigo',
compact=True,
leftIcon=[DashIconify(icon="mdi:xml")],
),
help_popover(
[
dcc.Markdown('You may also download the data programmatically.'),
download_tab,
dcc.Markdown('See {}/api for more options'.format(APIURL)),
],
'help_download',
trigger=dmc.ActionIcon(
DashIconify(icon="mdi:help"),
id='help_download',
variant="outline",
color='indigo',
),
),
html.Div(objectid, id='download_objectid', className='d-none'),
html.Div(APIURL, id='download_apiurl', className='d-none'),
], position="center"
),
help_popover(
[
dcc.Markdown('You may also download the data programmatically.'),
download_tab,
dcc.Markdown('See {}/api for more options'.format(APIURL)),
], 'help_download'
)
],
),
Expand Down
18 changes: 12 additions & 6 deletions apps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,16 +853,22 @@ def loading(item):
zIndex=100000
)

def help_popover(text, id):
def help_popover(text, id, trigger=None, className=None):
"""
Make clickable help icon with popover at the bottom right corner of current element
"""

if trigger is None:
trigger = html.I(
className="fa fa-question-circle fa-1x",
id=id,
)
if className is None:
className = "d-flex align-items-end justify-content-end"

return html.Div(
[
html.I(
className="fa fa-question-circle fa-1x",
id=id,
),
trigger,
dbc.Popover(
dbc.PopoverBody(
text,
Expand All @@ -873,5 +879,5 @@ def help_popover(text, id):
style={'width': '80vw', 'max-width': '800px'},
className='shadow-lg'
),
], className="d-flex align-items-end justify-content-end"
], className=className
)

0 comments on commit 412268a

Please sign in to comment.