page.tsx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. 'use client';
  2. import { useEffect } from 'react';
  3. import Link from 'next/link';
  4. export default function ApiDocs() {
  5. useEffect(() => {
  6. // Load Scalar API Reference dynamically
  7. const script = document.createElement('script');
  8. script.src = 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.32.9/dist/browser/standalone.min.js';
  9. script.async = true;
  10. document.body.appendChild(script);
  11. const style = document.createElement('link');
  12. style.rel = 'stylesheet';
  13. style.href = 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.32.9/dist/style.min.css';
  14. document.head.appendChild(style);
  15. return () => {
  16. document.body.removeChild(script);
  17. document.head.removeChild(style);
  18. };
  19. }, []);
  20. return (
  21. <div className="min-h-screen bg-gray-50">
  22. <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
  23. <div className="bg-white shadow rounded-lg">
  24. <div className="px-4 py-5 sm:p-6">
  25. <div className="flex items-center justify-between mb-4">
  26. <div>
  27. <h1 className="text-2xl font-bold text-gray-900">
  28. Vtorio API Documentation
  29. </h1>
  30. <p className="text-gray-600 mt-2">
  31. Interactive API documentation for file upload and management endpoints.
  32. </p>
  33. </div>
  34. <Link
  35. href="/"
  36. className="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors"
  37. >
  38. <svg
  39. className="w-4 h-4 mr-2"
  40. fill="none"
  41. stroke="currentColor"
  42. viewBox="0 0 24 24"
  43. >
  44. <path
  45. strokeLinecap="round"
  46. strokeLinejoin="round"
  47. strokeWidth={2}
  48. d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
  49. />
  50. </svg>
  51. Back to Home
  52. </Link>
  53. </div>
  54. <div
  55. id="api-reference"
  56. data-url="/api/openapi.json"
  57. data-theme="default"
  58. style={{ height: 'calc(100vh - 200px)' }}
  59. />
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. );
  65. }