rahul7star commited on
Commit
05d7575
·
verified ·
1 Parent(s): 706be82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -57
app.py CHANGED
@@ -207,6 +207,9 @@ def build_story_outputs():
207
  return outputs
208
 
209
 
 
 
 
210
  # =========================================================
211
  # PAGINATION CONFIG
212
  # =========================================================
@@ -348,33 +351,6 @@ body, .gradio-container {
348
  font-size: 24px !important;
349
  }
350
 
351
- .pagination-wrap {
352
- display: flex;
353
- justify-content: center;
354
- align-items: center;
355
- gap: 12px;
356
- margin: 0 0 22px 0;
357
- flex-wrap: wrap;
358
- width: 100%;
359
- }
360
-
361
- .page-indicator {
362
- background: white;
363
- border: 1px solid var(--border);
364
- border-radius: 16px;
365
- padding: 10px 16px;
366
- box-shadow: var(--shadow);
367
- color: var(--text);
368
- font-weight: 600;
369
- }
370
-
371
- .page-btn button,
372
- .page-btn > button {
373
- border-radius: 16px !important;
374
- min-width: 120px !important;
375
- height: 44px !important;
376
- }
377
-
378
  .stories-list {
379
  display: flex;
380
  flex-direction: column;
@@ -485,6 +461,33 @@ body, .gradio-container {
485
  border-radius: 16px !important;
486
  }
487
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
488
  .empty-state {
489
  background: rgba(255,255,255,0.025);
490
  border: 1px dashed var(--border);
@@ -566,10 +569,6 @@ def build_story_outputs(page=1):
566
  gr.update(value="Page 1 of 1"),
567
  gr.update(interactive=False),
568
  gr.update(interactive=False),
569
-
570
- gr.update(value="Page 1 of 1"),
571
- gr.update(interactive=False),
572
- gr.update(interactive=False),
573
  ]
574
 
575
  for _ in range(STORIES_PER_PAGE):
@@ -604,12 +603,7 @@ def build_story_outputs(page=1):
604
  outputs = [
605
  gr.update(value=hero_html),
606
 
607
- # Top pagination
608
- gr.update(value=f"Page {page} of {total_pages}"),
609
- gr.update(interactive=page > 1),
610
- gr.update(interactive=page < total_pages),
611
-
612
- # Bottom pagination
613
  gr.update(value=f"Page {page} of {total_pages}"),
614
  gr.update(interactive=page > 1),
615
  gr.update(interactive=page < total_pages),
@@ -697,8 +691,6 @@ with gr.Blocks(
697
  hero_html = gr.HTML()
698
  refresh_btn = gr.Button("↻", variant="secondary", elem_classes=["hero-refresh"], scale=0)
699
 
700
-
701
-
702
  with gr.Column(elem_classes=["stories-list"]):
703
  card_components = []
704
 
@@ -739,7 +731,7 @@ with gr.Blocks(
739
  gallery_comp,
740
  ])
741
 
742
- # BOTTOM pagination
743
  with gr.Row(elem_classes=["pagination-wrap"]):
744
  prev_btn_bottom = gr.Button("← Previous", variant="secondary", elem_classes=["page-btn"], scale=0)
745
  page_info_bottom = gr.Markdown("Page 1 of 1", elem_classes=["page-indicator"])
@@ -747,11 +739,6 @@ with gr.Blocks(
747
 
748
  all_outputs = [
749
  hero_html,
750
-
751
- page_info,
752
- prev_btn,
753
- next_btn,
754
-
755
  page_info_bottom,
756
  prev_btn_bottom,
757
  next_btn_bottom,
@@ -769,18 +756,6 @@ with gr.Blocks(
769
  outputs=[page_state] + all_outputs,
770
  )
771
 
772
- prev_btn.click(
773
- fn=go_prev_page,
774
- inputs=[page_state],
775
- outputs=[page_state] + all_outputs,
776
- )
777
-
778
- next_btn.click(
779
- fn=go_next_page,
780
- inputs=[page_state],
781
- outputs=[page_state] + all_outputs,
782
- )
783
-
784
  prev_btn_bottom.click(
785
  fn=go_prev_page,
786
  inputs=[page_state],
 
207
  return outputs
208
 
209
 
210
+ # =========================================================
211
+ # PAGINATION CONFIG
212
+ # =========================================================
213
  # =========================================================
214
  # PAGINATION CONFIG
215
  # =========================================================
 
351
  font-size: 24px !important;
352
  }
353
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  .stories-list {
355
  display: flex;
356
  flex-direction: column;
 
461
  border-radius: 16px !important;
462
  }
463
 
464
+ .pagination-wrap {
465
+ display: flex;
466
+ justify-content: center;
467
+ align-items: center;
468
+ gap: 12px;
469
+ margin: 10px 0 40px 0;
470
+ flex-wrap: wrap;
471
+ width: 100%;
472
+ }
473
+
474
+ .page-indicator {
475
+ background: white;
476
+ border: 1px solid var(--border);
477
+ border-radius: 16px;
478
+ padding: 10px 16px;
479
+ box-shadow: var(--shadow);
480
+ color: var(--text);
481
+ font-weight: 600;
482
+ }
483
+
484
+ .page-btn button,
485
+ .page-btn > button {
486
+ border-radius: 16px !important;
487
+ min-width: 120px !important;
488
+ height: 44px !important;
489
+ }
490
+
491
  .empty-state {
492
  background: rgba(255,255,255,0.025);
493
  border: 1px dashed var(--border);
 
569
  gr.update(value="Page 1 of 1"),
570
  gr.update(interactive=False),
571
  gr.update(interactive=False),
 
 
 
 
572
  ]
573
 
574
  for _ in range(STORIES_PER_PAGE):
 
603
  outputs = [
604
  gr.update(value=hero_html),
605
 
606
+ # Bottom pagination only
 
 
 
 
 
607
  gr.update(value=f"Page {page} of {total_pages}"),
608
  gr.update(interactive=page > 1),
609
  gr.update(interactive=page < total_pages),
 
691
  hero_html = gr.HTML()
692
  refresh_btn = gr.Button("↻", variant="secondary", elem_classes=["hero-refresh"], scale=0)
693
 
 
 
694
  with gr.Column(elem_classes=["stories-list"]):
695
  card_components = []
696
 
 
731
  gallery_comp,
732
  ])
733
 
734
+ # BOTTOM pagination only
735
  with gr.Row(elem_classes=["pagination-wrap"]):
736
  prev_btn_bottom = gr.Button("← Previous", variant="secondary", elem_classes=["page-btn"], scale=0)
737
  page_info_bottom = gr.Markdown("Page 1 of 1", elem_classes=["page-indicator"])
 
739
 
740
  all_outputs = [
741
  hero_html,
 
 
 
 
 
742
  page_info_bottom,
743
  prev_btn_bottom,
744
  next_btn_bottom,
 
756
  outputs=[page_state] + all_outputs,
757
  )
758
 
 
 
 
 
 
 
 
 
 
 
 
 
759
  prev_btn_bottom.click(
760
  fn=go_prev_page,
761
  inputs=[page_state],