Alejandro Cremades commited on
Commit
df9758b
1 Parent(s): 54ecdf5

Show Scryfall links for legal cards found when checking a card list

Browse files
pages/1_Check_Card_List.py CHANGED
@@ -55,4 +55,7 @@ if "English" in input_cards and "日本語" in input_cards:
55
  hide_index=True,
56
  )
57
 
 
 
 
58
  streamlit_common.footer.write_footer()
 
55
  hide_index=True,
56
  )
57
 
58
+ if input_cards.shape[0] > 0:
59
+ input_cards[input_cards["Legal"] == "✅"].apply(lib.row_to_button_link, axis=1)
60
+
61
  streamlit_common.footer.write_footer()
streamlit_common/lib.py CHANGED
@@ -17,6 +17,14 @@ def row_to_link(row: pd.DataFrame) -> None:
17
  st.markdown(f"- [{cardname}]({row.link})")
18
 
19
 
 
 
 
 
 
 
 
 
20
  def get_legal_cardnames(cardname: str, mslist_df: pd.DataFrame) -> list:
21
  """Returns a list with legality (boolean) plus the English and Japanese
22
  names for the card if there is an exact match, or the user's input if there is not.
 
17
  st.markdown(f"- [{cardname}]({row.link})")
18
 
19
 
20
+ def row_to_button_link(row: pd.DataFrame) -> None:
21
+ """Prints a list item with a Scryfall link for the card in the row passed"""
22
+ cardname = row.English
23
+ if row.日本語 is not "":
24
+ cardname = f"{cardname} / {row.日本語}"
25
+ st.link_button(cardname, compose_scryfall_url(row.English))
26
+
27
+
28
  def get_legal_cardnames(cardname: str, mslist_df: pd.DataFrame) -> list:
29
  """Returns a list with legality (boolean) plus the English and Japanese
30
  names for the card if there is an exact match, or the user's input if there is not.