ginipick commited on
Commit
414539a
ยท
verified ยท
1 Parent(s): f22af82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -36
app.py CHANGED
@@ -94,7 +94,7 @@ def html(cards, pg, total):
94
  grid-template-rows: repeat(3, 1fr);
95
  gap: 10px;
96
  width: 100%;
97
- height: calc(100vh - 150px);
98
  box-sizing: border-box;
99
  padding: 10px;
100
  }
@@ -149,16 +149,18 @@ def html(cards, pg, total):
149
  color: #4a6dd8;
150
  text-decoration: none;
151
  }
152
- .pagination {
 
 
 
 
153
  display: flex;
154
  justify-content: center;
155
- align-items: center;
156
- padding: 10px 0;
157
- }
158
- .page-info {
159
- font-size: 0.85rem;
160
- color: #555;
161
- margin: 0 15px;
162
  }
163
  </style>"""
164
 
@@ -174,8 +176,8 @@ def html(cards, pg, total):
174
  </div>"""
175
  h += "</div></div>"
176
 
177
- # ํŽ˜์ด์ง€ ์ •๋ณด๋งŒ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ‘œ์‹œ
178
- h += f"<div class='pagination'><span class='page-info'>Page {pg} / {total}</span></div>"
179
 
180
  return h
181
 
@@ -183,40 +185,18 @@ def html(cards, pg, total):
183
  def build():
184
  _init_best()
185
  with gr.Blocks(title="Vibe Game Craft", css="body{margin:0;padding:0;overflow:hidden;}") as demo:
186
- # URL ์ž…๋ ฅ ํ•„๋“œ
187
- with gr.Row():
188
- title_input = gr.Textbox(label="์ œ๋ชฉ", placeholder="๊ฒŒ์ž„ ์ œ๋ชฉ")
189
- url_input = gr.Textbox(label="URL", placeholder="https://...")
190
- add_btn = gr.Button("์ถ”๊ฐ€", variant="primary")
191
-
192
  # ์ƒํƒœ ๋ฐ ์ถœ๋ ฅ
193
  bp = gr.State(1)
194
  out = gr.HTML()
195
 
196
- # ํŽ˜์ด์ง€ ๋„ค๋น„๊ฒŒ์ด์…˜
197
- with gr.Row():
198
  b_prev = gr.Button("โ—€ ์ด์ „", size="sm")
199
  b_next = gr.Button("๋‹ค์Œ โ–ถ", size="sm")
200
 
201
  def show_best(p=1):
202
  d, t = page(_load_best(), p)
203
  return html(d, p, t), p
204
-
205
- def add_url():
206
- title = title_input.value
207
- url = url_input.value
208
-
209
- if not title or not url:
210
- return
211
-
212
- if not url.startswith("http"):
213
- url = "https://" + url
214
-
215
- add_url_to_best(title, url)
216
-
217
- # URL ์ถ”๊ฐ€ ํ›„ ํ™”๋ฉด ๊ฐฑ์‹ 
218
- d, t = page(_load_best(), 1)
219
- return html(d, 1, t), 1, "", ""
220
 
221
  def prev(b):
222
  b = max(1, b-1)
@@ -230,7 +210,6 @@ def build():
230
  return h, b
231
 
232
  # ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ
233
- add_btn.click(add_url, outputs=[out, bp, title_input, url_input])
234
  b_prev.click(prev, inputs=[bp], outputs=[out, bp])
235
  b_next.click(nxt, inputs=[bp], outputs=[out, bp])
236
 
 
94
  grid-template-rows: repeat(3, 1fr);
95
  gap: 10px;
96
  width: 100%;
97
+ height: calc(100vh - 80px);
98
  box-sizing: border-box;
99
  padding: 10px;
100
  }
 
149
  color: #4a6dd8;
150
  text-decoration: none;
151
  }
152
+ .navigation-buttons {
153
+ position: fixed;
154
+ bottom: 10px;
155
+ left: 0;
156
+ right: 0;
157
  display: flex;
158
  justify-content: center;
159
+ gap: 20px;
160
+ padding: 10px;
161
+ background: rgba(255, 255, 255, 0.7);
162
+ backdrop-filter: blur(5px);
163
+ z-index: 100;
 
 
164
  }
165
  </style>"""
166
 
 
176
  </div>"""
177
  h += "</div></div>"
178
 
179
+ # ํŽ˜์ด์ง€ ์ •๋ณด
180
+ h += f"<div style='text-align:center;font-size:0.85rem;color:#555;padding:5px;'>{pg} / {total}</div>"
181
 
182
  return h
183
 
 
185
  def build():
186
  _init_best()
187
  with gr.Blocks(title="Vibe Game Craft", css="body{margin:0;padding:0;overflow:hidden;}") as demo:
 
 
 
 
 
 
188
  # ์ƒํƒœ ๋ฐ ์ถœ๋ ฅ
189
  bp = gr.State(1)
190
  out = gr.HTML()
191
 
192
+ # ํŽ˜์ด์ง€ ๋„ค๋น„๊ฒŒ์ด์…˜ (ํ™”๋ฉด ํ•˜๋‹จ์— ๊ณ ์ •)
193
+ with gr.Row(elem_classes="navigation-buttons"):
194
  b_prev = gr.Button("โ—€ ์ด์ „", size="sm")
195
  b_next = gr.Button("๋‹ค์Œ โ–ถ", size="sm")
196
 
197
  def show_best(p=1):
198
  d, t = page(_load_best(), p)
199
  return html(d, p, t), p
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
 
201
  def prev(b):
202
  b = max(1, b-1)
 
210
  return h, b
211
 
212
  # ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ
 
213
  b_prev.click(prev, inputs=[bp], outputs=[out, bp])
214
  b_next.click(nxt, inputs=[bp], outputs=[out, bp])
215