Skip to content

Commit

Permalink
feat(Challenge): show simple banner on the home page (#1304)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn authored Jan 20, 2025
1 parent 20adbb9 commit ddd86df
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/components/ChallengeBanner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<v-banner class="border-grey" rounded>
<v-banner-text>
<h3 class="text-h6 mb-1">
{{ $t('Challenge.Title') }}
</h3>
<p>
{{ $t('Challenge.Subtitle', {challenge_title: `${challenge.icon} ${challenge.title} ${challenge.icon}`, challenge_subtitle: challenge.subtitle}) }}
</p>
</v-banner-text>
<template #actions>
<v-btn
color="primary"
variant="flat"
prepend-icon="mdi-trophy-variant"
to="/experiments/challenge"
>
{{ $t('Common.Join') }}
</v-btn>
</template>
</v-banner>
</template>

<script>
export default {
data() {
return {
challenge: {
title: "Nutella",
icon: "🌰",
subtitle: "(and other hazelnut spreads)",
startDate: "2025-01-20",
endDate: "2025-01-31",
categories: ["en:hazelnut-spreads"],
numberOfContributions: 0,
latestContributions: [],
numberOfProofs: 0,
userContributions: 0,
userProofContributions: 0,
exampleProofUrl: "https://prices.openfoodfacts.org/img/0029/nCWeCVnpQJ.webp"
},
}
}
}
</script>
1 change: 1 addition & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
"Done": "Done",
"Error": "Error",
"Experiments": "Experiments",
"Join": "Join",
"Label": "Label",
"Labels": "Labels",
"LabelTotal": "{count} labels | {count} label | {count} labels",
Expand Down
5 changes: 5 additions & 0 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

<br>

<ChallengeBanner />

<br>

<v-row>
<v-col v-for="price in latestPriceList" :key="price" cols="12" sm="6" md="4" xl="3">
<PriceCard :price="price" :product="price.product" elevation="1" height="100%" />
Expand Down Expand Up @@ -45,6 +49,7 @@ import utils from '../utils.js'
export default {
components: {
StatCard: defineAsyncComponent(() => import('../components/StatCard.vue')),
ChallengeBanner: defineAsyncComponent(() => import('../components/ChallengeBanner.vue')),
PriceCard: defineAsyncComponent(() => import('../components/PriceCard.vue'))
},
data() {
Expand Down

0 comments on commit ddd86df

Please sign in to comment.