-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
240 lines (228 loc) · 7.41 KB
/
app.py
File metadata and controls
240 lines (228 loc) · 7.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
import os
from dotenv import load_dotenv
from dash import Dash, html, page_container
import dash_mantine_components as dmc
# Load .env file
load_dotenv()
# Google Analytics Measurement ID
GA_MEASUREMENT_ID = os.getenv("GOOGLE_ANALYTICS")
external_stylesheets = [
{
"href": "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Oxanium:wght@200..800&display=swap",
"rel": "stylesheet"
},
"custom.css",
]
app = Dash(__name__, use_pages=True, suppress_callback_exceptions=True, external_stylesheets=external_stylesheets)
APP_LAST_UPDATED = "Mar 27, 2026"
# Google analytics
app.index_string = f"""
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={GA_MEASUREMENT_ID}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){{dataLayer.push(arguments);}}
gtag('js', new Date());
gtag('config', '{GA_MEASUREMENT_ID}');
</script>
{{%metas%}}
<title>{{%title%}}</title>
{{%favicon%}}
{{%css%}}
</head>
<body>
{{%app_entry%}}
<footer>
{{%config%}}
{{%scripts%}}
{{%renderer%}}
</footer>
</body>
</html>
"""
navbar = dmc.Flex(
justify="flex-start",
align="center",
direction="row",
wrap="wrap",
py="1.25rem",
style={
"backdropFilter": "blur(0.5px)",
},
children=[
dmc.Flex(
justify="flex-start",
align="flex-start",
direction="row",
wrap="wrap",
children=[
dmc.Image(
h=37,
w="auto",
fit="contain",
src="/assets/basketball-icon128.png",
mr="0.375rem"
),
dmc.Anchor(
href="/",
underline="never",
children=[
dmc.Title(
"BasketHogs",
order=1,
c="white", # Color utility
mb=0,
lh=1.0,
style={
"textShadow": "1px 1px 3px black",
},
),
dmc.Title(
"Fan-powered analytics hub",
order=6,
c="white", # Color utility
fw=400,
fz="0.6875rem",
lh=0.96,
style={
"textShadow": "1px 1px 3px black",
},
),
]
),
]
),
dmc.Flex(
ml="auto",
children=[
dmc.Anchor(
dmc.Button(
"About",
variant="white",
color="black",
size="xs",
style={
"boxShadow": "5px 5px 10px 2px rgba(0, 0, 0, 0.6)"
}
),
href="/about",
underline="never",
),
]
)
]
)
header = dmc.Box(
px="1rem",
# mb="2rem",
style={
"backgroundImage": "linear-gradient(rgba(0, 0, 0, 0.375), rgba(0, 0, 0, 0.25)), url('/assets/bwa-packed-arena.png')",
"backgroundSize": "cover",
"backgroundPosition": "center center"
},
children=[
navbar,
dmc.Flex(
justify="center",
align="center",
direction="column",
wrap="wrap",
pt={"base": "7rem", "lg": "10rem"},
pb={"base": "3rem", "lg": "4rem"},
style={
"backdropFilter": "blur(0.5px)",
},
children=[
dmc.Title(
"Arkansas Razorbacks",
order=1,
c="white", # Color utility
ta="center", # text align center
lh=1.0, # line height 1
mb="sm", # margin-bottom
fz={
"base": "4rem", # mobile ≤576px
"sm": "5rem", # ≥768px
"md": "7rem", # ≥992px
"lg": "7rem", # ≥1200px
"xl": "7rem" # ≥1440px
},
style={
"textShadow": "1px 1px 47px black",
}
),
dmc.Title(
f"Men's Basketball 2025-2026 • Last Updated {APP_LAST_UPDATED}",
order=6,
c="white",
fw=500,
bg="black",
p="0.375rem 0.75rem",
style={"borderRadius": "0.375rem"},
fz={"base": "0.75rem", "sm": "0.75rem", "md": "0.875rem"},
),
]
)
]
)
footer = dmc.Group(
align="center", # vertical alignment
pt="2.5rem",
mb="1.25rem",
justify="space-between",
mt="auto",
children=[
dmc.Anchor(
"Source",
c="black",
href="https://arkansasrazorbacks.com/sport/m-baskbl/",
underline="never",
fw=500
),
dmc.Text(
"© 2025 BasketHogs",
# ml="auto",
),
]
)
app.layout = html.Div([
# Favicon
html.Link(
rel="icon",
href="/assets/favicon.ico",
type="image/x-icon"
),
dmc.MantineProvider(
theme= {
"fontFamily": 'Inter',
"headings": { "fontFamily": "Inter, Arial, sans-serif" },
},
children=[
header,
dmc.Container(
fluid=True, # Makes it full-width
style={
"minHeight": "100vh",
"display": "flex", # Added: Enables flexbox
"flexDirection": "column", # Added: Vertical stacking (page > footer)
},
children=[
# page_container,
# footer
# Main content (grows to fill space)
html.Div(
style={"flex": "1"}, # Added: Expands page_container
children=page_container, # Dash injects multi-page content here
),
footer, # Pushed to bottom by flex:1 above
],
),
]
)
])
if __name__ == "__main__":
port = int(os.environ.get("PORT", 8080)) # Use $PORT env var if set, fallback to 8080
app.run(debug=False, host='0.0.0.0', port=port) # Set debug to True to deploy to Plotly Cloud