diff --git a/src/Collections/CollectionMembers.tsx b/src/Collections/CollectionMembers.tsx index 64619b6..c573a18 100644 --- a/src/Collections/CollectionMembers.tsx +++ b/src/Collections/CollectionMembers.tsx @@ -22,6 +22,8 @@ import { CachedCollection } from "../Pim/helpers"; import CollectionMemberAddDialog from "./CollectionMemberAddDialog"; import Alert from "@material-ui/lab/Alert"; +import { pushMessage } from "../store/actions"; +import { useDispatch } from "react-redux"; interface PropsType { collection: CachedCollection; @@ -29,10 +31,10 @@ interface PropsType { export default function CollectionMembers(props: PropsType) { const etebase = useCredentials()!; + const dispatch = useDispatch(); const [members, setMembers] = React.useState(); const [revokeUser, setRevokeUser] = React.useState(null); const [addMemberOpen, setAddMemberOpen] = React.useState(false); - const [inviteSuccessOpen, setInviteSuccessOpen] = React.useState(false); const [error, setError] = React.useState(); const { collection, metadata } = props.collection; @@ -71,6 +73,7 @@ export default function CollectionMembers(props: PropsType) { await memberManager.remove(revokeUser!.username); await fetchMembers(); setRevokeUser(null); + dispatch(pushMessage({ message: "Removed member", severity: "success" })); } async function onMemberAdd(username: string, pubkey: Uint8Array, accessLevel: Etebase.CollectionAccessLevel) { @@ -78,7 +81,7 @@ export default function CollectionMembers(props: PropsType) { await inviteMgr.invite(collection, username, pubkey, accessLevel); await fetchMembers(); setAddMemberOpen(false); - setInviteSuccessOpen(true); + dispatch(pushMessage({ message: "Invitation sent", severity: "success" })); } return ( @@ -149,17 +152,6 @@ export default function CollectionMembers(props: PropsType) { onClose={() => setAddMemberOpen(false)} /> } - - setInviteSuccessOpen(false)} - > -

- Invitation sent. User will be added once the invitation has been accepted. -

-
); } diff --git a/src/Collections/Main.tsx b/src/Collections/Main.tsx index edd375c..14dbda2 100644 --- a/src/Collections/Main.tsx +++ b/src/Collections/Main.tsx @@ -19,7 +19,7 @@ import CollectionEdit from "./CollectionEdit"; import CollectionMembers from "./CollectionMembers"; import Collection from "./Collection"; import { useAsyncDispatch } from "../store"; -import { collectionUpload } from "../store/actions"; +import { collectionUpload, pushMessage } from "../store/actions"; import Invitations from "./Invitations"; const decryptCollections = getDecryptCollectionsFunction(); @@ -48,6 +48,7 @@ export default function CollectionsMain() { async function onSave(collection: Etebase.Collection): Promise { const colMgr = getCollectionManager(etebase); await dispatch(collectionUpload(colMgr, collection)); + dispatch(pushMessage({ message: "Collection saved", severity: "success" })); history.push(routeResolver.getRoute("collections")); } @@ -59,6 +60,7 @@ export default function CollectionsMain() { await collection.setMeta({ ...meta, mtime }); await collection.delete(true); await dispatch(collectionUpload(colMgr, collection)); + dispatch(pushMessage({ message: "Collection deleted", severity: "success" })); history.push(routeResolver.getRoute("collections")); }