Spaces:
Running
on
Zero
Running
on
Zero
Update search_history.py
Browse files- search_history.py +33 -39
search_history.py
CHANGED
@@ -182,28 +182,37 @@ def create_history_tab(history_component: SearchHistoryComponent):
|
|
182 |
with gr.TabItem("Recommendation Search History"):
|
183 |
gr.HTML("""
|
184 |
<style>
|
185 |
-
.
|
186 |
-
|
|
|
|
|
187 |
border: none !important;
|
|
|
|
|
188 |
color: white !important;
|
189 |
-
|
190 |
-
border-radius: 8px !important;
|
191 |
-
font-weight: 600 !important;
|
192 |
-
transition: all 0.3s ease !important;
|
193 |
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
|
194 |
}
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
}
|
200 |
|
201 |
-
|
202 |
-
|
|
|
203 |
}
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
</style>
|
209 |
|
@@ -243,37 +252,22 @@ def create_history_tab(history_component: SearchHistoryComponent):
|
|
243 |
with gr.Row():
|
244 |
with gr.Column(scale=4):
|
245 |
history_display = gr.HTML()
|
246 |
-
|
247 |
-
# with gr.Row():
|
248 |
-
# with gr.Column(scale=1):
|
249 |
-
# clear_history_btn = gr.Button(
|
250 |
-
# "🗑️ Clear History",
|
251 |
-
# variant="secondary",
|
252 |
-
# size="sm"
|
253 |
-
# )
|
254 |
-
# with gr.Column(scale=1):
|
255 |
-
# refresh_btn = gr.Button(
|
256 |
-
# "🔄 Refresh",
|
257 |
-
# variant="secondary",
|
258 |
-
# size="sm"
|
259 |
-
# )
|
260 |
-
|
261 |
with gr.Row(equal_height=True):
|
262 |
with gr.Column(scale=1):
|
263 |
clear_history_btn = gr.Button(
|
264 |
"🗑️ Clear History",
|
265 |
-
variant="primary",
|
266 |
-
size="
|
267 |
-
elem_id="clear-btn",
|
268 |
-
elem_classes="custom-history-btn"
|
269 |
)
|
270 |
with gr.Column(scale=1):
|
271 |
refresh_btn = gr.Button(
|
272 |
"🔄 Refresh",
|
273 |
-
variant="primary",
|
274 |
-
size="
|
275 |
-
elem_id="refresh-btn",
|
276 |
-
elem_classes="custom-history-btn"
|
277 |
)
|
278 |
|
279 |
history_display.value = history_component.format_history_html()
|
|
|
182 |
with gr.TabItem("Recommendation Search History"):
|
183 |
gr.HTML("""
|
184 |
<style>
|
185 |
+
.history-btn {
|
186 |
+
font-size: 0.9em !important;
|
187 |
+
padding: 8px 16px !important;
|
188 |
+
border-radius: 6px !important;
|
189 |
border: none !important;
|
190 |
+
font-weight: 500 !important;
|
191 |
+
transition: all 0.2s ease !important;
|
192 |
color: white !important;
|
193 |
+
text-transform: none !important;
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
+
|
196 |
+
/* Clear History 按鈕樣式 */
|
197 |
+
.clear-btn {
|
198 |
+
background: linear-gradient(135deg, rgba(244, 67, 54, 0.85), rgba(255, 152, 0, 0.85)) !important;
|
199 |
}
|
200 |
|
201 |
+
/* Refresh 按鈕樣式 */
|
202 |
+
.refresh-btn {
|
203 |
+
background: linear-gradient(135deg, rgba(66, 165, 245, 0.85), rgba(38, 166, 154, 0.85)) !important;
|
204 |
}
|
205 |
+
|
206 |
+
/* 懸浮效果 */
|
207 |
+
.history-btn:hover {
|
208 |
+
transform: translateY(-1px);
|
209 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
|
210 |
+
}
|
211 |
+
|
212 |
+
/* 點擊效果 */
|
213 |
+
.history-btn:active {
|
214 |
+
transform: translateY(1px) scale(0.98);
|
215 |
+
box-shadow: none !important;
|
216 |
}
|
217 |
</style>
|
218 |
|
|
|
252 |
with gr.Row():
|
253 |
with gr.Column(scale=4):
|
254 |
history_display = gr.HTML()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
with gr.Row(equal_height=True):
|
256 |
with gr.Column(scale=1):
|
257 |
clear_history_btn = gr.Button(
|
258 |
"🗑️ Clear History",
|
259 |
+
variant="primary",
|
260 |
+
size="sm",
|
261 |
+
elem_id="clear-btn",
|
262 |
+
elem_classes="custom-history-btn"
|
263 |
)
|
264 |
with gr.Column(scale=1):
|
265 |
refresh_btn = gr.Button(
|
266 |
"🔄 Refresh",
|
267 |
+
variant="primary",
|
268 |
+
size="sm",
|
269 |
+
elem_id="refresh-btn",
|
270 |
+
elem_classes="custom-history-btn"
|
271 |
)
|
272 |
|
273 |
history_display.value = history_component.format_history_html()
|