diff --git a/src/components/Setup/SetupItem.tsx b/src/components/Setup/SetupItem.tsx index 6125b07e..ea099950 100644 --- a/src/components/Setup/SetupItem.tsx +++ b/src/components/Setup/SetupItem.tsx @@ -31,7 +31,7 @@ export default function SetupItem({ )} - + {title} {children} diff --git a/src/components/Setup/Step4Rules.tsx b/src/components/Setup/Step4Rules.tsx index 53fb9144..ce4cd124 100644 --- a/src/components/Setup/Step4Rules.tsx +++ b/src/components/Setup/Step4Rules.tsx @@ -7,13 +7,14 @@ import { Checkbox, Button, Link, - TextField, + Grid, } from "@mui/material"; import LoadingButton from "@mui/lab/LoadingButton"; import CopyIcon from "@src/assets/icons/Copy"; import InlineOpenInNewIcon from "@src/components/InlineOpenInNewIcon"; import SetupItem from "./SetupItem"; +import DiffEditor from "@src/components/CodeEditor/DiffEditor"; import { name } from "@root/package.json"; import { useAppContext } from "@src/contexts/AppContext"; @@ -21,7 +22,7 @@ import { CONFIG } from "@src/config/dbPaths"; import { requiredRules, adminRules, utilFns } from "@src/config/firestoreRules"; import { rowyRun } from "@src/utils/rowyRun"; import { runRoutes } from "@src/constants/runRoutes"; -import { useConfirmation } from "@src/components/ConfirmationDialog"; +// import { useConfirmation } from "@src/components/ConfirmationDialog"; export default function Step4Rules({ rowyRunUrl, @@ -29,7 +30,7 @@ export default function Step4Rules({ setCompletion, }: ISetupStepBodyProps) { const { projectId, getAuthToken } = useAppContext(); - const { requestConfirmation } = useConfirmation(); + // const { requestConfirmation } = useConfirmation(); const [hasRules, setHasRules] = useState(completion.rules); const [adminRule, setAdminRule] = useState(true); @@ -97,18 +98,20 @@ export default function Step4Rules({ } }; - const handleSkip = () => { - requestConfirmation({ - title: "Skip rules", - body: "This might prevent you or other users in your project from accessing firestore data on Rowy", - confirm: "Skip", - cancel: "cancel", - handleConfirm: async () => { - setCompletion((c) => ({ ...c, rules: true })); - setHasRules(true); - }, - }); - }; + const [showManualMode, setShowManualMode] = useState(false); + + // const handleSkip = () => { + // requestConfirmation({ + // title: "Skip rules", + // body: "This might prevent you or other users in your project from accessing firestore data on Rowy", + // confirm: "Skip", + // cancel: "cancel", + // handleConfirm: async () => { + // setCompletion((c) => ({ ...c, rules: true })); + // setHasRules(true); + // }, + // }); + // }; return ( <> @@ -138,89 +141,21 @@ export default function Step4Rules({ label="Allow admins to read and write all documents" sx={{ "&&": { ml: -11 / 8, mb: -11 / 8 }, width: "100%" }} /> - - $1` - ), - }} + - - - - )} - - - {!hasRules && ( - - You can add these rules{" "} - - in the Firebase Console - - {" "} - or directly below: - - } - > - setNewRules(e.target.value)} - multiline - rows={5} - fullWidth - sx={{ - "& .MuiInputBase-input": { - fontFamily: "mono", - letterSpacing: 0, - resize: "vertical", - }, - }} - /> - - - Please check the generated rules first. - - -
- {" "} + Please verify the new rules first. + Set Firestore Rules - + {rulesStatus !== "LOADING" && typeof rulesStatus === "string" && ( + + {rulesStatus} + + )} + {!showManualMode && ( + setShowManualMode(true)} + > + Alternatively, add these rules in the Firebase Console + + )} + + )} + + + {!hasRules && showManualMode && ( + + $1` + ), + }} + /> + +
+ + + + + + + + +
- {rulesStatus !== "LOADING" && typeof rulesStatus === "string" && ( - - {rulesStatus} - - )}
)} diff --git a/src/pages/Setup.tsx b/src/pages/Setup.tsx index 882e5e21..f9789223 100644 --- a/src/pages/Setup.tsx +++ b/src/pages/Setup.tsx @@ -60,6 +60,8 @@ export interface ISetupStepBodyProps { rowyRunUrl: string; } +const BASE_WIDTH = 1024; + const checkAllSteps = async ( rowyRunUrl: string, currentUser: firebase.default.User | null | undefined, @@ -256,7 +258,7 @@ export default function SetupPage() { alpha(theme.palette.background.paper, 0.5), backdropFilter: "blur(20px) saturate(150%)", - maxWidth: 840, + maxWidth: BASE_WIDTH, width: (theme) => `calc(100vw - ${theme.spacing(2)})`, maxHeight: (theme) => `calc(${ @@ -264,7 +266,7 @@ export default function SetupPage() { } - ${theme.spacing( 2 )} - env(safe-area-inset-top) - env(safe-area-inset-bottom))`, - height: 840 * 0.75, + height: BASE_WIDTH * 0.75, resize: "both", p: 0,