diff options
Diffstat (limited to 'src/match_up/view.py')
| -rw-r--r-- | src/match_up/view.py | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/match_up/view.py b/src/match_up/view.py new file mode 100644 index 0000000..9da82a9 --- /dev/null +++ b/src/match_up/view.py @@ -0,0 +1,77 @@ +from dash.html import Div, H4 +from match_up.model import Player +from dash.dash_table import DataTable +from dash_bootstrap_components import Row, Col, Container, Input, Select + + +class PlayerLayout: + def __init__(self, player_list: list[Player]): + self._layout = Div( + [ + H4(children="Player List"), + DataTable( + data=[ + { + "Player": player.first_name + " " + player.last_name, + "Status": "Active" if player.status else "Inactive", + } + for player in player_list + ], + columns=[ + {"name": "Player", "id": "Player", "type": "text"}, + ], + style_data_conditional=[ + { + "if": { + "column_id": "Player", + "filter_query": "{Status} = Active", + }, + "backgroundColor": "green", + "color": "white", + }, + { + "if": { + "column_id": "Player", + "filter_query": "{Status} = Inactive", + }, + "backgroundColor": "tomato", + "color": "white", + "fontWeight": "bold", + }, + ], + ), + ] + ) + + def get(self): + return self._layout + + +class GameLayout: + def __init__(): ... + + +class MainLayout: + def __init__(self, player_list: list[Player]): + self._player_layout = PlayerLayout(player_list) + + def refresh(): ... + + def get(self): + full_layout = Div( + [ + Container( + [ + Row( + [ + Col(["Total Samples"], width=1), + Col([self._player_layout.get()], width=10), + ], + style={"margin": "15px"}, + ) + ] + ) + ] + ) + # full_layout = Div([Div(children="Hello World")]) + return full_layout |
