rbiswasfc commited on
Commit
a14cb14
1 Parent(s): 8e97bca
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -151,10 +151,14 @@ pie_chart = Div(generate_contributions_chart(), id="pie-chart")
151
  style = Style("""
152
  .grid { margin-bottom: 1rem; }
153
  .card { display: flex; flex-direction: column; }
 
154
  .card img { margin-bottom: 0.5rem; }
155
  .card h5 { margin: 0; font-size: 0.9rem; line-height: 1.2; }
156
  .card a { color: inherit; text-decoration: none; }
157
  .card a:hover { text-decoration: underline; }
 
 
 
158
  """)
159
 
160
  app, rt = fast_app(html_style=(style,))
@@ -223,16 +227,20 @@ def generate_week_content(current_week):
223
  )
224
  ]
225
 
226
- # insert image
227
  card_content.insert(
228
  0,
229
- Img(
230
- src=PLACEHOLDER_IMAGE, # image_url,
231
- alt="Article image",
232
- style="max-width: 100%; height: auto; margin-bottom: 15px;",
 
 
 
 
 
233
  hx_get=f"/image/{arxiv_id}",
234
  hx_trigger="revealed",
235
- hx_swap="outerHTML",
236
  ),
237
  )
238
 
 
151
  style = Style("""
152
  .grid { margin-bottom: 1rem; }
153
  .card { display: flex; flex-direction: column; }
154
+ .card img { margin-bottom: 0.5rem; width: 500px; height: 500px; object-fit: cover; }
155
  .card img { margin-bottom: 0.5rem; }
156
  .card h5 { margin: 0; font-size: 0.9rem; line-height: 1.2; }
157
  .card a { color: inherit; text-decoration: none; }
158
  .card a:hover { text-decoration: underline; }
159
+ .htmx-indicator { display: none; }
160
+ .htmx-request .htmx-indicator { display: inline; }
161
+ .htmx-request.htmx-indicator { display: inline; }
162
  """)
163
 
164
  app, rt = fast_app(html_style=(style,))
 
227
  )
228
  ]
229
 
 
230
  card_content.insert(
231
  0,
232
+ Div(
233
+ Img(src=PLACEHOLDER_IMAGE, alt="Article image", style="width: 500px; height: 500px; object-fit: cover;"),
234
+ Img(
235
+ src="/static/loading.gif",
236
+ alt="Loading",
237
+ cls="htmx-indicator",
238
+ style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);",
239
+ ),
240
+ style="position: relative;",
241
  hx_get=f"/image/{arxiv_id}",
242
  hx_trigger="revealed",
243
+ hx_swap="innerHTML",
244
  ),
245
  )
246