From 6dcaa8cccdb289bb2289e026fc93141a91f9d6d2 Mon Sep 17 00:00:00 2001 From: nael Date: Thu, 1 Feb 2024 06:16:55 +0100 Subject: [PATCH] :bug: L :wq --- apps/embedded-catalog/react/index.ts | 1 + apps/embedded-catalog/react/src/App.tsx | 4 +-- .../PanoraIntegrationCard.tsx} | 28 ++++++++----------- .../react/src/components/index.ts | 1 + 4 files changed, 15 insertions(+), 19 deletions(-) create mode 100644 apps/embedded-catalog/react/index.ts rename apps/embedded-catalog/react/src/{lib/index.tsx => components/PanoraIntegrationCard.tsx} (82%) create mode 100644 apps/embedded-catalog/react/src/components/index.ts diff --git a/apps/embedded-catalog/react/index.ts b/apps/embedded-catalog/react/index.ts new file mode 100644 index 000000000..07e461ccf --- /dev/null +++ b/apps/embedded-catalog/react/index.ts @@ -0,0 +1 @@ +export { PanoraIntegrationCard } from './src/components/PanoraIntegrationCard' \ No newline at end of file diff --git a/apps/embedded-catalog/react/src/App.tsx b/apps/embedded-catalog/react/src/App.tsx index fbc7b2cf4..9cb95b632 100644 --- a/apps/embedded-catalog/react/src/App.tsx +++ b/apps/embedded-catalog/react/src/App.tsx @@ -1,5 +1,5 @@ import './App.css' -import ProviderCard from './lib' +import { PanoraIntegrationCard } from './components/PanoraIntegrationCard' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' @@ -10,7 +10,7 @@ function App() {

- +

diff --git a/apps/embedded-catalog/react/src/lib/index.tsx b/apps/embedded-catalog/react/src/components/PanoraIntegrationCard.tsx similarity index 82% rename from apps/embedded-catalog/react/src/lib/index.tsx rename to apps/embedded-catalog/react/src/components/PanoraIntegrationCard.tsx index a42975e46..ba9bbd190 100644 --- a/apps/embedded-catalog/react/src/lib/index.tsx +++ b/apps/embedded-catalog/react/src/components/PanoraIntegrationCard.tsx @@ -1,4 +1,3 @@ -import config from '@/helpers/config'; import { findProviderVertical, getDescription } from '@/helpers/utils'; import useLinkedUserMutation from '@/hooks/mutations/useLinkedUserMutation'; import useLinkedUser from '@/hooks/queries/useLinkedUserId'; @@ -15,10 +14,10 @@ interface RemoteUserInfo { interface ProviderCardProp { name: string; projectId: string; + returnUrl: string; linkedUserIdOrRemoteUserInfo: string | RemoteUserInfo; - } -const ProviderCard = ({name, projectId, linkedUserIdOrRemoteUserInfo}: ProviderCardProp) => { +export const PanoraIntegrationCard = ({name, projectId, returnUrl, linkedUserIdOrRemoteUserInfo}: ProviderCardProp) => { const [providerClicked, setProviderClicked] = useState(false); const [originId, setOriginId] = useState("") const [loading, setLoading] = useState(false) @@ -46,7 +45,7 @@ const ProviderCard = ({name, projectId, linkedUserIdOrRemoteUserInfo}: ProviderC const { open, isReady } = useOAuth({ providerName: name.toLowerCase(), - returnUrl: config.ML_FRONTEND_URL, // TODO: Replace with the actual return URL + returnUrl: returnUrl, // TODO: Replace with the actual return URL projectId: projectId, linkedUserId: linkedUserId, onSuccess: () => console.log('OAuth successful'), @@ -73,19 +72,16 @@ const ProviderCard = ({name, projectId, linkedUserIdOrRemoteUserInfo}: ProviderC return (
- -
- - -
Integrate with {name}
-
+
+ +
Integrate with {name}
+
- {!loading ? - <>

{getDescription(name.toLowerCase())}

+ {!loading ? - + : <>

Continue in {name}

@@ -116,6 +112,4 @@ const ProviderCard = ({name, projectId, linkedUserIdOrRemoteUserInfo}: ProviderC }
) -}; - -export default ProviderCard; \ No newline at end of file +}; \ No newline at end of file diff --git a/apps/embedded-catalog/react/src/components/index.ts b/apps/embedded-catalog/react/src/components/index.ts new file mode 100644 index 000000000..633685be4 --- /dev/null +++ b/apps/embedded-catalog/react/src/components/index.ts @@ -0,0 +1 @@ +export { PanoraIntegrationCard } from './PanoraIntegrationCard' \ No newline at end of file