aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/components/NavBar.tsx
blob: 7e111d04509523947216d0c90ab4fe7dd75a21ef (plain) (blame)
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
import { Link } from "react-router";

export const NavBar = ({ currentPage, user, handleLogout }: {
  currentPage: string;
  user: { username: string };
  handleLogout: () => void;
}) => {
  const getMenuOptions = () => {
    switch (currentPage) {
      case 'dashboard':
        return (
          <>
            <Link
              to="/import"
              className="text-slate-300 hover:text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-slate-800/50"
            >
              Import Data
            </Link>
          </>
        );
      case 'import':
        return (
          <>
            <Link
              to="/home"
              className="text-slate-300 hover:text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-slate-800/50"
            >
              Home
            </Link>
          </>
        );
      case 'score':
        return (
          <>
            <Link
              to="/home"
              className="text-slate-300 hover:text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-slate-800/50"
            >
              Home
            </Link>
            <Link
              to="/import"
              className="text-slate-300 hover:text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-slate-800/50"
            >
              Import Data
            </Link>
          </>
        );
      default:
        return (
          <Link
            to="/import"
            className="text-slate-300 hover:text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-slate-800/50"
          >
            Import Data
          </Link>
        );
    }
  };

  return (
    <nav className="border-b border-slate-800/50 bg-slate-950/95 backdrop-blur-sm sticky top-0 z-50">
      <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div className="flex items-center justify-between h-16">
          <div className="flex items-center space-x-3">
            <div className="w-8 h-8 bg-gradient-to-r from-violet-600 to-violet-700 rounded-lg flex items-center justify-center shadow-lg">
              <span className="text-white font-bold text-sm">M</span>
            </div>
            <span className="text-white font-semibold text-lg">Mirage</span>
          </div>
          <div className="flex items-center space-x-4">
            {getMenuOptions()}
            <span className="text-slate-300 text-sm">
              Welcome back,{" "}
              <span className="text-violet-400 font-medium">
                {user.username}
              </span>
            </span>
            <button
              onClick={handleLogout}
              className="text-slate-300 hover:text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 hover:bg-slate-800/50"
            >
              Sign Out
            </button>
          </div>
        </div>
      </div>
    </nav>
  );
};
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage