0 ? `hasBoards` : `noBoards`} ${boards && boards?.length == 1 ? `oneBoard` : ``}`}>
{(boardsLoading || selectedGrid == null) ? <>
diff --git a/components/modals/authenticate/authenticate-dialog.tsx b/components/modals/authenticate/authenticate-dialog.tsx
index 7fea160..5b41d89 100644
--- a/components/modals/authenticate/authenticate-dialog.tsx
+++ b/components/modals/authenticate/authenticate-dialog.tsx
@@ -5,9 +5,29 @@ import { StateContext } from '../../../pages/_app';
import { logToast } from '../../../shared/constants';
import Authenticate, { onAuthenticate } from './authenticate';
import { deleteDatabaseData, deleteUserAuth } from '../../../firebase';
+import { AuthGrids } from '../../../shared/types/types';
export default function AuthenticationDialog({ }: any) {
- const { user, signOutReset, onSignOut, onAuthenticateFunction, authenticateOpen, setAuthenticateOpen } = useContext
(StateContext);
+ const {
+ user,
+ onSignOut,
+ upNextGrid,
+ signOutReset,
+ globalUserData,
+ authenticateOpen,
+ setAuthenticateOpen,
+ hardSetSelectedGrid,
+ onAuthenticateFunction,
+ } = useContext(StateContext);
+
+ const deleteAndCloseDialog = () => {
+ setAuthenticateOpen(false);
+ deleteUserFromDatabases();
+ }
+ const setAuthGrid = () => {
+ setAuthenticateOpen(false);
+ hardSetSelectedGrid(upNextGrid, globalUserData?.grids);
+ }
const deleteUserFromDatabases = async () => {
toast.info(`Deleting User ${user?.id}`);
@@ -22,10 +42,18 @@ export default function AuthenticationDialog({ }: any) {
});
}
+ const onCloseLogic = (e?: any) => {
+ setAuthenticateOpen(!authenticateOpen);
+ if (onAuthenticateFunction == `Set Grid`) {
+ const unAuthGrids = globalUserData?.grids?.filter(gr => !AuthGrids?.includes(gr?.gridType));
+ hardSetSelectedGrid(unAuthGrids[0], globalUserData?.grids);
+ }
+ }
+
return (