Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavnt committed Jul 8, 2022
2 parents 2cd6fd9 + aa8b73e commit 7e3b2f6
Show file tree
Hide file tree
Showing 14 changed files with 877 additions and 255 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
"@kobra-dev/better-react-spreadsheet": "^0.2.0",
"@kobra-dev/react-firebase-auth-hooks": "3.0.3",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^5.0.0-beta.4",
"@material-ui/icons": "^5.0.0-beta.5",
"@material-ui/lab": "^4.0.0-alpha.60",
"blockly": "5.20210325.1",
"comlink": "^4.3.1",
"firebase": "8.6.2",
"graphql": "15.5.0",
"intro.js-react": "^0.5.0",
"js-cookie": "2.2.1",
"kbar": "^0.1.0-beta.25",
"kbar": "^0.1.0-beta.28",
"kobra.js": "0.1.6",
"next": "11.1.3",
"notistack": "^1.0.9",
"notistack": "^1.0.10",
"papaparse": "^5.3.1",
"plotly.js-cartesian-dist-min": "1.58.4",
"react": "^17.0.2",
Expand Down Expand Up @@ -81,13 +81,13 @@
"@types/react-plotly.js": "2.2.4",
"autoprefixer": "10.2.5",
"cross-env": "7.0.3",
"cypress": "^7.5.0",
"cypress": "^7.7.0",
"eslint": "^7.32.0",
"eslint-config-next": "^11.0.0",
"eslint-config-next": "^11.1.4",
"husky": "^6.0.0",
"prettier": "2.3.0",
"pretty-quick": "^3.1.1",
"typescript": "^4.3.2"
"pretty-quick": "^3.1.3",
"typescript": "^4.6.2"
},
"resolutions": {
"webpack": "^5.36.1"
Expand Down
47 changes: 6 additions & 41 deletions src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ export default function Editor() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [getProjectDetailsData.data?.project.id]);

useEffect(() => {
window.addEventListener("kobranewproject", newEmptyProject);
return () =>
window.removeEventListener("kobranewproject", newEmptyProject);
}, []);

if (openProjectId && getProjectDetailsData.loading) {
return (
<Loader>
Expand Down Expand Up @@ -339,47 +345,6 @@ export default function Editor() {
return !(newData.errors || !newData.data);
}

/*async function fork() {
if (!user && !(await login())) {
return;
}
// If the user just logged in the hook hasn't updated yet
const currentUser = user ?? firebase.auth().currentUser;
if (!currentUser)
throw new Error("User is undefined when trying to fork");
const newData = await gqlAddProject({
variables: {
name: openProjectName,
isPublic: false,
projectJson: getSaveData(),
description:
getProjectDetailsData.data?.project
?.description,
summary:
getProjectDetailsData.data?.project?.summary,
parentId: openProjectId
}
});
if (newData.errors || !newData.data) {
enqueueSnackbar(
"Fork failed" + newData?.errors?.[0].message
? `: ${newData.errors[0].message}`
: "",
{
variant: "error"
}
);
} else {
const id = newData.data.addProject.id;
setOpenProjectId(id);
setQueryString(openProjectId + TITLE_SUFFIX, "?id=" + id);
enqueueSnackbar("Save successful!", { variant: "success" });
}
}*/

// The function called by the autosaver provider
// It will only ever be called if the project exists in the DB so no need to worry about forking or creating a project
async function autosave(): Promise<boolean> {
Expand Down
7 changes: 6 additions & 1 deletion src/components/auth/FinishSignupDialogProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ export default function FinishSignupDialogProvider(props: {
useEffect(() => {
// The user is signed in with SSO and the username is not set
const user = firebase.auth().currentUser;
if (user && user.providerData[0] && !usernameLoading && !username) {
if (
user &&
user.providerData[0].providerId !== "password" &&
!usernameLoading &&
!username
) {
setFsOpen(true);
}
// No need to depend on user because useUsername does that for us
Expand Down
7 changes: 6 additions & 1 deletion src/components/auth/LoginDialogProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button, Dialog } from "@material-ui/core";
import React, { createContext, useCallback, useContext, useState } from "react";
import { getKBarLock, releaseKBarLock } from "../kbar/kbar";
import Login, { LoginTab } from "./Login";

type LoginFunction = { (initialTab?: LoginTab): Promise<boolean> };
Expand All @@ -15,9 +16,13 @@ export default function LoginDialogProvider(props: {

const loginFn = useCallback(
(initialTab?: LoginTab) => {
const kbarLock = getKBarLock();
setLoginOpen(initialTab ?? LoginTab.LOGIN);
return new Promise<boolean>((resolve) => {
setOpenResolve(() => resolve);
setOpenResolve(() => (val: boolean) => {
resolve(val);
releaseKBarLock(kbarLock);
});
});
},
[setLoginOpen, setOpenResolve]
Expand Down
162 changes: 0 additions & 162 deletions src/components/kbar.tsx

This file was deleted.

Loading

0 comments on commit 7e3b2f6

Please sign in to comment.