Skip to content

Commit

Permalink
Allow medal images not to include a description title
Browse files Browse the repository at this point in the history
Bump submodule
  • Loading branch information
bperel committed Nov 11, 2023
1 parent a52590b commit ec173bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
43 changes: 24 additions & 19 deletions apps/web/src/components/MedalImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<span class="wrapper" :class="{ small, 'x-small': xSmall }">
<div class="overlay">
<template v-if="!small && !xSmall">
<div class="title" :title="medalDescription" />
<div v-if="withDescription" class="title" :title="medalDescription" />
<svg
v-if="level < 3"
width="100"
Expand Down Expand Up @@ -60,18 +60,7 @@ import { getCurrentLocaleShortKey } from "~/composables/useLocales";
const i18n = useI18n();
const currentLocaleShortKey = getCurrentLocaleShortKey(i18n.locale.value);
const {
contribution,
nextLevel = false,
userLevelPoints,
small = false,
xSmall = false,
currentLevel,
pointsDiffNextLevel,
levelProgressPercentage,
radius,
circumference,
} = defineProps<{
const props = defineProps<{
small?: boolean;
xSmall?: boolean;
nextLevel?: boolean;
Expand All @@ -82,16 +71,32 @@ const {
levelProgressPercentage: number | null;
radius: number;
circumference: number;
withDescription: boolean;
getImagePath: (name: string) => string;
}>();
const {
contribution,
nextLevel = false,
userLevelPoints,
small = false,
xSmall = false,
currentLevel,
pointsDiffNextLevel,
levelProgressPercentage,
radius,
circumference,
} = toRefs(props);
const { t } = useI18n();
const medalColors = ["bronze", "argent", "or"];
const level = computed(() =>
nextLevel && currentLevel !== null ? currentLevel + 1 : currentLevel,
nextLevel && currentLevel.value !== null
? currentLevel.value + 1
: currentLevel.value,
);
const medalTitle = computed(() => {
switch (contribution) {
switch (contribution.value) {
case "edge_photographer":
return t("Concepteur de tranches");
case "edge_designer":
Expand All @@ -103,8 +108,8 @@ const medalTitle = computed(() => {
});
const medalDescription = computed(() => {
let textTemplate;
if (currentLevel === 3) {
switch (contribution) {
if (currentLevel.value === 3) {
switch (contribution.value) {
case "edge_photographer":
textTemplate = "Vous avez {0} points Concepteur de tranches";
break;
Expand All @@ -119,7 +124,7 @@ const medalDescription = computed(() => {
}
return t(textTemplate, [userLevelPoints]);
} else {
switch (contribution) {
switch (contribution.value) {
case "edge_photographer":
textTemplate =
"Vous avez {0} points Photographe de tranches, envoyez-nous des photos de tranches depuis votre bibliothèque et obtenez {1} points de plus pour recevoir le badge {2} !";
Expand All @@ -138,7 +143,7 @@ const medalDescription = computed(() => {
return t(textTemplate, [
userLevelPoints,
pointsDiffNextLevel,
t(medalColors[currentLevel]),
t(medalColors[currentLevel.value]),
]);
}
});
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck-ionic

0 comments on commit ec173bc

Please sign in to comment.