From 77272d6450b8da29698ea338354a88e6aa755c45 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Thu, 7 Jan 2021 19:26:42 +0800 Subject: [PATCH] AddTorrentsByURL: display "handle magnet link" only when supported --- .../add-torrents-modal/AddTorrentsByURL.tsx | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/client/src/javascript/components/modals/add-torrents-modal/AddTorrentsByURL.tsx b/client/src/javascript/components/modals/add-torrents-modal/AddTorrentsByURL.tsx index d5e4a570..71368f8d 100644 --- a/client/src/javascript/components/modals/add-torrents-modal/AddTorrentsByURL.tsx +++ b/client/src/javascript/components/modals/add-torrents-modal/AddTorrentsByURL.tsx @@ -41,21 +41,23 @@ const AddTorrentsByURL: FC = () => { {intl.formatMessage({ id: 'torrents.add.torrents.label', })} - { - if (typeof navigator.registerProtocolHandler === 'function') { - navigator.registerProtocolHandler( - 'magnet', - `${ConfigStore.baseURI}?action=add-urls&url=%s`, - 'Magnet -> Flood', - ); - } - }}> - {intl.formatMessage({ - id: 'torrents.add.tab.url.register.magnet.handler', - })} - + {typeof navigator.registerProtocolHandler === 'function' && ( + { + if (typeof navigator.registerProtocolHandler === 'function') { + navigator.registerProtocolHandler( + 'magnet', + `${ConfigStore.baseURI}?action=add-urls&url=%s`, + 'Magnet -> Flood', + ); + } + }}> + {intl.formatMessage({ + id: 'torrents.add.tab.url.register.magnet.handler', + })} + + )} } placeholder={intl.formatMessage({