Spaces:
Running
on
Zero
Running
on
Zero
Update search_history.py
Browse files- search_history.py +49 -5
search_history.py
CHANGED
@@ -181,6 +181,32 @@ def create_history_tab(history_component: SearchHistoryComponent):
|
|
181 |
"""
|
182 |
with gr.TabItem("Recommendation Search History"):
|
183 |
gr.HTML("""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
<div style='text-align: center; padding: 20px;'>
|
185 |
<h3 style='
|
186 |
color: #2D3748;
|
@@ -218,18 +244,36 @@ def create_history_tab(history_component: SearchHistoryComponent):
|
|
218 |
with gr.Column(scale=4):
|
219 |
history_display = gr.HTML()
|
220 |
|
221 |
-
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
with gr.Column(scale=1):
|
223 |
clear_history_btn = gr.Button(
|
224 |
"🗑️ Clear History",
|
225 |
-
variant="
|
226 |
-
size="
|
|
|
|
|
227 |
)
|
228 |
with gr.Column(scale=1):
|
229 |
refresh_btn = gr.Button(
|
230 |
"🔄 Refresh",
|
231 |
-
variant="
|
232 |
-
size="
|
|
|
|
|
233 |
)
|
234 |
|
235 |
history_display.value = history_component.format_history_html()
|
|
|
181 |
"""
|
182 |
with gr.TabItem("Recommendation Search History"):
|
183 |
gr.HTML("""
|
184 |
+
<style>
|
185 |
+
.custom-history-btn {
|
186 |
+
background: linear-gradient(135deg, #4299e1, #48bb78) !important;
|
187 |
+
border: none !important;
|
188 |
+
color: white !important;
|
189 |
+
padding: 12px 24px !important;
|
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 |
+
.custom-history-btn:hover {
|
197 |
+
transform: translateY(-2px);
|
198 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
|
199 |
+
}
|
200 |
+
|
201 |
+
#clear-btn {
|
202 |
+
background: linear-gradient(135deg, #e53e3e, #ed8936) !important;
|
203 |
+
}
|
204 |
+
|
205 |
+
#refresh-btn {
|
206 |
+
background: linear-gradient(135deg, #4299e1, #48bb78) !important;
|
207 |
+
}
|
208 |
+
</style>
|
209 |
+
|
210 |
<div style='text-align: center; padding: 20px;'>
|
211 |
<h3 style='
|
212 |
color: #2D3748;
|
|
|
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", # 改變按鈕變體為 primary
|
266 |
+
size="lg", # 改變大小為 lg
|
267 |
+
elem_id="clear-btn", # 添加唯一的元素ID
|
268 |
+
elem_classes="custom-history-btn" # 添加自訂類別
|
269 |
)
|
270 |
with gr.Column(scale=1):
|
271 |
refresh_btn = gr.Button(
|
272 |
"🔄 Refresh",
|
273 |
+
variant="primary", # 改變按鈕變體為 primary
|
274 |
+
size="lg", # 改變大小為 lg
|
275 |
+
elem_id="refresh-btn", # 添加唯一的元素ID
|
276 |
+
elem_classes="custom-history-btn" # 添加自訂類別
|
277 |
)
|
278 |
|
279 |
history_display.value = history_component.format_history_html()
|