2020-05-02 03:03:19 +02:00
|
|
|
import React from "react";
|
|
|
|
|
import { Route, Switch } from "react-router-dom";
|
2020-05-02 21:46:05 +02:00
|
|
|
import { LoginFailure } from "./components/LoginFailure";
|
2020-05-13 21:22:56 +02:00
|
|
|
import { LoginSuccess } from "./components/LoginSuccess";
|
2020-05-02 03:03:19 +02:00
|
|
|
import { NavBar } from "./components/NavBar";
|
2020-05-09 19:22:43 +02:00
|
|
|
import { RecentListens } from "./components/RecentListens";
|
|
|
|
|
import { ReportListens } from "./components/ReportListens";
|
2020-11-15 02:43:23 +01:00
|
|
|
import { ReportTopAlbums } from "./components/ReportTopAlbums";
|
|
|
|
|
import { ReportTopArtists } from "./components/ReportTopArtists";
|
2021-05-22 14:57:28 +02:00
|
|
|
import { ReportTopTracks } from "./components/ReportTopTracks";
|
2020-05-02 03:03:19 +02:00
|
|
|
import { useAuth } from "./hooks/use-auth";
|
|
|
|
|
import "./tailwind/generated.css";
|
|
|
|
|
|
|
|
|
|
export function App() {
|
|
|
|
|
const { isLoaded } = useAuth();
|
|
|
|
|
|
|
|
|
|
if (!isLoaded) {
|
|
|
|
|
return <div>Loading...</div>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="App">
|
|
|
|
|
<header>
|
|
|
|
|
<NavBar />
|
|
|
|
|
</header>
|
|
|
|
|
<Switch>
|
|
|
|
|
<Route path="/" exact />
|
2020-05-13 21:22:56 +02:00
|
|
|
<Route path="/login/success" exact component={LoginSuccess} />
|
2020-05-02 21:46:05 +02:00
|
|
|
<Route path="/login/failure" exact component={LoginFailure} />
|
2020-05-02 21:46:41 +02:00
|
|
|
<Route path="/listens" exact component={RecentListens} />
|
2020-05-09 19:22:43 +02:00
|
|
|
<Route path="/reports/listens" exact component={ReportListens} />
|
2020-05-31 23:26:06 +02:00
|
|
|
<Route path="/reports/top-artists" exact component={ReportTopArtists} />
|
2020-11-15 02:43:23 +01:00
|
|
|
<Route path="/reports/top-albums" exact component={ReportTopAlbums} />
|
2021-05-22 14:57:28 +02:00
|
|
|
<Route path="/reports/top-tracks" exact component={ReportTopTracks} />
|
2020-05-02 03:03:19 +02:00
|
|
|
</Switch>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|