diff --git a/apps/frontend/src/components/developer/developer.component.tsx b/apps/frontend/src/components/developer/developer.component.tsx index 92cf6c65..65414061 100644 --- a/apps/frontend/src/components/developer/developer.component.tsx +++ b/apps/frontend/src/components/developer/developer.component.tsx @@ -3,7 +3,6 @@ import { FC, useCallback, useState } from 'react'; import { useFetch } from '@gitroom/helpers/utils/custom.fetch'; import useSWR from 'swr'; -import { Button } from '@gitroom/react/form/button'; import { useToaster } from '@gitroom/react/toaster/toaster'; import { useDecisionModal, useModals } from '@gitroom/frontend/components/layout/new-modal'; import { MediaBox } from '@gitroom/frontend/components/media/media.component'; @@ -27,6 +26,41 @@ const useOAuthApp = () => { }); }; +const CopyButton = ({ + text, + label, +}: { + text: string; + label: string; +}) => { + const toaster = useToaster(); + return ( + + ); +}; + export const DeveloperComponent: FC = () => { const fetch = useFetch(); const toaster = useToaster(); @@ -175,314 +209,397 @@ export const DeveloperComponent: FC = () => { } }, [decision]); - const copyToClipboard = useCallback( - (text: string, label: string) => { - copy(text); - toaster.show(`${label} copied to clipboard`, 'success'); - }, - [] - ); - if (app === undefined) { return null; } + // No app yet — show create prompt if (!app && !creating) { return ( -
-
-

{t('developer', 'Developer')}

-
- {t( - 'create_an_oauth_application', - 'Create an OAuth application to allow third-party integrations with Postiz on behalf of your users.' - )} -
+
+
+ {t( + 'oauth_app_note_line1', + 'Create an OAuth App to let other Postiz users authorize your product to post on their behalf.' + )} +
+ {t( + 'oauth_app_note_line2', + 'After a user completes the OAuth2 flow, you receive a pos_ prefixed token that works everywhere an API Key does — API, MCP, and CLI.' + )} +
+
+
+
+
+ {t('oauth_application', 'OAuth Application')} +
+
+ {t( + 'create_an_oauth_application', + 'Create an OAuth application to allow third-party integrations with Postiz on behalf of your users.' + )} +
+
+ +
+
+ +
+
+
+ ); + } + + // Create form + if (creating && !app) { + return ( +
+
+ {t( + 'oauth_app_note_line1', + 'Create an OAuth App to let other Postiz users authorize your product to post on their behalf.' + )} +
+ {t( + 'oauth_app_note_line2', + 'After a user completes the OAuth2 flow, you receive a pos_ prefixed token that works everywhere an API Key does — API, MCP, and CLI.' + )} +
+
+
+
+ {t('create_oauth_app', 'Create OAuth App')} +
+
+ {t( + 'fill_in_the_details_for_your_oauth_application', + 'Fill in the details for your OAuth application.' + )} +
+
+
+
+ + setName(e.target.value)} + placeholder="My Application" + maxLength={100} + /> +
+
+ +