💄(domains) improve user experience and avoid repeat fix operations

Adds a loader after clicking on "Re-run check" for a domain
This commit is contained in:
Laurent Bossavit
2025-03-03 16:08:53 +01:00
committed by Sabrina Demagny
parent 8b56d97037
commit 4060006a22
2 changed files with 24 additions and 19 deletions

View File

@@ -14,6 +14,7 @@ and this project adheres to
### Fixed ### Fixed
- 💄(domains) improve user experience and avoid repeat fix_domain operations
- 👽️(dimail) increase timeout value for check domain API call - 👽️(dimail) increase timeout value for check domain API call
- 🧱(helm) add resource-server ingress path #743 - 🧱(helm) add resource-server ingress path #743
- 🌐(backend) synchronize translations with crowdin again - 🌐(backend) synchronize translations with crowdin again

View File

@@ -1,5 +1,6 @@
import { import {
Button, Button,
Loader,
Modal, Modal,
ModalSize, ModalSize,
VariantType, VariantType,
@@ -62,18 +63,17 @@ export const MailDomainView = ({ mailDomain, onMailDomainUpdate }: Props) => {
toast(t('copy done'), VariantType.SUCCESS); toast(t('copy done'), VariantType.SUCCESS);
}; };
const { mutate: fetchMailDomain } = useFetchFromDimail({ const { mutate: fetchMailDomain, isPending: fetchPending } =
onSuccess: (data: MailDomain) => { useFetchFromDimail({
console.info('fetchMailDomain success', data); onSuccess: (data: MailDomain) => {
setShowModal(false); setShowModal(false);
toast(t('Domain data fetched successfully'), VariantType.SUCCESS); toast(t('Domain data fetched successfully'), VariantType.SUCCESS);
onMailDomainUpdate?.(data); onMailDomainUpdate?.(data);
}, },
onError: () => { onError: () => {
console.error('fetchMailDomain error'); toast(t('Failed to fetch domain data'), VariantType.ERROR);
toast(t('Failed to fetch domain data'), VariantType.ERROR); },
}, });
});
return ( return (
<> <>
@@ -155,13 +155,17 @@ export const MailDomainView = ({ mailDomain, onMailDomainUpdate }: Props) => {
)} )}
<pre> <pre>
<div style={{ display: 'flex', justifyContent: 'center' }}> <div style={{ display: 'flex', justifyContent: 'center' }}>
<Button {fetchPending ? (
onClick={() => { <Loader />
void fetchMailDomain(mailDomain.slug); ) : (
}} <Button
> onClick={() => {
{t('Re-run check')} void fetchMailDomain(mailDomain.slug);
</Button> }}
>
{t('Re-run check')}
</Button>
)}
</div> </div>
</pre> </pre>
</Modal> </Modal>