Spaces:
Sleeping
Sleeping
Abhinav
commited on
chore: formatting
Browse files- pages/Offers.py +4 -1
- pages/Roles.py +16 -1
- utils/helper.py +2 -1
- utils/models.py +4 -1
- utils/wolvesville.py +3 -3
pages/Offers.py
CHANGED
@@ -26,7 +26,10 @@ for roles in chunks(offerList, CHUNK_SIZE):
|
|
26 |
advancedRoleId = role.advancedRoleId
|
27 |
advancedRoleId = " ".join(advancedRoleId.split("-"))
|
28 |
col.subheader(advancedRoleId)
|
29 |
-
col.button(
|
|
|
|
|
|
|
30 |
col.button(f"Talismans: {role.talismanCount}", key=uuid4().hex)
|
31 |
col.button(f"Loyalty Tokens: {role.loyaltyTokenCount}", key=uuid4().hex)
|
32 |
|
|
|
26 |
advancedRoleId = role.advancedRoleId
|
27 |
advancedRoleId = " ".join(advancedRoleId.split("-"))
|
28 |
col.subheader(advancedRoleId)
|
29 |
+
col.button(
|
30 |
+
f"Ability exchange vouchers: {role.abilityExchangeVoucherCount}",
|
31 |
+
key=uuid4().hex,
|
32 |
+
)
|
33 |
col.button(f"Talismans: {role.talismanCount}", key=uuid4().hex)
|
34 |
col.button(f"Loyalty Tokens: {role.loyaltyTokenCount}", key=uuid4().hex)
|
35 |
|
pages/Roles.py
CHANGED
@@ -3,17 +3,32 @@ from utils.wolvesville import Wolvesville
|
|
3 |
from utils.models import Role, AdvancedRoleCardOffers
|
4 |
from utils.helper import chunks, getTitle
|
5 |
from typing import List
|
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
|
9 |
api = Wolvesville()
|
10 |
|
11 |
roles: List[Role] = api.getRoleRoleIcons()
|
|
|
12 |
offers: List[AdvancedRoleCardOffers] = api.getRoleCardOffers()
|
13 |
|
14 |
st.markdown(getTitle("Roles"), unsafe_allow_html=True)
|
15 |
st.divider()
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
CHUNK_SIZE = 4
|
18 |
|
19 |
for roles in chunks(roles, CHUNK_SIZE):
|
@@ -41,4 +56,4 @@ for roles in chunks(roles, CHUNK_SIZE):
|
|
41 |
|
42 |
st.divider()
|
43 |
|
44 |
-
st.toast("Loaded roles", icon="🕵️")
|
|
|
3 |
from utils.models import Role, AdvancedRoleCardOffers
|
4 |
from utils.helper import chunks, getTitle
|
5 |
from typing import List
|
6 |
+
|
7 |
st.set_page_config(layout="wide")
|
8 |
|
9 |
|
10 |
api = Wolvesville()
|
11 |
|
12 |
roles: List[Role] = api.getRoleRoleIcons()
|
13 |
+
|
14 |
offers: List[AdvancedRoleCardOffers] = api.getRoleCardOffers()
|
15 |
|
16 |
st.markdown(getTitle("Roles"), unsafe_allow_html=True)
|
17 |
st.divider()
|
18 |
|
19 |
+
search_bar = st.text_input(
|
20 |
+
"Search roles",
|
21 |
+
"",
|
22 |
+
key="search_roles",
|
23 |
+
)
|
24 |
+
|
25 |
+
name: str = st.session_state.search_roles
|
26 |
+
if name == "":
|
27 |
+
roles = api.getRoleRoleIcons()
|
28 |
+
else:
|
29 |
+
roles = [role for role in roles if name.lower() in role.name.lower()]
|
30 |
+
|
31 |
+
|
32 |
CHUNK_SIZE = 4
|
33 |
|
34 |
for roles in chunks(roles, CHUNK_SIZE):
|
|
|
56 |
|
57 |
st.divider()
|
58 |
|
59 |
+
st.toast("Loaded roles", icon="🕵️")
|
utils/helper.py
CHANGED
@@ -11,6 +11,7 @@ def chunks(lst: List, n: int):
|
|
11 |
def getTitle(text: str):
|
12 |
return f"<h1 style='text-align: center;'>{text}</h1>"
|
13 |
|
|
|
14 |
def groupItemCategories(items: Tuple[AvatarItems]):
|
15 |
groups = {}
|
16 |
for item in items:
|
@@ -19,4 +20,4 @@ def groupItemCategories(items: Tuple[AvatarItems]):
|
|
19 |
else:
|
20 |
groups[item.type].append(item)
|
21 |
|
22 |
-
return groups
|
|
|
11 |
def getTitle(text: str):
|
12 |
return f"<h1 style='text-align: center;'>{text}</h1>"
|
13 |
|
14 |
+
|
15 |
def groupItemCategories(items: Tuple[AvatarItems]):
|
16 |
groups = {}
|
17 |
for item in items:
|
|
|
20 |
else:
|
21 |
groups[item.type].append(item)
|
22 |
|
23 |
+
return groups
|
utils/models.py
CHANGED
@@ -202,9 +202,11 @@ def _getProfileIconObjects(profile_icons: List[Dict[str, Union[str, Dict]]]):
|
|
202 |
print(icon)
|
203 |
return profileIconList
|
204 |
|
|
|
205 |
def getUrl(text: str):
|
206 |
return text.split("'")[1]
|
207 |
|
|
|
208 |
class Backgrounds(BaseModel):
|
209 |
id: str
|
210 |
rarity: str
|
@@ -237,6 +239,7 @@ class AdvancedRoleCardOffers(BaseModel):
|
|
237 |
loyaltyTokenCount: int
|
238 |
promoImageUrl: str
|
239 |
|
|
|
240 |
def _getRoleCardOfferObjects(offers: List[Dict[str, Union[str, Dict]]]):
|
241 |
roleCardOfferList = []
|
242 |
for icon in offers:
|
@@ -246,4 +249,4 @@ def _getRoleCardOfferObjects(offers: List[Dict[str, Union[str, Dict]]]):
|
|
246 |
except Exception as e:
|
247 |
print(e)
|
248 |
print(icon)
|
249 |
-
return roleCardOfferList
|
|
|
202 |
print(icon)
|
203 |
return profileIconList
|
204 |
|
205 |
+
|
206 |
def getUrl(text: str):
|
207 |
return text.split("'")[1]
|
208 |
|
209 |
+
|
210 |
class Backgrounds(BaseModel):
|
211 |
id: str
|
212 |
rarity: str
|
|
|
239 |
loyaltyTokenCount: int
|
240 |
promoImageUrl: str
|
241 |
|
242 |
+
|
243 |
def _getRoleCardOfferObjects(offers: List[Dict[str, Union[str, Dict]]]):
|
244 |
roleCardOfferList = []
|
245 |
for icon in offers:
|
|
|
249 |
except Exception as e:
|
250 |
print(e)
|
251 |
print(icon)
|
252 |
+
return roleCardOfferList
|
utils/wolvesville.py
CHANGED
@@ -11,7 +11,7 @@ from utils.models import (
|
|
11 |
_getAvatarItemSetObjects,
|
12 |
_mapItemItemSets,
|
13 |
_getBackgroundObjects,
|
14 |
-
_getRoleCardOfferObjects
|
15 |
)
|
16 |
from dotenv import load_dotenv
|
17 |
from os import getenv
|
@@ -82,7 +82,7 @@ class Wolvesville:
|
|
82 |
).json()
|
83 |
resp = _getScreenObjects(screens=screens)
|
84 |
return resp
|
85 |
-
|
86 |
@lru_cache(maxsize=None)
|
87 |
def getBackgrounds(self):
|
88 |
backgrounds = requests.get(
|
@@ -128,4 +128,4 @@ class Wolvesville:
|
|
128 |
f"{self.url}/items/advancedRoleCardOffers", headers=self.headers
|
129 |
).json()
|
130 |
resp = _getRoleCardOfferObjects(offers=icons)
|
131 |
-
return resp
|
|
|
11 |
_getAvatarItemSetObjects,
|
12 |
_mapItemItemSets,
|
13 |
_getBackgroundObjects,
|
14 |
+
_getRoleCardOfferObjects,
|
15 |
)
|
16 |
from dotenv import load_dotenv
|
17 |
from os import getenv
|
|
|
82 |
).json()
|
83 |
resp = _getScreenObjects(screens=screens)
|
84 |
return resp
|
85 |
+
|
86 |
@lru_cache(maxsize=None)
|
87 |
def getBackgrounds(self):
|
88 |
backgrounds = requests.get(
|
|
|
128 |
f"{self.url}/items/advancedRoleCardOffers", headers=self.headers
|
129 |
).json()
|
130 |
resp = _getRoleCardOfferObjects(offers=icons)
|
131 |
+
return resp
|