add brain name to explore and upload page (#708)

This commit is contained in:
Zineb El Bachiri 2023-07-19 13:51:53 +02:00 committed by GitHub
parent aa7bc483c2
commit bc33528297
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View File

@ -1,29 +1,39 @@
/* eslint-disable */
"use client";
import { AnimatePresence, motion } from "framer-motion";
import Link from "next/link";
import Button from "@/lib/components/ui/Button";
import Spinner from "@/lib/components/ui/Spinner";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
import { useSupabase } from "@/lib/context/SupabaseProvider";
import { redirectToLogin } from "@/lib/router/redirectToLogin";
import DocumentItem from "./DocumentItem";
import { useExplore } from "./hooks/useExplore";
const ExplorePage = (): JSX.Element => {
const { session } = useSupabase();
const { documents, setDocuments, isPending } = useExplore();
const { currentBrain } = useBrainContext();
if (session === null) {
redirectToLogin();
}
if (currentBrain === undefined) {
return (
<div className="flex flex-col items-center justify-center mt-10 gap-1">
<p className="text-center">
{"You need to select a brain first. 🧠💡🥲"}
</p>
</div>
);
}
return (
<main>
<section className="w-full outline-none pt-10 flex flex-col gap-5 items-center justify-center p-6">
<div className="flex flex-col items-center justify-center">
<h1 className="text-3xl font-bold text-center">
Explore uploaded data
Explore uploaded data in {currentBrain.name}
</h1>
<h2 className="opacity-50">
View or delete stored data used by your brain

View File

@ -1,13 +1,12 @@
/* eslint-disable */
"use client";
import Link from "next/link";
import { BrainRoleType } from "@/lib/components/NavBar/components/NavItems/components/BrainsDropDown/components/BrainActions/types";
import Button from "@/lib/components/ui/Button";
import { Divider } from "@/lib/components/ui/Divider";
import PageHeading from "@/lib/components/ui/PageHeading";
import { BrainRoleType } from "@/lib/components/NavBar/components/NavItems/components/BrainsDropDown/components/BrainActions/types";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
import { Crawler } from "./components/Crawler";
import { FileUploader } from "./components/FileUploader";
@ -22,16 +21,14 @@ const UploadPage = (): JSX.Element => {
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative max-w-md">
<strong className="font-bold mr-1">Oh no!</strong>
<span className="block sm:inline">
You need to select a brain first. 🧠💡🥲
{"You need to select a brain first. 🧠💡🥲"}
</span>
</div>
</div>
);
}
const hasUploadRights =
currentBrain?.rights !== undefined &&
requiredRolesForUpload.includes(currentBrain?.rights);
const hasUploadRights = requiredRolesForUpload.includes(currentBrain.rights);
if (!hasUploadRights) {
return (
@ -39,8 +36,9 @@ const UploadPage = (): JSX.Element => {
<div className="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative max-w-md">
<strong className="font-bold mr-1">Oh no!</strong>
<span className="block sm:inline">
You don't have the necessary rights to upload content to the
selected brain. 🧠💡🥲
{
"You don't have the necessary rights to upload content to the selected brain. 🧠💡🥲"
}
</span>
</div>
</div>
@ -50,7 +48,7 @@ const UploadPage = (): JSX.Element => {
return (
<main className="pt-10">
<PageHeading
title="Upload Knowledge"
title={`Upload Knowledge to ${currentBrain.name}`}
subtitle="Text, document, spreadsheet, presentation, audio, video, and URLs supported"
/>
<FileUploader />