From 00ba7b78ca79e7c11c886580ca7a310b64896402 Mon Sep 17 00:00:00 2001 From: Sukhman S Date: Sat, 1 Jul 2023 23:04:45 +0530 Subject: [PATCH] feat: use generic Modal with render props --- frontend/src/preferences/APIKeyModal.tsx | 77 +++++++++--------------- 1 file changed, 30 insertions(+), 47 deletions(-) diff --git a/frontend/src/preferences/APIKeyModal.tsx b/frontend/src/preferences/APIKeyModal.tsx index d068aa42..e8f9f224 100644 --- a/frontend/src/preferences/APIKeyModal.tsx +++ b/frontend/src/preferences/APIKeyModal.tsx @@ -3,6 +3,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { ActiveState } from '../models/misc'; import { selectApiKey, setApiKey } from './preferenceSlice'; import { useOutsideAlerter } from './../hooks'; +import Modal from '../Modal'; export default function APIKeyModal({ modalState, @@ -49,53 +50,35 @@ export default function APIKeyModal({ } return ( -
-
-

OpenAI API Key

-

- Before you can start using DocsGPT we need you to provide an API key - for llm. Currently, we support only OpenAI but soon many more. You can - find it here. -

- setKey(e.target.value)} - /> -
-
- - {isCancellable && ( - - )} -
- {isError && ( -

- Please enter a valid API key + { + return ( +

+

OpenAI API Key

+

+ Before you can start using DocsGPT we need you to provide an API + key for llm. Currently, we support only OpenAI but soon many more. + You can find it here.

- )} -
-
-
+ setKey(e.target.value)} + /> + + ); + }} + /> ); }