From 529bada5190ed8e8dd0ebb875dd641622c9121ac Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 10:05:40 -0400 Subject: [PATCH 01/83] admin navbar init --- src/app/components/NavBarAdmin.tsx | 154 +++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 src/app/components/NavBarAdmin.tsx diff --git a/src/app/components/NavBarAdmin.tsx b/src/app/components/NavBarAdmin.tsx new file mode 100644 index 0000000..517c46d --- /dev/null +++ b/src/app/components/NavBarAdmin.tsx @@ -0,0 +1,154 @@ +// Navbar.client.js +"use client"; +import { useState } from 'react'; +import Link from "next/link"; +import { signIn, signOut, useSession } from "next-auth/react"; + +const NavbarAdmin: React.FC = () => { + const [isOpen, setIsOpen] = useState(false); + const { data: session } = useSession(); + + return ( + <> + + + + + + + + ); +}; + +export default NavbarAdmin; From aa106a1b855079ee9aed32757a6629b3fb3cb4a6 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 10:06:06 -0400 Subject: [PATCH 02/83] logo path + documentation website link updated --- src/app/components/Navbar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/Navbar.tsx b/src/app/components/Navbar.tsx index 75f9339..24734c5 100644 --- a/src/app/components/Navbar.tsx +++ b/src/app/components/Navbar.tsx @@ -12,7 +12,7 @@ const Navbar: React.FC = () => { className="bg-white dark:bg-gray-900 fixed w-full z-20 top-0 start-0 border-b border-gray-200 dark:border-gray-600">
- BrainKB Logo + BrainKB Logo BrainKB @@ -73,7 +73,7 @@ const Navbar: React.FC = () => {
  • - Documentation From de5ea0c01730ce70727e1cb4db74e8ff0734584a Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 10:06:21 -0400 Subject: [PATCH 03/83] layout updated --- src/app/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 745a1b1..ca6b78b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -34,7 +34,7 @@ export default async function RootLayout({ -
    +
    {children}
    From ea20f081e30c5dbfc491af9c2040050062b30b8d Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 10:06:56 -0400 Subject: [PATCH 04/83] admin pages + layout init --- src/app/admin/configure/page.tsx | 147 +++++++++++++++++++++++++++++++ src/app/admin/layout.tsx | 43 +++++++++ src/app/admin/page.tsx | 100 ++++++++++++++++++++- 3 files changed, 287 insertions(+), 3 deletions(-) create mode 100644 src/app/admin/configure/page.tsx create mode 100644 src/app/admin/layout.tsx diff --git a/src/app/admin/configure/page.tsx b/src/app/admin/configure/page.tsx new file mode 100644 index 0000000..7355975 --- /dev/null +++ b/src/app/admin/configure/page.tsx @@ -0,0 +1,147 @@ +"use Client"; +import type { Metadata } from "next"; +import { getServerSession } from "next-auth"; +import { redirect } from "next/navigation"; +export const metadata: Metadata = { + title:"Admin", + +}; +export default async function AdminIndex(){ + const session = await getServerSession(); + if (!session || !session.user) { + redirect("/login"); + } + return ( + <> + + + +
    +
    +

    + Welcome + +

    + +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    + + + + + ); +} \ No newline at end of file diff --git a/src/app/admin/layout.tsx b/src/app/admin/layout.tsx new file mode 100644 index 0000000..6a22a87 --- /dev/null +++ b/src/app/admin/layout.tsx @@ -0,0 +1,43 @@ +import type { Metadata } from "next"; +import { Inter } from "next/font/google"; +import "../globals.css"; +import NavbarAdmin from "@/src/app/components/NavbarAdmin"; +import FooterAdmin from "@/src/app/components/FooterAdmin"; +import { getServerSession } from "next-auth"; +import SessionProvider from "@/src/app/components/SessionProvider"; + + +const inter = Inter({ subsets: ["latin"] }); + + + +export default async function AdminRootLayout({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + const session = await getServerSession(); + + return ( + +
    + +
    +
    +
    + + {children} +
    + +
    + + + +
    + @ +
    +
    + +) + ; +} diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index e2aceb8..50ae03b 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -13,8 +13,102 @@ export default async function AdminIndex(){ } return ( <> -

    Admin Page

    -

    Signed in as {session.user.email}

    - + +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    +

    + +

    +
    +
    + + ); } \ No newline at end of file From 004b203012d86f4d6160e28d54f942fb6e158a33 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 11:43:09 -0400 Subject: [PATCH 05/83] profile + logout option added in menu --- src/app/components/NavBarAdmin.tsx | 52 ++++++++++++------------------ 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/src/app/components/NavBarAdmin.tsx b/src/app/components/NavBarAdmin.tsx index 517c46d..0c790fc 100644 --- a/src/app/components/NavBarAdmin.tsx +++ b/src/app/components/NavBarAdmin.tsx @@ -26,37 +26,27 @@ const NavbarAdmin: React.FC = () => {
  • -
    -
    - -
    - +
    + {session ? ( + <> + + {isOpen && ( +
    + Profile + +
    + )} + + ) : ( + + Login + + + )}
    From ec7a977f7048c8345d045d4f87aa9ff8d1d99431 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 11:43:24 -0400 Subject: [PATCH 06/83] redirect to admin to loggedin users --- src/app/about/page.tsx | 8 +++++++- src/app/page.tsx | 22 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/app/about/page.tsx b/src/app/about/page.tsx index 74af681..54d2377 100644 --- a/src/app/about/page.tsx +++ b/src/app/about/page.tsx @@ -1,11 +1,17 @@ import type { Metadata } from "next"; +import {getServerSession} from "next-auth"; +import {authOptions} from "@/lib/auth"; +import {redirect} from "next/navigation"; export const metadata: Metadata = { title:"About", }; -export default function About(){ +export default async function About(){ + const current_session = await getServerSession(authOptions); + //user is logged in so redirect to admin page + if (current_session) return redirect("/admin"); return (
    diff --git a/src/app/page.tsx b/src/app/page.tsx index ba9d9e3..77c7175 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,11 +1,16 @@ import type { Metadata } from "next"; - +import { getServerSession } from "next-auth"; +import { redirect, useRouter } from "next/navigation"; +import { authOptions } from "@/lib/auth"; export const metadata: Metadata = { title:"Home", }; -export default function Home() { +export default async function Home() { + const current_session = await getServerSession(authOptions); + //user is logged in so redirect to admin page + if (current_session) return redirect("/admin"); return (
    @@ -19,8 +24,21 @@ export default function Home() {

    Facilitating Evidence-Based Decision Making to Unlock the Mysteries of the Mind

    +
    +
    +
    +
    +

    + Connected Models +

    +
    +
    +

    + List os struc +

    +
    ); From caf76f751dcbacb2107f1e897bf2947aab5b4d4f Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Fri, 28 Jun 2024 11:48:08 -0400 Subject: [PATCH 07/83] redirect added to admin + contact page issue 404, fixed --- src/app/contact/contact.tsx | 12 ------------ src/app/contact/page.tsx | 18 ++++++++++++++++++ src/app/knowledge-base/page.tsx | 8 +++++++- 3 files changed, 25 insertions(+), 13 deletions(-) delete mode 100644 src/app/contact/contact.tsx create mode 100644 src/app/contact/page.tsx diff --git a/src/app/contact/contact.tsx b/src/app/contact/contact.tsx deleted file mode 100644 index d01d011..0000000 --- a/src/app/contact/contact.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import type { Metadata } from "next"; - -export const metadata: Metadata = { - title:"Contact", - -}; - -export default function Contact(){ - return ( -

    Contact Page

    - ); -} \ No newline at end of file diff --git a/src/app/contact/page.tsx b/src/app/contact/page.tsx new file mode 100644 index 0000000..3c73e4b --- /dev/null +++ b/src/app/contact/page.tsx @@ -0,0 +1,18 @@ +import type { Metadata } from "next"; +import {getServerSession} from "next-auth"; +import {authOptions} from "@/lib/auth"; +import {redirect} from "next/navigation"; + +export const metadata: Metadata = { + title:"Contact", + +}; + +export default async function Contact(){ + const current_session = await getServerSession(authOptions); + //user is logged in so redirect to admin page + if (current_session) return redirect("/admin"); + return ( +

    Contact Page

    + ); +} \ No newline at end of file diff --git a/src/app/knowledge-base/page.tsx b/src/app/knowledge-base/page.tsx index 6f1824e..0d01f8c 100644 --- a/src/app/knowledge-base/page.tsx +++ b/src/app/knowledge-base/page.tsx @@ -1,11 +1,17 @@ import type { Metadata } from "next"; +import {getServerSession} from "next-auth"; +import {authOptions} from "@/lib/auth"; +import {redirect} from "next/navigation"; export const metadata: Metadata = { title:"Knowledge Base", }; -export default function KnowledgeBase(){ +export default async function KnowledgeBase(){ + const current_session = await getServerSession(authOptions); + //user is logged in so redirect to admin page + if (current_session) return redirect("/admin"); return (

    Knowledge Base

    ); From a1b57abbc96d3a763d2b62588e57c827b1c806d2 Mon Sep 17 00:00:00 2001 From: Tek Raj Chhetri Date: Mon, 1 Jul 2024 15:09:05 -0400 Subject: [PATCH 08/83] configure page template structure created --- .dockerignore | 8 + .gitignore | 7 + src/app/admin/configure/page.tsx | 395 +++++++++++++++++++++---------- 3 files changed, 289 insertions(+), 121 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..4c7db2f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +Dockerfile +.dockerignore +node_modules +npm-debug.log +README.md +.next +docker +.git \ No newline at end of file diff --git a/.gitignore b/.gitignore index dc7da36..26b880e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,13 @@ # production /build +node_modules +build +.next +.git +.DS_Store + + #env file .env # misc diff --git a/src/app/admin/configure/page.tsx b/src/app/admin/configure/page.tsx index 7355975..477b14c 100644 --- a/src/app/admin/configure/page.tsx +++ b/src/app/admin/configure/page.tsx @@ -13,134 +13,287 @@ export default async function AdminIndex(){ } return ( <> + {/* titles for configure options */} +
    +
    +

    + Step 1
    + Query Endpoint Configuration +

    +
    +
    +

    + Step 2
    + Knowledge Base Page Configuration +

    +
    +
    +
    + {/* Step 1 form */} +
    + {/* Step 1 input form configure query endpoints */} +
    +
    + + +
    +
    + + +
    -
    -
    -

    - Welcome - -

    - -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -
    -

    - -

    -
    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -

    - -

    -
    -
    -
    -

    - -

    + +
    + + +
    + + + +
    + {/* Step 2 */} +
    + {/* Step 2 input form configure knowledge base pages */} +
    +
    + + +
    + +
    + +