diff --git a/apps/nextjs/.env.example b/apps/nextjs/.env.example index 50845ee6a..624c05ee1 100644 --- a/apps/nextjs/.env.example +++ b/apps/nextjs/.env.example @@ -17,6 +17,10 @@ GOOGLE_CLIENT_SECRET= GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET= +# https://resend.com/settings/smtp +EMAIL_SERVER=smtp://username:password@smtp.example.com:587 +EMAIL_FROM=noreply@example.com + # Database DATABASE_URL="postgresql://user:pass@localhost:5432/fdai_test?schema=public" diff --git a/apps/nextjs/README.md b/apps/nextjs/README.md index 4b29ad152..2272a91e8 100644 --- a/apps/nextjs/README.md +++ b/apps/nextjs/README.md @@ -1,20 +1,32 @@ # FDAi Next.js Example App + This is an example app that demonstrates how to use the FDAi SDK with Next.js. ## Getting Started -Copy `.env.example` to `.env.local` file in the root of the project. The following environment variables are supported: +### Fork the repository + +First, fork the repository to your own GitHub account. + +### Clone the repository + +Clone the repository to your local machine. + + +Copy `.env.example` to `.env` file in the root of the project. The following environment variables are supported: [https://builder.fdai.earth](https://builder.fdai.earth) - `FDAI_CLIENT_ID`: The client ID of your FDAi app. - `FDAI_CLIENT_SECRET`: The client secret of your FDAi app. +See the .env file for how to get the rest of the required environment variables. + First, install the dependencies: ```bash -npm install +yarn install ``` Then, run the development server: diff --git a/apps/nextjs/app/(auth)/signin/page.tsx b/apps/nextjs/app/(auth)/signin/page.tsx index 6f0f07421..a9d7b87c0 100644 --- a/apps/nextjs/app/(auth)/signin/page.tsx +++ b/apps/nextjs/app/(auth)/signin/page.tsx @@ -1,14 +1,14 @@ import { Metadata } from "next" import Link from "next/link" - +import { siteConfig } from "@/config/site" import { cn } from "@/lib/utils" import { buttonVariants } from "@/components/ui/button" import { Icons } from "@/components/icons" import { UserAuthForm } from "@/components/user/user-auth-form" export const metadata: Metadata = { - title: "Enter Wishonia", - description: "Sign in to Wishonia", + title: siteConfig.name, + description: "Sign in to your account", } export default function Signin() { @@ -28,9 +28,9 @@ export default function Signin() {
-

Enter Wishonia

+

Sign In

- Please confirm your identity + Sign in and accelerate clinical discovery

@@ -40,7 +40,7 @@ export default function Signin() { href="/signup" className="hover:text-brand underline underline-offset-4" > - Become a citizen + Sign Up

diff --git a/apps/nextjs/app/(auth)/signup/page.tsx b/apps/nextjs/app/(auth)/signup/page.tsx index 8e4a7e52b..4000f04e4 100644 --- a/apps/nextjs/app/(auth)/signup/page.tsx +++ b/apps/nextjs/app/(auth)/signup/page.tsx @@ -29,10 +29,10 @@ export default function Signup() {

- Become a Citizen of Wishonia + Join the Decentralized FDA

- Select a provider to verify your identity + Become a citizen scientist and accelerate clinical discovery

diff --git a/apps/nextjs/app/api/causes/route.ts b/apps/nextjs/app/api/causes/route.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/conditions.ts b/apps/nextjs/app/api/conditions.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/conditions/route.ts b/apps/nextjs/app/api/conditions/route.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/treatments.ts b/apps/nextjs/app/api/treatments.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/treatments/route.ts b/apps/nextjs/app/api/treatments/route.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/user/causes/route.ts b/apps/nextjs/app/api/user/causes/route.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/user/conditions/route.ts b/apps/nextjs/app/api/user/conditions/route.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/api/user/treatments/route.ts b/apps/nextjs/app/api/user/treatments/route.ts new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/chat/layout.tsx b/apps/nextjs/app/chat/layout.tsx new file mode 100644 index 000000000..6e4c15f4f --- /dev/null +++ b/apps/nextjs/app/chat/layout.tsx @@ -0,0 +1,34 @@ +import { dashboardLinks } from "@/config/links" +import { getCurrentUser } from "@/lib/session" +import Footer from "@/components/layout/footer" +import Navbar from "@/components/layout/navbar" +import { DashboardNav } from "@/components/pages/dashboard/dashboard-nav" + +interface DashboardLayoutProps { + children: React.ReactNode +} + +export default async function DashboardLayout({ + children, +}: DashboardLayoutProps) { + const user = await getCurrentUser() + + return ( +
+ +
+ +
{children}
+
+
+
+ ) +} diff --git a/apps/nextjs/app/chat/page.tsx b/apps/nextjs/app/chat/page.tsx new file mode 100644 index 000000000..b8d71ea9e --- /dev/null +++ b/apps/nextjs/app/chat/page.tsx @@ -0,0 +1,38 @@ +import { Metadata } from "next" +import { redirect } from "next/navigation" + +import { authOptions } from "@/lib/auth" +import { getCurrentUser } from "@/lib/session" +import { Shell } from "@/components/layout/shell" +import { DashboardHeader } from "@/components/pages/dashboard/dashboard-header" +import ChatComponent from '@/components/chat-component'; + +export const metadata: Metadata = { + title: "Chat", + description: "Monitor your progress.", +} + +interface DashboardProps { + searchParams: { from: string; to: string } +} + +export default async function Dashboard({ searchParams }: DashboardProps) { + const user = await getCurrentUser() + + if (!user) { + redirect(authOptions?.pages?.signIn || "/signin") + } + + + const layout = "grid grid-cols-1 gap-4 md:grid-cols-2"; + + return ( + + + +
+ +
+
+ ) +} diff --git a/apps/nextjs/app/conditions/report/page.tsx b/apps/nextjs/app/conditions/report/page.tsx new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/app/survey/page.tsx b/apps/nextjs/app/survey/page.tsx new file mode 100644 index 000000000..52f237fa9 --- /dev/null +++ b/apps/nextjs/app/survey/page.tsx @@ -0,0 +1,17 @@ +import React from "react" +import dynamic from "next/dynamic" +import styled from "styled-components" +const SurveyComponent = dynamic(() => import("../components/survey"), { + ssr: false, +}) +const Container = styled.div` + margin: 2rem; +` +const Survey = () => { + return ( + + + + ) +} +export default Survey diff --git a/apps/nextjs/app/treatments/report/page.tsx b/apps/nextjs/app/treatments/report/page.tsx new file mode 100644 index 000000000..e69de29bb diff --git a/apps/nextjs/components/chat-component.tsx b/apps/nextjs/components/chat-component.tsx new file mode 100644 index 000000000..0f97e5f2f --- /dev/null +++ b/apps/nextjs/components/chat-component.tsx @@ -0,0 +1,37 @@ +"use client"; +import { FullPageChat } from 'flowise-embed-react'; + +export default function ChatComponent() { + return +} diff --git a/apps/nextjs/components/deep-chat-component.tsx b/apps/nextjs/components/deep-chat-component.tsx new file mode 100644 index 000000000..ffff07a07 --- /dev/null +++ b/apps/nextjs/components/deep-chat-component.tsx @@ -0,0 +1,86 @@ +"use client"; + +// !!Useful links at the bottom!! +// import {DeepChat as DeepChatCore} from 'deep-chat'; <- type +//import styles from './style.module.css'; +import dynamic from 'next/dynamic'; + +export default function DeepChatComponent() { + return + + const initialMessages = [ + { + html: ` +
+ + + +
`, + role: 'ai', + }, + // { role: 'user', text: 'Hey, how are you today?' }, + // { role: 'ai', text: 'I am doing very well!' }, + ]; + + // need to import the component dynamically as it uses the 'window' property + const DeepChat = dynamic( + () => import('deep-chat-react').then((mod) => mod.DeepChat), + { + ssr: false, + } + ); + + // demo/style/textInput are examples of passing an object directly into a property + // initialMessages is an example of passing a state object into the property + return ( + <> +
+

Deep Chat

+ +
+ + ); +} + +// Info to get a reference for the component: +// https://github.com/OvidijusParsiunas/deep-chat/issues/59#issuecomment-1839483469 + +// Info to add types to a component reference: +// https://github.com/OvidijusParsiunas/deep-chat/issues/59#issuecomment-1839487740 diff --git a/apps/nextjs/components/landing-navbar.tsx b/apps/nextjs/components/landing-navbar.tsx index c2f82d5e1..ea0f614a7 100644 --- a/apps/nextjs/components/landing-navbar.tsx +++ b/apps/nextjs/components/landing-navbar.tsx @@ -7,6 +7,7 @@ import Link from "next/link" import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import {useUserLoggedIn} from "@/lib/useUserLoggedIn"; +import { siteConfig } from "@/config/site"; const font = Montserrat({ weight: '600', subsets: ['latin'] }); @@ -19,7 +20,7 @@ export const LandingNavbar = () => { Logo

- Wishonia + {siteConfig.name}

@@ -31,4 +32,4 @@ export const LandingNavbar = () => {
) -} \ No newline at end of file +} diff --git a/apps/nextjs/components/layout/footer.tsx b/apps/nextjs/components/layout/footer.tsx index 66a214d9d..2ede7919a 100644 --- a/apps/nextjs/components/layout/footer.tsx +++ b/apps/nextjs/components/layout/footer.tsx @@ -6,45 +6,41 @@ import { siteConfig } from "@/config/site" import { ModeToggle } from "../mode-toggle" export default function Footer() { - return null; return (