dashboard/src/app.tsx

66 lines
1.7 KiB
TypeScript
Raw Normal View History

import React, { useEffect } from "react";
import { createGlobalStyle } from "styled-components";
2020-07-08 19:36:36 +02:00
import SearchBar from "./components/searchBar";
import Greeter from "./components/greeter";
import AppList from "./components/appList";
import BookmarkList from "./components/bookmarkList";
2020-09-08 13:18:58 +02:00
import Settings from "./components/settings";
2020-09-08 18:26:45 +02:00
import Imprint from "./components/imprint";
2020-07-08 19:36:36 +02:00
import selectedTheme from "./components/themeManager";
import {
useAppData,
useSearchProviderData,
useBookmarkData,
useThemeData,
useImprintData,
} from "./components/fetch";
2020-07-08 19:36:36 +02:00
const GlobalStyle = createGlobalStyle`
body {
background-color: ${selectedTheme.backgroundColor};
font-family: Roboto, sans-serif;
2020-07-10 00:04:47 +02:00
margin: auto;
max-width: 95%;
max-height: 100%;
@media (min-width: 1366px) {
max-width: 70%;
}
2020-07-08 19:36:36 +02:00
}
`;
const App = () => {
const { appData } = useAppData();
const { searchProviderData } = useSearchProviderData();
const { bookmarkData } = useBookmarkData();
const { themeData } = useThemeData();
const { imprintData } = useImprintData();
return (
<>
<GlobalStyle />
<div>
<SearchBar providers={searchProviderData?.providers} />
{!themeData.error && !searchProviderData.error && (
<Settings
themes={themeData?.themes}
providers={searchProviderData?.providers}
/>
)}
<Greeter />
{!appData.error && (
<AppList apps={appData.apps} categories={appData.categories} />
)}
{!bookmarkData.error && <BookmarkList groups={bookmarkData.groups} />}
{!imprintData.error && <Imprint imprint={imprintData.imprint} />}
</div>
</>
);
};
2020-07-08 19:36:36 +02:00
export default App;