Skip to content

Commit

Permalink
Update product names and fix chart image filename
Browse files Browse the repository at this point in the history
  • Loading branch information
SSIvanov19 committed Mar 31, 2024
1 parent 82a7930 commit a9713b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions client/src/components/sections/TrendFluctuationSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>

<div class="product-trend-cards-container" v-if="products.at(0).name">
<ProductTrendCard v-for="product in productsHistory" :title="product.product.name" :growth="product.fluctuation" :isGrowthUp="product.fluctuation > 0" @click="router.push({name:'productView', params:{id:product.product.id}})"/>
<ProductTrendCard v-for="product in productsHistory" :title="product.product.serialized_name" :growth="product.fluctuation" :isGrowthUp="product.fluctuation > 0" @click="router.push({name:'productView', params:{id:product.product.id}})"/>
</div>
</div>
</template>
Expand All @@ -25,8 +25,10 @@ let productsHistory: Ref<any> = ref([]);
onMounted(()=>{
props.products.forEach(async (product)=>{
productService.getProductTrendHistory(product.id).then((res)=>{
if (res.data.length < 1) return;
let record = res.data;
let fluctuation = record[record.length-2].value / record[record.length-1].value * 100 - 100;
record.sort((a:any, b:any) => new Date(a.date).getTime() - new Date(b.date).getTime())
let fluctuation = record[record.length - 1].value;
productsHistory.value.push({product:product, fluctuation:fluctuation.toFixed(2)});
console.log(record)
});
Expand Down
4 changes: 2 additions & 2 deletions client/src/views/ProductOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<button @click="navigateToItems" class="back-button">
<BackArrowIcon />
</button>
<h1 v-if="product">{{product.name}}</h1>
<h1 v-if="product">{{product.serialized_name}}</h1>
</header>

<section class="trend-section">
Expand All @@ -15,7 +15,7 @@
</section>
<OverviewCard/>
<h2>The interest is highly positive</h2>
<img src="../assets/CatchUp.png" alt="chart" class="chart"/>
<img src="../assets/CatchUP.png" alt="chart" class="chart"/>
</div>

<Navbar :active="'products'"/>
Expand Down

0 comments on commit a9713b5

Please sign in to comment.