|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
| 5 | +from importlib import metadata |
| 6 | +import time |
| 7 | + |
5 | 8 | from dash import html |
6 | 9 | from dash.dash_table import DataTable |
7 | 10 | from dash.dcc import Checklist, Store |
@@ -283,6 +286,94 @@ def build_weight_components( |
283 | 286 | return Div(layout) |
284 | 287 |
|
285 | 288 |
|
| 289 | +def build_footer() -> html.Footer: |
| 290 | + """ |
| 291 | + Build shared footer with author, copyright, and repository link. |
| 292 | +
|
| 293 | + Returns |
| 294 | + ------- |
| 295 | + html.Footer |
| 296 | + Styled footer component rendered at the bottom of each tab. |
| 297 | + """ |
| 298 | + copyright_first_year = "2025" |
| 299 | + current_year = str(time.localtime().tm_year) |
| 300 | + copyright_owners = metadata.metadata("ml-peg")["author"] |
| 301 | + |
| 302 | + copyright_year_string = ( |
| 303 | + current_year |
| 304 | + if current_year == copyright_first_year |
| 305 | + else f"{copyright_first_year}-{current_year}" |
| 306 | + ) |
| 307 | + copyright_txt = ( |
| 308 | + f"Copyright © {copyright_year_string}, {copyright_owners}. All rights reserved" |
| 309 | + ) |
| 310 | + |
| 311 | + return html.Footer( |
| 312 | + [ |
| 313 | + Div( |
| 314 | + [ |
| 315 | + html.Span(copyright_txt, style={"fontWeight": "800"}), |
| 316 | + ], |
| 317 | + style={ |
| 318 | + "display": "flex", |
| 319 | + "justifyContent": "center", |
| 320 | + "flexWrap": "wrap", |
| 321 | + "gap": "6px", |
| 322 | + }, |
| 323 | + ), |
| 324 | + Div( |
| 325 | + html.A( |
| 326 | + "GPL-3.0 license", |
| 327 | + href="https://github.com/ddmms/ml-peg/blob/main/LICENSE", |
| 328 | + target="_blank", |
| 329 | + ), |
| 330 | + style={"marginTop": "4px", "fontWeight": "800"}, |
| 331 | + ), |
| 332 | + Div( |
| 333 | + html.A( |
| 334 | + [ |
| 335 | + html.Img( |
| 336 | + src=( |
| 337 | + "https://github.githubassets.com/images/modules/logos_page/" |
| 338 | + "GitHub-Mark.png" |
| 339 | + ), |
| 340 | + alt="GitHub", |
| 341 | + width="16", |
| 342 | + height="16", |
| 343 | + style={ |
| 344 | + "marginRight": "6px", |
| 345 | + "verticalAlign": "middle", |
| 346 | + "display": "block", |
| 347 | + }, |
| 348 | + ), |
| 349 | + html.Span("View on GitHub"), |
| 350 | + ], |
| 351 | + href="https://github.com/ddmms/ml-peg", |
| 352 | + target="_blank", |
| 353 | + style={ |
| 354 | + "color": "#0d6efd", |
| 355 | + "textDecoration": "none", |
| 356 | + "fontWeight": "800", |
| 357 | + "display": "inline-flex", |
| 358 | + "alignItems": "center", |
| 359 | + }, |
| 360 | + ), |
| 361 | + style={"marginTop": "6px"}, |
| 362 | + ), |
| 363 | + ], |
| 364 | + style={ |
| 365 | + "marginTop": "24px", |
| 366 | + "padding": "14px 12px", |
| 367 | + "color": "#343a40", |
| 368 | + "fontSize": "12px", |
| 369 | + "textAlign": "center", |
| 370 | + "borderTop": "1px solid #dee2e6", |
| 371 | + "background": "#f8f9fa", |
| 372 | + "borderRadius": "6px", |
| 373 | + }, |
| 374 | + ) |
| 375 | + |
| 376 | + |
286 | 377 | def build_test_layout( |
287 | 378 | name: str, |
288 | 379 | description: str, |
|
0 commit comments