aboutsummaryrefslogtreecommitdiffstats
path: root/packages/browser-extension/src/App.tsx
blob: 1044363b0628f04f9a1bc6b70707112b54562269 (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
import { Settings, X } from "lucide-react";
import SavePage from "./SavePage";
import usePluginSettings from "./settings";
import { useNavigate } from "react-router-dom";

function App() {
  const navigate = useNavigate();
  const [settings, _1, _2, _3, isInit] = usePluginSettings();

  if (!isInit) {
    return <div className="p-4">Loading ... </div>;
  }

  if (!settings.apiKey || !settings.address) {
    navigate("/notconfigured");
    return;
  }

  return (
    <div className="flex flex-col space-y-2">
      <SavePage settings={settings} />
      <hr />
      <div className="flex justify-end space-x-3">
        <button onClick={() => navigate("/options")}>
          <Settings className="w-4" />
        </button>
        <button onClick={() => window.close()}>
          <X className="w-4" />
        </button>
      </div>
    </div>
  );
}

export default App;