File size: 3,419 Bytes
dc11950
 
4dc66a3
 
 
 
345b8ff
dc11950
 
4dc66a3
 
dc11950
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4dc66a3
 
 
 
 
 
 
 
 
 
345b8ff
 
 
 
 
 
4dc66a3
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"use client";

import Link from "next/link";

import { KnowledgeBasePanel } from "@/components/knowledge-base-panel";
import { Footer } from "@/components/footer";
import { TenantSelector } from "@/components/tenant-selector";
import { useTenant } from "@/contexts/TenantContext";
import { canIngestDocuments } from "@/lib/permissions";

export default function IngestionPage() {
  const { role } = useTenant();

  if (!canIngestDocuments(role)) {
    return (
      <main className="mx-auto flex min-h-screen max-w-5xl flex-col gap-10 px-4 pb-16 pt-12 sm:px-6 lg:px-8">
        <header className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-white/5 px-6 py-6 text-slate-100 shadow-lg shadow-slate-950/40">
          <div className="flex items-center justify-between gap-3">
            <div className="flex items-center gap-3 text-base font-semibold">
              <span className="inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-gradient-to-br from-sky-400 to-cyan-500 text-slate-950">
                IC
              </span>
              IntegraChat · Data Ingestion
            </div>
            <div className="flex items-center gap-4">
              <TenantSelector />
              <Link href="/" className="text-xs font-semibold uppercase tracking-[0.3em] text-cyan-300 hover:text-white">
                ← Back Home
              </Link>
            </div>
          </div>
        </header>

        <div className="rounded-2xl border border-red-500/50 bg-red-500/10 p-8 text-center">
          <h2 className="text-2xl font-bold text-red-300 mb-2">Access Denied</h2>
          <p className="text-slate-300 mb-4">
            You need <strong>Editor</strong>, <strong>Admin</strong>, or <strong>Owner</strong> role to ingest documents.
          </p>
          <p className="text-sm text-slate-400">
            Your current role: <strong className="text-slate-200">{role.charAt(0).toUpperCase() + role.slice(1)}</strong>
          </p>
          <p className="text-sm text-slate-400 mt-2">
            Please switch your role using the dropdown in the header.
          </p>
        </div>
        <Footer />
      </main>
    );
  }

  return (
    <main className="mx-auto flex min-h-screen max-w-5xl flex-col gap-10 px-4 pb-16 pt-12 sm:px-6 lg:px-8">
      <header className="flex flex-col gap-4 rounded-2xl border border-white/10 bg-white/5 px-6 py-6 text-slate-100 shadow-lg shadow-slate-950/40">
        <div className="flex items-center justify-between gap-3">
          <div className="flex items-center gap-3 text-base font-semibold">
            <span className="inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-gradient-to-br from-sky-400 to-cyan-500 text-slate-950">
              IC
            </span>
            IntegraChat · Data Ingestion
          </div>
          <div className="flex items-center gap-4">
            <TenantSelector />
            <Link href="/" className="text-xs font-semibold uppercase tracking-[0.3em] text-cyan-300 hover:text-white">
              ← Back Home
            </Link>
          </div>
        </div>
        <p className="text-sm text-slate-300">
          Upload raw text, URLs, or documents to feed the tenant-specific RAG index. All inputs flow into the FastAPI +
          MCP ingestion pipeline.
        </p>
      </header>

      <KnowledgeBasePanel />
      <Footer />
    </main>
  );
}