mirror of
https://github.com/joaovitoriasilva/endurain.git
synced 2026-01-10 08:17:59 -05:00
Add snow gear types & icons, fix avatars and search
[backend] fix some comments [frontend] fixed avatars path to be inline with rest of the code [frontend] added skis and snowboarding icons/avatars [frontend] fixed searchView not considering gear types 4, 5 and 6 [frontend] added new gear types to GearView
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import core.dependencies as core_dependencies
|
||||
|
||||
def validate_activity_stream_type(stream_type: int):
|
||||
# Check if gear type is between 1 and 3
|
||||
# Check if gear type is between 1 and 7
|
||||
core_dependencies.validate_type(type=stream_type, min=1, max=7, message="Invalid activity stream type")
|
||||
@@ -11,7 +11,7 @@ def validate_id(id: int, min: int, message: str):
|
||||
|
||||
|
||||
def validate_type(type: int, min: int, max: id, message: str):
|
||||
# Check if gear_type is between 1 and 3
|
||||
# Check if gear_type is between min and max
|
||||
if not (min <= int(type) <= max):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
|
||||
@@ -5,5 +5,5 @@ def validate_gear_id(gear_id: int):
|
||||
core_dependencies.validate_id(id=gear_id, min=0, message="Invalid gear ID")
|
||||
|
||||
def validate_gear_type(gear_type: int):
|
||||
# Check if gear type is within known id range
|
||||
# Check if gear type is within 1 and 6
|
||||
core_dependencies.validate_type(type=gear_type, min=1, max=6, message="Invalid gear type")
|
||||
@@ -30,7 +30,7 @@ class Gear(Base):
|
||||
comment="Gear nickname (May include spaces)",
|
||||
)
|
||||
gear_type = Column(
|
||||
Integer, nullable=False, comment="Gear type (1 - bike, 2 - shoes, 3 - wetsuit, 4 - racquet, 5 - ski, 6 - snowboard)"
|
||||
Integer, nullable=False, comment="Gear type (1 - bike, 2 - shoes, 3 - wetsuit, 4 - racquet, 5 - skis, 6 - snowboard)"
|
||||
)
|
||||
user_id = Column(
|
||||
Integer,
|
||||
|
||||
BIN
frontend/app/src/assets/avatar/skis1.png
Normal file
BIN
frontend/app/src/assets/avatar/skis1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
BIN
frontend/app/src/assets/avatar/snowboard1.png
Normal file
BIN
frontend/app/src/assets/avatar/snowboard1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
@@ -5,8 +5,8 @@
|
||||
<img src="/src/assets/avatar/running_shoe1.png" alt="running shoe avatar" width="55" height="55" class="rounded-circle" v-else-if="gear.gear_type == 2">
|
||||
<img src="/src/assets/avatar/wetsuit1.png" alt="wetsuit avatar" width="55" height="55" class="rounded-circle" v-else-if="gear.gear_type == 3">
|
||||
<img src="/src/assets/avatar/racquet1.png" alt="racquet avatar" width="55" height="55" class="rounded-circle" v-else-if="gear.gear_type == 4">
|
||||
<img src="/src/assets/avatar/ski.png" alt="ski avatar" width="55" height="55" class="rounded-circle" v-else-if="gear.gear_type == 5">
|
||||
<img src="/src/assets/avatar/snowboard.png" alt="snowboard avatar" width="55" height="55" class="rounded-circle" v-else>
|
||||
<img src="/src/assets/avatar/skis1.png" alt="ski avatar" width="55" height="55" class="rounded-circle" v-else-if="gear.gear_type == 5">
|
||||
<img src="/src/assets/avatar/snowboard1.png" alt="snowboard avatar" width="55" height="55" class="rounded-circle" v-else>
|
||||
<div class="ms-3">
|
||||
<div class="fw-bold">
|
||||
<router-link :to="{ name: 'gear', params: { id: gear.id }}" class="link-body-emphasis link-underline-opacity-0 link-underline-opacity-100-hover">
|
||||
|
||||
@@ -369,6 +369,8 @@ const runGear = ref(null);
|
||||
const bikeGear = ref(null);
|
||||
const swimGear = ref(null);
|
||||
const racquetGear = ref(null);
|
||||
const skisGear = ref(null);
|
||||
const snowboardGear = ref(null);
|
||||
const defaultGear = ref(null);
|
||||
const defaultRunGear = ref(null);
|
||||
const defaultTrailRunGear = ref(null);
|
||||
@@ -518,6 +520,12 @@ onMounted(async () => {
|
||||
racquetGear.value = allGears.value.filter(
|
||||
(gear) => gear.gear_type === 4,
|
||||
);
|
||||
skisGear.value = allGears.value.filter(
|
||||
(gear) => gear.gear_type === 5,
|
||||
);
|
||||
snowboardGear.value = allGears.value.filter(
|
||||
(gear) => gear.gear_type === 6,
|
||||
);
|
||||
|
||||
try {
|
||||
defaultGear.value = await userDefaultGear.getUserDefaultGear();
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
"searchSelectGearType1": "Bike",
|
||||
"searchSelectGearType2": "Shoes",
|
||||
"searchSelectGearType3": "Wetsuit",
|
||||
"searchSelectGearType4": "Racquet",
|
||||
"searchSelectGearType5": "Skis",
|
||||
"searchSelectGearType6": "Snowboard",
|
||||
"resultIsInactiveBadge": "Inactive",
|
||||
"searchInputPlaceholder": "Search text",
|
||||
"errorFetchingUserWithUsernameContains": "Error fetching user with username contains logic",
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
<img src="/src/assets/avatar/bicycle1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-if="gear?.gear_type == 1">
|
||||
<img src="/src/assets/avatar/running_shoe1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-else-if="gear?.gear_type == 2">
|
||||
<img src="/src/assets/avatar/wetsuit1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-else-if="gear?.gear_type == 3">
|
||||
<img src="/src/assets/avatar/racquet1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-else>
|
||||
<img src="/src/assets/avatar/racquet1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-else-if="gear?.gear_type == 4">
|
||||
<img src="/src/assets/avatar/skis1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-else-if="gear?.gear_type == 5">
|
||||
<img src="/src/assets/avatar/snowboard1.png" alt="Bicycle avatar" width="180" height="180" class="rounded-circle" v-else>
|
||||
</div>
|
||||
<br>
|
||||
<div class="vstack justify-content-center align-items-center d-flex">
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
<option value="1">{{ $t("searchView.searchSelectGearType1") }}</option>
|
||||
<option value="2">{{ $t("searchView.searchSelectGearType2") }}</option>
|
||||
<option value="3">{{ $t("searchView.searchSelectGearType3") }}</option>
|
||||
<option value="4">{{ $t("searchView.searchSelectGearType4") }}</option>
|
||||
<option value="5">{{ $t("searchView.searchSelectGearType5") }}</option>
|
||||
<option value="6">{{ $t("searchView.searchSelectGearType6") }}</option>
|
||||
</select>
|
||||
<!-- Search area -->
|
||||
<input type="text" class="form-control rounded" id="inputTextFieldToSearch"
|
||||
@@ -59,6 +62,10 @@
|
||||
v-if="searchSelectValue == 3 && [3].includes(Number(result.gear_type))" />
|
||||
<font-awesome-icon :icon="['fas', 'table-tennis-paddle-ball']"
|
||||
v-if="searchSelectValue == 3 && [4].includes(Number(result.gear_type))" />
|
||||
<font-awesome-icon :icon="['fas', 'person-skiing']"
|
||||
v-if="searchSelectValue == 3 && [5].includes(Number(result.gear_type))" />
|
||||
<font-awesome-icon :icon="['fas', 'person-snowboarding']"
|
||||
v-if="searchSelectValue == 3 && [6].includes(Number(result.gear_type))" />
|
||||
<div class="ms-3">
|
||||
<div class="fw-bold">
|
||||
<router-link :to="{ name: 'user', params: { id: result.id } }"
|
||||
@@ -249,6 +256,14 @@ function updateSearchResultsBasedOnGearType() {
|
||||
searchResults.value = searchResultsOriginal.value.filter((user) =>
|
||||
[3].includes(user.gear_type),
|
||||
);
|
||||
} else if (searchSelectGearType.value === "4") {
|
||||
searchResults.value = searchResultsOriginal.value.filter((user) =>
|
||||
[4].includes(user.gear_type),
|
||||
);
|
||||
} else if (searchSelectGearType.value === "5") {
|
||||
searchResults.value = searchResultsOriginal.value.filter((user) =>
|
||||
[5].includes(user.gear_type),
|
||||
);
|
||||
} else {
|
||||
searchResults.value = searchResultsOriginal.value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user