Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -95,14 +95,18 @@ app.layout = dbc.Container([
|
|
95 |
], fluid=True)
|
96 |
|
97 |
@callback(
|
98 |
-
Output("add-url-modal", "is_open"),
|
|
|
|
|
99 |
[Input("open-modal-button", "n_clicks"), Input("add-url-button", "n_clicks")],
|
100 |
[State("add-url-modal", "is_open")],
|
101 |
)
|
102 |
def toggle_modal(n1, n2, is_open):
|
103 |
if n1 or n2:
|
104 |
-
|
105 |
-
|
|
|
|
|
106 |
|
107 |
@callback(
|
108 |
Output('url-list', 'children'),
|
@@ -131,6 +135,7 @@ def update_url_list(add_clicks, status, delete_clicks, new_name, new_link):
|
|
131 |
|
132 |
triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
133 |
print(f"Triggered by: {triggered_id}") # Debug print
|
|
|
134 |
|
135 |
if triggered_id == 'add-url-button' and new_name and new_link:
|
136 |
try:
|
|
|
95 |
], fluid=True)
|
96 |
|
97 |
@callback(
|
98 |
+
[Output("add-url-modal", "is_open"),
|
99 |
+
Output('new-url-name', 'value'),
|
100 |
+
Output('new-url-link', 'value')],
|
101 |
[Input("open-modal-button", "n_clicks"), Input("add-url-button", "n_clicks")],
|
102 |
[State("add-url-modal", "is_open")],
|
103 |
)
|
104 |
def toggle_modal(n1, n2, is_open):
|
105 |
if n1 or n2:
|
106 |
+
if is_open:
|
107 |
+
return False, '', '' # Close modal and reset input fields
|
108 |
+
return True, dash.no_update, dash.no_update # Open modal
|
109 |
+
return is_open, dash.no_update, dash.no_update
|
110 |
|
111 |
@callback(
|
112 |
Output('url-list', 'children'),
|
|
|
135 |
|
136 |
triggered_id = ctx.triggered[0]['prop_id'].split('.')[0]
|
137 |
print(f"Triggered by: {triggered_id}") # Debug print
|
138 |
+
print(f"New name: {new_name}, New link: {new_link}") # Debug print
|
139 |
|
140 |
if triggered_id == 'add-url-button' and new_name and new_link:
|
141 |
try:
|