Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

1.4 KB
Raw Blame
'use client';

import { ApiReferenceReact } from '@scalar/api-reference-react';
import '@scalar/api-reference-react/style.css';
import './scalar-theme.css';
import { API_URL } from '@/lib/api/core/client';

// The API mounts /docs/json outside the session guard, so the browser fetches it
// directly.
const SPEC_URL = `${API_URL}/docs/json`;

// The app owns the light/dark switch (next-themes), so Scalar's mode is forced to
// match and its own toggle is hidden. Theming: scalar-theme.css.
export default function ScalarReference({ dark }: { dark: boolean }) {
  return (
    <div className="itp-scalar min-h-0 flex-1 overflow-y-auto">
      <ApiReferenceReact
        configuration={{
          url: SPEC_URL,
          forceDarkModeState: dark ? 'dark' : 'light',
          hideDarkModeToggle: true,
          // Scalar's default fonts are loaded from fonts.scalar.com, which the
          // Content-Security-Policy blocks. The theme maps --scalar-font to the app
          // font anyway, so its own faces are not needed.
          withDefaultFonts: false,
          agent: { disabled: true },
          // The app already exposes its own MCP server; hide Scalar's built-in
          // "Generate MCP" button.
          mcp: { disabled: true },
          // App owns Cmd/Ctrl+K for its command palette; move Scalar's search
          // hotkey off it so the two don't collide.
          searchHotKey: 'j',
        }}
      />
    </div>
  );
}