Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Axies not showing on cards #6

Merged
merged 2 commits into from Oct 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 32 additions & 5 deletions components/AppAxieCard.vue
@@ -1,15 +1,27 @@
<template>
<div>
<v-card max-width="250" min-height="250" outlined>
<v-card max-width="250" max-height="300" outlined>
<v-chip
class="subtitle-2 mt-3 ml-3"
x-small
:color="chipColor || _color"
v-text="`#${axie.id}`"
/>
<div class="caption white--text mt-1 ml-3">
{{ axie.name }}
</div>
<div class="caption grey--text mt-n1 ml-3">
Breed Count: {{ axie.breedCount }}
</div>
<v-card-text align="center" justify="center">
<v-img :src="axie.image" max-height="200" max-width="200" />
</v-card-text>

<v-card-actions class="card-actions d-flex">
<div class="caption grey--text ml-1">
{{ axie.class }}
</div>
</v-card-actions>
</v-card>
</div>
</template>
Expand All @@ -31,16 +43,31 @@ export default {
_color() {
switch (this.axie.class) {
case "Aquatic":
return "blue";
return "cyan lighten-2";

case "Beast":
return "orange";
return "yellow darken-2";

case "Bird":
return "pink lighten-3";
return "pink";

case "Plant":
return "green";
return "green darken-2";

case "Reptile":
return "purple lighten-2";

case "Bug":
return "orange darken-4";

case "Dawn":
return "purple lighten-4";

case "Dusk":
return "cyan darken-3";

case "Mech":
return "purple lighten-5";

default:
return "dark";
Expand Down
4 changes: 3 additions & 1 deletion pages/scholars/_id/index.vue
Expand Up @@ -52,7 +52,7 @@
<h2>{{ axies.length }} Axies</h2>
</div>

<v-row align="center" justify="center">
<v-row class="mt-5" align="center" justify="center">
<v-col cols="12" md="2" v-for="axie in axies" :key="axie.id">
<app-axie-card :axie="axie" />
</v-col>
Expand Down Expand Up @@ -114,6 +114,8 @@ export default {
methods: {
async getUserAxies(wallet) {
try {
var splitAddress = wallet.split("ronin:");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor this to

const wallet = `0x${this.$stringUtil.extractRoninAddress(wallet)}`

wallet = "0x" + splitAddress[1];
const response = await this.$axios.$get(
`${AXIE_RAPID_API_BASE_URL}/get-axies/${wallet}`,
{
Expand Down