Spaces:
Running
Running
Alejandro Cremades
commited on
Commit
·
dbc1992
1
Parent(s):
14ce0f4
Add placeholders and make labels bold
Browse files- Middle_School_Card_Search.py +15 -5
- streamlit_common/locale.py +25 -9
Middle_School_Card_Search.py
CHANGED
@@ -39,7 +39,10 @@ st.write(f'**{mslist_df.shape[0]}**{_["search"]["cards_are_legal"][l]}')
|
|
39 |
results_df = mslist_df
|
40 |
|
41 |
# Filter by card name
|
42 |
-
input_name = st.text_input(
|
|
|
|
|
|
|
43 |
exact_match = lib.get_legal_cardnames(input_name, mslist_df)
|
44 |
results_en_df = results_df[results_df["name"].str.contains(input_name, case=False)]
|
45 |
results_ja_df = results_df[results_df["name_ja"].str.contains(input_name, case=False)]
|
@@ -55,7 +58,7 @@ results_df = results_en_df.merge(results_ja_df, how="outer")
|
|
55 |
colorcol5,
|
56 |
colorcol6,
|
57 |
) = st.columns(7)
|
58 |
-
colorcol0.write(_["search"]["search_by_color"][l])
|
59 |
if colorcol1.checkbox(_["basic"]["color_w"][l]):
|
60 |
results_df = results_df[results_df["w"] == True]
|
61 |
if colorcol2.checkbox(_["basic"]["color_u"][l]):
|
@@ -73,8 +76,9 @@ col1, col2 = st.columns(2)
|
|
73 |
# Filter by type (select)
|
74 |
type_list = streamlit_common.locale.get_type_options()
|
75 |
select_types = col1.multiselect(
|
76 |
-
_["search"]["select_type"][l],
|
77 |
type_list[l],
|
|
|
78 |
)
|
79 |
for cardtype in select_types:
|
80 |
type_to_search = cardtype
|
@@ -83,11 +87,17 @@ for cardtype in select_types:
|
|
83 |
results_df = results_df[results_df["type"].str.contains(type_to_search, case=False)]
|
84 |
|
85 |
# Filter by type (text input)
|
86 |
-
input_type = col2.text_input(
|
|
|
|
|
|
|
87 |
results_df = results_df[results_df["type"].str.contains(input_type, case=False)]
|
88 |
|
89 |
# Filter by text
|
90 |
-
input_text = st.text_input(
|
|
|
|
|
|
|
91 |
results_df = results_df[results_df["text"].str.contains(input_text, case=False)]
|
92 |
|
93 |
if results_df.shape[0] < mslist_df.shape[0]:
|
|
|
39 |
results_df = mslist_df
|
40 |
|
41 |
# Filter by card name
|
42 |
+
input_name = st.text_input(
|
43 |
+
f'**{_["search"]["search_by_card_name"][l]}**',
|
44 |
+
placeholder=_["search"]["search_by_card_name_placeholder"][l],
|
45 |
+
).strip()
|
46 |
exact_match = lib.get_legal_cardnames(input_name, mslist_df)
|
47 |
results_en_df = results_df[results_df["name"].str.contains(input_name, case=False)]
|
48 |
results_ja_df = results_df[results_df["name_ja"].str.contains(input_name, case=False)]
|
|
|
58 |
colorcol5,
|
59 |
colorcol6,
|
60 |
) = st.columns(7)
|
61 |
+
colorcol0.write(f'**{_["search"]["search_by_color"][l]}**')
|
62 |
if colorcol1.checkbox(_["basic"]["color_w"][l]):
|
63 |
results_df = results_df[results_df["w"] == True]
|
64 |
if colorcol2.checkbox(_["basic"]["color_u"][l]):
|
|
|
76 |
# Filter by type (select)
|
77 |
type_list = streamlit_common.locale.get_type_options()
|
78 |
select_types = col1.multiselect(
|
79 |
+
f'**{_["search"]["select_type"][l]}**',
|
80 |
type_list[l],
|
81 |
+
placeholder=_["search"]["select_type_placeholder"][l],
|
82 |
)
|
83 |
for cardtype in select_types:
|
84 |
type_to_search = cardtype
|
|
|
87 |
results_df = results_df[results_df["type"].str.contains(type_to_search, case=False)]
|
88 |
|
89 |
# Filter by type (text input)
|
90 |
+
input_type = col2.text_input(
|
91 |
+
f'**{_["search"]["search_by_type"][l]}**',
|
92 |
+
placeholder=_["search"]["search_by_type_placeholder"][l],
|
93 |
+
).strip()
|
94 |
results_df = results_df[results_df["type"].str.contains(input_type, case=False)]
|
95 |
|
96 |
# Filter by text
|
97 |
+
input_text = st.text_input(
|
98 |
+
f'**{_["search"]["search_by_text"][l]}**',
|
99 |
+
placeholder=_["search"]["search_by_text_placeholder"][l],
|
100 |
+
).strip()
|
101 |
results_df = results_df[results_df["text"].str.contains(input_text, case=False)]
|
102 |
|
103 |
if results_df.shape[0] < mslist_df.shape[0]:
|
streamlit_common/locale.py
CHANGED
@@ -11,21 +11,37 @@ def get_locale():
|
|
11 |
"ja": "枚 のカードが使用可能です。",
|
12 |
},
|
13 |
"search_by_card_name": {
|
14 |
-
"en": "Search by card name
|
15 |
-
"ja": "
|
16 |
},
|
17 |
-
"
|
18 |
-
"en": "Type a part of
|
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.",
|
31 |
"ja": "が完全一致します。",
|
|
|
11 |
"ja": "枚 のカードが使用可能です。",
|
12 |
},
|
13 |
"search_by_card_name": {
|
14 |
+
"en": "Search by card name:",
|
15 |
+
"ja": "カード名で検索:",
|
16 |
},
|
17 |
+
"search_by_card_name_placeholder": {
|
18 |
+
"en": "Type a card name or part of it",
|
19 |
+
"ja": "カード名もしくはその一部を入力してください",
|
|
|
|
|
|
|
|
|
20 |
},
|
21 |
"select_type": {
|
22 |
"en": "Select card types:",
|
23 |
"ja": "タイプを選択してください:",
|
24 |
},
|
25 |
+
"search_by_type": {
|
26 |
+
"en": "Search by card types:",
|
27 |
+
"ja": "カードタイプで検索:",
|
28 |
+
},
|
29 |
+
"search_by_type_placeholder": {
|
30 |
+
"en": "Type a types, subtypes or supertypes",
|
31 |
+
"ja": "タイプ、サブタイプ、スーパータイプを入力",
|
32 |
+
},
|
33 |
+
"select_type_placeholder": {
|
34 |
+
"en": "Select card types",
|
35 |
+
"ja": "カードタイプ選択",
|
36 |
+
},
|
37 |
+
"search_by_text": {
|
38 |
+
"en": "Search by rules text:",
|
39 |
+
"ja": "テキストで検索:",
|
40 |
+
},
|
41 |
+
"search_by_text_placeholder": {
|
42 |
+
"en": "Type a part of the rules text",
|
43 |
+
"ja": "テキストの一部を入力してください",
|
44 |
+
},
|
45 |
"exact_match": {
|
46 |
"en": "is an exact match.",
|
47 |
"ja": "が完全一致します。",
|