File size: 2,367 Bytes
e7abd9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
04f06ea
 
 
fc869a4
04f06ea
fc869a4
04f06ea
fc869a4
04f06ea
 
eca575e
 
 
 
 
 
 
 
 
 
04f06ea
 
 
fc869a4
04f06ea
fc869a4
04f06ea
fc869a4
04f06ea
 
 
 
 
fc869a4
04f06ea
fc869a4
04f06ea
fc869a4
04f06ea
 
5ce0932
 
 
fc869a4
5ce0932
fc869a4
5ce0932
fc869a4
5ce0932
 
e7abd9e
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import React from "react";
import { useNavigate, useSearchParams, useLocation } from "react-router-dom";
import { Box } from "@mui/material";
import HFLogo from "./HFLogo";
import { useLeaderboard } from "../../pages/LeaderboardPage/components/Leaderboard/context/LeaderboardContext";

const Logo = ({ height = "40px" }) => {
  const navigate = useNavigate();
  const [searchParams, setSearchParams] = useSearchParams();
  const location = useLocation();
  const { actions } = useLeaderboard();

  const handleReset = () => {
    // Reset all leaderboard state first
    actions.resetAll();

    // Then clean URL in one go
    if (
      location.pathname !== "/" ||
      searchParams.toString() !== "" ||
      location.hash !== ""
    ) {
      window.history.replaceState(null, "", "/");
      navigate("/", { replace: true, state: { skipUrlSync: true } });
      setSearchParams({}, { replace: true, state: { skipUrlSync: true } });
    }
  };

  return (
    <Box
      onClick={handleReset}
      sx={{
        height,
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        cursor: "pointer",
        transition: "opacity 0.2s ease",
        "&:hover": {
          opacity: 0.8,
        },
      }}
    >
        <Box
          component="img"
          src="/logofinai.png"
          alt="FinAI Logo"
          sx={{
            height: "80%",
            mx: 2,
            maxHeight: 80,
          }}
        />
        <Box
          component="img"
          src="/securefinailab.png"
          alt="SecureFinAI Logo"
          sx={{
            height: "80%",
            mx: 2,
            maxHeight: 80,
          }}
        />
        <Box
          component="img"
          src="/nactemlogo.png"
          alt="NACTEM Logo"
          sx={{
            height: "60%",
            mx: 2,
            maxHeight: 60,
          }}
        />
        <Box
          component="img"
          src="/archimedeslogo.png"
          alt="Archimedes Logo"
          sx={{
            height: "60%",
            mx: 2,
            maxHeight: 60,
          }}
        />
        <Box
          component="img"
          src="/airclogo.png"
          alt="AIRC Logo"
          sx={{
            height: "80%",
            mx: 2,
            maxHeight: 80,
          }}
        />
    </Box>
  );
};

export default Logo;