diff --git a/src/components/AchievementBadge.vue b/src/components/AchievementBadge.vue index b6c626e..6c6762d 100644 --- a/src/components/AchievementBadge.vue +++ b/src/components/AchievementBadge.vue @@ -64,20 +64,6 @@ const achievementProps: AchievementProps = { emoji: '🦅', }, }, - hotStreak: { - [AchievementLevel.Bronze]: { - textProps: [5], - emoji: '🌶️', - }, - [AchievementLevel.Silver]: { - textProps: [10], - emoji: '🔥', - }, - [AchievementLevel.Gold]: { - textProps: [20], - emoji: '🌋', - }, - }, experimenterBean: { [AchievementLevel.Gold]: { textProps: [15], @@ -114,6 +100,34 @@ const achievementProps: AchievementProps = { emoji: CATEGORY_EMOJI.Vegetable, }, }, + favorite: { + [AchievementLevel.Bronze]: { + textProps: [20], + emoji: '😺', + }, + [AchievementLevel.Silver]: { + textProps: [50], + emoji: '😽', + }, + [AchievementLevel.Gold]: { + textProps: [100], + emoji: '😻', + }, + }, + hotStreak: { + [AchievementLevel.Bronze]: { + textProps: [5], + emoji: '🌶️', + }, + [AchievementLevel.Silver]: { + textProps: [10], + emoji: '🔥', + }, + [AchievementLevel.Gold]: { + textProps: [20], + emoji: '🌋', + }, + }, thirtyVeggies: { [AchievementLevel.Gold]: { textProps: [30], diff --git a/src/components/AchievementList.vue b/src/components/AchievementList.vue index b5f6d2b..45c9881 100644 --- a/src/components/AchievementList.vue +++ b/src/components/AchievementList.vue @@ -99,6 +99,25 @@ const {achievements} = storeToRefs(useAppStateStore()); /> + +
+ + + +
+
{ it('renders', () => { const wrapper = mount(AchievementList); expect(wrapper.html()).toMatchSnapshot(); - expect(wrapper.findAll('.badge[aria-disabled="true"]').length).toBe(19); + expect(wrapper.findAll('.badge[aria-disabled="true"]').length).toBe(22); }); it('renders with badges enabled', () => { @@ -36,6 +36,6 @@ describe('AchievementList', () => { const wrapper = mount(AchievementList); expect(wrapper.html()).toMatchSnapshot(); - expect(wrapper.findAll('.badge[aria-disabled="true"]').length).toBe(10); + expect(wrapper.findAll('.badge[aria-disabled="true"]').length).toBe(13); }); }); diff --git a/src/components/__tests__/__snapshots__/AchievementList.spec.ts.snap b/src/components/__tests__/__snapshots__/AchievementList.spec.ts.snap index eb48161..0217994 100644 --- a/src/components/__tests__/__snapshots__/AchievementList.spec.ts.snap +++ b/src/components/__tests__/__snapshots__/AchievementList.spec.ts.snap @@ -106,6 +106,29 @@ exports[`AchievementList > renders 1`] = `
+
+ +
+ + + +
+
@@ -261,6 +284,29 @@ exports[`AchievementList > renders with badges enabled 1`] = `
+
+ +
+ + + +
+
diff --git a/src/components/__tests__/achievements.spec.ts b/src/components/__tests__/achievements.spec.ts index e6d9e67..d047fd0 100644 --- a/src/components/__tests__/achievements.spec.ts +++ b/src/components/__tests__/achievements.spec.ts @@ -20,13 +20,14 @@ const defaultAchievements: Achievements = { challengeAccepted: AchievementLevel.NoAchievement, committed: AchievementLevel.NoAchievement, completionist: AchievementLevel.NoAchievement, - hotStreak: AchievementLevel.NoAchievement, experimenterBean: AchievementLevel.NoAchievement, experimenterFruit: AchievementLevel.NoAchievement, experimenterGrain: AchievementLevel.NoAchievement, experimenterLeafy: AchievementLevel.NoAchievement, experimenterRoot: AchievementLevel.NoAchievement, experimenterVegetable: AchievementLevel.NoAchievement, + favorite: AchievementLevel.NoAchievement, + hotStreak: AchievementLevel.NoAchievement, thirtyVeggies: AchievementLevel.NoAchievement, }; @@ -38,144 +39,156 @@ describe('achievements', () => { it('advances completionist', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, [...Array(39)], 0, 0, 0); + advanceAchievements(0, [...Array(39)], 0, 0, 0, 0); expect(achievements.value.completionist).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, [...Array(40)], 0, 0, 0); + advanceAchievements(0, [...Array(40)], 0, 0, 0, 0); expect(achievements.value.completionist).toBe(AchievementLevel.Bronze); - advanceAchievements(0, [...Array(80)], 0, 0, 0); + advanceAchievements(0, [...Array(80)], 0, 0, 0, 0); expect(achievements.value.completionist).toBe(AchievementLevel.Silver); - advanceAchievements(0, [...Array(150)], 0, 0, 0); + advanceAchievements(0, [...Array(150)], 0, 0, 0, 0); expect(achievements.value.completionist).toBe(AchievementLevel.Gold); }); it('goes straight to silver', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, [...Array(80)], 0, 0, 0); + advanceAchievements(0, [...Array(80)], 0, 0, 0, 0); expect(achievements.value.completionist).toBe(AchievementLevel.Silver); }); it('completionist goes straight to gold', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, [...Array(150)], 0, 0, 0); + advanceAchievements(0, [...Array(150)], 0, 0, 0, 0); expect(achievements.value.completionist).toBe(AchievementLevel.Gold); }); it('advances experimenterFruit', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(FRUITS, 14), 0, 0, 0); + advanceAchievements(0, take(FRUITS, 14), 0, 0, 0, 0); expect(achievements.value.experimenterFruit).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, take(FRUITS, 15), 0, 0, 0); + advanceAchievements(0, take(FRUITS, 15), 0, 0, 0, 0); expect(achievements.value.experimenterFruit).toBe(AchievementLevel.Gold); }); it('experimenter goes straight to gold', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(FRUITS, 15), 0, 0, 0); + advanceAchievements(0, take(FRUITS, 15), 0, 0, 0, 0); expect(achievements.value.experimenterFruit).toBe(AchievementLevel.Gold); }); it('advances experimenterVegetable', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(VEGETABLES, 14), 0, 0, 0); + advanceAchievements(0, take(VEGETABLES, 14), 0, 0, 0, 0); expect(achievements.value.experimenterVegetable).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, take(VEGETABLES, 15), 0, 0, 0); + advanceAchievements(0, take(VEGETABLES, 15), 0, 0, 0, 0); expect(achievements.value.experimenterVegetable).toBe(AchievementLevel.Gold); }); it('advances experimenterLeafy', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(LEAFIES, 14), 0, 0, 0); + advanceAchievements(0, take(LEAFIES, 14), 0, 0, 0, 0); expect(achievements.value.experimenterLeafy).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, take(LEAFIES, 15), 0, 0, 0); + advanceAchievements(0, take(LEAFIES, 15), 0, 0, 0, 0); expect(achievements.value.experimenterLeafy).toBe(AchievementLevel.Gold); }); it('advances experimenterBean', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(BEANS, 14), 0, 0, 0); + advanceAchievements(0, take(BEANS, 14), 0, 0, 0, 0); expect(achievements.value.experimenterBean).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, take(BEANS, 15), 0, 0, 0); + advanceAchievements(0, take(BEANS, 15), 0, 0, 0, 0); expect(achievements.value.experimenterBean).toBe(AchievementLevel.Gold); }); it('advances experimenterRoot', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(ROOTS, 14), 0, 0, 0); + advanceAchievements(0, take(ROOTS, 14), 0, 0, 0, 0); expect(achievements.value.experimenterRoot).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, take(ROOTS, 15), 0, 0, 0); + advanceAchievements(0, take(ROOTS, 15), 0, 0, 0, 0); expect(achievements.value.experimenterRoot).toBe(AchievementLevel.Gold); }); it('advances experimenterGrain', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, take(GRAINS, 14), 0, 0, 0); + advanceAchievements(0, take(GRAINS, 14), 0, 0, 0, 0); expect(achievements.value.experimenterGrain).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, take(GRAINS, 15), 0, 0, 0); + advanceAchievements(0, take(GRAINS, 15), 0, 0, 0, 0); expect(achievements.value.experimenterGrain).toBe(AchievementLevel.Gold); }); it('advances hot streak', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, [], 4, 0, 0); + advanceAchievements(0, [], 4, 0, 0, 0); expect(achievements.value.hotStreak).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, [], 5, 0, 0); + advanceAchievements(0, [], 5, 0, 0, 0); expect(achievements.value.hotStreak).toEqual(AchievementLevel.Bronze); - advanceAchievements(0, [], 10, 0, 0); + advanceAchievements(0, [], 10, 0, 0, 0); expect(achievements.value.hotStreak).toEqual(AchievementLevel.Silver); - advanceAchievements(0, [], 20, 0, 0); + advanceAchievements(0, [], 20, 0, 0, 0); expect(achievements.value.hotStreak).toEqual(AchievementLevel.Gold); }); it('advances committed', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, [], 0, 11, 0); + advanceAchievements(0, [], 0, 11, 0, 0); expect(achievements.value.committed).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, [], 0, 12, 0); + advanceAchievements(0, [], 0, 12, 0, 0); expect(achievements.value.committed).toEqual(AchievementLevel.Bronze); - advanceAchievements(0, [], 0, 26, 0); + advanceAchievements(0, [], 0, 26, 0, 0); expect(achievements.value.committed).toEqual(AchievementLevel.Silver); - advanceAchievements(0, [], 0, 52, 0); + advanceAchievements(0, [], 0, 52, 0, 0); expect(achievements.value.committed).toEqual(AchievementLevel.Gold); }); it('advances challengeAccepted', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(0, [], 0, 0, 4); + advanceAchievements(0, [], 0, 0, 4, 0); expect(achievements.value.challengeAccepted).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(0, [], 0, 0, 5); + advanceAchievements(0, [], 0, 0, 5, 0); expect(achievements.value.challengeAccepted).toEqual(AchievementLevel.Bronze); - advanceAchievements(0, [], 0, 0, 10); + advanceAchievements(0, [], 0, 0, 10, 0); expect(achievements.value.challengeAccepted).toEqual(AchievementLevel.Silver); - advanceAchievements(0, [], 0, 0, 20); + advanceAchievements(0, [], 0, 0, 20, 0); expect(achievements.value.challengeAccepted).toEqual(AchievementLevel.Gold); }); it('advances thirtyVeggies', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(29, [], 0, 0, 0); + advanceAchievements(29, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toEqual(AchievementLevel.NoAchievement); - advanceAchievements(30, [], 0, 0, 0); + advanceAchievements(30, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toBe(AchievementLevel.Gold); - advanceAchievements(40, [], 0, 0, 0); + advanceAchievements(40, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toBe(AchievementLevel.Platinum); }); it('resets thirtyVeggies', async () => { const {advanceAchievements, achievements} = await withSetup(useAchievements); - advanceAchievements(30, [], 0, 0, 0); + advanceAchievements(30, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toEqual(AchievementLevel.Gold); - advanceAchievements(0, [], 0, 0, 0); + advanceAchievements(0, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toBe(AchievementLevel.NoAchievement); - advanceAchievements(40, [], 0, 0, 0); + advanceAchievements(40, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toEqual(AchievementLevel.Platinum); - advanceAchievements(0, [], 0, 0, 0); + advanceAchievements(0, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toBe(AchievementLevel.NoAchievement); - advanceAchievements(40, [], 0, 0, 0); + advanceAchievements(40, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toEqual(AchievementLevel.Platinum); - advanceAchievements(39, [], 0, 0, 0); + advanceAchievements(39, [], 0, 0, 0, 0); expect(achievements.value.thirtyVeggies).toBe(AchievementLevel.Gold); }); + it('advances favorite', async () => { + const {advanceAchievements, achievements} = await withSetup(useAchievements); + advanceAchievements(0, [], 0, 0, 0, 19); + expect(achievements.value.favorite).toEqual(AchievementLevel.NoAchievement); + advanceAchievements(0, [], 0, 0, 0, 20); + expect(achievements.value.favorite).toEqual(AchievementLevel.Bronze); + advanceAchievements(0, [], 0, 0, 0, 50); + expect(achievements.value.favorite).toEqual(AchievementLevel.Silver); + advanceAchievements(0, [], 0, 0, 0, 100); + expect(achievements.value.favorite).toEqual(AchievementLevel.Gold); + }); + it('resets achievements', async () => { const expectedAchievements: Achievements = { challengeAccepted: AchievementLevel.Gold, @@ -187,11 +200,12 @@ describe('achievements', () => { experimenterGrain: AchievementLevel.Gold, experimenterLeafy: AchievementLevel.Gold, experimenterVegetable: AchievementLevel.Gold, + favorite: AchievementLevel.Gold, hotStreak: AchievementLevel.Gold, thirtyVeggies: AchievementLevel.Platinum, }; const {advanceAchievements, achievements, resetAchievements} = await withSetup(useAchievements); - advanceAchievements(40, ALL_VEGGIES, 30, 52, 20); + advanceAchievements(40, ALL_VEGGIES, 30, 52, 20, 100); expect(achievements.value).toEqual(expectedAchievements); resetAchievements(); expect(achievements.value).toEqual(defaultAchievements); diff --git a/src/components/__tests__/activityStore.spec.ts b/src/components/__tests__/activityStore.spec.ts index ae39261..3040390 100644 --- a/src/components/__tests__/activityStore.spec.ts +++ b/src/components/__tests__/activityStore.spec.ts @@ -503,6 +503,30 @@ describe('activityStore', () => { }); }); + it('returns max amount of single veggie logged', () => { + activityStore.startDate = threeWeeksAgo; + activityStore.weeks.push( + { + startDate: threeWeeksAgo, + veggies: ['apple', 'edamame', 'portobello'], + }, + { + startDate: twoWeeksAgo, + veggies: ['apple', 'edamame'], + }, + { + startDate: lastWeek, + veggies: ['wheat'], + }, + { + startDate: thisWeek, + veggies: ['apple', 'portobello', 'black trumpet mushroom'], + }, + ); + + expect(activityStore.maxAmount).toBe(3); + }); + it('resets the store', () => { activityStore.startDate = thisWeek; activityStore.weeks.push({ diff --git a/src/hooks/achievements.ts b/src/hooks/achievements.ts index 58288b0..be7cbc6 100644 --- a/src/hooks/achievements.ts +++ b/src/hooks/achievements.ts @@ -12,6 +12,7 @@ type AdvanceEvent = { completedChallenges: number; hotStreakLength: number; totalWeeks: number; + maxAmount: number; }; type ResetEvent = { @@ -31,14 +32,18 @@ const guards = { (threshold: number) => ({event}: GuardArgs) => event.uniqueVeggies.length >= threshold, - hotStreak: - (threshold: number) => - ({event}: GuardArgs) => - event.hotStreakLength >= threshold, experimenter: (targetGroup: string[]) => ({event}: GuardArgs) => intersection(event.uniqueVeggies, targetGroup).length >= 15, + favorite: + (threshold: number) => + ({event}: GuardArgs) => + event.maxAmount >= threshold, + hotStreak: + (threshold: number) => + ({event}: GuardArgs) => + event.hotStreakLength >= threshold, thirtyVeggies: (threshold: number, rising: boolean) => ({event}: GuardArgs) => @@ -200,130 +205,176 @@ export function useAchievements() { '3': {}, }, }, - hotStreak: { + experimenterFruit: { initial: '0', states: { '0': { on: { - ADVANCE: [ - { - target: '3', - guard: guards.hotStreak(20), - }, - { - target: '2', - guard: guards.hotStreak(10), - }, - { - target: '1', - guard: guards.hotStreak(5), - }, - ], - }, - }, - '1': { - on: { - ADVANCE: [ - { - target: '3', - guard: guards.hotStreak(20), - }, - { - target: '2', - guard: guards.hotStreak(10), - }, - ], + ADVANCE: { + target: '3', + guard: guards.experimenter(FRUITS), + }, }, }, - '2': { + '3': {}, + }, + }, + experimenterVegetable: { + initial: '0', + states: { + '0': { on: { ADVANCE: { target: '3', - guard: guards.hotStreak(20), + guard: guards.experimenter(VEGETABLES), }, }, }, '3': {}, }, }, - experimenterFruit: { + experimenterLeafy: { initial: '0', states: { '0': { on: { ADVANCE: { target: '3', - guard: guards.experimenter(FRUITS), + guard: guards.experimenter(LEAFIES), }, }, }, '3': {}, }, }, - experimenterVegetable: { + experimenterRoot: { initial: '0', states: { '0': { on: { ADVANCE: { target: '3', - guard: guards.experimenter(VEGETABLES), + guard: guards.experimenter(ROOTS), }, }, }, '3': {}, }, }, - experimenterLeafy: { + experimenterBean: { initial: '0', states: { '0': { on: { ADVANCE: { target: '3', - guard: guards.experimenter(LEAFIES), + guard: guards.experimenter(BEANS), }, }, }, '3': {}, }, }, - experimenterRoot: { + experimenterGrain: { initial: '0', states: { '0': { on: { ADVANCE: { target: '3', - guard: guards.experimenter(ROOTS), + guard: guards.experimenter(GRAINS), }, }, }, '3': {}, }, }, - experimenterBean: { + favorite: { initial: '0', states: { '0': { + on: { + ADVANCE: [ + { + target: '3', + guard: guards.favorite(100), + }, + { + target: '2', + guard: guards.favorite(50), + }, + { + target: '1', + guard: guards.favorite(20), + }, + ], + }, + }, + '1': { + on: { + ADVANCE: [ + { + target: '3', + guard: guards.favorite(100), + }, + { + target: '2', + guard: guards.favorite(50), + }, + ], + }, + }, + '2': { on: { ADVANCE: { target: '3', - guard: guards.experimenter(BEANS), + guard: guards.favorite(100), }, }, }, '3': {}, }, }, - experimenterGrain: { + hotStreak: { initial: '0', states: { '0': { + on: { + ADVANCE: [ + { + target: '3', + guard: guards.hotStreak(20), + }, + { + target: '2', + guard: guards.hotStreak(10), + }, + { + target: '1', + guard: guards.hotStreak(5), + }, + ], + }, + }, + '1': { + on: { + ADVANCE: [ + { + target: '3', + guard: guards.hotStreak(20), + }, + { + target: '2', + guard: guards.hotStreak(10), + }, + ], + }, + }, + '2': { on: { ADVANCE: { target: '3', - guard: guards.experimenter(GRAINS), + guard: guards.hotStreak(20), }, }, }, @@ -403,6 +454,7 @@ export function useAchievements() { hotStreakLength: number, totalWeeks: number, completedChallenges: number, + maxAmount: number, ) => actor.send({ type: 'ADVANCE', @@ -411,6 +463,7 @@ export function useAchievements() { hotStreakLength, totalWeeks, completedChallenges, + maxAmount, }), resetAchievements: () => actor.send({type: 'RESET'}), }; diff --git a/src/i18n/en.json b/src/i18n/en.json index f2f37d3..aaebaa9 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -60,6 +60,14 @@ "badgeText": "Vegetables", "3": "You have enjoyed 15 unique vegetables, earning you this achievement!" }, + "favorite": { + "title": "Playing Favorites", + "ariaLabel": "{0} repeat uses of same veggie", + "badgeText": "{0} times", + "1": "You have tried the same veggie 20 times, earning you the bronze achievement!", + "2": "You have tried the same veggie 50 times, earning you the silver achievement!", + "3": "You have tried the same veggie 100, earning you the gold achievement!" + }, "hotStreak": { "title": "Hot Streak", "ariaLabel": "{0} week streak of over 30 veggies", diff --git a/src/i18n/fi.json b/src/i18n/fi.json index 0056c4f..bb2c0ce 100644 --- a/src/i18n/fi.json +++ b/src/i18n/fi.json @@ -56,9 +56,17 @@ }, "experimenterVegetable": { "title": "Kokeilija", - "ariaLabel": "{0} erilaista vihannesta", + "ariaLabel": "{0} erilaista kasvista", "badgeText": "Vihannekset", - "3": "Olet kokeillut 15:tä erilaista vihannesta ansaiten tämän palkinnon!" + "3": "Olet kokeillut 15:tä erilaista kasvista ansaiten tämän palkinnon!" + }, + "favorite": { + "title": "Oma suosikki", + "ariaLabel": "Sama kasvis {0} kertaa", + "badgeText": "{0} kertaa", + "1": "Olet kokeillut samaa kasvista 20 kertaa ja ansainnut pronssisen palkinnon!", + "2": "Olet kokeillut samaa kasvista 50 kertaa ja ansainnut hopeisen palkinnon!", + "3": "Olet kokeillut samaa kasvista 100 kertaa ja ansainnut kultaisen palkinnon!" }, "hotStreak": { "title": "Putki päällä", diff --git a/src/stores/activityStore.ts b/src/stores/activityStore.ts index 58bee70..7055ef4 100644 --- a/src/stores/activityStore.ts +++ b/src/stores/activityStore.ts @@ -2,7 +2,20 @@ import {computed, ref, watchEffect} from 'vue'; import {defineStore} from 'pinia'; import {useNow, useStorage} from '@vueuse/core'; import {DateTime} from 'luxon'; -import {difference, entries, filter, groupBy, map, pipe, prop, sortBy, take, unique} from 'remeda'; +import { + difference, + entries, + filter, + first, + groupBy, + map, + pipe, + prop, + sortBy, + take, + unique, + values, +} from 'remeda'; import {Category, type Favorites, type Challenge, type Week} from '@/utils/types'; import {dateParser, getCategoryForVeggie, getRandomVeggie} from '@/utils/helpers'; @@ -142,6 +155,17 @@ export const useActivityStore = defineStore('activity', () => { ), ); + const maxAmount = computed( + () => + pipe( + allVeggies.value, + groupBy((veggie) => veggie), + values(), + sortBy([({length}) => length, 'desc']), + first, + )?.length ?? 0, + ); + // Actions const toggleVeggie = (targetVeggie: string) => { const weekStart = currentDate.value.startOf('week'); @@ -169,21 +193,22 @@ export const useActivityStore = defineStore('activity', () => { }; return { - startDate, - weeks, + allVeggies, + atMostVeggies, challenges, - getWeekStarts, - hotStreak, completedChallenges, - currentVeggies, currentChallenge, - allVeggies, - uniqueVeggies, + currentVeggies, + favorites, + getWeekStarts, + hotStreak, + maxAmount, over30Veggies, - atMostVeggies, - veggiesForWeek, + startDate, suggestions, - favorites, + uniqueVeggies, + veggiesForWeek, + weeks, toggleVeggie, $reset, }; diff --git a/src/stores/appStateStore.ts b/src/stores/appStateStore.ts index 3760369..46935ce 100644 --- a/src/stores/appStateStore.ts +++ b/src/stores/appStateStore.ts @@ -12,7 +12,7 @@ type Message = { export const useAppStateStore = defineStore('appState', () => { const {advanceAchievements, achievements, resetAchievements} = useAchievements(); - const {currentVeggies, uniqueVeggies, hotStreak, weeks, completedChallenges} = + const {currentVeggies, uniqueVeggies, hotStreak, weeks, completedChallenges, maxAmount} = storeToRefs(useActivityStore()); watchEffect(() => @@ -22,6 +22,7 @@ export const useAppStateStore = defineStore('appState', () => { hotStreak.value, weeks.value.length, completedChallenges.value, + maxAmount.value, ), ); diff --git a/src/utils/types.ts b/src/utils/types.ts index ee11231..f475ce6 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -50,12 +50,13 @@ export type Achievements = { challengeAccepted: AchievementLevel; committed: AchievementLevel; completionist: AchievementLevel; - hotStreak: AchievementLevel; experimenterBean: AchievementLevel; experimenterFruit: AchievementLevel; experimenterGrain: AchievementLevel; experimenterLeafy: AchievementLevel; experimenterRoot: AchievementLevel; experimenterVegetable: AchievementLevel; + favorite: AchievementLevel; + hotStreak: AchievementLevel; thirtyVeggies: AchievementLevel; };