/**
 * /files/<path...> — in-browser viewer for any file under <dataDir>/.
 *
 * Backed by /api/files (dataDir-wide, sensitive blacklist applied).
 * Reuses ScratchViewer with apiBase overridden — same markdown render
 * + image/pdf inline + download button, just rooted at <dataDir>/.
 *
 * Pairs with the chat link-pattern that turns `tmp/foo.md` into
 * `/files/tmp/foo.md` so users click straight through.
 */

import ScratchViewer from '@/components/ScratchViewer';

export default async function FilesPage({
  params,
}: {
  params: Promise<{ path: string[] }>;
}) {
  const { path } = await params;
  const joined = (path || []).map(encodeURIComponent).join('/');
  return <ScratchViewer path={joined} apiBase="/api/files" topLabel="file" />;
}
