From 95bae4001783954f7c54fe74a189de41d63912ef Mon Sep 17 00:00:00 2001 From: Anton Gustafsson Date: Tue, 21 Nov 2023 19:20:48 +0100 Subject: [PATCH 1/7] feat: added christmas season --- android/app/build.gradle | 4 +- .../android/en-US/changelogs/14400.txt | 2 + .../icons/icon-chevron-forward.html | 11 ++++ src/components/index.ts | 3 +- .../season-explore/get-active-season.ts | 23 +++++++ .../season-explore/season-explore.html | 18 +++--- .../widgets/season-explore/season-explore.ts | 58 ++++++++++++++++-- .../widgets/season-explore/season.ts | 1 + src/data/cocktail-data.ts | 15 +++++ src/locales/en/cocktails.json | 3 +- src/locales/en/instructions.json | 3 +- src/locales/en/translation.json | 4 +- .../cocktails/all-cocktails/all-cocktails.ts | 4 ++ .../cocktails/cocktail-filter-component.ts | 7 ++- src/modules/cocktails/cocktails.ts | 4 +- src/services/dev-tools-service.ts | 16 +++++ static/images/christmas.jpg | Bin 0 -> 73068 bytes static/images/old_cuban.jpg | Bin 0 -> 113351 bytes tests/functions/get-active-season.test.ts | 49 +++++++++++++++ 19 files changed, 204 insertions(+), 21 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/14400.txt create mode 100644 src/components/icons/icon-chevron-forward.html create mode 100644 src/components/widgets/season-explore/get-active-season.ts create mode 100644 src/components/widgets/season-explore/season.ts create mode 100644 src/services/dev-tools-service.ts create mode 100644 static/images/christmas.jpg create mode 100644 static/images/old_cuban.jpg create mode 100644 tests/functions/get-active-season.test.ts diff --git a/android/app/build.gradle b/android/app/build.gradle index 493bf849..5d527ab7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.moimob.drinkable" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 14300 - versionName "1.43.0" + versionCode 14400 + versionName "1.44.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/fastlane/metadata/android/en-US/changelogs/14400.txt b/fastlane/metadata/android/en-US/changelogs/14400.txt new file mode 100644 index 00000000..89d09691 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/14400.txt @@ -0,0 +1,2 @@ +• Added Christmas Season +• Added Old Cuban Cocktail \ No newline at end of file diff --git a/src/components/icons/icon-chevron-forward.html b/src/components/icons/icon-chevron-forward.html new file mode 100644 index 00000000..064b3462 --- /dev/null +++ b/src/components/icons/icon-chevron-forward.html @@ -0,0 +1,11 @@ + diff --git a/src/components/index.ts b/src/components/index.ts index d39a82e8..b4d11e53 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -33,6 +33,7 @@ export function configure(config: FrameworkConfiguration) { PLATFORM.moduleName('./tag-component.html'), PLATFORM.moduleName('./add-ingredient-component/add-ingredient-component'), PLATFORM.moduleName('./copy-to-clipboard/copy-to-clipboard'), - PLATFORM.moduleName('./icons/icon-arrow-forward.html') + PLATFORM.moduleName('./icons/icon-arrow-forward.html'), + PLATFORM.moduleName('./icons/icon-chevron-forward.html') ]); } diff --git a/src/components/widgets/season-explore/get-active-season.ts b/src/components/widgets/season-explore/get-active-season.ts new file mode 100644 index 00000000..7a0776d8 --- /dev/null +++ b/src/components/widgets/season-explore/get-active-season.ts @@ -0,0 +1,23 @@ +import { Season } from './season'; + +/** + * Returns the active season based on the current date. + * @param today - The current date. + * @returns The active season, or null if no season is active. + */ +export function getActiveSeason(today: Date): Season { + const month = today.getMonth() + 1; + const day = today.getDate(); + + // Check if it's Halloween season (October 15th to November 7th) + if ((month === 10 && day >= 15) || (month === 11 && day <= 7)) { + return 'halloween'; + } + + // Check if it's Christmas season (November 15th to January 7th) + if ((month === 11 && day >= 15) || month === 12 || (month === 1 && day <= 7)) { + return 'christmas'; + } + + return null; +} diff --git a/src/components/widgets/season-explore/season-explore.html b/src/components/widgets/season-explore/season-explore.html index c9ab2cbf..01707ec8 100644 --- a/src/components/widgets/season-explore/season-explore.html +++ b/src/components/widgets/season-explore/season-explore.html @@ -1,16 +1,18 @@