Rename frontend directory (#472)

* Rename directory

* Cleanup

* Recover lost images

* remove lint
This commit is contained in:
Andrey Pokhilko
2023-09-26 10:04:44 +01:00
committed by GitHub
parent 133eef6745
commit dd7aca70ff
146 changed files with 595 additions and 309 deletions
+40
View File
@@ -0,0 +1,40 @@
import { createContext, useState, useContext } from "react";
export interface AppContextData {
selectedRepo: string;
setSelectedRepo: (newValue: string) => void;
clusterMode: boolean;
setClusterMode: (newValue: boolean) => void;
}
const AppContext = createContext<AppContextData | undefined>(undefined);
export const useAppContext = (): AppContextData => {
const context = useContext(AppContext);
if (!context) {
throw new Error("useAppContext must be used within a AppContextProvider");
}
return context;
};
export const AppContextProvider = ({
children,
}: {
children: React.ReactNode;
}) => {
const [selectedRepo, setSelectedRepo] = useState("");
const [clusterMode, setClusterMode] = useState(false);
const contextValue: AppContextData = {
selectedRepo,
setSelectedRepo,
clusterMode,
setClusterMode,
};
return (
<AppContext.Provider value={contextValue}>{children}</AppContext.Provider>
);
};
export default AppContext;
@@ -0,0 +1,17 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { createContext } from "react";
export interface ErrorAlert {
title?: string;
msg: string;
}
export const ErrorModalContext = createContext<{
shouldShowErrorModal?: ErrorAlert;
setShowErrorModal: (toggle?: ErrorAlert) => void;
}>({
shouldShowErrorModal: undefined,
// in this case we allow Unexpected empty method
//eslint-disable-next-line @typescript-eslint/no-empty-function
setShowErrorModal: (toggle?: ErrorAlert) => {},
});