page.tsx 2.5 KB

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