diff --git a/nepalingo-web/src/App.tsx b/nepalingo-web/src/App.tsx
index 64e0152..6285744 100644
--- a/nepalingo-web/src/App.tsx
+++ b/nepalingo-web/src/App.tsx
@@ -10,12 +10,6 @@ import Home from "./pages/Home/Home";
import FlashcardPage from "./pages/FlashcardPage"
import { useAuth } from "./components/userAuth/AuthContext";
import ReactGA from "react-ga4";
-import GreetingCard from './components/GreetingCard';
-//const App: React.FC<{}>; {
-// const TrackingID = import.meta.env.VITE_GOOGLE_ANALYTICS_TRACKING_ID;
-// ReactGA.initialize(TrackingID);
-//const { user } = useAuth();
-
const TrackingID = import.meta.env.VITE_GOOGLE_ANALYTICS_TRACKING_ID;
ReactGA.initialize(TrackingID);
@@ -24,9 +18,7 @@ const { user } = useAuth();
const App: React.FC = () => {
return (
<>
-
-
-
+
} />
diff --git a/nepalingo-web/src/components/GreetingCard.tsx b/nepalingo-web/src/components/GreetingCard.tsx
index ac9b865..a58a316 100644
--- a/nepalingo-web/src/components/GreetingCard.tsx
+++ b/nepalingo-web/src/components/GreetingCard.tsx
@@ -1,7 +1,7 @@
import React from 'react';
interface GreetingCardProps {
- message: string;
+
name: string;
}
@@ -21,10 +21,21 @@ const headingStyle: React.CSSProperties = {
color: '#333',
};
-const GreetingCard: React.FC = ({ message, name }) => {
+const GreetingCard: React.FC = ({ name }) => {
+ const getCurrentGreeting = (): string => {
+ const CurrentHours = new Date().getHours();
+ if (CurrentHours < 12) {
+ return 'Good Morning';
+ }
+ else if (CurrentHours < 18) {
+ return 'Good Afternoon';
+ } else {
+ return 'Good Evening';
+ }
+ }
return (
-
{message} {name}
+ {`${getCurrentGreeting()}, ${name}!`} {name}
);
diff --git a/nepalingo-web/src/components/Home.tsx b/nepalingo-web/src/components/Home.tsx
deleted file mode 100644
index e69de29..0000000
diff --git a/nepalingo-web/src/pages/Home/Home.tsx b/nepalingo-web/src/pages/Home/Home.tsx
index b7467f3..69a81c4 100644
--- a/nepalingo-web/src/pages/Home/Home.tsx
+++ b/nepalingo-web/src/pages/Home/Home.tsx
@@ -3,11 +3,16 @@ import { Link } from "react-router-dom";
import logo from "../../assets/logo.png";
import ReactGA from 'react-ga4';
import { useAuth } from "../../components/userAuth/AuthContext";
+import GreetingCard from "../../components/GreetingCard";
const Home: React.FC = () => {
- ReactGA.send({ hitType: "pageview", page: window.location.pathname, title: "home"});
+ ReactGA.send({ hitType: "pageview", page: window.location.pathname, title: "home" });
const { user } = useAuth();
+ const userName = 'user';
+
+
+
return (
@@ -15,6 +20,11 @@ const Home: React.FC = () => {
Hello {user?.user_metadata?.username}, welcome to Nepalingo!
+
+
+
+
+