diff --git a/packages/webapp/src/components/ui/prism/PrismPlus.tsx b/packages/webapp/src/components/ui/prism/PrismPlus.tsx new file mode 100644 index 0000000000..82a275113e --- /dev/null +++ b/packages/webapp/src/components/ui/prism/PrismPlus.tsx @@ -0,0 +1,38 @@ +import type { PrismProps } from '@mantine/prism'; +import { Prism } from '@mantine/prism'; +import classNames from 'classnames'; +import { useCallback, useState } from 'react'; + +//just Prism component with some additional powers! + +export default function PrismPlus({ children, ...props }: PrismProps) { + const [isSecretVisible, setIsSecretVisible] = useState(false); + + const toggleSecretVisibility = useCallback(() => setIsSecretVisible(!isSecretVisible), [isSecretVisible, setIsSecretVisible]); + + const Switch = useCallback(() => { + return ( + + {isSecretVisible ? 'hide' : 'show'} + + ); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isSecretVisible]); + + return ( +
+ {isSecretVisible ? ( + + ) : ( +
+ +
+ )} + + {children} +
+ ); +} diff --git a/packages/webapp/src/pages/ConnectionDetails.tsx b/packages/webapp/src/pages/ConnectionDetails.tsx index 6b7937036f..da278420da 100644 --- a/packages/webapp/src/pages/ConnectionDetails.tsx +++ b/packages/webapp/src/pages/ConnectionDetails.tsx @@ -8,6 +8,8 @@ import { HelpCircle } from '@geist-ui/icons'; import { useGetConnectionDetailsAPI, useDeleteConnectionAPI } from '../utils/api'; import DashboardLayout from '../layout/DashboardLayout'; import { LeftNavBarItems } from '../components/LeftNavBar'; +import SecretInput from '../components/ui/SecretInput'; +import PrismPlus from '../components/ui/prism/PrismPlus'; interface Connection { id: number; @@ -161,9 +163,8 @@ We could not retrieve and/or refresh your access token due to the following erro - - {connection.accessToken} - + + )} @@ -183,9 +184,7 @@ We could not retrieve and/or refresh your access token due to the following erro - - {connection.refreshToken} - + )} @@ -195,9 +194,7 @@ We could not retrieve and/or refresh your access token due to the following erro - - {connection.oauthToken} - + )} @@ -207,9 +204,7 @@ We could not retrieve and/or refresh your access token due to the following erro - - {connection.oauthTokenSecret} - + )} @@ -238,14 +233,13 @@ We could not retrieve and/or refresh your access token due to the following erro - + {JSON.stringify(connection.rawCredentials, null, 4) || '{}'} - + )} - {serverErrorMessage && (

{serverErrorMessage}