Skip to content

Commit

Permalink
use formatted denom in listing (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
PiranavanShanmugavadivelu authored Mar 1, 2024
1 parent c56999e commit 917c1e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions frontend/marketplace/src/components/ListingCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import CustomImage from "@/components/CustomImage.vue";
import tracking, { TrackEvents } from "@/utils/analytics";
import CustomSpinner from "@/components/CustomSpinner.vue";
import { findPlasticTypeInMaterial } from "@/utils/utils";
import { formatDenom } from "@/utils/wallet-utils";
export interface ListingCardProps {
listingData: any;
class?: string;
}
const props = defineProps<ListingCardProps>();
const showSpinner = ref(true);
const denom = ref("");
const data = ref({
id: props.listingData?.id,
Expand All @@ -39,6 +41,7 @@ const subheader = computed(() => {
});
onMounted(async () => {
denom.value = await formatDenom(props.listingData?.pricePerCreditDenom);
if (
props.listingData?.creditCollection?.creditData?.nodes[0].mediaFiles
?.nodes[0].url !== ""
Expand Down Expand Up @@ -79,7 +82,7 @@ const handleClick = () => {
<div class="card-actions justify-between mt-4">
<dl>
<dd class="text-title26 font-bold">
{{ listingData?.pricePerCreditAmount / 1000000 }} USD
{{ listingData?.pricePerCreditAmount / 1000000 }} {{ denom }}
</dd>
<dt class="text-title11 md:text-title12 font-light">
per kilo removed
Expand All @@ -97,6 +100,5 @@ const handleClick = () => {
</div>
</div>
</router-link>

</div>
</template>
3 changes: 2 additions & 1 deletion frontend/marketplace/src/components/ListingCardTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ const handleClick = () => {
<dt class="details-title mb-5">Price per kg removed</dt>
<dd class="grow grid content-between">
<span class="text-title32 font-bold"
>{{ listingData?.pricePerCreditAmount / 1000000 }} USD</span
>{{ listingData?.pricePerCreditAmount / 1000000 }}
{{ denom }}</span
>
<dl class="flex flex-col">
<dd class="text-title26 font-bold">
Expand Down
3 changes: 3 additions & 0 deletions frontend/marketplace/src/utils/wallet-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export async function formatDenom(denom: string): Promise<string> {
}
}
denom = denom.slice(1);
if (denom === "USDC") {
denom = "USD";
}
return denom.toUpperCase();
}

Expand Down

0 comments on commit 917c1e7

Please sign in to comment.