Spaces:
Running
Running
Merge pull request #57 from alecrem/feature/issue-56/search-select-type
Browse files- Middle_School_Card_Search.py +12 -2
- streamlit_common/locale.py +6 -2
Middle_School_Card_Search.py
CHANGED
@@ -34,8 +34,18 @@ results_en_df = results_df[results_df["name"].str.contains(input_name, case=Fals
|
|
34 |
results_ja_df = results_df[results_df["name_ja"].str.contains(input_name, case=False)]
|
35 |
results_df = results_en_df.merge(results_ja_df, how="outer")
|
36 |
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
results_df = results_df[results_df["type"].str.contains(input_type, case=False)]
|
40 |
|
41 |
# Filter by text
|
|
|
34 |
results_ja_df = results_df[results_df["name_ja"].str.contains(input_name, case=False)]
|
35 |
results_df = results_en_df.merge(results_ja_df, how="outer")
|
36 |
|
37 |
+
col1, col2 = st.columns(2)
|
38 |
+
|
39 |
+
# Filter by type (select)
|
40 |
+
select_types = col1.multiselect(
|
41 |
+
_["search"]["select_type"][l],
|
42 |
+
["Artifact", "Creature", "Enchantment", "Instant", "Land", "Sorcery"],
|
43 |
+
)
|
44 |
+
for cardtype in select_types:
|
45 |
+
results_df = results_df[results_df["type"].str.contains(cardtype, case=False)]
|
46 |
+
|
47 |
+
# Filter by type (text input)
|
48 |
+
input_type = col2.text_input(_["search"]["search_by_type"][l]).strip()
|
49 |
results_df = results_df[results_df["type"].str.contains(input_type, case=False)]
|
50 |
|
51 |
# Filter by text
|
streamlit_common/locale.py
CHANGED
@@ -19,8 +19,12 @@ def get_locale():
|
|
19 |
"ja": "テキストの一部を入力してください:",
|
20 |
},
|
21 |
"search_by_type": {
|
22 |
-
"en": "
|
23 |
-
"ja": "
|
|
|
|
|
|
|
|
|
24 |
},
|
25 |
"exact_match": {
|
26 |
"en": "is an exact match.",
|
|
|
19 |
"ja": "テキストの一部を入力してください:",
|
20 |
},
|
21 |
"search_by_type": {
|
22 |
+
"en": "Search by types, cardtypes and supertypes:",
|
23 |
+
"ja": "タイプ、サブタイプ、スーパータイプで検索:",
|
24 |
+
},
|
25 |
+
"select_type": {
|
26 |
+
"en": "Select card types:",
|
27 |
+
"ja": "タイプを選択してください:",
|
28 |
},
|
29 |
"exact_match": {
|
30 |
"en": "is an exact match.",
|