= {
- impersonateUser: { path: "/impersonateUser", method: "GET" },
- version: { path: "/version", method: "GET" },
- region: { path: "/region", method: "GET" },
- firestoreRules: { path: "/firestoreRules", method: "GET" },
- setFirestoreRules: { path: "/setFirestoreRules", method: "POST" },
- listCollections: { path: "/listCollections", method: "GET" },
- serviceAccountAccess: { path: "/serviceAccountAccess", method: "GET" },
- checkFT2Rowy: { path: "/checkFT2Rowy", method: "GET" },
- migrateFT2Rowy: { path: "/migrateFT2Rowy", method: "GET" },
- actionScript: { path: "/actionScript", method: "POST" },
- buildFunction: { path: "/buildFunction", method: "POST" },
- projectOwner: { path: "/projectOwner", method: "GET" },
- setOwnerRoles: { path: "/setOwnerRoles", method: "GET" },
-};
+export const runRoutes = {
+ impersonateUser: { path: "/impersonateUser", method: "GET" } as RunRoute,
+ version: { path: "/version", method: "GET" } as RunRoute,
+ region: { path: "/region", method: "GET" } as RunRoute,
+ firestoreRules: { path: "/firestoreRules", method: "GET" } as RunRoute,
+ setFirestoreRules: { path: "/setFirestoreRules", method: "POST" } as RunRoute,
+ listCollections: { path: "/listCollections", method: "GET" } as RunRoute,
+ serviceAccountAccess: {
+ path: "/serviceAccountAccess",
+ method: "GET",
+ } as RunRoute,
+ checkFT2Rowy: { path: "/checkFT2Rowy", method: "GET" } as RunRoute,
+ migrateFT2Rowy: { path: "/migrateFT2Rowy", method: "GET" } as RunRoute,
+ actionScript: { path: "/actionScript", method: "POST" } as RunRoute,
+ buildFunction: { path: "/buildFunction", method: "POST" } as RunRoute,
+ projectOwner: { path: "/projectOwner", method: "GET" } as RunRoute,
+ setOwnerRoles: { path: "/setOwnerRoles", method: "GET" } as RunRoute,
+} as const;
diff --git a/src/pages/Setup.tsx b/src/pages/Setup.tsx
index a9bdddcf..64330f4f 100644
--- a/src/pages/Setup.tsx
+++ b/src/pages/Setup.tsx
@@ -34,6 +34,9 @@ import Step1RowyRun, { checkRowyRun } from "components/Setup/Step1RowyRun";
import Step2ServiceAccount, { checkServiceAccount } from "components/Setup/Step2ServiceAccount";
// prettier-ignore
import Step3ProjectOwner, { checkProjectOwner } from "@src/components/Setup/Step3ProjectOwner";
+import Step4Rules, { checkRules } from "components/Setup/Step4Rules";
+import Step5Migrate, { checkMigrate } from "components/Setup/Step5Migrate";
+import Step6Finish from "components/Setup/Step6Finish";
import { name } from "@root/package.json";
import routes from "constants/routes";
@@ -60,6 +63,7 @@ const checkAllSteps = async (
rowyRunUrl: string,
currentUser: firebase.default.User | null | undefined,
userRoles: string[] | null,
+ authToken: string,
signal: AbortSignal
) => {
console.log("Check all steps");
@@ -69,23 +73,30 @@ const checkAllSteps = async (
if (rowyRunValidation.isValidRowyRunUrl) {
if (rowyRunValidation.isLatestVersion) completion.rowyRun = true;
- const serviceAccount = await checkServiceAccount(rowyRunUrl, signal);
- if (serviceAccount) completion.serviceAccount = true;
-
- const projectOwner = await checkProjectOwner(
- rowyRunUrl,
- currentUser,
- userRoles,
- signal
- );
- if (projectOwner) completion.projectOwner = true;
+ const promises = [
+ checkServiceAccount(rowyRunUrl, signal).then((serviceAccount) => {
+ if (serviceAccount) completion.serviceAccount = true;
+ }),
+ checkProjectOwner(rowyRunUrl, currentUser, userRoles, signal).then(
+ (projectOwner) => {
+ if (projectOwner) completion.projectOwner = true;
+ }
+ ),
+ checkRules(rowyRunUrl, authToken, signal).then((rules) => {
+ if (rules) completion.rules = true;
+ }),
+ checkMigrate(rowyRunUrl, authToken, signal).then((requiresMigration) => {
+ if (requiresMigration) completion.migrate = false;
+ }),
+ ];
+ await Promise.all(promises);
}
return completion;
};
export default function SetupPage() {
- const { currentUser, userRoles } = useAppContext();
+ const { currentUser, userRoles, getAuthToken } = useAppContext();
const fullScreenHeight = use100vh() ?? 0;
const isMobile = useMediaQuery((theme: any) => theme.breakpoints.down("sm"));
@@ -110,16 +121,24 @@ export default function SetupPage() {
if (rowyRunUrl) {
setCheckingAllSteps(true);
- checkAllSteps(rowyRunUrl, currentUser, userRoles, signal).then(
- (result) => {
- if (!signal.aborted) setCompletion((c) => ({ ...c, ...result }));
- setCheckingAllSteps(false);
- }
+ getAuthToken().then((authToken) =>
+ checkAllSteps(
+ rowyRunUrl,
+ currentUser,
+ userRoles,
+ authToken,
+ signal
+ ).then((result) => {
+ if (!signal.aborted) {
+ setCompletion((c) => ({ ...c, ...result }));
+ setCheckingAllSteps(false);
+ }
+ })
);
}
return () => controller.abort();
- }, [rowyRunUrl, currentUser, userRoles]);
+ }, [rowyRunUrl, currentUser, userRoles, getAuthToken]);
const stepProps = { completion, setCompletion, checkAllSteps, rowyRunUrl };
@@ -176,14 +195,14 @@ export default function SetupPage() {
id: "rules",
shortTitle: `Rules`,
title: `Set Up Firestore Rules`,
- body: `x`,
+ body: ,
},
completion.migrate !== undefined
? {
id: "migrate",
shortTitle: `Migrate`,
title: `Migrate to ${name} (optional)`,
- body: `x`,
+ body: ,
}
: ({} as ISetupStep),
{
@@ -191,21 +210,17 @@ export default function SetupPage() {
layout: "centered" as "centered",
shortTitle: `Finish`,
title: `You’re all set up!`,
- body: (
-
- You can now create a table from your Firestore collections or continue
- to {name}
-
- ),
+ body: ,
actions: (
- <>
-
-
- >
+
),
},
].filter((x) => x.id);
@@ -239,7 +254,7 @@ export default function SetupPage() {
backdropFilter: "blur(20px) saturate(150%)",
maxWidth: 840,
- width: "100%",
+ width: (theme) => `calc(100vw - ${theme.spacing(2)})`,
maxHeight: (theme) =>
`calc(${
fullScreenHeight > 0 ? `${fullScreenHeight}px` : "100vh"
@@ -249,7 +264,7 @@ export default function SetupPage() {
height: 840 * 0.75,
p: 0,
- "& > *": { px: { xs: 2, sm: 4 } },
+ "& > *, & > .MuiDialogContent-root": { px: { xs: 2, sm: 4 } },
display: "flex",
flexDirection: "column",
@@ -373,7 +388,10 @@ export default function SetupPage() {
-
+
{step.body}
diff --git a/src/theme/components.tsx b/src/theme/components.tsx
index 964587ac..7c6f2e72 100644
--- a/src/theme/components.tsx
+++ b/src/theme/components.tsx
@@ -42,14 +42,29 @@ export const components = (theme: Theme): ThemeOptions => {
components: {
MuiCssBaseline: {
styleOverrides: {
- code: {
+ // https://css-tricks.com/revisiting-prefers-reduced-motion-the-reduced-motion-media-query/
+ "@media screen and (prefers-reduced-motion: reduce), (update: slow)":
+ {
+ "*:not(.MuiCircularProgress-root *):not(.MuiLinearProgress-root *)":
+ {
+ animationDuration: "0.001ms !important",
+ animationIteratonCount: "1 !important",
+ transitionDuration: "0.001ms !important",
+ scrollBehavior: "auto !important",
+ },
+ },
+
+ "code, pre, pre.MuiTypography-root": {
fontFamily: theme.typography.fontFamilyMono,
letterSpacing: 0,
- backgroundColor: theme.palette.action.selected,
+ backgroundColor: theme.palette.action.hover,
borderRadius: theme.shape.borderRadius,
padding: `${1 / 16}em ${4 / 16}em`,
},
+ "pre, pre.MuiTypography-root": {
+ padding: `${4 / 16}em ${8 / 16}em`,
+ },
".chrome-picker": {
colorScheme: "light",
@@ -818,7 +833,7 @@ export const components = (theme: Theme): ThemeOptions => {
MuiStepIcon: {
styleOverrides: {
root: {
- color: theme.palette.action.selected,
+ color: theme.palette.action.hover,
"&.Mui-completed:not(.Mui-active)": {
color: theme.palette.text.disabled,
},
diff --git a/yarn.lock b/yarn.lock
index 9e089817..619d2e8e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2672,10 +2672,10 @@
use-debounce "^3.4.3"
yup "^0.32.9"
-"@rowy/multiselect@^0.1.6":
- version "0.1.6"
- resolved "https://registry.yarnpkg.com/@rowy/multiselect/-/multiselect-0.1.6.tgz#a1edfbc67d4f9267cb73a3d33d5a2570662b74d1"
- integrity sha512-NxyskBT/8GA1ARtWv1XSBr8ltfmArhnETujbf/PgT7sRtDhv5dFB/XNSMH46rNYuN6zGmG1jHR/pIRs2fTy08w==
+"@rowy/multiselect@^0.1.7":
+ version "0.1.7"
+ resolved "https://registry.yarnpkg.com/@rowy/multiselect/-/multiselect-0.1.7.tgz#d751cf12886a560f25ba9aa98908ab1aa124b78b"
+ integrity sha512-sCvnWl5sP6W5N3NQI360diu+Iktxh4VmsaiHmTk9Y85BdPPjeTTKcTuKqbewZsYXDkk4gEcxOpx5XD00Ap9xhw==
"@sindresorhus/is@^0.14.0":
version "0.14.0"