i-darrshan commited on
Commit
ad83ff7
·
1 Parent(s): ea69864
frontend/src/App.js CHANGED
@@ -14,12 +14,14 @@ import PrivacyPolicy from "./pages/Privacy";
14
 
15
  import ScrollTop from "./components/ScrollTop";
16
  import TransitionWrapper from "./components/Transition";
 
17
 
18
 
19
  function App() {
20
  return (
21
  <Router>
22
  <ScrollTop />
 
23
  <TransitionWrapper>
24
  <div className="flex flex-col min-h-screen">
25
  <Header />
@@ -47,6 +49,7 @@ function App() {
47
  <Footer />
48
  </div>
49
  </TransitionWrapper>
 
50
  </Router>
51
  );
52
  }
 
14
 
15
  import ScrollTop from "./components/ScrollTop";
16
  import TransitionWrapper from "./components/Transition";
17
+ import { LoaderProvider } from "./components/LoaderContext";
18
 
19
 
20
  function App() {
21
  return (
22
  <Router>
23
  <ScrollTop />
24
+ <LoaderProvider>
25
  <TransitionWrapper>
26
  <div className="flex flex-col min-h-screen">
27
  <Header />
 
49
  <Footer />
50
  </div>
51
  </TransitionWrapper>
52
+ </LoaderProvider>
53
  </Router>
54
  );
55
  }
frontend/src/components/LoaderContext.jsx ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createContext, useContext, useState } from "react";
2
+
3
+ const LoaderContext = createContext();
4
+
5
+ export const LoaderProvider = ({ children }) => {
6
+ const [isLoaderShown, setIsLoaderShown] = useState(true); // Initially true
7
+
8
+ return (
9
+ <LoaderContext.Provider value={{ isLoaderShown, setIsLoaderShown }}>
10
+ {children}
11
+ </LoaderContext.Provider>
12
+ );
13
+ };
14
+
15
+ export const useLoader = () => useContext(LoaderContext);
frontend/src/pages/Home.jsx CHANGED
@@ -1,42 +1,64 @@
1
- import React from "react";
2
- import {ReactTyped} from "react-typed";
3
- import {Hero_video} from "../utils/index";
 
 
4
 
5
  const Home = () => {
 
 
 
 
 
 
 
 
6
  return (
7
  <div className="relative w-full h-screen">
 
 
 
 
 
 
 
 
 
 
 
8
  {/* Video Background */}
9
  <video
10
- className="absolute inset-0 w-full h-full object-cover"
 
 
11
  autoPlay
12
  loop
13
  muted
14
  preload="auto"
15
  >
16
- <source
17
- src={Hero_video}
18
- type="video/mp4"
19
- />
20
  Your browser does not support the video tag.
21
  </video>
22
 
23
  {/* Overlaying Text */}
24
- <div className="relative z-10 flex items-center justify-center w-full h-full flex-col text-center bg-black bg-opacity-50">
 
 
 
 
25
  {/* Title with Gradient */}
26
- <h1 className="text-5xl font-bold bg-clip-text text-transparent" style={{color: "#3267B9"}}>
27
  <ReactTyped
28
  strings={["Variants, Diseases and Genes", "VarDiG"]}
29
- typeSpeed={50} // Speed of typing
30
- backSpeed={30} // Speed of deleting
31
- backDelay={1500} // Delay before deleting
32
  loop
33
  />
34
  </h1>
35
 
36
  {/* Subtitle */}
37
- <p className="mt-4 text-xl text-white">
38
- Variants Deciphered
39
- </p>
40
  </div>
41
  </div>
42
  );
 
1
+ import React, { useEffect } from "react";
2
+ import { ReactTyped } from "react-typed";
3
+ import { Hero_video } from "../utils/index";
4
+ import Logo from "../assets/images/genomatics-logo.png";
5
+ import { useLoader } from "../components/LoaderContext"; // Import global loader state
6
 
7
  const Home = () => {
8
+ const { isLoaderShown, setIsLoaderShown } = useLoader();
9
+
10
+ useEffect(() => {
11
+ if (isLoaderShown) {
12
+ setTimeout(() => setIsLoaderShown(false), 2500); // Loader stays for at least 2.5s
13
+ }
14
+ }, [isLoaderShown, setIsLoaderShown]);
15
+
16
  return (
17
  <div className="relative w-full h-screen">
18
+ {/* Loader (Only appears on first visit) */}
19
+ {isLoaderShown && (
20
+ <div className="fixed inset-0 flex items-center justify-center bg-black z-[9999] transition-opacity duration-1000">
21
+ <img
22
+ src={Logo}
23
+ alt="Loading..."
24
+ className="w-40 h-40 animate-pulse" // Blinking effect
25
+ />
26
+ </div>
27
+ )}
28
+
29
  {/* Video Background */}
30
  <video
31
+ className={`absolute inset-0 w-full h-full object-cover transition-opacity duration-1000 ${
32
+ isLoaderShown ? "opacity-0" : "opacity-100"
33
+ }`}
34
  autoPlay
35
  loop
36
  muted
37
  preload="auto"
38
  >
39
+ <source src={Hero_video} type="video/mp4" />
 
 
 
40
  Your browser does not support the video tag.
41
  </video>
42
 
43
  {/* Overlaying Text */}
44
+ <div
45
+ className={`relative z-10 flex items-center justify-center w-full h-full flex-col text-center bg-black bg-opacity-50 transition-opacity duration-1000 ${
46
+ isLoaderShown ? "opacity-0" : "opacity-100"
47
+ }`}
48
+ >
49
  {/* Title with Gradient */}
50
+ <h1 className="text-5xl font-bold bg-clip-text text-transparent" style={{ color: "#3267B9" }}>
51
  <ReactTyped
52
  strings={["Variants, Diseases and Genes", "VarDiG"]}
53
+ typeSpeed={50}
54
+ backSpeed={30}
55
+ backDelay={1500}
56
  loop
57
  />
58
  </h1>
59
 
60
  {/* Subtitle */}
61
+ <p className="mt-4 text-xl text-white">Variants Deciphered</p>
 
 
62
  </div>
63
  </div>
64
  );