Spaces:
Sleeping
Sleeping
| import React, { useEffect, useState } from 'react'; | |
| import { Link, useNavigate } from 'react-router-dom'; | |
| import { | |
| AcademicCapIcon, | |
| UsersIcon, | |
| LightBulbIcon, | |
| DocumentTextIcon | |
| } from '@heroicons/react/24/outline'; | |
| interface User { | |
| name: string; | |
| email: string; | |
| role?: string; | |
| } | |
| const Home: React.FC = () => { | |
| const [user, setUser] = useState<User | null>(null); | |
| const navigate = useNavigate(); | |
| useEffect(() => { | |
| // Check if user is already logged in | |
| const userData = localStorage.getItem('user'); | |
| const token = localStorage.getItem('token'); | |
| if (userData && token) { | |
| setUser(JSON.parse(userData)); | |
| } | |
| }, []); | |
| const handleGetStarted = () => { | |
| if (user) { | |
| // User is already logged in, redirect to dashboard | |
| navigate('/dashboard'); | |
| } else { | |
| // User is not logged in, redirect to login | |
| navigate('/login'); | |
| } | |
| }; | |
| return ( | |
| <div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100"> | |
| {/* Hero Section */} | |
| <div className="relative overflow-hidden"> | |
| <div className="max-w-7xl mx-auto"> | |
| <div className="relative z-10 pb-8 sm:pb-16 md:pb-20 lg:max-w-2xl lg:w-full lg:pb-28 xl:pb-32"> | |
| <main className="mt-10 mx-auto max-w-7xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 lg:px-8 xl:mt-28"> | |
| <div className="sm:text-center lg:text-left"> | |
| <h1 className="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl"> | |
| <span className="block text-gradient">Transcreation</span> | |
| <span className="block text-indigo-600">Sandbox</span> | |
| </h1> | |
| <p className="mt-3 text-base text-gray-500 sm:mt-5 sm:text-lg sm:max-w-xl sm:mx-auto md:mt-5 md:text-xl lg:mx-0"> | |
| A practice platform for translation students to work with puns and wordplay examples. | |
| Enter your student email to start practicing transcreation skills. | |
| </p> | |
| <div className="mt-5 sm:mt-8 sm:flex sm:justify-center lg:justify-start"> | |
| <div className="rounded-md shadow"> | |
| <button | |
| onClick={handleGetStarted} | |
| className="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 md:py-4 md:text-lg md:px-10" | |
| > | |
| {user ? 'Continue to Dashboard' : 'Get Started'} | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| </div> | |
| </div> | |
| </div> | |
| {/* Features Section */} | |
| <div className="py-12 bg-white"> | |
| <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> | |
| <div className="lg:text-center"> | |
| <h2 className="text-base text-indigo-600 font-semibold tracking-wide uppercase">Features</h2> | |
| <p className="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl"> | |
| Practice translation skills | |
| </p> | |
| <p className="mt-4 max-w-2xl text-xl text-gray-500 lg:mx-auto"> | |
| Work with puns and wordplay examples, submit translations, and vote on peer submissions. | |
| </p> | |
| </div> | |
| <div className="mt-10"> | |
| <dl className="space-y-10 md:space-y-0 md:grid md:grid-cols-2 md:gap-x-8 md:gap-y-10"> | |
| <div className="relative"> | |
| <dt> | |
| <div className="absolute flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white"> | |
| <AcademicCapIcon className="h-6 w-6" aria-hidden="true" /> | |
| </div> | |
| <p className="ml-16 text-lg leading-6 font-medium text-gray-900"> | |
| Practice Examples | |
| </p> | |
| </dt> | |
| <dd className="mt-2 ml-16 text-base text-gray-500"> | |
| Work with curated puns and wordplay examples in English and Chinese | |
| for translation practice. | |
| </dd> | |
| </div> | |
| <div className="relative"> | |
| <dt> | |
| <div className="absolute flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white"> | |
| <DocumentTextIcon className="h-6 w-6" aria-hidden="true" /> | |
| </div> | |
| <p className="ml-16 text-lg leading-6 font-medium text-gray-900"> | |
| Submit Translations | |
| </p> | |
| </dt> | |
| <dd className="mt-2 ml-16 text-base text-gray-500"> | |
| Submit your translations for practice examples and track your progress. | |
| </dd> | |
| </div> | |
| <div className="relative"> | |
| <dt> | |
| <div className="absolute flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white"> | |
| <UsersIcon className="h-6 w-6" aria-hidden="true" /> | |
| </div> | |
| <p className="ml-16 text-lg leading-6 font-medium text-gray-900"> | |
| Peer Voting | |
| </p> | |
| </dt> | |
| <dd className="mt-2 ml-16 text-base text-gray-500"> | |
| Vote on anonymous student translations and see how your work compares. | |
| </dd> | |
| </div> | |
| <div className="relative"> | |
| <dt> | |
| <div className="absolute flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white"> | |
| <LightBulbIcon className="h-6 w-6" aria-hidden="true" /> | |
| </div> | |
| <p className="ml-16 text-lg leading-6 font-medium text-gray-900"> | |
| Cultural Guidance | |
| </p> | |
| </dt> | |
| <dd className="mt-2 ml-16 text-base text-gray-500"> | |
| Highlight culturally sensitive elements in source texts and provide | |
| reference examples for comparison. | |
| </dd> | |
| </div> | |
| </dl> | |
| </div> | |
| </div> | |
| </div> | |
| {/* CTA Section */} | |
| <div className="bg-indigo-700"> | |
| <div className="max-w-2xl mx-auto text-center py-16 px-4 sm:py-20 sm:px-6 lg:px-8"> | |
| <h2 className="text-3xl font-extrabold text-white sm:text-4xl"> | |
| <span className="block">Ready to start?</span> | |
| <span className="block">Begin your translation practice.</span> | |
| </h2> | |
| <p className="mt-4 text-lg leading-6 text-indigo-200"> | |
| Enter your student email to access the translation practice tools. | |
| </p> | |
| <button | |
| onClick={handleGetStarted} | |
| className="mt-8 w-full inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-indigo-600 bg-white hover:bg-indigo-50 sm:w-auto" | |
| > | |
| {user ? 'Continue to Dashboard' : 'Get Started'} | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| ); | |
| }; | |
| export default Home; |