Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions HIDDEN LIARS/AMANE/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}
37 changes: 37 additions & 0 deletions HIDDEN LIARS/AMANE/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
36 changes: 36 additions & 0 deletions HIDDEN LIARS/AMANE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
25 changes: 25 additions & 0 deletions HIDDEN LIARS/AMANE/app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ReactNode } from "react";
import { NavBar } from "../../components/navbar"; // Adjust the import path as needed

export default function AuthLayout({ children }: { children: ReactNode }) {
return (
<div className="relative min-h-screen w-full">
{/* Background image can be added here if needed */}
{/* <Image
src="/path-to-your-background-image.jpg"
alt="Background"
layout="fill"
objectFit="cover"
className="opacity-60"
/> */}

<NavBar />

<main className="relative z-10 flex min-h-screen flex-col items-center justify-center px-4 pt-24 md:pt-32">
<div className="w-full max-w-md space-y-8 bg-white dark:bg-zinc-900 p-8 rounded-xl shadow-lg">
{children}
</div>
</main>
</div>
);
}
51 changes: 51 additions & 0 deletions HIDDEN LIARS/AMANE/app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import Link from "next/link";
import GithubSignInButton from "@/app/components/GithubSigninButton";
import GoogleSignInButton from "@/app/components/GoogleSigninButton";
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/utils/auth";
import { redirect } from "next/navigation";

export default async function Login() {
const session = await getServerSession(authOptions);

if (session) {
return redirect("/home");
}

return (
<div className="mt-24 rounded py-10 px-6 md:mt-0 md:max-w-sm md:px-14 ">
<form method="post" action="/api/auth/signin">
<h1 className="text-3xl font-semibold text-black">Log in</h1>
<div className="space-y-4 mt-5">
<Input
type="email"
name="email"
placeholder="Email"
className="bg-gray-100 placeholder:text-xs placeholder:text-gray-500 text-black w-full inline-block"
/>
<Button
type="submit"
variant="default"
className="w-full text-white"
>
Log in
</Button>
</div>
</form>

<div className="text-gray-700 text-sm mt-2">
New to<span className="text-blue"> Amane</span>?{" "}
<Link className="text-blue-600 hover:underline" href="/signup">
Sign up now
</Link>
</div>

<div className="flex w-full justify-center items-center gap-x-3 mt-6">
<GithubSignInButton />
<GoogleSignInButton />
</div>
</div>
);
}
49 changes: 49 additions & 0 deletions HIDDEN LIARS/AMANE/app/(auth)/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import Link from "next/link";
import GithubSignInButton from "@/app/components/GithubSigninButton";
import GoogleSignInButton from "@/app/components/GoogleSigninButton";
import { getServerSession } from "next-auth";
import { authOptions } from "@/app/utils/auth";
import { redirect } from "next/navigation";

export default async function SignUp() {
const session = await getServerSession(authOptions);
if (session) {
return redirect("/home");
}
return (
<div className="mt-24 rounded bg-white/80 py-10 px-6 md:mt-0 md:max-w-sm md:px-14">
<form method="post" action="/api/auth/signin">
<h1 className="text-3xl font-semibold text-light-green">Sign Up</h1>
<div className="space-y-4 mt-5">
<Input
type="email"
name="email"
placeholder="Email"
className="bg-light-blue/20 placeholder:text-xs placeholder:text-gray-400 w-full inline-block"
/>
<Button
type="submit"
variant="destructive"
className="w-full bg-light-green hover:bg-light-green/80"
>
Sign Up
</Button>
</div>
</form>

<div className="text-gray-500 text-sm mt-2">
Already have an account?{" "}
<Link className="text-light-blue hover:underline" href="/login">
Log in now!
</Link>
</div>

<div className="flex w-full justify-center items-center gap-x-3 mt-6">
<GithubSignInButton />
<GoogleSignInButton />
</div>
</div>
);
}
6 changes: 6 additions & 0 deletions HIDDEN LIARS/AMANE/app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { authOptions } from "@/app/utils/auth"
import NextAuth from "next-auth"

const handler = NextAuth(authOptions)

export { handler as GET, handler as POST }
10 changes: 10 additions & 0 deletions HIDDEN LIARS/AMANE/app/api/auth/session/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getServerSession } from "next-auth/next";
import { authOptions } from "@/app/utils/auth";
import { NextResponse } from "next/server";

export async function GET() {
const session = await getServerSession(authOptions);
return NextResponse.json({
user: session?.user ?? null,
});
}
14 changes: 14 additions & 0 deletions HIDDEN LIARS/AMANE/app/components/GithubSigninButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use client";

import { Button } from "@/components/ui/button";
import { GithubIcon } from "lucide-react";
import { signIn } from "next-auth/react";

export default function GithubSigninButton() {
return(
<Button onClick={()=>signIn("github")}
variant="outline" size="icon">
<GithubIcon className=""/>
</Button>
)
}
14 changes: 14 additions & 0 deletions HIDDEN LIARS/AMANE/app/components/GoogleSigninButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use client";

import { Button } from "@/components/ui/button";
import Image from "next/image";
import GooogleIcon from "../../public/google.svg";
import { signIn } from "next-auth/react";

export default function GoogleSignInButton() {
return (
<Button onClick={() => signIn("google")} variant="outline" size="icon">
<Image src={GooogleIcon} alt="Google icon" className="w-6 h-6" />
</Button>
);
}
74 changes: 74 additions & 0 deletions HIDDEN LIARS/AMANE/app/components/IrrigationStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from "react";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { AlertTriangle, CheckCircle, Droplet, ShieldOff } from "lucide-react";

// Define the type for the card configurations
type CardConfig = {
key: string;
label: string;
icon: React.ComponentType<{ className?: string }>;
iconColor: string;
activeClassName: string;
};

// Define the props type
type IrrigationStatusCardsProps = {
modelResponse: string;
};

const IrrigationStatusCards: React.FC<IrrigationStatusCardsProps> = ({ modelResponse }) => {
// Predefined card configurations
const cardConfigs: CardConfig[] = [
{
key: "ALERT",
label: "Alert",
icon: AlertTriangle,
iconColor: "text-red-500",
activeClassName: "border-red-500 bg-red-50"
},
{
key: "No adjustment",
label: "No Adjustment",
icon: CheckCircle,
iconColor: "text-green-500",
activeClassName: "border-green-500 bg-green-50"
},
{
key: "Irrigation ON",
label: "Irrigation On",
icon: Droplet,
iconColor: "text-blue-500",
activeClassName: "border-blue-500 bg-blue-50"
},
{
key: "Irrigation OFF",
label: "Irrigation Off",
icon: ShieldOff,
iconColor: "text-gray-500",
activeClassName: "border-gray-500 bg-gray-50"
}
];

return (
<div className="grid grid-cols-2 gap-4">
{cardConfigs.map((config) => (
<Card
key={config.key}
className={`max-w-xs border-2 ${modelResponse === config.key ? config.activeClassName : "border-gray-300"}`}
>
<CardHeader>
<div className="flex items-center">
<config.icon className={`${config.iconColor} mr-2`} />
<CardTitle>{config.label}</CardTitle>
</div>
</CardHeader>
<CardContent>
{modelResponse === config.key ? "Active" : "Inactive"}
</CardContent>
</Card>
))}
</div>
);
};

export default IrrigationStatusCards;
62 changes: 62 additions & 0 deletions HIDDEN LIARS/AMANE/app/components/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"use client";
// import Image from "next/image";
// import Link from "next/link";
// import Logo from "../../public/netflix_logo.svg";
import { usePathname } from "next/navigation";
import { Bell, Search } from "lucide-react";
import UserNav from "./UserNav";

interface linkProps {
name: string;
href: string;
}

const links: linkProps[] = [
{ name: "Home", href: "/home" },
{ name: "Tv Shows", href: "/home/shows" },
{ name: "Movies", href: "/home/movies" },
{ name: "Recently Added", href: "/home/recently" },
{ name: "My List", href: "/home/user/list" },
];

export default function Navbar() {
const pathName = usePathname();
return (
<div className="w-full max-w-7xl mx-auto items-center justify-between px-5 sm:px-6 py-5 lg:px-8 flex shadow-md bg-grey bg-opacity-80">
<div className="flex items-center">
{/* Uncomment the following section if you want to show the links */}
{/* <ul className="lg:flex gap-x-4 ml-14 hidden">
{links.map((link, idx) => (
<div key={idx}>
{pathName === link.href ? (
<li>
<Link
href={link.href}
className="text-white font-semibold underline text-sm"
>
{link.name}
</Link>
</li>
) : (
<li>
<Link
className="text-gray-300 font-normal text-sm"
href={link.href}
>
{link.name}
</Link>
</li>
)}
</div>
))}
</ul> */}
</div>

<div className="flex items-center gap-x-8">
<Search className="w-6 h-6 text-gray-700 cursor-pointer transition-transform transform hover:scale-110" />
<Bell className="h-6 w-6 text-gray-700 cursor-pointer transition-transform transform hover:scale-110" />
<UserNav />
</div>
</div>
);
}
Loading