Skip to content

Commit

Permalink
Merge pull request #16 from danyoungday/misc-cleanup
Browse files Browse the repository at this point in the history
Some miscellaneous cleanup before deployment
  • Loading branch information
danyoungday authored Oct 3, 2024
2 parents e137a6b + a4efb30 commit bed7f32
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
28 changes: 27 additions & 1 deletion app/components/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def create_context_div(self):
dbc.Button(
"AI Generate Policies for Scenario",
id="presc-button",
className="me-1 mb-2",
className="me-1 mb-2 w-25",
n_clicks=0
)
]
Expand Down Expand Up @@ -229,3 +229,29 @@ def update_ssp_desc(*context_values):
html.H4("Custom Scenario Selected")
]
)

@app.callback(
Output("presc-button", "disabled", allow_duplicate=True),
Output("presc-button", "children", allow_duplicate=True),
Output("presc-button", "color", allow_duplicate=True),
Input("presc-button", "n_clicks"),
prevent_initial_call=True
)
def disable_button(n_clicks):
"""
Disables the button after it is clicked and displays a loading message.
"""
return n_clicks > 0, "Please wait...", "warning"

@app.callback(
Output("presc-button", "disabled", allow_duplicate=True),
Output("presc-button", "children", allow_duplicate=True),
Output("presc-button", "color", allow_duplicate=True),
Input("reset-button", "disabled"),
prevent_initial_call=True
)
def enable_button(reset_disabled):
"""
Enables the button when the filtering is done and resets it.
"""
return False, "AI Generate Policies for Scenario", "primary"
2 changes: 1 addition & 1 deletion app/components/intro.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def create_intro_div(self):
)
),
dbc.Row(
style={"height": "60vh"}
style={"height": "70vh"}
),
dbc.Row(
html.P("Get Started:", className="w-50 text-center mx-auto text-white h4")
Expand Down
2 changes: 1 addition & 1 deletion app/components/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_references_div(self):
aspx")
]),
html.P([
"Project Resilience is a collaboration between the United Nations and Cognizant Advanced \
"Project Resilience is a collaboration between the United Nations and Cognizant \
AI Labs. More info about the lab can be found here: ",
html.A("https://www.cognizant.com/us/en/services/ai/ai-lab",
href="https://www.cognizant.com/us/en/services/ai/ai-lab")
Expand Down

0 comments on commit bed7f32

Please sign in to comment.