From 8ddd7802810ac01b8d819ba567d479fdfaa3d148 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 24 Jan 2021 13:16:33 -0800 Subject: [PATCH] Disable social ok button if URL is not valid --- web/pages/config-social-links.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/pages/config-social-links.tsx b/web/pages/config-social-links.tsx index e703eeff3..7788b3443 100644 --- a/web/pages/config-social-links.tsx +++ b/web/pages/config-social-links.tsx @@ -7,6 +7,7 @@ import { fetchData, NEXT_PUBLIC_API_HOST, SOCIAL_PLATFORMS_LIST } from '../utils import { ServerStatusContext } from '../utils/server-status-context'; import { API_SOCIAL_HANDLES, postConfigUpdateToAPI, RESET_TIMEOUT, SUCCESS_STATES, DEFAULT_SOCIAL_HANDLE, OTHER_SOCIAL_HANDLE_OPTION } from './components/config/constants'; import { SocialHandle } from '../types/config-section'; +import {isValidUrl} from '../utils/urls'; const { Title } = Typography; @@ -221,6 +222,11 @@ export default function ConfigSocialLinks() { ); + const okButtonProps = { + disabled: !isValidUrl(modalDataState.url) +}; + + return (
Social Links @@ -243,6 +249,7 @@ export default function ConfigSocialLinks() { onOk={handleModalOk} onCancel={handleModalCancel} confirmLoading={modalProcessing} + okButtonProps={okButtonProps} >