Update Home.py
Browse files
Home.py
CHANGED
|
@@ -22,7 +22,7 @@ import time
|
|
| 22 |
#===config===
|
| 23 |
st.set_page_config(
|
| 24 |
page_title="TXTperpus",
|
| 25 |
-
page_icon="https://
|
| 26 |
layout="wide",
|
| 27 |
initial_sidebar_state="collapsed"
|
| 28 |
)
|
|
@@ -231,17 +231,36 @@ try:
|
|
| 231 |
|
| 232 |
with cl2.popover("Unduh Hasil Pencarian"):
|
| 233 |
|
| 234 |
-
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
|
|
|
|
| 237 |
selected = []
|
|
|
|
| 238 |
for i, opt in enumerate(options):
|
| 239 |
if cols[i % 3].checkbox(opt, key=f"dl_{opt}"):
|
| 240 |
selected.append(opt)
|
| 241 |
|
| 242 |
-
# default
|
| 243 |
-
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
st.caption(f"{len(key_df_j)} artikel siap diunduh")
|
| 247 |
|
|
@@ -249,8 +268,7 @@ try:
|
|
| 249 |
def convert_to_csv(df):
|
| 250 |
return df.to_csv(index=False).encode("utf-8")
|
| 251 |
|
| 252 |
-
|
| 253 |
-
download_df = key_df_j[selected].copy()
|
| 254 |
|
| 255 |
csv = convert_to_csv(download_df)
|
| 256 |
|
|
@@ -367,7 +385,7 @@ try:
|
|
| 367 |
|
| 368 |
<div class="result-buttons">
|
| 369 |
|
| 370 |
-
<a href="https://
|
| 371 |
<button>📜 Baca Artikel</button>
|
| 372 |
</a>
|
| 373 |
|
|
|
|
| 22 |
#===config===
|
| 23 |
st.set_page_config(
|
| 24 |
page_title="TXTperpus",
|
| 25 |
+
page_icon="https://huggingface.co/spaces/faizhalas/perpusdb/resolve/main/Logo.jpg",
|
| 26 |
layout="wide",
|
| 27 |
initial_sidebar_state="collapsed"
|
| 28 |
)
|
|
|
|
| 231 |
|
| 232 |
with cl2.popover("Unduh Hasil Pencarian"):
|
| 233 |
|
| 234 |
+
# kolom default selalu ikut
|
| 235 |
+
default_cols = [
|
| 236 |
+
"Journal",
|
| 237 |
+
"ID",
|
| 238 |
+
"Authors",
|
| 239 |
+
"Year",
|
| 240 |
+
"Volume",
|
| 241 |
+
"Issue",
|
| 242 |
+
"Institution",
|
| 243 |
+
"Keywords"
|
| 244 |
+
]
|
| 245 |
+
|
| 246 |
+
# kolom tambahan (opsional)
|
| 247 |
+
options = [c for c in part_opt[:-1] if c not in default_cols]
|
| 248 |
|
| 249 |
+
cols = st.columns(3)
|
| 250 |
selected = []
|
| 251 |
+
|
| 252 |
for i, opt in enumerate(options):
|
| 253 |
if cols[i % 3].checkbox(opt, key=f"dl_{opt}"):
|
| 254 |
selected.append(opt)
|
| 255 |
|
| 256 |
+
# gabungkan default + tambahan
|
| 257 |
+
final_cols = default_cols + selected
|
| 258 |
+
|
| 259 |
+
# hilangkan duplikat tapi pertahankan urutan
|
| 260 |
+
final_cols = list(dict.fromkeys(final_cols))
|
| 261 |
+
|
| 262 |
+
# pastikan kolom ada di dataframe
|
| 263 |
+
final_cols = [c for c in final_cols if c in key_df_j.columns]
|
| 264 |
|
| 265 |
st.caption(f"{len(key_df_j)} artikel siap diunduh")
|
| 266 |
|
|
|
|
| 268 |
def convert_to_csv(df):
|
| 269 |
return df.to_csv(index=False).encode("utf-8")
|
| 270 |
|
| 271 |
+
download_df = key_df_j[final_cols].copy()
|
|
|
|
| 272 |
|
| 273 |
csv = convert_to_csv(download_df)
|
| 274 |
|
|
|
|
| 385 |
|
| 386 |
<div class="result-buttons">
|
| 387 |
|
| 388 |
+
<a href="https://txtperpus.id/reader?art={article_id}" target="_blank">
|
| 389 |
<button>📜 Baca Artikel</button>
|
| 390 |
</a>
|
| 391 |
|