diff --git a/app/locales/en/index.json b/app/locales/en/index.json new file mode 100644 index 0000000..bd7c845 --- /dev/null +++ b/app/locales/en/index.json @@ -0,0 +1,7 @@ +{ + "discoverPassion": "Discover Your Passion", + "findInterestingTopics": "Find out what topics you find interesting, learn a new skill & connect with people that are passionate about similar topics.", + "login": "Login", + "loginWithGoogle": "Login with Google", + "continueAsGuest": "Continue as a Guest" + } \ No newline at end of file diff --git a/app/locales/tr/index.json b/app/locales/tr/index.json new file mode 100644 index 0000000..d52fae3 --- /dev/null +++ b/app/locales/tr/index.json @@ -0,0 +1,7 @@ +{ + "discoverPassion": "Tutkunuzu Keşfedin", + "findInterestingTopics": "İlginç konuları bulun, yeni bir beceri öğrenin ve benzer konulara ilgi duyan insanlarla bağlantı kurun.", + "login": "Giriş Yap", + "loginWithGoogle": "Google ile Giriş Yap", + "continueAsGuest": "Misafir Olarak Devam Et" + } \ No newline at end of file diff --git a/components/GetStarted.jsx b/components/GetStarted.jsx index 08ef0b3..237c87f 100644 --- a/components/GetStarted.jsx +++ b/components/GetStarted.jsx @@ -1,170 +1,110 @@ -'use client' -import React,{useState, useEffect} from 'react' -import Image from 'next/image' +// Import statements using ESM syntax +import React, { useState, useEffect } from 'react'; +import Image from 'next/image'; import Login from './Login'; import Link from 'next/link'; -import { doc,auth, firestore, setDoc } from '@/utils/firebase'; +import { auth } from '@/utils/firebase'; import { useAuthState } from 'react-firebase-hooks/auth'; -import { getUserCountry } from '@/app/pages/api/ip/route'; -import signIn from '@/app/pages/api/auth/signin' +import signIn from '@/app/pages/api/auth/signin'; import { setIsAnonymous } from '@/redux/actions'; import { useDispatch } from 'react-redux'; +import useTranslation from 'next-translate'; + +// Component definition const GetStarted = ({ routers }) => { - console.log(auth.currentUser) - const [user, setUser] = useAuthState(auth); - useEffect(() => { },[user]) - const dispatch = useDispatch() + const { t } = useTranslation(); + const [user] = useAuthState(auth); + useEffect(() => {}, [user]); + const dispatch = useDispatch(); const [showLogin, setShowLogin] = useState(false); - // const googleAuth = new GoogleAuthProvider(); - + const handleLoginClick = () => { setShowLogin(true); }; + const handleContinueAsGuestClick = async () => { - const { result, error } = await signIn('anonymous'); - if (error) { - return console.log(error) - } - dispatch(setIsAnonymous(true)) + if (error) { + return console.log(error); + } + dispatch(setIsAnonymous(true)); - // else successful - console.log(result) - return routers.push('/pages/home') + console.log(result); + return routers.push('/pages/home'); }; const handleGoogleLoginClick = async () => { - // isAnonymous = false; const { result, error } = await signIn('google'); - if (error) { - return console.log(error) - } - dispatch(setIsAnonymous(false)) - // else successful - console.log(result) - return routers.push('/pages/home') - + if (error) { + return console.log(error); + } + dispatch(setIsAnonymous(false)); + + console.log(result); + return routers.push('/pages/home'); }; - // const result = await signInWithPopup(auth, googleAuth) - // saveGoogleUserInfoToFirestore(); - // const { uid } = auth.currentUser; - // localStorage.setItem('uid', uid); - // routers.push('/pages/home') - - - // }; - // const saveGoogleUserInfoToFirestore = async () => { - // const { uid, displayName, email, photoURL } = auth.currentUser; - // const res = await getUserCountry(); - // try { - // await setDoc(doc(firestore,'users',uid),{ - - // name: displayName, - // email: email, - // profilePicture: photoURL, - // country: res, - - // }, { merge: true }); - // // console.log(uid,displayName,email,photoURL,country) - // } catch (error) { - // console.error('Firestore Update Error:', error); - // } - // }; - if (showLogin) { - return ; - } return ( -
- - - -
-
-
- icon image -
- -
-

Course Worm

-
-
+
+

{t('discoverPassion')}

+
+
+

{t('findInterestingTopics')}

+
+
+
+ +
+
+
- -
- -
-

Discover passion

-
- -
-

find out what topics you find interesting,
learn a new skill & connect with people that
are passionate about similer topics.

-
- - -
-
- -
-
- - -
-
- - - - -
- -
+
- - - - +
- ) -} + ); +}; -export default GetStarted \ No newline at end of file +// Export the component using ESM syntax +export default GetStarted; diff --git a/next.config.js b/next.config.js index 29792fb..ea75574 100644 --- a/next.config.js +++ b/next.config.js @@ -5,4 +5,10 @@ module.exports = { images: { domains: ['openlearning-cdn.s3.amazonaws.com', 'lh3.googleusercontent.com', 'firebasestorage.googleapis.com'], }, -}; \ No newline at end of file + i18n: { + locales: ['en', 'tr'], // Add more locales as needed + defaultLocale: 'en', + }, +}; + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 97e1e41..82d6310 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "next": "13.4.7", "next-auth": "^4.22.3", "next-navigation": "^1.0.6", + "next-translate": "^2.5.3", "postcss": "8.4.24", "react": "18.2.0", "react-dom": "18.2.0", @@ -12740,6 +12741,18 @@ "node": ">=0.10.0" } }, + "node_modules/next-translate": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/next-translate/-/next-translate-2.5.3.tgz", + "integrity": "sha512-Wl4CWqqIqeoPlrKmTgnc7w49mOEi93INUnfVHJDTqNKavlhFg26isqy0LGKWHcvthGiPFBoh5aOXBqhGEfzrSw==", + "engines": { + "node": ">=16.10.0" + }, + "peerDependencies": { + "next": ">= 13.2.5", + "react": ">= 18.0.0" + } + }, "node_modules/next/node_modules/postcss": { "version": "8.4.14", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", @@ -27283,6 +27296,12 @@ } } }, + "next-translate": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/next-translate/-/next-translate-2.5.3.tgz", + "integrity": "sha512-Wl4CWqqIqeoPlrKmTgnc7w49mOEi93INUnfVHJDTqNKavlhFg26isqy0LGKWHcvthGiPFBoh5aOXBqhGEfzrSw==", + "requires": {} + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", diff --git a/package.json b/package.json index e5fec5e..b2b887b 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "next": "13.4.7", "next-auth": "^4.22.3", "next-navigation": "^1.0.6", + "next-translate": "^2.5.3", "postcss": "8.4.24", "react": "18.2.0", "react-dom": "18.2.0",