+ );
+}
diff --git a/src/app/favicon.ico b/src/app/favicon.ico
new file mode 100644
index 0000000..718d6fe
Binary files /dev/null and b/src/app/favicon.ico differ
diff --git a/src/app/forms/page.tsx b/src/app/forms/page.tsx
deleted file mode 100644
index c8bffcc..0000000
--- a/src/app/forms/page.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import Layout from "~/components/layout";
-import { FormsGrid } from "~/components/forms/FormsGrid";
-import { UploadFormButton } from "~/components/forms/UploadFormButton";
-import { Card, CardHeader, CardTitle, CardContent } from "~/components/ui/card";
-
-export default function FormsPage() {
- return (
-
-
-
-
- Forms
-
-
-
-
-
-
-
-
- );
-}
\ No newline at end of file
diff --git a/src/styles/globals.css b/src/app/globals.css
similarity index 83%
rename from src/styles/globals.css
rename to src/app/globals.css
index 451168a..60eb781 100644
--- a/src/styles/globals.css
+++ b/src/app/globals.css
@@ -2,6 +2,10 @@
@tailwind components;
@tailwind utilities;
+body {
+ font-family: Arial, Helvetica, sans-serif;
+}
+
@layer base {
:root {
--background: 210 50% 98%;
@@ -100,42 +104,3 @@
@apply bg-background text-foreground;
}
}
-
-@keyframes bounce {
- 0%, 20%, 50%, 80%, 100% {
- transform: translateY(0);
- }
- 40% {
- transform: translateY(-10px);
- }
- 60% {
- transform: translateY(-5px);
- }
-}
-
-.animate-bounce {
- animation: bounce 1s infinite;
-}
-
-@keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
-}
-
-.spinner {
- border: 4px solid rgba(255, 255, 255, 0.3);
- border-top: 4px solid #3498db;
- border-radius: 50%;
- width: 40px;
- height: 40px;
- animation: spin 1s linear infinite;
-}
-
-.fade-in {
- animation: fadeIn 0.5s ease-in-out;
-}
-
-@keyframes fadeIn {
- from { opacity: 0; }
- to { opacity: 1; }
-}
\ No newline at end of file
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index f67bf0a..47321df 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,31 +1,26 @@
-import { ClerkProvider } from '@clerk/nextjs'
-import { Inter } from "next/font/google"
-import { StudyProvider } from '~/context/StudyContext'
-import { ThemeProvider } from '~/components/ThemeProvider'
-import "~/styles/globals.css"
+import {
+ ClerkProvider,
+ SignInButton,
+ SignedIn,
+ SignedOut,
+ UserButton
+} from '@clerk/nextjs'
+import './globals.css'
+import { Button } from '~/components/ui/button';
+import { Inter } from 'next/font/google';
-const inter = Inter({
- subsets: ["latin"],
- display: "swap",
- variable: "--font-sans",
-})
+const inter = Inter({ subsets: ['latin'] });
-export const metadata = {
- title: "HRIStudio",
- description: "Created with create-t3-app",
- icons: [{ rel: "icon", url: "/favicon.ico" }],
-}
-
-export default function RootLayout({ children }: React.PropsWithChildren) {
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
return (
-
-
-
-
- {children}
-
-
+
+
+ {children}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 686ee6a..b5cf829 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,74 +1,38 @@
-import Link from 'next/link';
-import Image from 'next/image';
-import { auth } from "@clerk/nextjs/server";
-import { redirect } from "next/navigation";
+'use client';
-export default function HomePage() {
- const { userId } = auth();
+import { SignedIn, SignedOut, SignInButton, SignOutButton, UserButton, useUser } from "@clerk/nextjs";
+import { Button } from "~/components/ui/button";
+import { useEffect, useState } from "react";
- if (userId) {
- redirect("/dash");
+export default function Home() {
+ const { user, isLoaded } = useUser(); // Get user information and loading state
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ if (isLoaded) {
+ setLoading(false);
+ }
+ }, [isLoaded]);
+
+ if (loading) {
+ return
Loading...
; // Show a loading state while fetching user data
}
return (
-
-
-
-
Welcome to HRIStudio
-
- Empowering Human-Robot Interaction Research and Development
-
-
-
-
-
-
About HRIStudio
-
- HRIStudio is a cutting-edge platform designed to streamline the process of creating,
- managing, and analyzing Human-Robot Interaction experiments. Our suite of tools
- empowers researchers and developers to push the boundaries of HRI research.
-
-
- With HRIStudio, you can:
-
-
-
Design complex interaction scenarios with ease
-
Collect and analyze data in real-time
-
Collaborate seamlessly with team members
-
Visualize results with advanced reporting tools
-
-
-
-
-
-
-
-
-
Join the HRI Revolution
-
- Whether you're a seasoned researcher or just starting in the field of Human-Robot Interaction,
- HRIStudio provides the tools and support you need to succeed.
-
-
-
- Sign In
-
-
- Sign Up
-
-
-
-
-
-
+
+
Welcome to HRIStudio
+
+
+
+
+
+
+
+
Signed in as: {user?.emailAddresses[0].emailAddress}
{/* Display user's email */}
+
+
+
+
);
-}
\ No newline at end of file
+}
diff --git a/src/app/participants/page.tsx b/src/app/participants/page.tsx
deleted file mode 100644
index aae21d0..0000000
--- a/src/app/participants/page.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import Layout from "~/components/layout";
-import { Participants } from "~/components/participant/Participants";
-
-const ParticipantsPage = () => {
- return (
-
-
-
- );
-};
-
-export default ParticipantsPage;
\ No newline at end of file
diff --git a/src/app/sign-in/[[...sign-in]]/page.tsx b/src/app/sign-in/[[...sign-in]]/page.tsx
deleted file mode 100644
index 4f6f89b..0000000
--- a/src/app/sign-in/[[...sign-in]]/page.tsx
+++ /dev/null
@@ -1,143 +0,0 @@
-"use client"
-
-import { useState } from "react"
-import { useSignIn, useSignUp } from "@clerk/nextjs"
-import { useRouter } from "next/navigation"
-import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "~/components/ui/card"
-import { Input } from "~/components/ui/input"
-import { Button } from "~/components/ui/button"
-import { Separator } from "~/components/ui/separator"
-import Link from "next/link"
-import { FcGoogle } from "react-icons/fc"
-import { FaApple } from "react-icons/fa"
-
-export default function SignInPage() {
- const { isLoaded, signIn, setActive } = useSignIn();
- const { signUp } = useSignUp();
- const [emailAddress, setEmailAddress] = useState("");
- const [password, setPassword] = useState("");
- const router = useRouter();
-
- const handleSubmit = async (e: React.FormEvent) => {
- e.preventDefault();
- if (!isLoaded) return;
-
- try {
- const result = await signIn.create({
- identifier: emailAddress,
- password,
- });
-
- if (result.status === "complete") {
- await setActive({ session: result.createdSessionId });
- router.push("/dash");
- }
- } catch (err) {
- const error = err as { errors?: { message: string }[] };
- console.error("Error:", error.errors?.[0]?.message ?? "Unknown error");
-
- // If the error indicates the user does not exist, trigger sign-up
- if (error.errors?.[0]?.message.includes("not found")) {
- if (!signUp) {
- console.error("Sign-up functionality is not available.");
- return;
- }
-
- try {
- const signUpResult = await signUp.create({
- emailAddress,
- password,
- });
-
- if (signUpResult.status === "complete") {
- await setActive({ session: signUpResult.createdSessionId });
-
- // Create a user entry in the database
- const response = await fetch('/api/users', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ email: emailAddress }),
- });
-
- if (!response.ok) {
- const errorData = await response.json();
- console.error("Error creating user in database:", errorData.error);
- return; // Optionally handle the error (e.g., show a message to the user)
- }
-
- router.push("/dash");
- }
- } catch (signUpErr) {
- const signUpError = signUpErr as { errors?: { message: string }[] };
- console.error("Sign-up Error:", signUpError.errors?.[0]?.message ?? "Unknown error");
- }
- }
- }
- }
-
- const signInWith = (strategy: "oauth_google" | "oauth_apple") => {
- if (!isLoaded) return
- signIn.authenticateWithRedirect({
- strategy,
- redirectUrl: "/sso-callback",
- redirectUrlComplete: "/dash",
- }).catch((error) => {
- console.error("Authentication error:", error); // Handle any potential errors
- })
- }
-
- return (
-
-
-
- Sign in to HRIStudio
- Enter your email and password to sign in
-
-
-
-
-
-
-
-
-
-
-
- Don't have an account?{" "}
-
- Sign up
-
-
-
-
-
- )
-}
\ No newline at end of file
diff --git a/src/app/sign-up/[[...sign-up]]/page.tsx b/src/app/sign-up/[[...sign-up]]/page.tsx
deleted file mode 100644
index af36baa..0000000
--- a/src/app/sign-up/[[...sign-up]]/page.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-"use client"
-
-import { useState } from "react"
-import { useSignUp } from "@clerk/nextjs"
-import { useRouter } from "next/navigation"
-import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "~/components/ui/card"
-import { Input } from "~/components/ui/input"
-import { Button } from "~/components/ui/button"
-import { Separator } from "~/components/ui/separator"
-import Link from "next/link"
-import { FcGoogle } from "react-icons/fc"
-import { FaApple } from "react-icons/fa"
-
-export default function SignUpPage() {
- const { isLoaded, signUp, setActive } = useSignUp()
- const [emailAddress, setEmailAddress] = useState("")
- const [password, setPassword] = useState("")
- const router = useRouter()
-
- const handleSubmit = async (e: React.FormEvent) => {
- e.preventDefault()
- if (!isLoaded) return
-
- try {
- const result = await signUp.create({
- emailAddress,
- password,
- })
-
- if (result.status === "complete") {
- await setActive({ session: result.createdSessionId })
-
- // Create a user entry in the database
- const response = await fetch('/api/users', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ email: emailAddress }),
- })
-
- if (!response.ok) {
- const errorData = await response.json()
- console.error("Error creating user in database:", errorData.error)
- return // Optionally handle the error (e.g., show a message to the user)
- }
-
- router.push("/dash")
- }
- } catch (err) {
- const error = err as { errors?: { message: string }[] }; // Specify type
- console.error("Error:", error.errors?.[0]?.message ?? "Unknown error") // Use optional chaining
- }
- }
-
- const signUpWith = (strategy: "oauth_google" | "oauth_apple") => {
- if (!isLoaded) return
- signUp.authenticateWithRedirect({
- strategy,
- redirectUrl: "/sso-callback",
- redirectUrlComplete: "/dash",
- }).catch((error) => {
- console.error("Authentication error:", error); // Handle any potential errors
- })
- }
-
- return (
-
-
-
- Sign up for HRIStudio
- Create an account to get started
-
-
-
-
-
-
-
-
-
-
-
- Already have an account?{" "}
-
- Sign in
-
-
-
-
-
- )
-}
\ No newline at end of file
diff --git a/src/app/studies/page.tsx b/src/app/studies/page.tsx
deleted file mode 100644
index 1b485c6..0000000
--- a/src/app/studies/page.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import Layout from "~/components/layout";
-import { Studies } from "~/components/study/Studies";
-
-export default function StudiesPage() {
- return (
-
-
-
- );
-}
\ No newline at end of file
diff --git a/src/app/trials/page.tsx b/src/app/trials/page.tsx
deleted file mode 100644
index d8b97e9..0000000
--- a/src/app/trials/page.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import Layout from "~/components/layout";
-import { Trials } from "~/components/trial/Trials";
-
-export default function TrialsPage() {
- return (
-
-
-
- );
-}
diff --git a/src/components/ThemeProvider.tsx b/src/components/ThemeProvider.tsx
deleted file mode 100644
index e953b44..0000000
--- a/src/components/ThemeProvider.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-"use client"
-
-import { ThemeProvider as NextThemesProvider } from "next-themes"
-import { type ThemeProviderProps } from "next-themes/dist/types"
-import { useEffect, useState } from "react"
-
-export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
- const [mounted, setMounted] = useState(false)
-
- useEffect(() => {
- setMounted(true)
- const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
- const handleChange = () => {
- document.documentElement.classList.toggle('dark', mediaQuery.matches)
- }
- mediaQuery.addListener(handleChange)
- handleChange() // Initial check
- return () => mediaQuery.removeListener(handleChange)
- }, [])
-
- if (!mounted) {
- return null
- }
-
- return (
-
- {children}
-
- )
-}
\ No newline at end of file
diff --git a/src/components/ThemeToggle.tsx b/src/components/ThemeToggle.tsx
deleted file mode 100644
index 7e22b95..0000000
--- a/src/components/ThemeToggle.tsx
+++ /dev/null
@@ -1,67 +0,0 @@
-"use client"
-
-import { useTheme } from "next-themes"
-import { Button } from "~/components/ui/button"
-import { MoonIcon, SunIcon, LaptopIcon } from "lucide-react"
-import { useEffect, useState } from "react"
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "~/components/ui/popover"
-
-export function ThemeToggle() {
- const { theme, setTheme } = useTheme()
- const [mounted, setMounted] = useState(false)
-
- useEffect(() => {
- setMounted(true)
- }, [])
-
- if (!mounted) {
- return null
- }
-
- return (
-
-
-
-
-
-