Skip to content

Conversation

@phoneuooyd
Copy link
Owner

This pull request introduces improvements to localization and code reusability in the Foodbook application. The main changes include adding new localized button texts for both English and Polish, updating view models to use these resources, and refactoring the ArchivePage to leverage new reusable UI components.

Localization enhancements:

  • Added new localization entries for button texts such as "Save", "Save changes", "Add recipe", "Add ingredient", "New recipe", "Edit recipe", "New ingredient", and "Edit ingredient" in both ButtonResources.resx (English) and ButtonResources.pl-PL.resx (Polish). [1] [2]
  • Updated the designer file ButtonResources.Designer.cs to expose the new localization strings as static properties. [1] [2]

View model updates:

  • Modified AddRecipeViewModel and IngredientFormViewModel to use the new localized button texts for titles and button labels, replacing hardcoded strings. [1] [2]

UI componentization and refactoring:

  • Added several new XAML component files to the project, including FloatingActionButtonComponent.xaml, GenericListComponent.xaml, IngredientListItemComponent.xaml, ModernSearchBarComponent.xaml, RecipeListItemComponent.xaml, and UniversalListItemComponent.xaml, enabling more modular and reusable UI elements.
  • Refactored ArchivePage.xaml to use the new GenericListComponent and UniversalListItemComponent for displaying archived plans, replacing the previous inline CollectionView and item template. This improves maintainability and consistency across the app.

Introduced reusable components (ModernSearchBarComponent, GenericListComponent, FloatingActionButtonComponent, RecipeListItemComponent, IngredientListItemComponent) to eliminate code duplication in RecipesPage and IngredientsPage. Updated both pages to use these components, significantly reducing code size and improving maintainability. Added documentation describing the new components and their usage.
Merged RecipeListItemComponent and IngredientListItemComponent into a single UniversalListItemComponent with a configurable ShowSubtitle property. Updated RecipesPage and IngredientsPage to use the new component, removed the old components and their code-behind files, and revised documentation to reflect the unified approach. This reduces code duplication, simplifies maintenance, and increases flexibility for future list item types.
Extended UniversalListItemComponent to support Recipe, Ingredient, and Plan modes via new bindable properties (ShowNutritionLayout, ShowPlanLayout, ShowDeleteButton, ShowArchiveButton, ArchiveCommand). Refactored RecipesPage, IngredientsPage, and ShoppingListPage to use the enhanced component, eliminating duplicated list item layouts and enabling flexible configuration for each data type. Updated documentation to reflect the new multi-mode architecture and usage patterns.
Replaces the custom archive list UI in ArchivePage.xaml with the reusable UniversalListItemComponent and GenericListComponent. Adds support for a restore button to UniversalListItemComponent, including new bindable properties and layout changes to accommodate the restore action. This improves code reuse and consistency across list item displays.
Added new localized resources for button texts and titles related to adding, editing, and saving recipes and ingredients. Updated AddRecipeViewModel and IngredientFormViewModel to use these localized strings instead of hardcoded values, improving internationalization support.
@phoneuooyd phoneuooyd self-assigned this Aug 29, 2025
@phoneuooyd phoneuooyd merged commit 76ace3a into main Aug 29, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant