Show a feedback when saving couple information
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2023-08-31 19:30:16 +02:00
parent e4a1817d7f
commit 79ce616781
2 changed files with 16 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import { MemberInput } from "../../widgets/forms/MemberInput";
import { PropSelect } from "../../widgets/forms/PropSelect"; import { PropSelect } from "../../widgets/forms/PropSelect";
import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton"; import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { useQuery } from "../../hooks/useQuery"; import { useQuery } from "../../hooks/useQuery";
import { useLoadingMessage } from "../../hooks/context_providers/LoadingMessageProvider";
/** /**
* Create a new couple route * Create a new couple route
@ -218,6 +219,7 @@ export function CouplePage(p: {
}): React.ReactElement { }): React.ReactElement {
const confirm = useConfirm(); const confirm = useConfirm();
const snackbar = useSnackbar(); const snackbar = useSnackbar();
const loadingMessage = useLoadingMessage();
const family = useFamily(); const family = useFamily();
@ -231,8 +233,12 @@ export function CouplePage(p: {
setCouple(new Couple(structuredClone(couple))); setCouple(new Couple(structuredClone(couple)));
}; };
const save = () => { const save = async () => {
p.onSave!(couple); loadingMessage.show(
"Enregistrement des informations du couple en cours..."
);
await p.onSave!(couple);
loadingMessage.hide();
}; };
const cancel = async () => { const cancel = async () => {

View File

@ -39,6 +39,7 @@ import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { useQuery } from "../../hooks/useQuery"; import { useQuery } from "../../hooks/useQuery";
import { mdiFamilyTree } from "@mdi/js"; import { mdiFamilyTree } from "@mdi/js";
import Icon from "@mdi/react"; import Icon from "@mdi/react";
import { useLoadingMessage } from "../../hooks/context_providers/LoadingMessageProvider";
/** /**
* Create a new member route * Create a new member route
@ -241,6 +242,7 @@ export function MemberPage(p: {
}): React.ReactElement { }): React.ReactElement {
const confirm = useConfirm(); const confirm = useConfirm();
const snackbar = useSnackbar(); const snackbar = useSnackbar();
const loadingMessage = useLoadingMessage();
const family = useFamily(); const family = useFamily();
@ -254,8 +256,12 @@ export function MemberPage(p: {
setMember(new Member(structuredClone(member))); setMember(new Member(structuredClone(member)));
}; };
const save = () => { const save = async () => {
p.onSave!(member); loadingMessage.show(
"Enregistrement des informations du membre en cours..."
);
await p.onSave!(member);
loadingMessage.hide();
}; };
const cancel = async () => { const cancel = async () => {