diff --git a/apps/router/src/languages/en.json b/apps/router/src/languages/en.json index 2f4358a14..d391d5bc5 100644 --- a/apps/router/src/languages/en.json +++ b/apps/router/src/languages/en.json @@ -219,7 +219,9 @@ "helper-text": "Will be wss:// for guardian or https:// for gateway", "service-type-label": "Service Type", "service-name-label": "Service Name", - "sync-status-label": "Sync Status" + "sync-status-label": "Sync Status", + "service-exists-error": "Service already exists", + "no-gateways-error": "Only Guardians can be added right now" }, "remove-service-modal": { "title": "Remove {{type}}", diff --git a/apps/router/src/modals/ConnectServiceModal.tsx b/apps/router/src/modals/ConnectServiceModal.tsx index 7186b145d..40d820dc5 100644 --- a/apps/router/src/modals/ConnectServiceModal.tsx +++ b/apps/router/src/modals/ConnectServiceModal.tsx @@ -10,6 +10,7 @@ import { ModalContent, ModalHeader, ModalOverlay, + ModalFooter, Text, Badge, Flex, @@ -54,7 +55,7 @@ export const ConnectServiceModal: React.FC = ({ try { const exists = await checkServiceExists(configUrl); if (exists) { - throw new Error('Service already exists'); + throw new Error(t('home.connect-service-modal.service-exists-error')); } const id = await sha256Hash(configUrl); @@ -69,10 +70,13 @@ export const ConnectServiceModal: React.FC = ({ payload: { id, guardian: { config: { id, baseUrl: configUrl } } }, }); } else { - dispatch({ - type: APP_ACTION_TYPE.ADD_GATEWAY, - payload: { id, gateway: { config: { id, baseUrl: configUrl } } }, - }); + // When Gateway UI is production ready, the dispatch can be reinstated + throw new Error(t('home.connect-service-modal.no-gateways-error')); + + // dispatch({ + // type: APP_ACTION_TYPE.ADD_GATEWAY, + // payload: { id, gateway: { config: { id, baseUrl: configUrl } } }, + // }); } resetForm(); @@ -84,7 +88,7 @@ export const ConnectServiceModal: React.FC = ({ } finally { setIsLoading(false); } - }, [configUrl, dispatch, resetForm, onClose, checkServiceExists]); + }, [configUrl, dispatch, resetForm, onClose, checkServiceExists, t]); return ( = ({ {t('home.connect-service-modal.title', 'Connect a Service')} - + {error && ( {error} @@ -120,15 +124,16 @@ export const ConnectServiceModal: React.FC = ({ }} /> + + - + ); diff --git a/apps/router/src/modals/EditServiceModal.tsx b/apps/router/src/modals/EditServiceModal.tsx index 86a714521..dc0ac6b84 100644 --- a/apps/router/src/modals/EditServiceModal.tsx +++ b/apps/router/src/modals/EditServiceModal.tsx @@ -10,6 +10,7 @@ import { ModalContent, ModalHeader, ModalOverlay, + ModalFooter, useToast, } from '@chakra-ui/react'; import { sha256Hash, useTranslation } from '@fedimint/utils'; @@ -103,7 +104,7 @@ export const EditServiceModal: React.FC = ({ })} - + {t('home.edit-service-modal.url-label')} = ({ onChange={(e) => setConfigUrl(e.target.value)} /> - - + );