From e3743454b51af2c5b0907317994edc30f6adf446 Mon Sep 17 00:00:00 2001 From: Anton Gustafsson Date: Wed, 6 Sep 2023 20:04:02 +0200 Subject: [PATCH] feat: create multiple lists of ingredients (#369) --- .gitignore | 5 +- android/app/build.gradle | 4 +- cypress/e2e/ingredients.cy.ts | 50 ++++++++ .../android/en-US/changelogs/13700.txt | 1 + src/components/dialogs/welcome-dialog.html | 2 +- src/components/icons/icon-arrow-forward.html | 11 ++ src/components/index.ts | 3 +- src/domain/entities/ingredient-list.ts | 5 + src/locales/en/translation.json | 6 +- src/main.ts | 10 +- .../all-ingredients/all-ingredients.html | 2 + src/modules/ingredients/ingredients.html | 4 +- .../search-ingredients.html | 3 + .../search-ingredients/search-ingredients.ts | 5 +- .../selected-ingredients-list-component.html | 9 ++ .../selected-ingredients-list-component.ts | 20 +++ .../ingredient-list-drawer.html | 40 ++++++ .../ingredient-list-drawer.ts | 70 +++++++++++ .../ingredient-lists/ingredient-lists.html | 25 ++++ .../user/ingredient-lists/ingredient-lists.ts | 30 +++++ .../user/ingredients/user-ingredients.html | 10 +- src/modules/user/tags/user-tags.html | 10 +- src/modules/user/user-page.html | 20 ++- src/modules/user/user-page.ts | 23 +++- src/modules/user/user-router.ts | 7 ++ src/services/local-storage-service.ts | 118 ++++++++++++++++-- tests/services/ingredient-service.test.ts | 5 +- tests/services/local-storage-service.test.ts | 20 +++ 28 files changed, 466 insertions(+), 52 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/13700.txt create mode 100644 src/components/icons/icon-arrow-forward.html create mode 100644 src/domain/entities/ingredient-list.ts create mode 100644 src/modules/ingredients/selected-ingredients-list-component.html create mode 100644 src/modules/ingredients/selected-ingredients-list-component.ts create mode 100644 src/modules/user/ingredient-lists/ingredient-list-drawer.html create mode 100644 src/modules/user/ingredient-lists/ingredient-list-drawer.ts create mode 100644 src/modules/user/ingredient-lists/ingredient-lists.html create mode 100644 src/modules/user/ingredient-lists/ingredient-lists.ts diff --git a/.gitignore b/.gitignore index 99deca21..90ff5783 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,4 @@ node_modules .env /coverage -/android/keystore.jks -/android/release.jks.base64 -/fastlane/service-account-key.base64 -/fastlane/service-account-key.json \ No newline at end of file +/fastlane/report.xml \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index aad62156..e2f7fd4e 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 13602 - versionName "1.36.2" + versionCode 13700 + versionName "1.37.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/cypress/e2e/ingredients.cy.ts b/cypress/e2e/ingredients.cy.ts index c7fb097a..ffcae8fa 100644 --- a/cypress/e2e/ingredients.cy.ts +++ b/cypress/e2e/ingredients.cy.ts @@ -3,6 +3,7 @@ describe('Ingredients', () => { window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric'); cy.visit('#/ingredients'); + cy.dataCy('selected-bar-component').should('not.exist'); cy.dataCy('ingredient-list').find('div').should('have.length', 0); cy.dataCy('add-ingredients-search').type('Vodka'); cy.dataCy('tag-vodka').click(); @@ -49,6 +50,55 @@ describe('Ingredients', () => { .first() .should('contain', 'All ingredients selected'); }); + + it('My inventory - Navigate to selected bar', () => { + window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric'); + window.localStorage.setItem( + 'CapacitorStorage.ingredient-lists', + JSON.stringify([ + { name: 'My Bar', ingredients: [] }, + { name: 'Test', ingredients: [] } + ]) + ); + + cy.visit('#/ingredients'); + + cy.dataCy('selected-bar-component').should('exist'); + cy.dataCy('selected-bar-name').should('include.text', 'My Bar'); + + cy.get('header').should('contain.text', 'Ingredients'); + cy.url().should('include', `ingredients`); + + cy.dataCy('selected-bar-name').first().click(); + + cy.get('header').should('contain.text', 'Profile'); + cy.url().should('include', `user`); + }); + + it('All ingredients - Navigate to selected bar', () => { + window.localStorage.setItem('CapacitorStorage.messuarement-system', 'Metric'); + window.localStorage.setItem( + 'CapacitorStorage.ingredient-lists', + JSON.stringify([ + { name: 'My Bar', ingredients: [] }, + { name: 'Test', ingredients: [] } + ]) + ); + + cy.visit('#/ingredients'); + navigateToAllIngredients(); + + cy.dataCy('selected-bar-component').should('exist'); + cy.dataCy('selected-bar-name').should('include.text', 'My Bar'); + + cy.get('header').should('contain.text', 'Ingredients'); + cy.url().should('include', `ingredients`); + + cy.dataCy('selected-bar-name').last().click(); + + cy.get('header').should('contain.text', 'Profile'); + cy.url().should('include', `user`); + }); }); function navigateToInventory() { diff --git a/fastlane/metadata/android/en-US/changelogs/13700.txt b/fastlane/metadata/android/en-US/changelogs/13700.txt new file mode 100644 index 00000000..8f6e91bb --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/13700.txt @@ -0,0 +1 @@ +• Added support for multiple lists of ingredients \ No newline at end of file diff --git a/src/components/dialogs/welcome-dialog.html b/src/components/dialogs/welcome-dialog.html index 3125c18e..64140786 100644 --- a/src/components/dialogs/welcome-dialog.html +++ b/src/components/dialogs/welcome-dialog.html @@ -1,7 +1,7 @@