Spaces:
Running
Running
Update app.py
Browse files
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 -
|
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 |
-
.
|
|
|
|
|
|
|
|
|
153 |
display: flex;
|
154 |
justify-content: center;
|
155 |
-
|
156 |
-
padding: 10px
|
157 |
-
|
158 |
-
|
159 |
-
|
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
|
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 |
|