diff --git a/knip.jsonc b/knip.jsonc index cf1229bd9..b5eed306c 100644 --- a/knip.jsonc +++ b/knip.jsonc @@ -44,7 +44,6 @@ "src/components/QueryGGBanner.tsx", "src/components/StackBlitzEmbed.tsx", "src/components/UserFeedbackSection.tsx", - "src/components/application-starter/CustomAddonDialog.tsx", "src/components/application-starter/CustomTemplateDialog.tsx", "src/components/application-starter/FeaturePicker.tsx", "src/components/application-starter/TemplatePicker.tsx", diff --git a/src/components/application-starter/CustomAddonDialog.tsx b/src/components/application-starter/CustomAddonDialog.tsx deleted file mode 100644 index b049fdc7c..000000000 --- a/src/components/application-starter/CustomAddonDialog.tsx +++ /dev/null @@ -1,253 +0,0 @@ -/** - * Custom Integration Dialog - * - * Allows importing integrations from external URLs. - */ - -import { useState } from 'react' -import { Link } from '@tanstack/react-router' -import { twMerge } from 'tailwind-merge' -import { - PlusIcon, - CircleNotchIcon, - WarningCircleIcon, - XIcon, - ArrowSquareOutIcon, - QuestionIcon, -} from '@phosphor-icons/react' -import { useApplicationStarterStore, useTailwind } from './store' -import type { IntegrationCompiled } from '~/application-starter/api' - -interface CustomAddonDialogProps { - onClose?: () => void -} - -export function CustomAddonDialog({ onClose }: CustomAddonDialogProps) { - const [url, setUrl] = useState('') - const [isLoading, setIsLoading] = useState(false) - const [error, setError] = useState(null) - const [preview, setPreview] = useState(null) - - const addCustomIntegration = useApplicationStarterStore( - (s) => s.addCustomIntegration, - ) - const tailwind = useTailwind() - - const handleLoad = async () => { - if (!url.trim()) { - setError('Please enter a URL') - return - } - - setIsLoading(true) - setError(null) - setPreview(null) - - try { - const response = await fetch( - `/api/application-starter/load-remote-addon?url=${encodeURIComponent(url)}`, - ) - const data = await response.json() - - if (data.error) { - setError(data.error) - } else if (data.integration) { - setPreview(data.integration) - } - } catch { - setError('Failed to load integration') - } finally { - setIsLoading(false) - } - } - - const handleAdd = () => { - if (!preview) return - - // Check Tailwind requirement - if (preview.requiresTailwind && !tailwind) { - setError('This integration requires Tailwind CSS. Enable Tailwind first.') - return - } - - addCustomIntegration(preview) - onClose?.() - } - - const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !isLoading) { - if (preview) { - handleAdd() - } else { - handleLoad() - } - } - } - - return ( -
- {/* URL Input */} -
- -
- { - setUrl(e.target.value) - setError(null) - setPreview(null) - }} - onKeyDown={handleKeyDown} - placeholder="https://example.com/my-integration.json" - className="flex-1 px-3 py-2 text-sm bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500" - disabled={isLoading} - /> - -
-

- Enter the URL to an integration JSON file (e.g., from GitHub raw - content) -

-
- - {/* Error */} - {error && ( -
- - {error} -
- )} - - {/* Preview */} - {preview && ( -
-
-
-

- {preview.name} -

-

- {preview.description} -

-
- {preview.link && ( - - - - )} -
- - {/* Metadata */} -
- {preview.author && ( - - By {preview.author} - - )} - {preview.version && ( - - v{preview.version} - - )} - {preview.category && ( - - {preview.category} - - )} - {preview.requiresTailwind && ( - - Requires Tailwind - - )} -
- - {/* Files count */} -
- {Object.keys(preview.files).length} files included -
- - {/* Add button */} - -
- )} -
- ) -} - -/** - * Button to open custom integration dialog in a modal-like expandable section - */ -export function CustomAddonButton() { - const [isOpen, setIsOpen] = useState(false) - - return ( -
- - - {isOpen && ( -
- setIsOpen(false)} /> -
- )} -
- ) -}