|
1 | 1 | import { useState } from 'react'; |
2 | | -import { Copy, Terminal, Database, Shield, HardDrive, Check, Server, Menu, X, ChevronDown, AlertCircle, Zap } from 'lucide-react'; |
| 2 | +import { Copy, Terminal, Database, Shield, HardDrive, Check, Server, Menu, X, ChevronDown, AlertCircle, Zap, AlertTriangle } from 'lucide-react'; |
3 | 3 | import { API_URL } from '../config'; |
4 | 4 |
|
5 | 5 | import Footer from '../components/Layout/Footer'; |
@@ -88,6 +88,28 @@ console.log(data); |
88 | 88 | </div> |
89 | 89 | ); |
90 | 90 |
|
| 91 | + // Helper for Error Status Codes Table |
| 92 | + const ErrorTable = ({ errors }) => ( |
| 93 | + <div style={{ margin: '1rem 0', overflowX: 'auto' }}> |
| 94 | + <table style={{ width: '100%', fontSize: '0.9rem', borderCollapse: 'collapse' }}> |
| 95 | + <thead> |
| 96 | + <tr style={{ borderBottom: '1px solid #333', textAlign: 'left' }}> |
| 97 | + <th style={{ padding: '8px', color: '#888' }}>Status Code</th> |
| 98 | + <th style={{ padding: '8px', color: '#888' }}>Description</th> |
| 99 | + </tr> |
| 100 | + </thead> |
| 101 | + <tbody> |
| 102 | + {errors.map((e, i) => ( |
| 103 | + <tr key={i} style={{ borderBottom: '1px solid #222' }}> |
| 104 | + <td style={{ padding: '8px', fontFamily: 'monospace', color: 'var(--color-primary)' }}>{e.code}</td> |
| 105 | + <td style={{ padding: '8px', color: '#ddd' }}>{e.desc}</td> |
| 106 | + </tr> |
| 107 | + ))} |
| 108 | + </tbody> |
| 109 | + </table> |
| 110 | + </div> |
| 111 | + ); |
| 112 | + |
91 | 113 | const renderContent = () => { |
92 | 114 | switch (activeTab) { |
93 | 115 | case 'intro': |
@@ -131,6 +153,27 @@ console.log(data); |
131 | 153 | </div> |
132 | 154 | ); |
133 | 155 |
|
| 156 | + case 'errors': |
| 157 | + return ( |
| 158 | + <div className="fade-in"> |
| 159 | + <h2 className="page-title" style={{ marginBottom: '1rem' }}>Error Reference</h2> |
| 160 | + <p style={{ color: 'var(--color-text-muted)', marginBottom: '2rem' }}> |
| 161 | + Common HTTP status codes and their meanings when making API requests. |
| 162 | + </p> |
| 163 | + |
| 164 | + <h3 style={{ fontSize: '1.2rem', marginBottom: '1rem', display: 'flex', alignItems: 'center', gap: '10px' }}> |
| 165 | + <AlertTriangle size={18} /> Status Codes |
| 166 | + </h3> |
| 167 | + <ErrorTable errors={[ |
| 168 | + { code: '400 Bad Request', desc: 'Invalid JSON or missing required schema fields.' }, |
| 169 | + { code: '401 Unauthorized', desc: 'Invalid or missing API Key/JWT Token.' }, |
| 170 | + { code: '403 Forbidden', desc: 'Resource limits exceeded (e.g., database or storage quota).' }, |
| 171 | + { code: '404 Not Found', desc: 'Collection or document does not exist.' }, |
| 172 | + { code: '500 Internal Server Error', desc: 'Unexpected server-side issues.' }, |
| 173 | + ]} /> |
| 174 | + </div> |
| 175 | + ); |
| 176 | + |
134 | 177 | case 'limits': |
135 | 178 | return ( |
136 | 179 | <div className="fade-in"> |
@@ -359,7 +402,8 @@ console.log("File URL:", result.url); |
359 | 402 | <ul style={{ listStyle: 'none', padding: 0 }}> |
360 | 403 | {[ |
361 | 404 | { id: 'intro', label: 'Introduction', icon: Terminal }, |
362 | | - { id: 'limits', label: 'Limits & Quotas', icon: AlertCircle }, // New Tab |
| 405 | + { id: 'errors', label: 'Error Reference', icon: AlertTriangle }, |
| 406 | + { id: 'limits', label: 'Limits & Quotas', icon: AlertCircle }, |
363 | 407 | { id: 'auth', label: 'Authentication', icon: Shield }, |
364 | 408 | { id: 'data', label: 'Database & API', icon: Database }, |
365 | 409 | { id: 'storage', label: 'Storage', icon: HardDrive }, |
|
0 commit comments