-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add user management page, RowyRunModal, ConfirmDialog
- Loading branch information
Showing
31 changed files
with
1,342 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"26CJMrwlouNRwkiLofNK07DNgKhw","createdAt":"1651022832613","lastLoginAt":"1651129533821","displayName":"Admin User","photoUrl":"","customAttributes":"{\"roles\": [\"ADMIN\"]}","providerUserInfo":[{"providerId":"google.com","rawId":"abc123","federatedId":"abc123","email":"[email protected]"}],"validSince":"1651117599","email":"[email protected]","emailVerified":true,"disabled":false,"lastRefreshAt":"2022-04-29T00:47:58.946Z"},{"localId":"3xTRVPnJGT2GE6lkiWKZp1jShuXj","createdAt":"1651023059442","lastLoginAt":"1651023059443","displayName":"Editor User","providerUserInfo":[{"providerId":"google.com","rawId":"1535779573397289142795231390488730790451","federatedId":"1535779573397289142795231390488730790451","displayName":"Editor User","email":"[email protected]"}],"validSince":"1651117599","email":"[email protected]","emailVerified":true,"disabled":false}]} | ||
{"kind":"identitytoolkit#DownloadAccountResponse","users":[{"localId":"26CJMrwlouNRwkiLofNK07DNgKhw","createdAt":"1651022832613","lastLoginAt":"1651297974462","displayName":"Admin User","photoUrl":"","customAttributes":"{\"roles\": [\"ADMIN\"]}","providerUserInfo":[{"providerId":"google.com","rawId":"abc123","federatedId":"abc123","displayName":"Admin User","email":"[email protected]"}],"validSince":"1651195467","email":"[email protected]","emailVerified":true,"disabled":false,"lastRefreshAt":"2022-04-30T08:44:58.158Z"},{"localId":"3xTRVPnJGT2GE6lkiWKZp1jShuXj","createdAt":"1651023059442","lastLoginAt":"1651223181908","displayName":"Editor User","providerUserInfo":[{"providerId":"google.com","rawId":"1535779573397289142795231390488730790451","federatedId":"1535779573397289142795231390488730790451","displayName":"Editor User","email":"[email protected]"}],"validSince":"1651195467","email":"[email protected]","emailVerified":true,"disabled":false,"lastRefreshAt":"2022-04-30T08:44:53.855Z"}]} |
Binary file modified
BIN
+0 Bytes
(100%)
emulators/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata
Binary file not shown.
Binary file modified
BIN
+450 Bytes
(220%)
emulators/firestore_export/all_namespaces/all_kinds/output-0
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
emulators/firestore_export/firestore_export.overall_export_metadata
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
export type UpdateFunction<T> = (update: Partial<T>) => Promise<any>; | ||
export type UpdateDocFunction<T> = (update: Partial<T>) => Promise<void>; | ||
|
||
export type UpdateCollectionFunction<T> = ( | ||
path: string, | ||
update: Partial<T> | ||
) => Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,77 @@ | ||
import { atom } from "jotai"; | ||
import { atomWithStorage } from "jotai/utils"; | ||
|
||
import { DialogProps, ButtonProps } from "@mui/material"; | ||
|
||
/** Nav open state stored in local storage. */ | ||
export const navOpenAtom = atomWithStorage("__ROWY__NAV_OPEN", false); | ||
/** Nav pinned state stored in local storage. */ | ||
export const navPinnedAtom = atomWithStorage("__ROWY__NAV_PINNED", false); | ||
|
||
export type ConfirmDialogProps = { | ||
open: boolean; | ||
|
||
title?: string; | ||
/** Pass a string to display basic styled text */ | ||
body?: React.ReactNode; | ||
|
||
/** Callback called when user clicks confirm */ | ||
handleConfirm?: () => void; | ||
/** Optionally override confirm button text */ | ||
confirm?: string | JSX.Element; | ||
/** Optionally require user to type this string to enable the confirm button */ | ||
confirmationCommand?: string; | ||
/** Optionally set confirm button color */ | ||
confirmColor?: ButtonProps["color"]; | ||
|
||
/** Callback called when user clicks cancel */ | ||
handleCancel?: () => void; | ||
/** Optionally override cancel button text */ | ||
cancel?: string; | ||
/** Optionally hide cancel button */ | ||
hideCancel?: boolean; | ||
|
||
/** Optionally set dialog max width */ | ||
maxWidth?: DialogProps["maxWidth"]; | ||
}; | ||
/** | ||
* Open a confirm dialog | ||
* | ||
* @example Basic usage: | ||
* ``` | ||
* const confirm = useSetAtom(confirmDialogAtom, globalScope); | ||
* confirm({ | ||
* open: true, | ||
* handleConfirm: () => ... | ||
* }); | ||
* ``` | ||
*/ | ||
export const confirmDialogAtom = atom<ConfirmDialogProps>({ open: false }); | ||
|
||
/** | ||
* Open global Rowy Run modal if feature not available | ||
* {@link openRowyRunModalAtom | Use `openRowyRunModalAtom` to open} | ||
*/ | ||
export const rowyRunModalAtom = atom({ open: false, feature: "", version: "" }); | ||
/** | ||
* Helper atom to open Rowy Run Modal | ||
* | ||
* @example Basic usage: | ||
* ``` | ||
* const openRowyRun = useSetAtom(openRowyRunModalAtom, globalScope); | ||
* openRowyRun({ | ||
* feature: ... | ||
* version: ... | ||
* }); | ||
* ``` | ||
*/ | ||
export const openRowyRunModalAtom = atom( | ||
null, | ||
(_, set, update?: Partial<Record<"feature" | "version", string>>) => { | ||
set(rowyRunModalAtom, { | ||
open: true, | ||
feature: update?.feature || "", | ||
version: update?.version || "", | ||
}); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { useAtom } from "jotai"; | ||
|
||
import { | ||
Typography, | ||
Stack, | ||
Avatar, | ||
Alert, | ||
Divider, | ||
Link as MuiLink, | ||
Button, | ||
} from "@mui/material"; | ||
import SecurityIcon from "@mui/icons-material/SecurityOutlined"; | ||
|
||
import EmptyState from "@src/components/EmptyState"; | ||
|
||
import { | ||
globalScope, | ||
currentUserAtom, | ||
userRolesAtom, | ||
} from "@src/atoms/globalScope"; | ||
import { WIKI_LINKS } from "@src/constants/externalLinks"; | ||
import { ROUTES } from "@src/constants/routes"; | ||
|
||
export default function AccessDenied() { | ||
const [currentUser] = useAtom(currentUserAtom, globalScope); | ||
const [userRoles] = useAtom(userRolesAtom, globalScope); | ||
|
||
if (!currentUser) window.location.reload(); | ||
|
||
return ( | ||
<EmptyState | ||
fullScreen | ||
Icon={SecurityIcon} | ||
message="Access denied" | ||
description={ | ||
<> | ||
<div style={{ textAlign: "left", width: "100%" }}> | ||
<Stack | ||
direction="row" | ||
spacing={1.25} | ||
alignItems="flex-start" | ||
sx={{ mt: 2 }} | ||
> | ||
<Avatar src={currentUser?.photoURL || ""} /> | ||
<div> | ||
<Typography>{currentUser?.displayName}</Typography> | ||
<Typography variant="button">{currentUser?.email}</Typography> | ||
</div> | ||
</Stack> | ||
|
||
{(!userRoles || userRoles.length === 0) && ( | ||
<Alert severity="warning" sx={{ mt: 2 }}> | ||
Your account has no roles set | ||
</Alert> | ||
)} | ||
</div> | ||
|
||
<Typography> | ||
You do not have access to this project. Please contact the project | ||
owner. | ||
</Typography> | ||
|
||
<Button href={ROUTES.signOut}>Sign out</Button> | ||
|
||
<Divider flexItem sx={{ typography: "overline" }}> | ||
OR | ||
</Divider> | ||
|
||
<Typography> | ||
If you are the project owner, please follow{" "} | ||
<MuiLink | ||
href={WIKI_LINKS.setupRoles} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
these instructions | ||
</MuiLink>{" "} | ||
to set up this project’s security rules. | ||
</Typography> | ||
</> | ||
} | ||
sx={{ | ||
position: "fixed", | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
bgcolor: "background.default", | ||
zIndex: 9999, | ||
}} | ||
/> | ||
); | ||
} |
Oops, something went wrong.