aboutsummaryrefslogtreecommitdiffstats
path: root/packages/browser-extension/src/App.tsx
blob: 21fec92f2c4c1901908dc7535b6e51b93260230e (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
import { redirect } from "react-router-dom";
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("/settings");
    return;
  }

  return (
    <div className="flex flex-col space-y-2">
      <SavePage settings={settings} />
      <hr />
      <div className="flex justify-end">
        <button className="w-2/6" onClick={() => navigate("/settings")}>
          Settings
        </button>
      </div>
    </div>
  );
}

export default App;