fix: move _toggle_offcanvas callback to _compte_shell.py

The callback was defined in compte_admin.py but controlled components
(compte-offcanvas and compte-offcanvas-open) rendered by account_shell()
in _compte_shell.py. Moving the callback to where the components live
improves code organization and reduces coupling.

Closes #73

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Colin Maudry
2026-06-24 22:10:01 +02:00
parent 95f7d80b45
commit e2124024e1
2 changed files with 11 additions and 11 deletions
+11 -1
View File
@@ -1,5 +1,5 @@
import dash_bootstrap_components as dbc
from dash import dcc, html
from dash import Input, Output, State, callback, dcc, html
from flask_login import current_user
# Définition centralisée des sections de l'espace compte.
@@ -104,3 +104,13 @@ def account_shell(active: str, contenu):
)
content = dbc.Col([mobile, contenu], md=9)
return dbc.Container(dbc.Row([sidebar, content]), className="py-4")
@callback(
Output("compte-offcanvas", "is_open"),
Input("compte-offcanvas-open", "n_clicks"),
State("compte-offcanvas", "is_open"),
prevent_initial_call=True,
)
def _toggle_offcanvas(_n, is_open):
return not is_open
-10
View File
@@ -206,13 +206,3 @@ def layout(
)
def _toggle_delete_modal(_open, _cancel, is_open):
return not is_open
@callback(
Output("compte-offcanvas", "is_open"),
Input("compte-offcanvas-open", "n_clicks"),
State("compte-offcanvas", "is_open"),
prevent_initial_call=True,
)
def _toggle_offcanvas(_n, is_open):
return not is_open