2021-07-10 23:57:08 +02:00
|
|
|
import { createGlobalStyle, ThemeProvider } from "styled-components";
|
2020-07-08 19:36:36 +02:00
|
|
|
|
|
|
|
import SearchBar from "./components/searchBar";
|
|
|
|
import Greeter from "./components/greeter";
|
2021-07-16 11:00:15 +02:00
|
|
|
import AppList from "./components/appList";
|
2021-06-14 11:29:03 +02:00
|
|
|
import BookmarkList from "./components/bookmarks";
|
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
|
|
|
|
2021-07-14 01:18:11 +02:00
|
|
|
import { IThemeProps, getTheme, setScheme } from "./lib/useTheme";
|
2022-02-13 20:57:26 +01:00
|
|
|
import useFetch from "./lib/useFetch";
|
2021-07-10 23:57:08 +02:00
|
|
|
import useMediaQuery from "./lib/useMediaQuery";
|
2020-07-08 19:36:36 +02:00
|
|
|
|
2021-07-10 23:57:08 +02:00
|
|
|
export const GlobalStyle = createGlobalStyle<{ theme: IThemeProps }>`
|
2020-07-08 19:36:36 +02:00
|
|
|
body {
|
2021-07-10 23:57:08 +02:00
|
|
|
background-color: ${(props) => props.theme.backgroundColor};
|
2020-07-08 19:36:36 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-03-21 18:05:24 +01:00
|
|
|
/**
|
|
|
|
* Renders the entire app by calling individual components
|
|
|
|
*/
|
2021-03-05 22:00:32 +01:00
|
|
|
const App = () => {
|
2021-06-14 11:29:03 +02:00
|
|
|
const {
|
|
|
|
appData,
|
|
|
|
bookmarkData,
|
2022-02-13 20:57:26 +01:00
|
|
|
searchData,
|
2021-06-14 11:29:03 +02:00
|
|
|
themeData,
|
|
|
|
imprintData,
|
|
|
|
greeterData,
|
2022-02-13 20:57:26 +01:00
|
|
|
} = useFetch();
|
2021-03-05 22:00:32 +01:00
|
|
|
|
2021-07-10 23:57:08 +02:00
|
|
|
const theme = getTheme();
|
2022-04-10 21:31:40 +02:00
|
|
|
const isDark = useMediaQuery("(prefers-color-scheme: dark)");
|
2022-02-13 20:57:26 +01:00
|
|
|
setScheme(isDark ? "dark-theme" : "light-theme");
|
2021-07-10 23:57:08 +02:00
|
|
|
|
2021-03-05 22:00:32 +01:00
|
|
|
return (
|
2021-07-10 23:57:08 +02:00
|
|
|
<ThemeProvider theme={theme}>
|
2021-03-05 22:00:32 +01:00
|
|
|
<GlobalStyle />
|
|
|
|
<div>
|
2022-02-13 20:57:26 +01:00
|
|
|
<SearchBar search={searchData.response} />
|
|
|
|
<Settings themes={themeData.response} search={searchData.response} />
|
|
|
|
<Greeter greeter={greeterData.response} />
|
|
|
|
<AppList
|
|
|
|
apps={appData.response?.apps}
|
|
|
|
categories={appData.response?.categories}
|
|
|
|
/>
|
|
|
|
<BookmarkList groups={bookmarkData.response?.groups} />
|
|
|
|
<Imprint imprint={imprintData.response} />
|
2021-03-05 22:00:32 +01:00
|
|
|
</div>
|
2021-07-10 23:57:08 +02:00
|
|
|
</ThemeProvider>
|
2021-03-05 22:00:32 +01:00
|
|
|
);
|
|
|
|
};
|
2020-07-08 19:36:36 +02:00
|
|
|
|
|
|
|
export default App;
|