Make the build not fail

This commit is contained in:
phntxx 2022-04-10 21:31:40 +02:00
parent 765ab6d643
commit 3131110b4c
9 changed files with 214 additions and 434 deletions

View file

@ -40,7 +40,7 @@ const App = () => {
} = useFetch();
const theme = getTheme();
let isDark = useMediaQuery("(prefers-color-scheme: dark)");
const isDark = useMediaQuery("(prefers-color-scheme: dark)");
setScheme(isDark ? "dark-theme" : "light-theme");
return (

View file

@ -55,7 +55,7 @@ export const isBetween = (a: number, b: number, c: number): boolean =>
* @returns {string} a greeting
*/
export const getGreeting = (greetings: Array<IGreetingProps>): string => {
let hours = Math.floor(new Date().getHours());
const hours = Math.floor(new Date().getHours());
let result = "";
greetings.forEach((greeting) => {
@ -95,14 +95,14 @@ export const getDateString = (
months: Array<string>,
format: string,
) => {
let currentDate = new Date();
const currentDate = new Date();
let weekday = weekdays[currentDate.getDay()];
let day = currentDate.getDate();
let month = months[currentDate.getMonth()];
let extension = getExtension(day);
let year = currentDate.getFullYear();
let isodate = currentDate.toISOString().slice(0, 10);
const weekday = weekdays[currentDate.getDay()];
const day = currentDate.getDate();
const month = months[currentDate.getMonth()];
const extension = getExtension(day);
const year = currentDate.getFullYear();
const isodate = currentDate.toISOString().slice(0, 10);
return format
.replace("%wd", weekday)

View file

@ -56,14 +56,14 @@ export const handleQueryWithProvider = (
search: ISearchProps,
query: string,
) => {
let queryArray: Array<string> = query.split(" ");
let prefix: string = queryArray[0];
const queryArray: Array<string> = query.split(" ");
const prefix: string = queryArray[0];
queryArray.shift();
let searchQuery: string = queryArray.join(" ");
const searchQuery: string = queryArray.join(" ");
let providerFound: boolean = false;
let providerFound = false;
if (search.providers) {
search.providers.forEach((provider: ISearchProviderProps) => {
if (provider.prefix === prefix) {
@ -81,15 +81,15 @@ export const handleQueryWithProvider = (
* @param {ISearchBarProps} search - The search providers for the search bar to use
*/
const SearchBar = ({ search }: ISearchBarProps) => {
let [input, setInput] = useState<string>("");
let [buttonsHidden, setButtonsHidden] = useState<boolean>(true);
const [input, setInput] = useState<string>("");
const [buttonsHidden, setButtonsHidden] = useState<boolean>(true);
useEffect(() => setButtonsHidden(input === ""), [input]);
if (search === undefined) return <></>;
const handleSearchQuery = (e: React.FormEvent) => {
var query: string = input || "";
const query: string = input || "";
if (query.split(" ")[0].includes("/")) {
handleQueryWithProvider(search, query);

View file

@ -49,7 +49,7 @@ interface IFetchProps {
* Fetches app, bookmark, search, theme and imprint data and returns it.
*/
export const useFetcher = (): IFetchProps => {
let defaults: IDataProps<any> = { error: true };
const defaults: IDataProps<any> = { error: true };
const [appData, setAppData] = useState<IDataProps<IAppListProps>>(defaults);
const [bookmarkData, setBookmarkData] =
@ -64,7 +64,14 @@ export const useFetcher = (): IFetchProps => {
useState<IDataProps<IGreeterDataProps>>(defaults);
const callback = useCallback(() => {
let files = ["apps", "bookmarks", "search", "themes", "imprint", "greeter"];
const files = [
"apps",
"bookmarks",
"search",
"themes",
"imprint",
"greeter",
];
Promise.all(files.map((f) => fetchFile(f))).then(
([apps, bookmarks, search, themes, imprint, greeter]: any) => {

View file

@ -58,7 +58,7 @@ export const getTheme = (scheme?: string): IThemeProps => {
currentScheme = "dark-theme";
}
let theme =
const theme =
currentScheme === "dark-theme"
? localStorage.getItem("dark-theme")
: localStorage.getItem("light-theme");