@@ -628,12 +628,21 @@ def update_location_and_parcel_info(opacity, smoke_location, lang):
628628 return children , {"display" : "block" , "marginTop" : "0px" , "padding" : "6px 0" }
629629
630630
631+ # Button id → enum string mapping
632+ BUTTON_TO_ENUM = {
633+ "confirm-fire" : "wildfire_smoke" ,
634+ "confirm-other-smoke" : "other_smoke" ,
635+ "confirm-false" : "other" ,
636+ }
637+
638+
631639@app .callback (
632640 [Output ("confirmation-modal" , "style" ), Output ("to_acknowledge" , "data" )],
633641 [
634642 Input ("acknowledge-button" , "n_clicks" ),
635- Input ("confirm-wildfire" , "n_clicks" ),
636- Input ("confirm-non-wildfire" , "n_clicks" ),
643+ Input ("confirm-fire" , "n_clicks" ),
644+ Input ("confirm-other-smoke" , "n_clicks" ),
645+ Input ("confirm-false" , "n_clicks" ),
637646 Input ("cancel-confirmation" , "n_clicks" ),
638647 ],
639648 [
@@ -643,7 +652,7 @@ def update_location_and_parcel_info(opacity, smoke_location, lang):
643652 prevent_initial_call = True ,
644653)
645654def acknowledge_event (
646- acknowledge_clicks , confirm_wildfire , confirm_non_wildfire , cancel , sequence_id_on_display , user_token
655+ acknowledge_clicks , confirm_fire , confirm_other_smoke , confirm_false , cancel , sequence_id_on_display , user_token
647656):
648657 ctx = dash .callback_context
649658
@@ -669,24 +678,26 @@ def acknowledge_event(
669678 client .token = user_token
670679
671680 if triggered_id == "acknowledge-button" :
672- if acknowledge_clicks is None or acknowledge_clicks == 0 :
681+ if not acknowledge_clicks :
673682 raise PreventUpdate
674683 return modal_visible_style , dash .no_update
675684
676- elif triggered_id == "confirm-wildfire" :
677- if confirm_wildfire is None or confirm_wildfire == 0 :
685+ elif triggered_id in BUTTON_TO_ENUM :
686+ # guard for specific button click
687+ if triggered_id == "confirm-fire" and not confirm_fire :
678688 raise PreventUpdate
679- client .label_sequence (sequence_id_on_display , True )
680- return modal_hidden_style , sequence_id_on_display
681-
682- elif triggered_id == "confirm-non-wildfire" :
683- if confirm_non_wildfire is None or confirm_non_wildfire == 0 :
689+ if triggered_id == "confirm-other-smoke" and not confirm_other_smoke :
684690 raise PreventUpdate
685- client .label_sequence (sequence_id_on_display , False )
691+ if triggered_id == "confirm-false" and not confirm_false :
692+ raise PreventUpdate
693+
694+ enum_value = BUTTON_TO_ENUM [triggered_id ]
695+ client .label_sequence (sequence_id_on_display , enum_value )
696+
686697 return modal_hidden_style , sequence_id_on_display
687698
688699 elif triggered_id == "cancel-confirmation" :
689- if cancel is None or cancel == 0 :
700+ if not cancel :
690701 raise PreventUpdate
691702 return modal_hidden_style , dash .no_update
692703
0 commit comments