From d5cbe55d818dd41f55ab1e6e94b0a7a3f509dfa5 Mon Sep 17 00:00:00 2001 From: enne2 Date: Thu, 21 Sep 2023 01:50:59 +0200 Subject: [PATCH] 1.1.4 --- main.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/main.py b/main.py index 7ce295c..e9bc3f7 100644 --- a/main.py +++ b/main.py @@ -114,7 +114,52 @@ def page_login() -> None: ui.add_head_html(''' ''') + ui.add_body_html(''' + + ''') + async def alert(): + await ui.run_javascript(''' + // Show the prompt + deferredPrompt.prompt(); + // Wait for the user to respond to the prompt + deferredPrompt.userChoice.then((choiceResult) => { + if (choiceResult.outcome === 'accepted') { + console.log('User accepted the A2HS prompt'); + } else { + console.log('User dismissed the A2HS prompt'); + } + deferredPrompt = null; + });''', respond=False) + with ui.card().classes('absolute-center items-center'): + ui.button('Install App', on_click=alert) ui.image('assets/logo.svg') ui.label('Let\'s Swing Admin').classes('text-2xl') username = ui.input('Username').on('keydown.enter', try_login).classes('w-full')