Dispaly a user message when a recipe is successfully deleted

This commit is contained in:
Greg Burri 2025-05-05 23:28:17 +02:00
parent d86c8ab6fe
commit ec36391ec8
6 changed files with 182 additions and 166 deletions

View file

@ -1,6 +1,7 @@
use std::{borrow::Borrow, fs::File, sync::LazyLock};
use chrono::Weekday;
pub use common::translation::Sentence;
use common::utils;
use ron::de::from_reader;
use serde::Deserialize;
@ -9,164 +10,6 @@ use tracing::warn;
use crate::consts;
#[repr(i64)]
#[derive(Debug, Clone, EnumCount, Deserialize)]
pub enum Sentence {
MainTitle = 0,
CreateNewRecipe,
PrivateRecipes,
UntitledRecipe,
Name,
EmailAddress,
Password,
SignOut,
Save,
NotLoggedIn,
ActionNotAuthorized,
DatabaseError,
TemplateError,
// Sign in page.
SignInMenu,
SignInTitle,
SignInButton,
SignInSuccess,
WrongEmailOrPassword,
// Sign up page.
SignUpMenu,
SignUpTitle,
SignUpButton,
SignUpEmailSent,
SignUpEmailTitle,
SignUpFollowEmailLink,
SignUpEmailValidationSuccess,
SignUpValidationExpired,
SignUpValidationErrorTryAgain,
SignUpClosed,
ChooseAPassword,
ReEnterPassword,
AccountMustBeValidatedFirst,
InvalidEmail,
PasswordDontMatch,
InvalidPassword,
EmailAlreadyTaken,
UnableToSendEmail,
// Validation.
ValidationSuccessful,
ValidationExpired,
ValidationErrorTryToSignUpAgain,
ValidationError,
ValidationUserAlreadyExists,
// Reset password page.
LostPassword,
AskResetChooseNewPassword,
AskResetButton,
AskResetAlreadyLoggedInError,
AskResetEmailAlreadyResetError,
AskResetEmailTitle,
AskResetFollowEmailLink,
AskResetEmailSent,
AskResetTokenMissing,
AskResetTokenExpired,
PasswordReset,
EmailUnknown,
UnableToSendResetEmail,
// Profile
ProfileTitle,
ProfileEmail,
ProfileDefaultServings,
ProfileFirstDayOfWeek,
ProfileNewPassword,
ProfileFollowEmailTitle,
ProfileFollowEmailLink,
ProfileEmailSent,
ProfileSaved,
// Recipe.
RecipeNotAllowedToEdit,
RecipeNotAllowedToView,
RecipeNotFound,
RecipeTitle,
RecipeDescription,
RecipeServings,
RecipeEstimatedTime,
RecipeDifficulty,
RecipeDifficultyEasy,
RecipeDifficultyMedium,
RecipeDifficultyHard,
RecipeTags,
RecipeLanguage,
RecipeIsPublic,
RecipeDelete,
RecipeAddAGroup,
RecipeRemoveGroup,
RecipeGroupName,
RecipeGroupComment,
RecipeAddAStep,
RecipeRemoveStep,
RecipeStepAction,
RecipeAddAnIngredient,
RecipeRemoveIngredient,
RecipeIngredientName,
RecipeIngredientQuantity,
RecipeIngredientUnit,
RecipeIngredientComment,
RecipeDeleteConfirmation,
RecipeGroupDeleteConfirmation,
RecipeStepDeleteConfirmation,
RecipeIngredientDeleteConfirmation,
// View Recipe.
RecipeOneServing,
RecipeSomeServings,
RecipeEstimatedTimeMinAbbreviation,
// Calendar.
CalendarMonday,
CalendarTuesday,
CalendarWednesday,
CalendarThursday,
CalendarFriday,
CalendarSaturday,
CalendarSunday,
CalendarMondayAbbreviation,
CalendarTuesdayAbbreviation,
CalendarWednesdayAbbreviation,
CalendarThursdayAbbreviation,
CalendarFridayAbbreviation,
CalendarSaturdayAbbreviation,
CalendarSundayAbbreviation,
CalendarJanuary,
CalendarFebruary,
CalendarMarch,
CalendarApril,
CalendarMay,
CalendarJune,
CalendarJuly,
CalendarAugust,
CalendarSeptember,
CalendarOctober,
CalendarNovember,
CalendarDecember,
CalendarAddToPlanner,
CalendarAddToPlannerSuccess,
CalendarAddToPlannerAlreadyExists,
CalendarDateFormat, // See https://docs.rs/chrono/latest/chrono/format/strftime/index.html.
CalendarAddIngredientsToShoppingList,
CalendarRemoveIngredientsFromShoppingList,
CalendarUnschedule,
CalendarUnscheduleConfirmation,
}
pub const DEFAULT_LANGUAGE_CODE: &str = "en";
pub const PLACEHOLDER_SUBSTITUTE: &str = "{}";

View file

@ -107,6 +107,7 @@
(RecipeIngredientUnit, "Unit"),
(RecipeIngredientComment, "Comment"),
(RecipeDeleteConfirmation, "Are you sure to delete the recipe: '{}'?"),
(RecipeSuccessfullyDeleted, "Recipe successfully deleted"),
(RecipeGroupDeleteConfirmation, "Are you sure to delete the group: '{}'?"),
(RecipeStepDeleteConfirmation, "Are you sure to delete the step: '{}'?"),
(RecipeIngredientDeleteConfirmation, "Are you sure to delete the ingredient: '{}'?"),
@ -259,6 +260,7 @@
(RecipeIngredientUnit, "Unité"),
(RecipeIngredientComment, "Commentaire"),
(RecipeDeleteConfirmation, "Êtes-vous sûr de vouloir supprimer la recette : '{}' ?"),
(RecipeSuccessfullyDeleted, "Recette supprimée avec succès"),
(RecipeGroupDeleteConfirmation, "Êtes-vous sûr de vouloir supprimer le groupe : '{}' ?"),
(RecipeStepDeleteConfirmation, "Êtes-vous sûr de vouloir supprimer l'étape : '{}' ?"),
(RecipeIngredientDeleteConfirmation, "Êtes-vous sûr de vouloir supprimer 'ingrédient : '{}' ?"),