diff --git a/apps/landing/src/components/docs/final/InteractiveAPIWidgetFinal.tsx b/apps/landing/src/components/docs/final/InteractiveAPIWidgetFinal.tsx index 183ebc7..a146cb6 100644 --- a/apps/landing/src/components/docs/final/InteractiveAPIWidgetFinal.tsx +++ b/apps/landing/src/components/docs/final/InteractiveAPIWidgetFinal.tsx @@ -26,23 +26,23 @@ interface InteractiveAPIWidgetFinalProps { }>; } -type Language = 'curl' | 'javascript' | 'python' | 'go'; +type Language = 'curl' | 'javascript' | 'python' | 'go' | 'js-sdk' | 'mcp'; const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000'; const API_KEY_STORAGE = 'banatie_docs_api_key'; -const getMethodColor = (method: string): string => { +const getMethodBadgeStyle = (method: string): string => { switch (method) { case 'GET': - return 'from-cyan-500 to-cyan-600'; + return 'bg-cyan-600/20 text-cyan-400 border border-cyan-500/40'; case 'POST': - return 'from-purple-500 to-purple-600'; + return 'bg-green-600/20 text-green-400 border border-green-500/40'; case 'PUT': - return 'from-amber-500 to-amber-600'; + return 'bg-amber-600/20 text-amber-400 border border-amber-500/40'; case 'DELETE': - return 'from-red-500 to-red-600'; + return 'bg-red-600/20 text-red-400 border border-red-500/40'; default: - return 'from-purple-500 to-cyan-500'; + return 'bg-slate-600/20 text-slate-400 border border-slate-500/40'; } }; @@ -96,10 +96,33 @@ export const InteractiveAPIWidgetFinal = ({ }; }, [parameters]); + // Get language display name + const getLanguageLabel = (lang: Language): string => { + switch (lang) { + case 'curl': + return 'cURL'; + case 'javascript': + return 'JavaScript'; + case 'python': + return 'Python'; + case 'go': + return 'Go'; + case 'js-sdk': + return 'JS SDK'; + case 'mcp': + return 'MCP'; + } + }; + // Generate code examples const generateCode = (): string => { const url = `${API_BASE_URL}${endpoint}`; + // Coming soon placeholders + if (language === 'js-sdk' || language === 'mcp') { + return `# Coming soon\n# ${getLanguageLabel(language)} integration is under development`; + } + switch (language) { case 'curl': return `curl -X ${method} "${url}" \\ @@ -251,59 +274,52 @@ func main() { return ( <> {/* Minimized Widget */} -
+
{/* Header */} -
+
-
+
{method}
{endpoint}
{/* Code Section - Full Width */}
{/* Language Tabs */} -
- {(['curl', 'javascript', 'python', 'go'] as Language[]).map((lang, idx) => { - const colors = ['purple', 'cyan', 'amber', 'purple']; - const color = colors[idx]; - return ( - - ); - })} +
+ {(['curl', 'javascript', 'python', 'go', 'js-sdk', 'mcp'] as Language[]).map((lang) => ( + + ))}
{/* Code Display */} -
-
- Code Example +
+
+ Code Example
@@ -315,50 +331,43 @@ func main() {
{/* Footer */} -
+
{/* Inline Response (if any) */} {(response || error) && ( -
-

- 📦 +
+

Response

{error ? ( -
-
- ⚠️ -
-

Error

-

{error}

-
-
+
+

Error

+

{error}

) : ( -
{isSuccess && (
- - ✓ 200 Success + + 200 Success
)} @@ -374,63 +383,59 @@ func main() { {/* Expanded Modal */} {isExpanded && (
-
+
{/* Modal Header */} -
-
-
- {method} +
+
+
+
+ {method} +
+ {endpoint}
- {endpoint} + +

{description}

{/* Two-Panel Layout */}
{/* Left: Code */} -
-
- {(['curl', 'javascript', 'python', 'go'] as Language[]).map((lang, idx) => { - const colors = ['purple', 'cyan', 'amber', 'purple']; - const color = colors[idx]; - return ( - - ); - })} +
+
+ {(['curl', 'javascript', 'python', 'go', 'js-sdk', 'mcp'] as Language[]).map((lang) => ( + + ))}
-
-
- Code Example +
+
+ Code Example
-
-
+                  
+
                       {generateCode()}
                     
@@ -438,36 +443,30 @@ func main() {
{/* Right: Response */} -
-

- 📦 +
+

Response

-
-
+
+
{response && ( - {response.success ? '✓ Success' : '✕ Error'} + {response.success ? 'Success' : 'Error'} )}
-
+
{error ? ( -
-
- ⚠️ -
-

Error

-

{error}

-
-
+
+

Error

+

{error}

) : response ? (
@@ -476,9 +475,8 @@ func main() {
                     ) : (
                       
-

🚀

- Click "Try It" below to see the response + Click "Try It" below to see the response

@@ -490,17 +488,12 @@ func main() {
- - {/* Footer hint */} -
-

{description}

-
)}