Skip to content

Commit

Permalink
Merge pull request #179 from mikepsinn/develop
Browse files Browse the repository at this point in the history
Lots of API documentation and other fixes
  • Loading branch information
mikepsinn authored Apr 16, 2024
2 parents 41b3cd6 + df3c06d commit 19c1e6e
Show file tree
Hide file tree
Showing 167 changed files with 2,508 additions and 1,439 deletions.
16 changes: 14 additions & 2 deletions apps/nextjs/README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 5 additions & 5 deletions apps/nextjs/app/(auth)/signin/page.tsx
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -28,9 +28,9 @@ export default function Signin() {
</Link>
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
<div className="flex flex-col space-y-2 text-center">
<h1 className="text-2xl font-semibold tracking-tight">Enter Wishonia</h1>
<h1 className="text-2xl font-semibold tracking-tight">Sign In</h1>
<p className="text-sm text-muted-foreground">
Please confirm your identity
Sign in to the Decentralized FDA and contribute to accelerating clinical discovery
</p>
</div>
<UserAuthForm />
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/app/(auth)/signup/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export default function Signup() {
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
<div className="flex flex-col space-y-2 text-center">
<h1 className="text-2xl font-semibold tracking-tight">
Become a Citizen of Wishonia
Join the Decentralized FDA
</h1>
<p className="text-sm text-muted-foreground">
Select a provider to verify your identity
Become a citizen scientist and accelerate clinical discovery
</p>
</div>
<UserAuthForm />
Expand Down
5 changes: 3 additions & 2 deletions apps/nextjs/components/landing-navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'] });

Expand All @@ -19,7 +20,7 @@ export const LandingNavbar = () => {
<Image fill alt="Logo" src="/logo.png" />
</div>
<h1 className={cn("text-2xl font-bold text-white", font.className)}>
Wishonia
{siteConfig.name}
</h1>
</Link>
<div className="flex items-center gap-x-2">
Expand All @@ -31,4 +32,4 @@ export const LandingNavbar = () => {
</div>
</nav>
)
}
}
52 changes: 24 additions & 28 deletions apps/nextjs/components/layout/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,41 @@ import { siteConfig } from "@/config/site"
import { ModeToggle } from "../mode-toggle"

export default function Footer() {
return null;
return (
<footer className="mt-auto">
<div className="mx-auto w-full max-w-screen-xl p-6 md:py-8">
<div className="sm:flex sm:items-center sm:justify-between">
<Link href="/">
<h1 className="mb-2 text-2xl font-bold sm:mb-0">
{siteConfig.name}
</h1>
</Link>
<ul className="mb-6 flex flex-wrap items-center opacity-60 sm:mb-0">
{navLinks.data.map((item, index) => {
return (
item.href && (
<li key={index}>
<Link
href={item.disabled ? "/" : item.href}
className="mr-4 hover:underline md:mr-6"
>
{item.title}
</Link>
</li>
<div className="mx-auto w-full max-w-screen-xl p-2 md:py-2">
<hr className="my-6 text-muted-foreground sm:mx-auto" />
<div className="flex items-center justify-center p-2">
<div className="sm:flex sm:items-center sm:justify-between">
<ul className="mb-8 flex flex-wrap items-center opacity-60 sm:mb-0">
{navLinks.data.map((item, index) => {
return (
item.href && (
<li key={index}>
<Link
href={item.disabled ? "/" : item.href}
className="mr-4 hover:underline md:mr-6"
>
{item.title}
</Link>
</li>
)
)
)
})}
</ul>
})}
</ul>
</div>
</div>
<hr className="my-6 text-muted-foreground sm:mx-auto" />
<div className="flex items-center justify-center">
<div id="copyright" className="flex items-center justify-center p-4">
<div className="block text-sm text-muted-foreground sm:text-center">
© {new Date().getFullYear()}{" "}
<a
target="_blank"
href="https://github.com/redpangilinan/Wishonia"
href="https://github.com/decentralized-fda"
className="hover:underline"
>
Wishonia App
{siteConfig.name}
</a>
. All Rights Reserved.
. Your Rights to Self-Experimentation Reserved.
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/components/loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Loader = () => {
/>
</div>
<p className="text-sm text-muted-foreground">
Wishonia is thinking...
FDAi is thinking...
</p>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions apps/nextjs/components/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { LayoutDashboard, MessageSquare, Settings } from "lucide-react";
import { usePathname } from "next/navigation";

import { cn } from "@/lib/utils";
import { siteConfig } from "@/config/site";

const poppins = Montserrat ({ weight: '600', subsets: ['latin'] });

Expand Down Expand Up @@ -47,13 +48,13 @@ export const Sidebar = ({
<Image fill alt="Logo" src="/logo.png" />
</div>
<h1 className={cn("text-2xl font-bold", poppins.className)}>
Wishonia
{siteConfig.name}
</h1>
</Link>
<div className="space-y-1">
{routes.map((route) => (
<Link
key={route.href}
key={route.href}
href={route.href}
className={cn(
"text-sm group flex p-3 w-full justify-start font-medium cursor-pointer hover:text-white hover:bg-white/10 rounded-lg transition",
Expand Down
3 changes: 1 addition & 2 deletions apps/nextjs/components/userVariable/user-variable-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export function UserVariableList() {
fetch('/api/userVariables')
.then(response => response.json())
.then(userVariables => {
debugger
console.log(userVariables);
//console.log("Got userVariables", userVariables);
setUserVariables(userVariables);
})
.catch(error => console.error('Error fetching war images:', error));
Expand Down
4 changes: 3 additions & 1 deletion apps/nextjs/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { SiteConfig } from "@/types"
import { env } from "@/env.mjs"

export const siteConfig: SiteConfig = {
name: "FDAi",
name: "The Decentralized FDA",
author: "The Decentralized FDA",
description:
"Using a to determine the effects of every food and drug in the world!",
keywords: [
],
url: {
base: env.NEXT_PUBLIC_APP_URL,
author: "The Decentralized FDA",
},
links: {
github: "https://github.com/FDA-AI/FDAi",
Expand Down
2 changes: 2 additions & 0 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"cmdk": "^0.2.0",
"date-fns": "^3.3.1",
"dotenv": "16.4.5",
"flowise-embed": "^1.2.1",
"flowise-embed-react": "^1.0.2",
"fs-extra": "^11.2.0",
"glob": "^10.3.12",
"gray-matter": "^4.0.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/AppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import { User } from '../models/User';
import { HttpFile } from '../http/http';


export class AppSettings {
'additionalSettings'?: any;
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/AppSettingsResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { AppSettings } from '../models/AppSettings';
import { Card } from '../models/Card';
import { ErrorResponse } from '../models/ErrorResponse';
import { HttpFile } from '../http/http';


export class AppSettingsResponse {
'appSettings'?: AppSettings;
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/AuthorizedClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import { AppSettings } from '../models/AppSettings';
import { HttpFile } from '../http/http';


export class AuthorizedClients {
/**
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/types/models/Button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* A platform for quantifying the effects of every drug, supplement, food, and other factor on your health.
*
* OpenAPI spec version: 0.0.1
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';


export class Button {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { Button } from '../models/Button';
import { InputField } from '../models/InputField';
import { HttpFile } from '../http/http';


export class Card {
'actionSheetButtons'?: Array<Button>;
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/types/models/Chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* A platform for quantifying the effects of every drug, supplement, food, and other factor on your health.
*
* OpenAPI spec version: 0.0.1
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';


export class Chart {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/CommonResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { Card } from '../models/Card';
import { ErrorResponse } from '../models/ErrorResponse';
import { HttpFile } from '../http/http';


export class CommonResponse {
/**
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/types/models/ConnectInstructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* A platform for quantifying the effects of every drug, supplement, food, and other factor on your health.
*
* OpenAPI spec version: 0.0.1
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';


export class ConnectInstructions {
/**
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/types/models/ConversionStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* A platform for quantifying the effects of every drug, supplement, food, and other factor on your health.
*
* OpenAPI spec version: 0.0.1
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';


export class ConversionStep {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/Correlation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { StudyHtml } from '../models/StudyHtml';
import { StudyImages } from '../models/StudyImages';
import { StudyLinks } from '../models/StudyLinks';
import { StudyText } from '../models/StudyText';
import { HttpFile } from '../http/http';


export class Correlation {
/**
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs/types/models/DataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { Button } from '../models/Button';
import { Card } from '../models/Card';
import { ConnectInstructions } from '../models/ConnectInstructions';
import { HttpFile } from '../http/http';


export class DataSource {
/**
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/types/models/DeviceToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* A platform for quantifying the effects of every drug, supplement, food, and other factor on your health.
*
* OpenAPI spec version: 0.0.1
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';


export class DeviceToken {
/**
Expand Down
Loading

0 comments on commit 19c1e6e

Please sign in to comment.